@bigbinary/neeto-editor 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
*/
|
|
24
24
|
var r=n(294),i=n(295),o=n(296);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,n){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=p(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!l.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(t,n),i=(e=s(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(l.isBuffer(t)){var n=0|f(t.length);return 0===(e=s(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?s(e,0):p(e,t);if("Buffer"===t.type&&o(t.data))return p(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function u(e,t){if(d(t),e=s(e,t<0?0:0|f(t)),!l.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function p(e,t){var n=t.length<0?0:0|f(t.length);e=s(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function f(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function h(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var d=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===d?0:o-d)){if(-1===d&&(d=o),o-d+1===l)return d*a}else-1!==d&&(o-=o-d),d=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){for(var u=!0,p=0;p<l;p++)if(c(e,o+p)!==c(t,p)){u=!1;break}if(u)return o}return-1}function E(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function b(e,t,n,r){return G(z(t,e.length-n),e,n,r)}function y(e,t,n,r){return G(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return y(e,t,n,r)}function T(e,t,n,r){return G(j(t),e,n,r)}function N(e,t,n,r){return G(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function O(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,l,c=e[i],d=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=n)switch(u){case 1:c<128&&(d=c);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&c)<<6|63&o)>127&&(d=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,r.push(d>>>10&1023|55296),d=56320|1023&d),r.push(d),i+=u}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return c(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return d(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return u(null,e)},l.allocUnsafeSlow=function(e){return u(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?C(this,0,e):h.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,n,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(r,i),d=e.slice(t,n),u=0;u<s;++u)if(c[u]!==d[u]){o=c[u],a=d[u];break}return o<a?-1:a<o?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return _(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return _(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return y(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function D(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=F(e[o]);return i}function w(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function x(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function k(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(e,t,n,r,o){return o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,o){return o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=l.prototype;else{var i=t-e;n=new l(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},l.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},l.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):k(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):k(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return P(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return P(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},l.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=l.isBuffer(e)?e:z(new l(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(7))},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),a=r[0],s=r[1],l=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),d=0,u=s>0?a-4:a;for(n=0;n<u;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],l[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;2===s&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[d++]=255&t);1===s&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(d(e,a,a+16383>s?s:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function d(e,t,n){for(var i,o,a=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
|
|
25
25
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
26
|
-
t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,d=-7,u=n?i-1:0,p=n?-1:1,f=e[t+u];for(u+=p,o=f&(1<<-d)-1,f>>=-d,d+=s;d>0;o=256*o+e[t+u],u+=p,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=256*a+e[t+u],u+=p,d-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,d=(1<<c)-1,u=d>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,m=r?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=d?(s=0,a=d):a+u>=1?(s=(t*l-1)*Math.pow(2,i),a+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=m,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=m,a/=256,c-=8);e[n+f-m]|=128*h}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var r=n(29);e.exports=function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return t.length>0?t:null}if("object"==typeof e&&r(e))return[e]}},function(e,t,n){var r=n(9),i=n(299),o=n(300);e.exports=function(e,t){var n=[],a=[];return r(e.items).forEach((function(e){var r=e.webkitGetAsEntry();r&&a.push(function e(r){return new Promise((function(a){if(r.isFile)r.file((function(e){e.relativePath=i(r),n.push(e),a()}),(function(e){t(e),a()}));else if(r.isDirectory){var s=r.createReader();o(s,[],t,{onSuccess:function(t){var n=t.map((function(t){return e(t)}));Promise.all(n).then((function(){return a()}))}})}}))}(r))})),Promise.all(a).then((function(){return n}))}},function(e,t){e.exports=function(e){return e.fullPath&&e.fullPath!=="/"+e.name?e.fullPath:null}},function(e,t){e.exports=function e(t,n,r,i){var o=i.onSuccess;t.readEntries((function(i){var a=[].concat(n,i);i.length?setTimeout((function(){e(t,a,r,{onSuccess:o})}),0):o(a)}),(function(e){r(e),o(n)}))}},function(e,t,n){var r=n(9);e.exports=function(e){var t=r(e.files);return Promise.resolve(t)}},function(e,t,n){var r=n(9),i=n(40),o=n(18);function a(e,t){var n=t[0];n&&(n.focus(),e.preventDefault())}function s(e,t,n){var s=i(n,t),l=r(s.querySelectorAll(o)),c=l.indexOf(document.activeElement);!function(e){return e.contains(document.activeElement)}(s)?a(e,l):e.shiftKey&&0===c?function(e,t){var n=t[t.length-1];n&&(n.focus(),e.preventDefault())}(e,l):e.shiftKey||c!==l.length-1||a(e,l)}e.exports={forModal:function(e,t,n){s(e,t,n)},forInline:function(e,t,n){null===t||s(e,t,n)}}},function(e,t,n){var r=n(304),i=n(18),o=n(40);e.exports=function(){var e=!1;return r((function(t,n){var r=o(t,n),a=r.contains(document.activeElement);if(!a||!e){var s=r.querySelector("[data-uppy-super-focusable]");if(!a||s)if(s)s.focus({preventScroll:!0}),e=!0;else{var l=r.querySelector(i);l&&l.focus({preventScroll:!0}),e=!1}}}),260)}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),d=Object.prototype.toString,u=Math.max,p=Math.min,f=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function h(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=i.test(e);return s||o.test(e)?a(e.slice(2),s?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var r,i,o,a,s,l,c=0,d=!1,g=!1,_=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,o=i;return r=i=void 0,c=t,a=e.apply(o,n)}function E(e){return c=e,s=setTimeout(y,t),d?v(e):a}function b(e){var n=e-l;return void 0===l||n>=t||n<0||g&&e-c>=o}function y(){var e=f();if(b(e))return S(e);s=setTimeout(y,function(e){var n=t-(e-l);return g?p(n,o-(e-c)):n}(e))}function S(e){return s=void 0,_&&r?v(e):(r=i=void 0,a)}function T(){var e=f(),n=b(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return E(l);if(g)return s=setTimeout(y,t),v(l)}return void 0===s&&(s=setTimeout(y,t)),a}return t=h(t)||0,m(n)&&(d=!!n.leading,o=(g="maxWait"in n)?u(h(n.maxWait)||0,t):o,_="trailing"in n?!!n.trailing:_),T.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=i=s=void 0},T.flush=function(){return void 0===s?a:S(f())},T}}).call(this,n(7))},function(e,t,n){"use strict";var r=n(306);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=n(4).Plugin,c=n(8),d=n(9),u=n(35),p=n(39),f=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).type="acquirer",r.id=r.opts.id||"DragDrop",r.title="Drag & Drop",r.defaultLocale={strings:{dropHereOr:"Drop files here or %{browse}",browse:"browse"}};return r.opts=o({},{target:null,inputName:"files[]",width:"100%",height:"100%",note:null},n),r.isDragDropSupported=u(),r.removeDragOverClassTimeout=null,r.i18nInit(),r.onInputChange=r.onInputChange.bind(a(r)),r.handleDragOver=r.handleDragOver.bind(a(r)),r.handleDragLeave=r.handleDragLeave.bind(a(r)),r.handleDrop=r.handleDrop.bind(a(r)),r.addFiles=r.addFiles.bind(a(r)),r.render=r.render.bind(a(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n);var i=r.prototype;return i.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new c([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.setPluginState()},i.addFiles=function(e){var t=this,n=e.map((function(e){return{source:t.id,name:e.name,type:e.type,data:e,meta:{relativePath:e.relativePath||null}}}));try{this.uppy.addFiles(n)}catch(e){this.uppy.log(e)}},i.onInputChange=function(e){this.uppy.log("[DragDrop] Files selected through input");var t=d(e.target.files);this.addFiles(t),e.target.value=null},i.handleDrop=function(e,t){var n=this;e.preventDefault(),e.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1}),this.uppy.log("[DragDrop] Files were dropped");p(e.dataTransfer,{logDropError:function(e){n.uppy.log(e,"error")}}).then((function(e){return n.addFiles(e)}))},i.handleDragOver=function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0})},i.handleDragLeave=function(e){var t=this;e.preventDefault(),e.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout((function(){t.setPluginState({isDraggingOver:!1})}),50)},i.renderHiddenFileInput=function(){var e=this,t=this.uppy.opts.restrictions;return f("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:function(t){e.fileInputRef=t},name:this.opts.inputName,multiple:1!==t.maxNumberOfFiles,accept:t.allowedFileTypes,onChange:this.onInputChange})},i.renderArrowSvg=function(){return f("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16"},f("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"}))},i.renderLabel=function(){return f("div",{className:"uppy-DragDrop-label"},this.i18nArray("dropHereOr",{browse:f("span",{className:"uppy-DragDrop-browse"},this.i18n("browse"))}))},i.renderNote=function(){return f("span",{className:"uppy-DragDrop-note"},this.opts.note)},i.render=function(e){var t=this,n="uppy-Root\n uppy-u-reset\n uppy-DragDrop-container\n "+(this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":"")+"\n "+(this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":"")+"\n ",r={width:this.opts.width,height:this.opts.height};return f("button",{type:"button",className:n,style:r,onClick:function(){return t.fileInputRef.click()},onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},this.renderHiddenFileInput(),f("div",{className:"uppy-DragDrop-inner"},this.renderArrowSvg(),this.renderLabel(),this.renderNote()))},i.install=function(){this.setPluginState({isDraggingOver:!1});var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(l),r.VERSION="1.4.27",i)},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=n(4).Plugin,l=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).id=r.opts.id||"ProgressBar",r.title="Progress Bar",r.type="progressindicator";return r.opts=o({},{target:"body",replaceTargetContent:!1,fixed:!1,hideAfterFinish:!0},n),r.render=r.render.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,a(t,n);var i=r.prototype;return i.render=function(e){var t=e.totalProgress||0,n=(0===t||100===t)&&this.opts.hideAfterFinish;return l("div",{className:"uppy uppy-ProgressBar",style:{position:this.opts.fixed?"fixed":"initial"},"aria-hidden":n},l("div",{className:"uppy-ProgressBar-inner",style:{width:t+"%"}}),l("div",{className:"uppy-ProgressBar-percentage"},t))},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(s),r.VERSION="1.3.27",i)},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=n(4).Plugin,c=n(9),d=n(8),u=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).id=r.opts.id||"FileInput",r.title="File Input",r.type="acquirer",r.defaultLocale={strings:{chooseFiles:"Choose files"}};return r.opts=o({},{target:null,pretty:!0,inputName:"files[]"},n),r.i18nInit(),r.render=r.render.bind(a(r)),r.handleInputChange=r.handleInputChange.bind(a(r)),r.handleClick=r.handleClick.bind(a(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n);var i=r.prototype;return i.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new d([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.setPluginState()},i.addFiles=function(e){var t=this,n=e.map((function(e){return{source:t.id,name:e.name,type:e.type,data:e}}));try{this.uppy.addFiles(n)}catch(e){this.uppy.log(e)}},i.handleInputChange=function(e){this.uppy.log("[FileInput] Something selected through input...");var t=c(e.target.files);this.addFiles(t),e.target.value=null},i.handleClick=function(e){this.input.click()},i.render=function(e){var t=this,n=this.uppy.opts.restrictions,r=n.allowedFileTypes?n.allowedFileTypes.join(","):null;return u("div",{className:"uppy-Root uppy-FileInput-container"},u("input",{className:"uppy-FileInput-input",style:this.opts.pretty&&{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},type:"file",name:this.opts.inputName,onChange:this.handleInputChange,multiple:1!==n.maxNumberOfFiles,accept:r,ref:function(e){t.input=e}}),this.opts.pretty&&u("button",{className:"uppy-FileInput-btn",type:"button",onClick:this.handleClick},this.i18n("chooseFiles")))},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(l),r.VERSION="1.4.25",i)},function(e,t,n){"use strict";var r=n(19),i=n(313),o=n(319),a=n(320);e.exports={RequestClient:r,Provider:i,SearchProvider:o,Socket:a}},function(e,t,n){"use strict";function r(e){var t="function"==typeof Map?new Map:void 0;return(r=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return i(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),a(r,e)})(e)}function i(e,t,n){return(i=o()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&a(i,n.prototype),i}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=function(e){var t,n;function r(){var t;return(t=e.call(this,"Authorization required")||this).name="AuthError",t.isAuthError=!0,t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,a(t,n),r}(r(Error));e.exports=l},function(e,t,n){var r=n(49);e.exports=function(){return fetch.apply(void 0,arguments).catch((function(e){throw"AbortError"===e.name?e:new r(e)}))}},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var o=n(314),a=n(315),s=n(19),l=n(318);e.exports=function(e){var t,n;function s(t,n){var r;return(r=e.call(this,t,n)||this).provider=n.provider,r.id=r.provider,r.name=r.opts.name||r.id.split("-").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join(" "),r.pluginId=r.opts.pluginId,r.tokenKey="companion-"+r.pluginId+"-auth-token",r.companionKeysParams=r.opts.companionKeysParams,r.preAuthToken=null,r}n=e,(t=s).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var c=s.prototype;return c.headers=function(){var t=this;return Promise.all([e.prototype.headers.call(this),this.getAuthToken()]).then((function(e){var n=e[0],i=e[1],o={};return i&&(o["uppy-auth-token"]=i),t.companionKeysParams&&(o["uppy-credentials-params"]=btoa(JSON.stringify({params:t.companionKeysParams}))),r({},n,o)}))},c.onReceiveResponse=function(t){t=e.prototype.onReceiveResponse.call(this,t);var n=this.uppy.getPlugin(this.pluginId),r=n.getPluginState().authenticated?401!==t.status:t.status<400;return n.setPluginState({authenticated:r}),t},c.setAuthToken=function(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)},c.getAuthToken=function(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)},c.authUrl=function(e){void 0===e&&(e={}),this.preAuthToken&&(e.uppyPreAuthToken=this.preAuthToken);var t=o(e);return t=t?"?"+t:t,this.hostname+"/"+this.id+"/connect"+t},c.fileUrl=function(e){return this.hostname+"/"+this.id+"/get/"+e},c.fetchPreAuthToken=function(){var e=this;return this.companionKeysParams?this.post(this.id+"/preauth/",{params:this.companionKeysParams}).then((function(t){e.preAuthToken=t.token})).catch((function(t){e.uppy.log("[CompanionClient] unable to fetch preAuthToken "+t,"warning")})):Promise.resolve()},c.list=function(e){return this.get(this.id+"/list/"+(e||""))},c.logout=function(){var e=this;return this.get(this.id+"/logout").then((function(t){return Promise.all([t,e.uppy.getPlugin(e.pluginId).storage.removeItem(e.tokenKey)])})).then((function(e){return e[0]}))},s.initPlugin=function(e,t,n){if(e.type="acquirer",e.files=[],n&&(e.opts=r({},n,t)),t.serverUrl||t.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(t.companionAllowedHosts){var i=t.companionAllowedHosts;if(!("string"==typeof i||Array.isArray(i)||i instanceof RegExp))throw new TypeError(e.id+': the option "companionAllowedHosts" must be one of string, Array, RegExp');e.opts.companionAllowedHosts=i}else/^(?!https?:\/\/).*$/i.test(t.companionUrl)?e.opts.companionAllowedHosts="https://"+t.companionUrl.replace(/^\/\//,""):e.opts.companionAllowedHosts=new a(t.companionUrl).origin;e.storage=e.opts.storage||l},s}(s)},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function e(t,r){var i=[];for(var o in t)if(n.call(t,o)){var a,s=t[o],l=encodeURIComponent(o);a="object"==typeof s?e(s,r?r+"["+l+"]":l):(r?r+"["+l+"]":l)+"="+encodeURIComponent(s),i.push(a)}return i.join("&")}},function(e,t,n){"use strict";(function(t){var r=n(316),i=n(317),o=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,a=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(s,"")}var c=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};function u(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},a=typeof(e=e||r);if("blob:"===e.protocol)i=new f(unescape(e.pathname),{});else if("string"===a)for(n in i=new f(e,{}),d)delete i[n];else if("object"===a){for(n in e)n in d||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=o.test(e.href))}return i}function p(e){e=l(e);var t=a.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!(t[2]&&t[2].length>=2),rest:t[2]&&1===t[2].length?"/"+t[3]:t[3]}}function f(e,t,n){if(e=l(e),!(this instanceof f))return new f(e,t,n);var o,a,s,d,m,h,g=c.slice(),_=typeof t,v=this,E=0;for("object"!==_&&"string"!==_&&(n=t,t=null),n&&"function"!=typeof n&&(n=i.parse),t=u(t),o=!(a=p(e||"")).protocol&&!a.slashes,v.slashes=a.slashes||o&&t.slashes,v.protocol=a.protocol||t.protocol||"",e=a.rest,a.slashes||(g[3]=[/(.*)/,"pathname"]);E<g.length;E++)"function"!=typeof(d=g[E])?(s=d[0],h=d[1],s!=s?v[h]=e:"string"==typeof s?~(m=e.indexOf(s))&&("number"==typeof d[2]?(v[h]=e.slice(0,m),e=e.slice(m+d[2])):(v[h]=e.slice(m),e=e.slice(0,m))):(m=s.exec(e))&&(v[h]=m[1],e=e.slice(0,m.index)),v[h]=v[h]||o&&d[3]&&t[h]||"",d[4]&&(v[h]=v[h].toLowerCase())):e=d(e);n&&(v.query=n(v.query)),o&&t.slashes&&"/"!==v.pathname.charAt(0)&&(""!==v.pathname||""!==t.pathname)&&(v.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,a=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),a++):a&&(0===r&&(o=!0),n.splice(r,1),a--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(v.pathname,t.pathname)),"/"!==v.pathname.charAt(0)&&v.hostname&&(v.pathname="/"+v.pathname),r(v.port,v.protocol)||(v.host=v.hostname,v.port=""),v.username=v.password="",v.auth&&(d=v.auth.split(":"),v.username=d[0]||"",v.password=d[1]||""),v.origin=v.protocol&&v.host&&"file:"!==v.protocol?v.protocol+"//"+v.host:"null",v.href=v.toString()}f.prototype={set:function(e,t,n){var o=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||i.parse)(t)),o[e]=t;break;case"port":o[e]=t,r(t,o.protocol)?t&&(o.host=o.hostname+":"+t):(o.host=o.hostname,o[e]="");break;case"hostname":o[e]=t,o.port&&(t+=":"+o.port),o.host=t;break;case"host":o[e]=t,/:\d+$/.test(t)?(t=t.split(":"),o.port=t.pop(),o.hostname=t.join(":")):(o.hostname=t,o.port="");break;case"protocol":o.protocol=t.toLowerCase(),o.slashes=!n;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";o[e]=t.charAt(0)!==a?a+t:t}else o[e]=t;break;default:o[e]=t}for(var s=0;s<c.length;s++){var l=c[s];l[4]&&(o[l[1]]=o[l[1]].toLowerCase())}return o.origin=o.protocol&&o.host&&"file:"!==o.protocol?o.protocol+"//"+o.host:"null",o.href=o.toString(),o},toString:function(e){e&&"function"==typeof e||(e=i.stringify);var t,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var o=r+(n.slashes?"//":"");return n.username&&(o+=n.username,n.password&&(o+=":"+n.password),o+="@"),o+=n.host+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},f.extractProtocol=p,f.location=u,f.trimLeft=l,f.qs=i,e.exports=f}).call(this,n(7))},function(e,t,n){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function o(e){try{return encodeURIComponent(e)}catch(e){return null}}t.stringify=function(e,t){t=t||"";var n,i,a=[];for(i in"string"!=typeof t&&(t="?"),e)if(r.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=o(i),n=o(n),null===i||null===n)continue;a.push(i+"="+n)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var o=i(t[1]),a=i(t[2]);null===o||null===a||o in r||(r[o]=a)}return r}},function(e,t,n){"use strict";e.exports.setItem=function(e,t){return new Promise((function(n){localStorage.setItem(e,t),n()}))},e.exports.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},e.exports.removeItem=function(e){return new Promise((function(t){localStorage.removeItem(e),t()}))}},function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var i=n(19);e.exports=function(e){var t,n;function i(t,n){var r;return(r=e.call(this,t,n)||this).provider=n.provider,r.id=r.provider,r.name=r.opts.name||r.id.split("-").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join(" "),r.pluginId=r.opts.pluginId,r}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var o=i.prototype;return o.fileUrl=function(e){return this.hostname+"/search/"+this.id+"/get/"+e},o.search=function(e,t){return t=t?"&"+t:"",this.get("search/"+this.id+"/list?q="+encodeURIComponent(e)+t)},i}(i)},function(e,t,n){var r=n(25);e.exports=function(){function e(e){this.opts=e,this._queued=[],this.isOpen=!1,this.emitter=r(),this._handleMessage=this._handleMessage.bind(this),this.close=this.close.bind(this),this.emit=this.emit.bind(this),this.on=this.on.bind(this),this.once=this.once.bind(this),this.send=this.send.bind(this),e&&!1===e.autoOpen||this.open()}var t=e.prototype;return t.open=function(){var e=this;this.socket=new WebSocket(this.opts.target),this.socket.onopen=function(t){for(e.isOpen=!0;e._queued.length>0&&e.isOpen;){var n=e._queued[0];e.send(n.action,n.payload),e._queued=e._queued.slice(1)}},this.socket.onclose=function(t){e.isOpen=!1},this.socket.onmessage=this._handleMessage},t.close=function(){this.socket&&this.socket.close()},t.send=function(e,t){this.isOpen?this.socket.send(JSON.stringify({action:e,payload:t})):this._queued.push({action:e,payload:t})},t.on=function(e,t){this.emitter.on(e,t)},t.emit=function(e,t){this.emitter.emit(e,t)},t.once=function(e,t){this.emitter.once(e,t)},t._handleMessage=function(e){try{var t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}},e}()},function(e,t,n){var r=n(15);e.exports=r((function(e,t,n){var r=t.progress,i=t.bytesUploaded,o=t.bytesTotal;r&&(e.uppy.log("Upload progress: "+r),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:i,bytesTotal:o}))}),300,{leading:!0,trailing:!0})},function(e,t){e.exports=function(e){var t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return(/^http:\/\//i.test(e)?"ws":"wss")+"://"+t}},function(e,t){e.exports=function(e){var t=[],n=[];function r(e){t.push(e)}function i(e){n.push(e)}return Promise.all(e.map((function(e){return e.then(r,i)}))).then((function(){return{successful:t,failed:n}}))}},function(e,t){e.exports=function(){function e(e){this._events=[],this._emitter=e}var t=e.prototype;return t.on=function(e,t){return this._events.push([e,t]),this._emitter.on(e,t)},t.remove=function(){var e=this;this._events.forEach((function(t){var n=t[0],r=t[1];e._emitter.off(n,r)}))},e}()},function(e,t){var n=function(){function e(e,t){this._timeout=e,this._onTimedOut=t,this._isDone=!1,this._aliveTimer=null,this._onTimedOut=this._onTimedOut.bind(this)}var t=e.prototype;return t.progress=function(){this._isDone||this._timeout>0&&(this._aliveTimer&&clearTimeout(this._aliveTimer),this._aliveTimer=setTimeout(this._onTimedOut,this._timeout))},t.done=function(){this._aliveTimer&&(clearTimeout(this._aliveTimer),this._aliveTimer=null),this._isDone=!0},e}();e.exports=n},function(e,t,n){var r=n(28);function i(){return new Error("Cancelled")}e.exports=function(){function e(e){this.limit="number"!=typeof e||0===e?1/0:e,this.activeRequests=0,this.queuedHandlers=[]}var t=e.prototype;return t._call=function(e){var t=this;this.activeRequests+=1;var n,r=!1;try{n=e()}catch(e){throw this.activeRequests-=1,e}return{abort:function(){r||(r=!0,t.activeRequests-=1,n(),t._queueNext())},done:function(){r||(r=!0,t.activeRequests-=1,t._queueNext())}}},t._queueNext=function(){var e=this;Promise.resolve().then((function(){e._next()}))},t._next=function(){if(!(this.activeRequests>=this.limit)&&0!==this.queuedHandlers.length){var e=this.queuedHandlers.shift(),t=this._call(e.fn);e.abort=t.abort,e.done=t.done}},t._queue=function(e,t){var n=this;void 0===t&&(t={});var i={fn:e,priority:t.priority||0,abort:function(){n._dequeue(i)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},o=r(this.queuedHandlers,(function(e){return i.priority>e.priority}));return-1===o?this.queuedHandlers.push(i):this.queuedHandlers.splice(o,0,i),i},t._dequeue=function(e){var t=this.queuedHandlers.indexOf(e);-1!==t&&this.queuedHandlers.splice(t,1)},t.run=function(e,t){return this.activeRequests<this.limit?this._call(e):this._queue(e,t)},t.wrapPromiseFunction=function(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var s,l=new Promise((function(r,a){s=n.run((function(){var t,n;try{n=Promise.resolve(e.apply(void 0,o))}catch(e){n=Promise.reject(e)}return n.then((function(e){t?a(t):(s.done(),r(e))}),(function(e){t?a(t):(s.done(),a(e))})),function(){t=i()}}),t)}));return l.abort=function(){s.abort()},l}},e}()},function(e,t){e.exports=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r);function o(e){this.content=e}o.prototype={constructor:o,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return-1==i?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new o(a)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new o(n)},addToStart:function(e,t){return new o([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new o(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(-1==a?i.length:a,0,t,n),new o(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=o.from(e)).size?new o(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=o.from(e)).size?new o(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=o.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},get size(){return this.content.length>>1}},o.from=function(e){if(e instanceof o)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new o(t)};var a=o;var s=function(e,t){if(this.content=e,this.size=t||0,null==t)for(var n=0;n<e.length;n++)this.size+=e[n].nodeSize},l={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(e,t,n,r,i){void 0===r&&(r=0);for(var o=0,a=0;a<t;o++){var s=this.content[o],l=a+s.nodeSize;if(l>e&&!1!==n(s,r+a,i,o)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,e-c),Math.min(s.content.size,t-c),n,r+c)}a=l}},s.prototype.descendants=function(e){this.nodesBetween(0,this.size,e)},s.prototype.textBetween=function(e,t,n,r){var i="",o=!0;return this.nodesBetween(e,t,(function(a,s){a.isText?(i+=a.text.slice(Math.max(e,s)-s,t-s),o=!n):a.isLeaf&&r?(i+=r,o=!n):!o&&a.isBlock&&(i+=n,o=!0)}),0),i},s.prototype.append=function(e){if(!e.size)return this;if(!this.size)return e;var t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new s(r,this.size+e.size)},s.prototype.cut=function(e,t){if(null==t&&(t=this.size),0==e&&t==this.size)return this;var n=[],r=0;if(t>e)for(var i=0,o=0;o<t;i++){var a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a=a.isText?a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),r+=a.nodeSize),o=l}return new s(n,r)},s.prototype.cutByIndex=function(e,t){return e==t?s.empty:0==e&&t==this.content.length?this:new s(this.content.slice(e,t))},s.prototype.replaceChild=function(e,t){var n=this.content[e];if(n==t)return this;var r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new s(r,i)},s.prototype.addToStart=function(e){return new s([e].concat(this.content),this.size+e.nodeSize)},s.prototype.addToEnd=function(e){return new s(this.content.concat(e),this.size+e.nodeSize)},s.prototype.eq=function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0},l.firstChild.get=function(){return this.content.length?this.content[0]:null},l.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},l.childCount.get=function(){return this.content.length},s.prototype.child=function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t},s.prototype.maybeChild=function(e){return this.content[e]},s.prototype.forEach=function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}},s.prototype.findDiffStart=function(e,t){return void 0===t&&(t=0),function e(t,n,r){for(var i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;var o=t.child(i),a=n.child(i);if(o!=a){if(!o.sameMarkup(a))return r;if(o.isText&&o.text!=a.text){for(var s=0;o.text[s]==a.text[s];s++)r++;return r}if(o.content.size||a.content.size){var l=e(o.content,a.content,r+1);if(null!=l)return l}r+=o.nodeSize}else r+=o.nodeSize}}(this,e,t)},s.prototype.findDiffEnd=function(e,t,n){return void 0===t&&(t=this.size),void 0===n&&(n=e.size),function e(t,n,r,i){for(var o=t.childCount,a=n.childCount;;){if(0==o||0==a)return o==a?null:{a:r,b:i};var s=t.child(--o),l=n.child(--a),c=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:r,b:i};if(s.isText&&s.text!=l.text){for(var d=0,u=Math.min(s.text.length,l.text.length);d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,r--,i--;return{a:r,b:i}}if(s.content.size||l.content.size){var p=e(s.content,l.content,r-1,i-1);if(p)return p}r-=c,i-=c}else r-=c,i-=c}}(this,e,t,n)},s.prototype.findIndex=function(e,t){if(void 0===t&&(t=-1),0==e)return d(0,e);if(e==this.size)return d(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position "+e+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var i=r+this.child(n).nodeSize;if(i>=e)return i==e||t>0?d(n+1,i):d(n,r);r=i}},s.prototype.toString=function(){return"<"+this.toStringInner()+">"},s.prototype.toStringInner=function(){return this.content.join(", ")},s.prototype.toJSON=function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null},s.fromJSON=function(e,t){if(!t)return s.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(t.map(e.nodeFromJSON))},s.fromArray=function(e){if(!e.length)return s.empty;for(var t,n=0,r=0;r<e.length;r++){var i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new s(t||e,n)},s.from=function(e){if(!e)return s.empty;if(e instanceof s)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new s([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,l);var c={index:0,offset:0};function d(e,t){return c.index=e,c.offset=t,c}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!u(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!u(e[i],t[i]))return!1;for(var o in t)if(!(o in e))return!1}return!0}s.empty=new s([],0);var p=function(e,t){this.type=e,this.attrs=t};function f(e){var t=Error.call(this,e);return t.__proto__=f.prototype,t}p.prototype.addToSet=function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t},p.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e},p.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1},p.prototype.eq=function(e){return this==e||this.type==e.type&&u(this.attrs,e.attrs)},p.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e},p.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type "+t.type+" in this schema");return n.create(t.attrs)},p.sameSet=function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0},p.setFrom=function(e){if(!e||0==e.length)return p.none;if(e instanceof p)return[e];var t=e.slice();return t.sort((function(e,t){return e.type.rank-t.type.rank})),t},p.none=[],f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="ReplaceError";var m=function(e,t,n){this.content=e,this.openStart=t,this.openEnd=n},h={size:{configurable:!0}};function g(e,t,n){if(n.openStart>e.depth)throw new f("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new f("Inconsistent open depths");return function e(t,n,r,i){var o=t.index(i),a=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){var l=e(t,n,r,i+1);return a.copy(a.content.replaceChild(o,l))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){var c=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(s.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t),d=c.start,u=c.end;return y(a,function e(t,n,r,i,o){var a=t.depth>o&&v(t,n,o+1),l=i.depth>o&&v(r,i,o+1),c=[];b(null,t,o,c),a&&l&&n.index(o)==r.index(o)?(_(a,l),E(y(a,e(t,n,r,i,o+1)),c)):(a&&E(y(a,S(t,n,o+1)),c),b(n,r,o,c),l&&E(y(l,S(r,i,o+1)),c));return b(i,null,o,c),new s(c)}(t,d,u,n,i))}var p=t.parent,f=p.content;return y(p,f.cut(0,t.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return y(a,S(t,n,i))}(e,t,n,0)}function _(e,t){if(!t.type.compatibleContent(e.type))throw new f("Cannot join "+t.type.name+" onto "+e.type.name)}function v(e,t,n){var r=e.node(n);return _(r,t.node(n)),r}function E(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function b(e,t,n,r){var i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(E(e.nodeAfter,r),o++));for(var s=o;s<a;s++)E(i.child(s),r);t&&t.depth==n&&t.textOffset&&E(t.nodeBefore,r)}function y(e,t){if(!e.type.validContent(t))throw new f("Invalid content for node "+e.type.name);return e.copy(t)}function S(e,t,n){var r=[];(b(null,e,n,r),e.depth>n)&&E(y(v(e,t,n+1),S(e,t,n+1)),r);return b(t,null,n,r),new s(r)}h.size.get=function(){return this.content.size-this.openStart-this.openEnd},m.prototype.insertAt=function(e,t){var n=function e(t,n,r,i){var o=t.findIndex(n),a=o.index,s=o.offset,l=t.maybeChild(a);if(s==n||l.isText)return i&&!i.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));var c=e(l.content,n-s-1,r);return c&&t.replaceChild(a,l.copy(c))}(this.content,e+this.openStart,t,null);return n&&new m(n,this.openStart,this.openEnd)},m.prototype.removeBetween=function(e,t){return new m(function e(t,n,r){var i=t.findIndex(n),o=i.index,a=i.offset,s=t.maybeChild(o),l=t.findIndex(r),c=l.index,d=l.offset;if(a==n||s.isText){if(d!=r&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(o!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(e(s.content,n-a-1,r-a-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)},m.prototype.eq=function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd},m.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},m.prototype.toJSON=function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e},m.fromJSON=function(e,t){if(!t)return m.empty;var n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new m(s.fromJSON(e,t.content),n,r)},m.maxOpen=function(e,t){void 0===t&&(t=!0);for(var n=0,r=0,i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)n++;for(var o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new m(e,n,r)},Object.defineProperties(m.prototype,h),m.empty=new m(s.empty,0,0);var T=function(e,t,n){this.pos=e,this.path=t,this.depth=t.length/3-1,this.parentOffset=n},N={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};T.prototype.resolveDepth=function(e){return null==e?this.depth:e<0?this.depth+e:e},N.parent.get=function(){return this.node(this.depth)},N.doc.get=function(){return this.node(0)},T.prototype.node=function(e){return this.path[3*this.resolveDepth(e)]},T.prototype.index=function(e){return this.path[3*this.resolveDepth(e)+1]},T.prototype.indexAfter=function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)},T.prototype.start=function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1},T.prototype.end=function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size},T.prototype.before=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]},T.prototype.after=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize},N.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},N.nodeAfter.get=function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r},N.nodeBefore.get=function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)},T.prototype.posAtIndex=function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r},T.prototype.marks=function(){var e=this.parent,t=this.index();if(0==e.content.size)return p.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var o=n.marks,a=0;a<o.length;a++)!1!==o[a].type.spec.inclusive||r&&o[a].isInSet(r.marks)||(o=o[a--].removeFromSet(o));return o},T.prototype.marksAcross=function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n},T.prototype.sharedDepth=function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0},T.prototype.blockRange=function(e,t){if(void 0===e&&(e=this),e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new D(this,e,n)},T.prototype.sameParent=function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset},T.prototype.max=function(e){return e.pos>this.pos?e:this},T.prototype.min=function(e){return e.pos<this.pos?e:this},T.prototype.toString=function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset},T.resolve=function(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");for(var n=[],r=0,i=t,o=e;;){var a=o.content.findIndex(i),s=a.index,l=a.offset,c=i-l;if(n.push(o,s,r+l),!c)break;if((o=o.child(s)).isText)break;i=c-1,r+=l+1}return new T(t,n,i)},T.resolveCached=function(e,t){for(var n=0;n<O.length;n++){var r=O[n];if(r.pos==t&&r.doc==e)return r}var i=O[C]=T.resolve(e,t);return C=(C+1)%A,i},Object.defineProperties(T.prototype,N);var O=[],C=0,A=12,D=function(e,t,n){this.$from=e,this.$to=t,this.depth=n},R={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};R.start.get=function(){return this.$from.before(this.depth+1)},R.end.get=function(){return this.$to.after(this.depth+1)},R.parent.get=function(){return this.$from.node(this.depth)},R.startIndex.get=function(){return this.$from.index(this.depth)},R.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(D.prototype,R);var w=Object.create(null),I=function(e,t,n,r){this.type=e,this.attrs=t,this.content=n||s.empty,this.marks=r||p.none},M={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};M.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},M.childCount.get=function(){return this.content.childCount},I.prototype.child=function(e){return this.content.child(e)},I.prototype.maybeChild=function(e){return this.content.maybeChild(e)},I.prototype.forEach=function(e){this.content.forEach(e)},I.prototype.nodesBetween=function(e,t,n,r){void 0===r&&(r=0),this.content.nodesBetween(e,t,n,r,this)},I.prototype.descendants=function(e){this.nodesBetween(0,this.content.size,e)},M.textContent.get=function(){return this.textBetween(0,this.content.size,"")},I.prototype.textBetween=function(e,t,n,r){return this.content.textBetween(e,t,n,r)},M.firstChild.get=function(){return this.content.firstChild},M.lastChild.get=function(){return this.content.lastChild},I.prototype.eq=function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)},I.prototype.sameMarkup=function(e){return this.hasMarkup(e.type,e.attrs,e.marks)},I.prototype.hasMarkup=function(e,t,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||w)&&p.sameSet(this.marks,n||p.none)},I.prototype.copy=function(e){return void 0===e&&(e=null),e==this.content?this:new this.constructor(this.type,this.attrs,e,this.marks)},I.prototype.mark=function(e){return e==this.marks?this:new this.constructor(this.type,this.attrs,this.content,e)},I.prototype.cut=function(e,t){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))},I.prototype.slice=function(e,t,n){if(void 0===t&&(t=this.content.size),void 0===n&&(n=!1),e==t)return m.empty;var r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),s=r.node(o).content.cut(r.pos-a,i.pos-a);return new m(s,r.depth-o,i.depth-o)},I.prototype.replace=function(e,t,n){return g(this.resolve(e),this.resolve(t),n)},I.prototype.nodeAt=function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(!(t=t.maybeChild(r)))return null;if(i==e||t.isText)return t;e-=i+1}},I.prototype.childAfter=function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},I.prototype.childBefore=function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}},I.prototype.resolve=function(e){return T.resolveCached(this,e)},I.prototype.resolveNoCache=function(e){return T.resolve(this,e)},I.prototype.rangeHasMark=function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r},M.isBlock.get=function(){return this.type.isBlock},M.isTextblock.get=function(){return this.type.isTextblock},M.inlineContent.get=function(){return this.type.inlineContent},M.isInline.get=function(){return this.type.isInline},M.isText.get=function(){return this.type.isText},M.isLeaf.get=function(){return this.type.isLeaf},M.isAtom.get=function(){return this.type.isAtom},I.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),k(this.marks,e)},I.prototype.contentMatchAt=function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t},I.prototype.canReplace=function(e,t,n,r,i){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===i&&(i=n.childCount);var o=this.contentMatchAt(e).matchFragment(n,r,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var l=r;l<i;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0},I.prototype.canReplaceWith=function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd},I.prototype.canAppend=function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)},I.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var e=p.none,t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!p.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(e){return e.type.name})));this.content.forEach((function(e){return e.check()}))},I.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((function(e){return e.toJSON()}))),e},I.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=s.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)},Object.defineProperties(I.prototype,M);var x=function(e){function t(t,n,r,i){if(e.call(this,t,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return t.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):k(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},t.prototype.textBetween=function(e,t){return this.text.slice(e,t)},n.nodeSize.get=function(){return this.text.length},t.prototype.mark=function(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)},t.prototype.withText=function(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)},t.prototype.cut=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.text.length),0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))},t.prototype.eq=function(e){return this.sameMarkup(e)&&this.text==e.text},t.prototype.toJSON=function(){var t=e.prototype.toJSON.call(this);return t.text=this.text,t},Object.defineProperties(t.prototype,n),t}(I);function k(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var L=function(e){this.validEnd=e,this.next=[],this.wrapCache=[]},P={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};L.parse=function(e,t){var n=new B(e,t);if(null==n.next)return L.empty;var r=F(n);n.next&&n.err("Unexpected trailing text");var i=function(e){var t=Object.create(null);return function n(r){var i=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){var o=i.indexOf(n),a=o>-1&&i[o+1];H(e,r).forEach((function(e){a||i.push(n,a=[]),-1==a.indexOf(e)&&a.push(e)}))}}))}));for(var o=t[r.join(",")]=new L(r.indexOf(e.length-1)>-1),a=0;a<i.length;a+=2){var s=i[a+1].sort(V);o.next.push(i[a],t[s.join(",")]||n(s))}return o}(H(e,0))}(function(e){var t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,o))}),[]);if("seq"==t.type)for(var a=0;;a++){var s=e(t.exprs[a],o);if(a==t.exprs.length-1)return s;i(s,o=n())}else{if("star"==t.type){var l=n();return r(o,l),i(e(t.expr,l),l),[r(l)]}if("plus"==t.type){var c=n();return i(e(t.expr,o),c),i(e(t.expr,c),c),[r(c)]}if("opt"==t.type)return[r(o)].concat(e(t.expr,o));if("range"==t.type){for(var d=o,u=0;u<t.min;u++){var p=n();i(e(t.expr,d),p),d=p}if(-1==t.max)i(e(t.expr,d),d);else for(var f=t.min;f<t.max;f++){var m=n();r(d,m),i(e(t.expr,d),m),d=m}return[r(d)]}if("name"==t.type)return[r(o,null,t.value)]}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach((function(e){return e.to=t}))}}(r));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],o=!i.validEnd,a=[],s=0;s<i.next.length;s+=2){var l=i.next[s],c=i.next[s+1];a.push(l.name),!o||l.isText||l.hasRequiredAttrs()||(o=!1),-1==r.indexOf(c)&&r.push(c)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i},L.prototype.matchType=function(e){for(var t=0;t<this.next.length;t+=2)if(this.next[t]==e)return this.next[t+1];return null},L.prototype.matchFragment=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.childCount);for(var r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r},P.inlineContent.get=function(){var e=this.next[0];return!!e&&e.isInline},P.defaultType.get=function(){for(var e=0;e<this.next.length;e+=2){var t=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}},L.prototype.compatible=function(e){for(var t=0;t<this.next.length;t+=2)for(var n=0;n<e.next.length;n+=2)if(this.next[t]==e.next[n])return!0;return!1},L.prototype.fillBefore=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=0);var r=[this];return function i(o,a){var l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return s.from(a.map((function(e){return e.createAndFill()})));for(var c=0;c<o.next.length;c+=2){var d=o.next[c],u=o.next[c+1];if(!d.isText&&!d.hasRequiredAttrs()&&-1==r.indexOf(u)){r.push(u);var p=i(u,a.concat(d));if(p)return p}}}(this,[])},L.prototype.findWrapping=function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n},L.prototype.computeWrapping=function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var o=[],a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(var s=0;s<i.next.length;s+=2){var l=i.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in t||r.type&&!i.next[s+1].validEnd||(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}},P.edgeCount.get=function(){return this.next.length>>1},L.prototype.edge=function(e){var t=e<<1;if(t>=this.next.length)throw new RangeError("There's no "+e+"th edge in this content match");return{type:this.next[t],next:this.next[t+1]}},L.prototype.toString=function(){var e=[];return function t(n){e.push(n);for(var r=1;r<n.next.length;r+=2)-1==e.indexOf(n.next[r])&&t(n.next[r])}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",i=0;i<t.next.length;i+=2)r+=(i?", ":"")+t.next[i].name+"->"+e.indexOf(t.next[i+1]);return r})).join("\n")},Object.defineProperties(L.prototype,P),L.empty=new L(!0);var B=function(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},U={next:{configurable:!0}};function F(e){var t=[];do{t.push(z(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function z(e){var t=[];do{t.push(j(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function j(e){for(var t=function(e){if(e.eat("(")){var t=F(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var o in n){var a=n[o];a.groups.indexOf(t)>-1&&i.push(a)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Y(e,t)}return t}function G(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function Y(e,t){var n=G(e),r=n;return e.eat(",")&&(r="}"!=e.next?G(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function V(e,t){return t-e}function H(e,t){var n=[];return function t(r){var i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(var o=0;o<i.length;o++){var a=i[o],s=a.term,l=a.to;s||-1!=n.indexOf(l)||t(l)}}(t),n.sort(V)}function q(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function $(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(void 0===i){var o=e[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}n[r]=i}return n}function W(e){var t=Object.create(null);if(e)for(var n in e)t[n]=new X(e[n]);return t}U.next.get=function(){return this.tokens[this.pos]},B.prototype.eat=function(e){return this.next==e&&(this.pos++||!0)},B.prototype.err=function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")},Object.defineProperties(B.prototype,U);var Q=function(e,t,n){this.name=e,this.schema=t,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=W(n.attrs),this.defaultAttrs=q(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e},K={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};K.isInline.get=function(){return!this.isBlock},K.isTextblock.get=function(){return this.isBlock&&this.inlineContent},K.isLeaf.get=function(){return this.contentMatch==L.empty},K.isAtom.get=function(){return this.isLeaf||this.spec.atom},Q.prototype.hasRequiredAttrs=function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1},Q.prototype.compatibleContent=function(e){return this==e||this.contentMatch.compatible(e.contentMatch)},Q.prototype.computeAttrs=function(e){return!e&&this.defaultAttrs?this.defaultAttrs:$(this.attrs,e)},Q.prototype.create=function(e,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new I(this,this.computeAttrs(e),s.from(t),p.setFrom(n))},Q.prototype.createChecked=function(e,t,n){if(t=s.from(t),!this.validContent(t))throw new RangeError("Invalid content for node "+this.name);return new I(this,this.computeAttrs(e),t,p.setFrom(n))},Q.prototype.createAndFill=function(e,t,n){if(e=this.computeAttrs(e),(t=s.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t).fillBefore(s.empty,!0);return i?new I(this,e,t.append(i),p.setFrom(n)):null},Q.prototype.validContent=function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0},Q.prototype.allowsMarkType=function(e){return null==this.markSet||this.markSet.indexOf(e)>-1},Q.prototype.allowsMarks=function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0},Q.prototype.allowedMarks=function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:p.empty:e},Q.compile=function(e,t){var n=Object.create(null);e.forEach((function(e,r){return n[e]=new Q(e,t,r)}));var r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var i in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(Q.prototype,K);var X=function(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default},Z={isRequired:{configurable:!0}};Z.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(X.prototype,Z);var J=function(e,t,n,r){this.name=e,this.schema=n,this.spec=r,this.attrs=W(r.attrs),this.rank=t,this.excluded=null;var i=q(this.attrs);this.instance=i&&new p(this,i)};J.prototype.create=function(e){return!e&&this.instance?this.instance:new p(this,$(this.attrs,e))},J.compile=function(e,t){var n=Object.create(null),r=0;return e.forEach((function(e,i){return n[e]=new J(e,r++,t,i)})),n},J.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e},J.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]},J.prototype.excludes=function(e){return this.excluded.indexOf(e)>-1};var ee=function(e){for(var t in this.spec={},e)this.spec[t]=e[t];this.spec.nodes=a.from(e.nodes),this.spec.marks=a.from(e.marks),this.nodes=Q.compile(this.spec.nodes,this),this.marks=J.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var i=this.nodes[r],o=i.spec.content||"",s=i.spec.marks;i.contentMatch=n[o]||(n[o]=L.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==s?null:s?te(this,s.split(" ")):""!=s&&i.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],d=c.spec.excludes;c.excluded=null==d?[c]:""==d?[]:te(this,d.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function te(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(var s in e.marks){var l=e.marks[s];("_"==i||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}ee.prototype.node=function(e,t,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Q))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)},ee.prototype.text=function(e,t){var n=this.nodes.text;return new x(n,n.defaultAttrs,e,p.setFrom(t))},ee.prototype.mark=function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)},ee.prototype.nodeFromJSON=function(e){return I.fromJSON(this,e)},ee.prototype.markFromJSON=function(e){return p.fromJSON(this,e)},ee.prototype.nodeType=function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t};var ne=function(e,t){var n=this;this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((function(e){e.tag?n.tags.push(e):e.style&&n.styles.push(e)})),this.normalizeLists=!this.tags.some((function(t){if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;var n=e.nodes[t.node];return n.contentMatch.matchType(n)}))};ne.prototype.parse=function(e,t){void 0===t&&(t={});var n=new le(this,t,!1);return n.addAll(e,null,t.from,t.to),n.finish()},ne.prototype.parseSlice=function(e,t){void 0===t&&(t={});var n=new le(this,t,!0);return n.addAll(e,null,t.from,t.to),m.maxOpen(n.finish())},ne.prototype.matchTag=function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(de(e,i.tag)&&(void 0===i.namespace||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var o=i.getAttrs(e);if(!1===o)continue;i.attrs=o}return i}}},ne.prototype.matchStyle=function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var o=this.styles[i];if(!(0!=o.style.indexOf(e)||o.context&&!n.matchesContext(o.context)||o.style.length>e.length&&(61!=o.style.charCodeAt(e.length)||o.style.slice(e.length+1)!=t))){if(o.getAttrs){var a=o.getAttrs(t);if(!1===a)continue;o.attrs=a}return o}}},ne.schemaRules=function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((null==i.priority?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=ue(e)),e.mark=t}))};for(var i in e.marks)r(i);var o;for(var a in e.nodes)o=void 0,(o=e.nodes[a].spec.parseDOM)&&o.forEach((function(e){n(e=ue(e)),e.node=a}));return t},ne.fromSchema=function(e){return e.cached.domParser||(e.cached.domParser=new ne(e,ne.schemaRules(e)))};var re={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ie={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oe={ol:!0,ul:!0};function ae(e){return(e?1:0)|("full"===e?2:0)}var se=function(e,t,n,r,i,o,a){this.type=e,this.attrs=t,this.solid=i,this.match=o||(4&a?null:e.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r,this.stashMarks=[]};se.prototype.findWrapping=function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(s.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)},se.prototype.finish=function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length)))}var r=s.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},se.prototype.popFromStashMark=function(e){for(var t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]},se.prototype.applyPending=function(e){for(var t=0,n=this.pendingMarks;t<n.length;t++){var r=n[t];(this.type?this.type.allowsMarkType(r.type):pe(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var le=function(e,t,n){this.parser=e,this.options=t,this.isOpen=n;var r,i=t.topNode,o=ae(t.preserveWhitespace)|(n?4:0);r=i?new se(i.type,i.attrs,p.none,p.none,!0,t.topMatch||i.type.contentMatch,o):new se(n?null:e.schema.topNodeType,null,p.none,p.none,!0,null,o),this.nodes=[r],this.open=0,this.find=t.findPositions,this.needsBlock=!1},ce={top:{configurable:!0},currentPos:{configurable:!0}};function de(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ue(e){var t={};for(var n in e)t[n]=e[n];return t}function pe(e,t){var n=t.schema.nodes,r=function(r){var i=n[r];if(i.allowsMarkType(e)){var o=[],a=function(e){o.push(e);for(var n=0;n<e.edgeCount;n++){var r=e.edge(n),i=r.type,s=r.next;if(i==t)return!0;if(o.indexOf(s)<0&&a(s))return!0}};return a(i.contentMatch)?{v:!0}:void 0}};for(var i in n){var o=r(i);if(o)return o.v}}ce.top.get=function(){return this.nodes[this.open]},le.prototype.addDOM=function(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){var t=e.getAttribute("style"),n=t?this.readStyles(function(e){var t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t)):null,r=this.top;if(null!=n)for(var i=0;i<n.length;i++)this.addPendingMark(n[i]);if(this.addElement(e),null!=n)for(var o=0;o<n.length;o++)this.removePendingMark(n[o],r)}},le.prototype.addTextNode=function(e){var t=e.nodeValue,n=this.top;if(2&n.options||(n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],i=e.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)},le.prototype.addElement=function(e,t){var n,r=e.nodeName.toLowerCase();oe.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&oe.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(i?i.ignore:ie.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);var o,a=this.top,s=this.needsBlock;if(re.hasOwnProperty(r))o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),o&&this.sync(a),this.needsBlock=s}else this.addElementByRule(e,i,!1===i.consuming?n:null)},le.prototype.leafFallback=function(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))},le.prototype.ignoreFallback=function(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},le.prototype.readStyles=function(e){var t=p.none;e:for(var n=0;n<e.length;n+=2)for(var r=null;;){var i=this.parser.matchStyle(e[n],e[n+1],this,r);if(!i)continue e;if(i.ignore)return null;if(t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;r=i}return t},le.prototype.addElementByRule=function(e,t,n){var r,i,o,a=this;t.node?(i=this.parser.schema.nodes[t.node]).isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):r=this.enter(i,t.attrs,t.preserveWhitespace):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));var s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return a.insertNode(e)}));else{var l=t.contentElement;"string"==typeof l?l=e.querySelector(l):"function"==typeof l&&(l=l(e)),l||(l=e),this.findAround(e,l,!0),this.addAll(l,r)}r&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},le.prototype.addAll=function(e,t,n,r){for(var i=n||0,o=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o),t&&re.hasOwnProperty(o.nodeName.toLowerCase())&&this.sync(t);this.findAtPoint(e,i)},le.prototype.findPlace=function(e){for(var t,n,r=this.open;r>=0;r--){var i=this.nodes[r],o=i.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,n=i,!o.length))break;if(i.solid)break}if(!t)return!1;this.sync(n);for(var a=0;a<t.length;a++)this.enterInner(t[a],null,!1);return!0},le.prototype.insertNode=function(e){if(e.isInline&&this.needsBlock&&!this.top.type){var t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();var n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));for(var r=n.activeMarks,i=0;i<e.marks.length;i++)n.type&&!n.type.allowsMarkType(e.marks[i].type)||(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1},le.prototype.enter=function(e,t,n){var r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r},le.prototype.enterInner=function(e,t,n,r){this.closeExtra();var i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e,t);var o=null==r?-5&i.options:ae(r);4&i.options&&0==i.content.length&&(o|=4),this.nodes.push(new se(e,t,i.activeMarks,i.pendingMarks,n,null,o)),this.open++},le.prototype.closeExtra=function(e){var t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}},le.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},le.prototype.sync=function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return void(this.open=t)},ce.currentPos.get=function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e},le.prototype.findAtPoint=function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)},le.prototype.findInside=function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)},le.prototype.findAround=function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},le.prototype.findInText=function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))},le.prototype.matchesContext=function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=function(e,s){for(;e>=0;e--){var l=n[e];if(""==l){if(e==n.length-1||0==e)continue;for(;s>=o;s--)if(a(e-1,s))return!0;return!1}var c=s>0||0==s&&i?t.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;s--}return!0};return a(n.length-1,this.open)},le.prototype.textblockFromContext=function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}},le.prototype.addPendingMark=function(e){var t=function(e,t){for(var n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)},le.prototype.removePendingMark=function(e,t){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);var i=r.popFromStashMark(e);i&&r.type&&r.type.allowsMarkType(i.type)&&(r.activeMarks=i.addToSet(r.activeMarks))}if(r==t)break}},Object.defineProperties(le.prototype,ce);var fe=function(e,t){this.nodes=e||{},this.marks=t||{}};function me(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function he(e){return e.document||window.document}fe.prototype.serializeFragment=function(e,t,n){var r=this;void 0===t&&(t={}),n||(n=he(t).createDocumentFragment());var i=n,o=null;return e.forEach((function(e){if(o||e.marks.length){o||(o=[]);for(var n=0,a=0;n<o.length&&a<e.marks.length;){var s=e.marks[a];if(r.marks[s.type.name]){if(!s.eq(o[n])||!1===s.type.spec.spanning)break;n+=2,a++}else a++}for(;n<o.length;)i=o.pop(),o.pop();for(;a<e.marks.length;){var l=e.marks[a++],c=r.serializeMark(l,e.isInline,t);c&&(o.push(l,i),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(r.serializeNode(e,t))})),n},fe.prototype.serializeNode=function(e,t){void 0===t&&(t={});var n=fe.renderSpec(he(t),this.nodes[e.type.name](e)),r=n.dom,i=n.contentDOM;if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");t.onContent?t.onContent(e,i,t):this.serializeFragment(e.content,t,i)}return r},fe.prototype.serializeNodeAndMarks=function(e,t){void 0===t&&(t={});for(var n=this.serializeNode(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n},fe.prototype.serializeMark=function(e,t,n){void 0===n&&(n={});var r=this.marks[e.type.name];return r&&fe.renderSpec(he(n),r(e,t))},fe.renderSpec=function(e,t,n){if(void 0===n&&(n=null),"string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var r=t[0],i=r.indexOf(" ");i>0&&(n=r.slice(0,i),r=r.slice(i+1));var o=null,a=n?e.createElementNS(n,r):e.createElement(r),s=t[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s))for(var c in l=2,s)if(null!=s[c]){var d=c.indexOf(" ");d>0?a.setAttributeNS(c.slice(0,d),c.slice(d+1),s[c]):a.setAttribute(c,s[c])}for(var u=l;u<t.length;u++){var p=t[u];if(0===p){if(u<t.length-1||u>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var f=fe.renderSpec(e,p,n),m=f.dom,h=f.contentDOM;if(a.appendChild(m),h){if(o)throw new RangeError("Multiple content holes");o=h}}return{dom:a,contentDOM:o}},fe.fromSchema=function(e){return e.cached.domSerializer||(e.cached.domSerializer=new fe(this.nodesFromSchema(e),this.marksFromSchema(e)))},fe.nodesFromSchema=function(e){var t=me(e.nodes);return t.text||(t.text=function(e){return e.text}),t},fe.marksFromSchema=function(e){return me(e.marks)};var ge=Math.pow(2,16);function _e(e){return 65535&e}var ve=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=null),this.pos=e,this.deleted=t,this.recover=n},Ee=function(e,t){void 0===t&&(t=!1),this.ranges=e,this.inverted=t};Ee.prototype.recover=function(e){var t=0,n=_e(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/ge}(e)},Ee.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},Ee.prototype.map=function(e,t){return void 0===t&&(t=1),this._map(e,t,!0)},Ee.prototype._map=function(e,t,n){for(var r=0,i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var l=this.ranges[a+i],c=this.ranges[a+o],d=s+l;if(e<=d){var u=s+r+((l?e==s?-1:e==d?1:t:t)<0?0:c);if(n)return u;var p=e==(t<0?s:d)?null:a/3+(e-s)*ge;return new ve(u,t<0?e!=s:e!=d,p)}r+=c-l}return n?e+r:new ve(e+r)},Ee.prototype.touches=function(e,t){for(var n=0,r=_e(t),i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var l=this.ranges[a+i];if(e<=s+l&&a==3*r)return!0;n+=this.ranges[a+o]-l}return!1},Ee.prototype.forEach=function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r<this.ranges.length;r+=3){var o=this.ranges[r],a=o-(this.inverted?i:0),s=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(a,a+l,s,s+c),i+=c-l}},Ee.prototype.invert=function(){return new Ee(this.ranges,!this.inverted)},Ee.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},Ee.offset=function(e){return 0==e?Ee.empty:new Ee(e<0?[0,-e,0]:[0,0,e])},Ee.empty=new Ee([]);var be=function(e,t,n,r){this.maps=e||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=t};function ye(e){var t=Error.call(this,e);return t.__proto__=ye.prototype,t}be.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.maps.length),new be(this.maps,this.mirror,e,t)},be.prototype.copy=function(){return new be(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},be.prototype.appendMap=function(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)},be.prototype.appendMapping=function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:null)}},be.prototype.getMirror=function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]},be.prototype.setMirror=function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)},be.prototype.appendMappingInverted=function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:null)}},be.prototype.invert=function(){var e=new be;return e.appendMappingInverted(this),e},be.prototype.map=function(e,t){if(void 0===t&&(t=1),this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e},be.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},be.prototype._map=function(e,t,n){for(var r=!1,i=this.from;i<this.to;i++){var o=this.maps[i].mapResult(e,t);if(null!=o.recover){var a=this.getMirror(i);if(null!=a&&a>i&&a<this.to){i=a,e=this.maps[a].recover(o.recover);continue}}o.deleted&&(r=!0),e=o.pos}return n?e:new ve(e,r)},ye.prototype=Object.create(Error.prototype),ye.prototype.constructor=ye,ye.prototype.name="TransformError";var Se=function(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new be},Te={before:{configurable:!0},docChanged:{configurable:!0}};function Ne(){throw new Error("Override me")}Te.before.get=function(){return this.docs.length?this.docs[0]:this.doc},Se.prototype.step=function(e){var t=this.maybeStep(e);if(t.failed)throw new ye(t.failed);return this},Se.prototype.maybeStep=function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t},Te.docChanged.get=function(){return this.steps.length>0},Se.prototype.addStep=function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t},Object.defineProperties(Se.prototype,Te);var Oe=Object.create(null),Ce=function(){};Ce.prototype.apply=function(e){return Ne()},Ce.prototype.getMap=function(){return Ee.empty},Ce.prototype.invert=function(e){return Ne()},Ce.prototype.map=function(e){return Ne()},Ce.prototype.merge=function(e){return null},Ce.prototype.toJSON=function(){return Ne()},Ce.fromJSON=function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Oe[t.stepType];if(!n)throw new RangeError("No step type "+t.stepType+" defined");return n.fromJSON(e,t)},Ce.jsonID=function(e,t){if(e in Oe)throw new RangeError("Duplicate use of step JSON ID "+e);return Oe[e]=t,t.prototype.jsonID=e,t};var Ae=function(e,t){this.doc=e,this.failed=t};Ae.ok=function(e){return new Ae(e,null)},Ae.fail=function(e){return new Ae(null,e)},Ae.fromReplace=function(e,t,n,r){try{return Ae.ok(e.replace(t,n,r))}catch(e){if(e instanceof f)return Ae.fail(e.message);throw e}};var De=function(e){function t(t,n,r,i){e.call(this),this.from=t,this.to=n,this.slice=r,this.structure=!!i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){return this.structure&&we(e,this.from,this.to)?Ae.fail("Structure replace would overwrite content"):Ae.fromReplace(e,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new Ee([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice)},t.prototype.merge=function(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var n=this.slice.size+e.slice.size==0?m.empty:new m(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var r=this.slice.size+e.slice.size==0?m.empty:new m(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),r,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,m.fromJSON(e,n.slice),!!n.structure)},t}(Ce);Ce.jsonID("replace",De);var Re=function(e){function t(t,n,r,i,o,a,s){e.call(this),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=!!s}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){if(this.structure&&(we(e,this.from,this.gapFrom)||we(e,this.gapTo,this.to)))return Ae.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ae.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?Ae.fromReplace(e,this.from,this.to,n):Ae.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new Ee([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return n.deleted&&r.deleted||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,m.fromJSON(e,n.slice),n.insert,!!n.structure)},t}(Ce);function we(e,t,n){for(var r=e.resolve(t),i=n-t,o=r.depth;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0)for(var a=r.node(o).maybeChild(r.indexAfter(o));i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}return!1}function Ie(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Me(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),i=e.$from.index(n),o=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,o,t))return n;if(0==n||r.type.spec.isolating||!Ie(r,i,o))break}}function xe(e,t,n,r){void 0===r&&(r=e);var i=function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;var a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}(e,t),o=i&&function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,l=r;s&&l<i;l++)s=s.matchType(n.child(l).type);if(!s||!s.validEnd)return null;return a}(r,t);return o?i.map(ke).concat({type:t,attrs:n}).concat(o.map(ke)):null}function ke(e){return{type:e,attrs:null}}function Le(e,t,n,r){void 0===n&&(n=1);var i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(var s=i.depth-1,l=n-2;s>o;s--,l--){var c=i.node(s),d=i.index(s);if(c.type.spec.isolating)return!1;var u=c.content.cutByIndex(d,c.childCount),p=r&&r[l]||c;if(p!=c&&(u=u.replaceChild(0,p.type.create(p.attrs))),!c.canReplace(d+1,c.childCount)||!p.type.validContent(u))return!1}var f=i.indexAfter(o),m=r&&r[0];return i.node(o).canReplaceWith(f,f,m?m.type:i.node(o+1).type)}function Pe(e,t){var n=e.resolve(t),r=n.index();return Be(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Be(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}function Ue(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,o=0;o<n.openStart;o++)i=i.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(1==a)u=d.canReplace(c,c,i);else{var p=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Fe(e,t,n){for(var r=[],i=0;i<e.childCount;i++){var o=e.child(i);o.content.size&&(o=o.copy(Fe(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return s.fromArray(r)}Ce.jsonID("replaceAround",Re),Se.prototype.lift=function(e,t){for(var n=e.$from,r=e.$to,i=e.depth,o=n.before(i+1),a=r.after(i+1),l=o,c=a,d=s.empty,u=0,p=i,f=!1;p>t;p--)f||n.index(p)>0?(f=!0,d=s.from(n.node(p).copy(d)),u++):l--;for(var h=s.empty,g=0,_=i,v=!1;_>t;_--)v||r.after(_+1)<r.end(_)?(v=!0,h=s.from(r.node(_).copy(h)),g++):c++;return this.step(new Re(l,c,o,a,new m(d.append(h),u,g),d.size-u,!0))},Se.prototype.wrap=function(e,t){for(var n=s.empty,r=t.length-1;r>=0;r--)n=s.from(t[r].type.create(t[r].attrs,n));var i=e.start,o=e.end;return this.step(new Re(i,o,i,o,new m(n,0,0),t.length,!0))},Se.prototype.setBlockType=function(e,t,n,r){var i=this;if(void 0===t&&(t=e),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var o=this.steps.length;return this.doc.nodesBetween(e,t,(function(e,t){if(e.isTextblock&&!e.hasMarkup(n,r)&&function(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(i.doc,i.mapping.slice(o).map(t),n)){i.clearIncompatible(i.mapping.slice(o).map(t,1),n);var a=i.mapping.slice(o),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return i.step(new Re(l,c,l+1,c-1,new m(s.from(n.create(r,null,e.marks)),0,0),1,!0)),!1}})),this},Se.prototype.setNodeMarkup=function(e,t,n,r){var i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);var o=t.create(n,null,r||i.marks);if(i.isLeaf)return this.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new Re(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new m(s.from(o),0,0),1,!0))},Se.prototype.split=function(e,t,n){void 0===t&&(t=1);for(var r=this.doc.resolve(e),i=s.empty,o=s.empty,a=r.depth,l=r.depth-t,c=t-1;a>l;a--,c--){i=s.from(r.node(a).copy(i));var d=n&&n[c];o=s.from(d?d.type.create(d.attrs,o):r.node(a).copy(o))}return this.step(new De(e,e,new m(i.append(o),t,t),!0))},Se.prototype.join=function(e,t){void 0===t&&(t=1);var n=new De(e-t,e+t,m.empty,!0);return this.step(n)};var ze=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new m(Fe(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),i),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,o)},t.prototype.invert=function(){return new je(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(Ce);Ce.jsonID("addMark",ze);var je=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),r=new m(Fe(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))})),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,r)},t.prototype.invert=function(){return new ze(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(Ce);function Ge(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Ce.jsonID("removeMark",je),Se.prototype.addMark=function(e,t,n){var r=this,i=[],o=[],a=null,s=null;return this.doc.nodesBetween(e,t,(function(r,l,c){if(r.isInline){var d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){for(var u=Math.max(l,e),p=Math.min(l+r.nodeSize,t),f=n.addToSet(d),m=0;m<d.length;m++)d[m].isInSet(f)||(a&&a.to==u&&a.mark.eq(d[m])?a.to=p:i.push(a=new je(u,p,d[m])));s&&s.to==u?s.to=p:o.push(s=new ze(u,p,n))}}})),i.forEach((function(e){return r.step(e)})),o.forEach((function(e){return r.step(e)})),this},Se.prototype.removeMark=function(e,t,n){var r=this;void 0===n&&(n=null);var i=[],o=0;return this.doc.nodesBetween(e,t,(function(r,a){if(r.isInline){o++;var s=null;if(n instanceof J)for(var l,c=r.marks;l=n.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else n?n.isInSet(r.marks)&&(s=[n]):s=r.marks;if(s&&s.length)for(var d=Math.min(a+r.nodeSize,t),u=0;u<s.length;u++){for(var p=s[u],f=void 0,m=0;m<i.length;m++){var h=i[m];h.step==o-1&&p.eq(i[m].style)&&(f=h)}f?(f.to=d,f.step=o):i.push({style:p,from:Math.max(a,e),to:d,step:o})}}})),i.forEach((function(e){return r.step(new je(e.from,e.to,e.style))})),this},Se.prototype.clearIncompatible=function(e,t,n){void 0===n&&(n=t.contentMatch);for(var r=this.doc.nodeAt(e),i=[],o=e+1,a=0;a<r.childCount;a++){var l=r.child(a),c=o+l.nodeSize,d=n.matchType(l.type,l.attrs);if(d){n=d;for(var u=0;u<l.marks.length;u++)t.allowsMarkType(l.marks[u].type)||this.step(new je(o,c,l.marks[u]))}else i.push(new De(o,c,m.empty));o=c}if(!n.validEnd){var p=n.fillBefore(s.empty,!0);this.replace(o,o,new m(p,0,0))}for(var f=i.length-1;f>=0;f--)this.step(i[f]);return this},Se.prototype.replace=function(e,t,n){void 0===t&&(t=e),void 0===n&&(n=m.empty);var r=function(e,t,n,r){if(void 0===n&&(n=t),void 0===r&&(r=m.empty),t==n&&!r.size)return null;var i=e.resolve(t),o=e.resolve(n);return Ge(i,o,r)?new De(t,n,r):new Ye(i,o,r).fit()}(this.doc,e,t,n);return r&&this.step(r),this},Se.prototype.replaceWith=function(e,t,n){return this.replace(e,t,new m(s.from(n),0,0))},Se.prototype.delete=function(e,t){return this.replace(e,t,m.empty)},Se.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};var Ye=function(e,t,n){this.$to=t,this.$from=e,this.unplaced=n,this.frontier=[];for(var r=0;r<=e.depth;r++){var i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}this.placed=s.empty;for(var o=e.depth;o>0;o--)this.placed=s.from(e.node(o).copy(this.placed))},Ve={depth:{configurable:!0}};function He(e,t,n){return 0==t?e.cutByIndex(n):e.replaceChild(0,e.firstChild.copy(He(e.firstChild.content,t-1,n)))}function qe(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qe(e.lastChild.content,t-1,n)))}function $e(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function We(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,We(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(s.empty,!0)))),e.copy(r)}function Qe(e,t,n,r,i){var o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;var s=r.fillBefore(o.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,a)?s:null}function Ke(e,t,n,r,i){if(t<n){var o=e.firstChild;e=e.replaceChild(0,o.copy(Ke(o.content,t+1,n,r,o)))}if(t>r){var a=i.contentMatchAt(0),l=a.fillBefore(e).append(e);e=l.append(a.matchFragment(l).fillBefore(s.empty,!0))}return e}function Xe(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;i==t.start(r)&&n.push(r)}return n}Ve.depth.get=function(){return this.frontier.length-1},Ye.prototype.fit=function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;for(var o=this.placed,a=r.depth,s=i.depth;a&&s&&1==o.childCount;)o=o.firstChild.content,a--,s--;var l=new m(o,a,s);return t>-1?new Re(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new De(r.pos,i.pos,l):void 0},Ye.prototype.findFittable=function(){for(var e=1;e<=2;e++)for(var t=this.unplaced.openStart;t>=0;t--)for(var n=void 0,r=(t?(n=$e(this.unplaced.content,t-1).firstChild).content:this.unplaced.content).firstChild,i=this.depth;i>=0;i--){var o=this.frontier[i],a=o.type,l=o.match,c=void 0,d=void 0;if(1==e&&(r?l.matchType(r.type)||(d=l.fillBefore(s.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:t,frontierDepth:i,parent:n,inject:d};if(2==e&&r&&(c=l.findWrapping(r.type)))return{sliceDepth:t,frontierDepth:i,parent:n,wrap:c};if(n&&l.matchType(n.type))break}},Ye.prototype.openMore=function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=$e(t,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new m(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)},Ye.prototype.dropNode=function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=$e(t,n);if(i.childCount<=1&&n>0){var o=t.size-n<=n+i.size;this.unplaced=new m(He(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new m(He(t,n,1),n,r)},Ye.prototype.placeNodes=function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,i=e.inject,o=e.wrap;this.depth>n;)this.closeFrontierNode();if(o)for(var a=0;a<o.length;a++)this.openFrontierNode(o[a]);var l=this.unplaced,c=r?r.content:l.content,d=l.openStart-t,u=0,p=[],f=this.frontier[n],h=f.match,g=f.type;if(i){for(var _=0;_<i.childCount;_++)p.push(i.child(_));h=h.matchFragment(i)}for(var v=c.size+t-(l.content.size-l.openEnd);u<c.childCount;){var E=c.child(u),b=h.matchType(E.type);if(!b)break;(++u>1||0==d||E.content.size)&&(h=b,p.push(We(E.mark(g.allowedMarks(E.marks)),1==u?d:0,u==c.childCount?v:-1)))}var y=u==c.childCount;y||(v=-1),this.placed=qe(this.placed,n,s.from(p)),this.frontier[n].match=h,y&&v<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var S=0,T=c;S<v;S++){var N=T.lastChild;this.frontier.push({type:N.type,match:N.contentMatchAt(N.childCount)}),T=N.content}this.unplaced=y?0==t?m.empty:new m(He(l.content,t-1,1),t-1,v<0?l.openEnd:t-1):new m(He(l.content,t,u),l.openStart,l.openEnd)},Ye.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Qe(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},Ye.prototype.findCloseLevel=function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Qe(e,t,i,r,o);if(a){for(var s=t-1;s>=0;s--){var l=this.frontier[s],c=l.match,d=Qe(e,s,l.type,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}},Ye.prototype.close=function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qe(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e},Ye.prototype.openFrontierNode=function(e,t,n){var r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=qe(this.placed,this.depth,s.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})},Ye.prototype.closeFrontierNode=function(){var e=this.frontier.pop().match.fillBefore(s.empty,!0);e.childCount&&(this.placed=qe(this.placed,this.frontier.length,e))},Object.defineProperties(Ye.prototype,Ve),Se.prototype.replaceRange=function(e,t,n){if(!n.size)return this.deleteRange(e,t);var r=this.doc.resolve(e),i=this.doc.resolve(t);if(Ge(r,i,n))return this.step(new De(e,t,n));var o=Xe(r,this.doc.resolve(t));0==o[o.length-1]&&o.pop();var a=-(r.depth+1);o.unshift(a);for(var s=r.depth,l=r.pos-1;s>0;s--,l--){var c=r.node(s).type.spec;if(c.defining||c.isolating)break;o.indexOf(s)>-1?a=s:r.before(s)==l&&o.splice(1,0,-s)}for(var d=o.indexOf(a),u=[],p=n.openStart,f=n.content,h=0;;h++){var g=f.firstChild;if(u.push(g),h==n.openStart)break;f=g.content}p>0&&u[p-1].type.spec.defining&&r.node(d).type!=u[p-1].type?p-=1:p>=2&&u[p-1].isTextblock&&u[p-2].type.spec.defining&&r.node(d).type!=u[p-2].type&&(p-=2);for(var _=n.openStart;_>=0;_--){var v=(_+p+1)%(n.openStart+1),E=u[v];if(E)for(var b=0;b<o.length;b++){var y=o[(b+d)%o.length],S=!0;y<0&&(S=!1,y=-y);var T=r.node(y-1),N=r.index(y-1);if(T.canReplaceWith(N,N,E.type,E.marks))return this.replace(r.before(y),S?i.after(y):t,new m(Ke(n.content,0,n.openStart,v),v,n.openEnd))}}for(var O=this.steps.length,C=o.length-1;C>=0&&(this.replace(e,t,n),!(this.steps.length>O));C--){var A=o[C];A<0||(e=r.before(A),t=i.after(A))}return this},Se.prototype.replaceRangeWith=function(e,t,n){if(!n.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var r=function(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var i=r.depth-1;i>=0;i--){var o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}}(this.doc,e,n.type);null!=r&&(e=t=r)}return this.replaceRange(e,t,new m(s.from(n),0,0))},Se.prototype.deleteRange=function(e,t){for(var n=this.doc.resolve(e),r=this.doc.resolve(t),i=Xe(n,r),o=0;o<i.length;o++){var a=i[o],s=o==i.length-1;if(s&&0==a||n.node(a).type.contentMatch.validEnd)return this.delete(n.start(a),r.end(a));if(a>0&&(s||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return this.delete(n.before(a),r.after(a))}for(var l=1;l<=n.depth&&l<=r.depth;l++)if(e-n.start(l)==n.depth-l&&t>n.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(n.before(l),t);return this.delete(e,t)};var Ze=Object.create(null),Je=function(e,t,n){this.ranges=n||[new tt(e.min(t),e.max(t))],this.$anchor=e,this.$head=t},et={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};et.anchor.get=function(){return this.$anchor.pos},et.head.get=function(){return this.$head.pos},et.from.get=function(){return this.$from.pos},et.to.get=function(){return this.$to.pos},et.$from.get=function(){return this.ranges[0].$from},et.$to.get=function(){return this.ranges[0].$to},et.empty.get=function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0},Je.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Je.prototype.replace=function(e,t){void 0===t&&(t=m.empty);for(var n=t.content.lastChild,r=null,i=0;i<t.openEnd;i++)r=n,n=n.lastChild;for(var o=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,d=l.$to,u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),s?m.empty:t),0==s&&ct(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Je.prototype.replaceWith=function(e,t){for(var n=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var o=r[i],a=o.$from,s=o.$to,l=e.mapping.slice(n),c=l.map(a.pos),d=l.map(s.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),ct(e,n,t.isInline?-1:1))}},Je.findFrom=function(e,t,n){var r=e.parent.inlineContent?new nt(e):lt(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var i=e.depth-1;i>=0;i--){var o=t<0?lt(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):lt(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(o)return o}},Je.near=function(e,t){return void 0===t&&(t=1),this.findFrom(e,t)||this.findFrom(e,-t)||new at(e.node(0))},Je.atStart=function(e){return lt(e,e,0,0,1)||new at(e)},Je.atEnd=function(e){return lt(e,e,e.content.size,e.childCount,-1)||new at(e)},Je.fromJSON=function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ze[t.type];if(!n)throw new RangeError("No selection type "+t.type+" defined");return n.fromJSON(e,t)},Je.jsonID=function(e,t){if(e in Ze)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ze[e]=t,t.prototype.jsonID=e,t},Je.prototype.getBookmark=function(){return nt.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Je.prototype,et),Je.prototype.visible=!0;var tt=function(e,t){this.$from=e,this.$to=t},nt=function(e){function t(t,n){void 0===n&&(n=t),e.call(this,t,n)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},t.prototype.map=function(n,r){var i=n.resolve(r.map(this.head));if(!i.parent.inlineContent)return e.near(i);var o=n.resolve(r.map(this.anchor));return new t(o.parent.inlineContent?o:i,i)},t.prototype.replace=function(t,n){if(void 0===n&&(n=m.empty),e.prototype.replace.call(this,t,n),n==m.empty){var r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head},t.prototype.getBookmark=function(){return new rt(this.anchor,this.head)},t.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))},t.create=function(e,t,n){void 0===n&&(n=t);var r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))},t.between=function(n,r,i){var o=n.pos-r.pos;if(i&&!o||(i=o>=0?1:-1),!r.parent.inlineContent){var a=e.findFrom(r,i,!0)||e.findFrom(r,-i,!0);if(!a)return e.near(r,i);r=a.$head}return n.parent.inlineContent||(0==o||(n=(e.findFrom(n,-i,!0)||e.findFrom(n,i,!0)).$anchor).pos<r.pos!=o<0)&&(n=r),new t(n,r)},Object.defineProperties(t.prototype,n),t}(Je);Je.jsonID("text",nt);var rt=function(e,t){this.anchor=e,this.head=t};rt.prototype.map=function(e){return new rt(e.map(this.anchor),e.map(this.head))},rt.prototype.resolve=function(e){return nt.between(e.resolve(this.anchor),e.resolve(this.head))};var it=function(e){function t(t){var n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);e.call(this,t,r),this.node=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var i=r.mapResult(this.anchor),o=i.deleted,a=i.pos,s=n.resolve(a);return o?e.near(s):new t(s)},t.prototype.content=function(){return new m(s.from(this.node),0,0)},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor},t.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},t.prototype.getBookmark=function(){return new ot(this.anchor)},t.fromJSON=function(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))},t.create=function(e,t){return new this(e.resolve(t))},t.isSelectable=function(e){return!e.isText&&!1!==e.type.spec.selectable},t}(Je);it.prototype.visible=!1,Je.jsonID("node",it);var ot=function(e){this.anchor=e};ot.prototype.map=function(e){var t=e.mapResult(this.anchor),n=t.deleted,r=t.pos;return n?new rt(r,r):new ot(r)},ot.prototype.resolve=function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&it.isSelectable(n)?new it(t):Je.near(t)};var at=function(e){function t(t){e.call(this,t.resolve(0),t.resolve(t.content.size))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.replace=function(t,n){if(void 0===n&&(n=m.empty),n==m.empty){t.delete(0,t.doc.content.size);var r=e.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else e.prototype.replace.call(this,t,n)},t.prototype.toJSON=function(){return{type:"all"}},t.fromJSON=function(e){return new t(e)},t.prototype.map=function(e){return new t(e)},t.prototype.eq=function(e){return e instanceof t},t.prototype.getBookmark=function(){return st},t}(Je);Je.jsonID("all",at);var st={map:function(){return this},resolve:function(e){return new at(e)}};function lt(e,t,n,r,i,o){if(t.inlineContent)return nt.create(e,n);for(var a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){var s=t.child(a);if(s.isAtom){if(!o&&it.isSelectable(s))return it.create(e,n-(i<0?s.nodeSize:0))}else{var l=lt(e,s,n+i,i<0?s.childCount:0,i,o);if(l)return l}n+=s.nodeSize*i}}function ct(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i,o=e.steps[r];if(o instanceof De||o instanceof Re)e.mapping.maps[r].forEach((function(e,t,n,r){null==i&&(i=r)})),e.setSelection(Je.near(e.doc.resolve(i),n))}}var dt=function(e){function t(t){e.call(this,t.doc),this.time=Date.now(),this.curSelection=t.selection,this.curSelectionFor=0,this.storedMarks=t.storedMarks,this.updated=0,this.meta=Object.create(null)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},t.prototype.setSelection=function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},t.prototype.setStoredMarks=function(e){return this.storedMarks=e,this.updated|=2,this},t.prototype.ensureMarks=function(e){return p.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this},t.prototype.addStoredMark=function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))},t.prototype.removeStoredMark=function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},t.prototype.addStep=function(t,n){e.prototype.addStep.call(this,t,n),this.updated=-3&this.updated,this.storedMarks=null},t.prototype.setTime=function(e){return this.time=e,this},t.prototype.replaceSelection=function(e){return this.selection.replace(this,e),this},t.prototype.replaceSelectionWith=function(e,t){var n=this.selection;return!1!==t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,e),this},t.prototype.deleteSelection=function(){return this.selection.replace(this),this},t.prototype.insertText=function(e,t,n){void 0===n&&(n=t);var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(!e)return this.deleteRange(t,n);var i=this.storedMarks;if(!i){var o=this.doc.resolve(t);i=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(Je.near(this.selection.$to)),this},t.prototype.setMeta=function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this},t.prototype.getMeta=function(e){return this.meta["string"==typeof e?e:e.key]},n.isGeneric.get=function(){for(var e in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(t.prototype,n),t}(Se);function ut(e,t){return t&&e?e.bind(t):e}var pt=function(e,t,n){this.name=e,this.init=ut(t.init,n),this.apply=ut(t.apply,n)},ft=[new pt("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new pt("selection",{init:function(e,t){return e.selection||Je.atStart(t.doc)},apply:function(e){return e.selection}}),new pt("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new pt("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],mt=function(e,t){var n=this;this.schema=e,this.fields=ft.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),t&&t.forEach((function(e){if(n.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");n.plugins.push(e),n.pluginsByKey[e.key]=e,e.spec.state&&n.fields.push(new pt(e.key,e.spec.state,e))}))},ht=function(e){this.config=e},gt={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};gt.schema.get=function(){return this.config.schema},gt.plugins.get=function(){return this.config.plugins},ht.prototype.apply=function(e){return this.applyTransaction(e).state},ht.prototype.filterTransaction=function(e,t){void 0===t&&(t=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0},ht.prototype.applyTransaction=function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var i=!1,o=0;o<this.config.plugins.length;o++){var a=this.config.plugins[o];if(a.spec.appendTransaction){var s=r?r[o].n:0,l=r?r[o].state:this,c=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var d=0;d<this.config.plugins.length;d++)r.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}},ht.prototype.applyInner=function(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var t=new ht(this.config),n=this.config.fields,r=0;r<n.length;r++){var i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}for(var o=0;o<_t.length;o++)_t[o](this,e,t);return t},gt.tr.get=function(){return new dt(this)},ht.create=function(e){for(var t=new mt(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new ht(t),r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n},ht.prototype.reconfigure=function(e){for(var t=new mt(this.schema,e.plugins),n=t.fields,r=new ht(t),i=0;i<n.length;i++){var o=n[i].name;r[o]=this.hasOwnProperty(o)?this[o]:n[i].init(e,r)}return r},ht.prototype.toJSON=function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((function(e){return e.toJSON()}))),e&&"object"==typeof e)for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t},ht.fromJSON=function(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");var r=new mt(e.schema,e.plugins),i=new ht(r);return r.fields.forEach((function(r){if("doc"==r.name)i.doc=I.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=Je.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(var o in n){var a=n[o],s=a.spec.state;if(a.key==r.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(t,o))return void(i[r.name]=s.fromJSON.call(a,e,t[o],i))}i[r.name]=r.init(e,i)}})),i},ht.addApplyListener=function(e){_t.push(e)},ht.removeApplyListener=function(e){var t=_t.indexOf(e);t>-1&&_t.splice(t,1)},Object.defineProperties(ht.prototype,gt);var _t=[];var vt=function(e){this.props={},e.props&&function e(t,n,r){for(var i in t){var o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.spec=e,this.key=e.key?e.key.key:bt("plugin")};vt.prototype.getState=function(e){return e[this.key]};var Et=Object.create(null);function bt(e){return e in Et?e+"$"+ ++Et[e]:(Et[e]=0,e+"$")}var yt=function(e){void 0===e&&(e="key"),this.key=bt(e)};yt.prototype.get=function(e){return e.config.pluginsByKey[this.key]},yt.prototype.getState=function(e){return e[this.key]};var St={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Tt=/Edge\/(\d+)/.exec(navigator.userAgent),Nt=/MSIE \d/.test(navigator.userAgent),Ot=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);St.mac=/Mac/.test(navigator.platform);var Ct=St.ie=!!(Nt||Ot||Tt);St.ie_version=Nt?document.documentMode||6:Ot?+Ot[1]:Tt?+Tt[1]:null,St.gecko=!Ct&&/gecko\/(\d+)/i.test(navigator.userAgent),St.gecko_version=St.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var At=!Ct&&/Chrome\/(\d+)/.exec(navigator.userAgent);St.chrome=!!At,St.chrome_version=At&&+At[1],St.safari=!Ct&&/Apple Computer/.test(navigator.vendor),St.ios=St.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),St.android=/Android \d/.test(navigator.userAgent),St.webkit="webkitFontSmoothing"in document.documentElement.style,St.webkit_version=St.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Dt=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Rt=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},wt=null,It=function(e,t,n){var r=wt||(wt=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Mt=function(e,t,n,r){return n&&(kt(e,t,n,r,-1)||kt(e,t,n,r,1))},xt=/^(img|br|input|textarea|hr)$/i;function kt(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Lt(e))){var o=e.parentNode;if(1!=o.nodeType||Pt(e)||xt.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Dt(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?Lt(e):0}}}function Lt(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Pt(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Bt=function(e){var t=e.isCollapsed;return t&&St.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function Ut(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Ft(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function zt(e,t){return"number"==typeof e?e:e[t]}function jt(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Gt(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Rt(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Ft(o):jt(a),c=0,d=0;if(t.top<l.top+zt(r,"top")?d=-(l.top-t.top+zt(i,"top")):t.bottom>l.bottom-zt(r,"bottom")&&(d=t.bottom-l.bottom+zt(i,"bottom")),t.left<l.left+zt(r,"left")?c=-(l.left-t.left+zt(i,"left")):t.right>l.right-zt(r,"right")&&(c=t.right-l.right+zt(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function Yt(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Rt(e));return t}function Vt(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Ht=null;function qt(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=It(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=Qt(r,1);if(o.top!=o.bottom&&$t(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:qt(n,r)}function $t(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Wt(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!$t(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if($t(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(St.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(St.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=qt(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function Qt(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var Kt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Xt(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=St.webkit||St.gecko;if(3==i.nodeType){if(!a||!Kt.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,Zt(Qt(It(i,s,l),c),c<0)}var d=Qt(It(i,o,o),n);if(St.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=Qt(It(i,o-1,o-1),-1);if(u.top==d.top){var p=Qt(It(i,o,o+1),-1);if(p.top!=d.top)return Zt(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==Lt(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return Jt(f.getBoundingClientRect(),!1)}if(o<Lt(i)){var m=i.childNodes[o];if(1==m.nodeType)return Jt(m.getBoundingClientRect(),!0)}return Jt(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==Lt(i))){var h=i.childNodes[o-1],g=3==h.nodeType?It(h,Lt(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return Zt(Qt(g,1),!1)}if(o<Lt(i)){var _=i.childNodes[o],v=3==_.nodeType?It(_,0,a?0:1):1==_.nodeType?_:null;if(v)return Zt(Qt(v,-1),!0)}return Zt(Qt(3==i.nodeType?It(i):i,-n),n>=0)}function Zt(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Jt(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function en(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var tn=/[\u0590-\u08ac]/;var nn=null,rn=null,on=!1;function an(e,t,n){return nn==t&&rn==n?on:(nn=t,rn=n,on="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return en(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=Xt(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=It(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return tn.test(r.parent.textContent)&&s.modify?en(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var sn=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},ln={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};sn.prototype.matchesWidget=function(){return!1},sn.prototype.matchesMark=function(){return!1},sn.prototype.matchesNode=function(){return!1},sn.prototype.matchesHack=function(){return!1},ln.beforePosition.get=function(){return!1},sn.prototype.parseRule=function(){return null},sn.prototype.stopEvent=function(){return!1},ln.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},ln.border.get=function(){return 0},sn.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},sn.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},ln.posBefore.get=function(){return this.parent.posBeforeChild(this)},ln.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},ln.posAfter.get=function(){return this.posBefore+this.size},ln.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},sn.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>Dt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},sn.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},sn.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},sn.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},sn.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},sn.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?Dt(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},sn.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=Dt(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Dt(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},sn.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},sn.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},sn.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((St.gecko||St.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:Dt(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(r||f&&St.safari||!Mt(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Mt(u.node,u.offset,p.focusNode,p.focusOffset)){var _=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),_=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!_){if(e>t){var v=d;d=u,u=v}var E=document.createRange();E.setEnd(u.node,u.offset),E.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(E)}}},sn.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},ln.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},sn.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},sn.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},ln.domAtom.get=function(){return!1},Object.defineProperties(sn.prototype,ln);var cn=[],dn=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,cn,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(sn),un=function(e){function t(t,n,r,i){e.call(this,t,cn,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(sn),pn=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=Dn(o,n,a,r)),e>0&&(o=Dn(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(sn),fn=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?cn:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Tn(u,r,n),d?l=new _n(e,n,r,i,u,p,f,d,o,a+1):n.isText?new hn(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Nn(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Cn(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(An);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():cn;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(cn,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=On(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof pn){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=On(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),St.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=Lt(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new un(this,o,n,i);e.compositionNodes.push(a),this.children=Dn(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Nn(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=yn(this.dom,this.nodeDOM,bn(this.outerDeco,this.node,t),bn(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(sn);function mn(e,t,n,r,i){return Tn(r,t,e),new fn(null,e,t,n,r,r,r,i,0)}var hn=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(fn),gn=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(sn),_n=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(fn);function vn(e){e&&(this.nodeName=e)}vn.prototype=Object.create(null);var En=[new vn];function bn(e,t,n){if(0==e.length)return En;for(var r=n?En[0]:new vn,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new vn(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new vn(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function yn(e,t,n,r){if(n==En&&r==En)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=En[0]),i=l}Sn(i,s||En[0],a)}return i}function Sn(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):cn,a=n.class?n.class.split(" ").filter(Boolean):cn,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Tn(e,t,n){return yn(e,e,En,bn(t,n,1!=e.nodeType))}function Nn(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function On(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Cn=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function An(e,t){return e.type.side-t.type.side}function Dn(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Rn(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Bt(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==Lt(e);r||i;){if(e==n)return!0;var o=Dt(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Lt(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=Un(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function wn(e){return e.editable?e.hasFocus():Fn(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function In(e,t){var n=e.state.selection;if(Pn(e,n),wn(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Dt(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&St.ie&&St.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!Mn||n instanceof nt||(n.$from.parent.inlineContent||(r=xn(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=xn(e,n.to))),e.docView.setSelection(o,a,e.root,t),Mn&&(r&&Ln(r),i&&Ln(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){wn(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Cn.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Cn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Cn.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=pn.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Cn.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Cn.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof fn){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Nn(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Cn.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,fn.create(this.top,e,t,n,r,i)),this.changed=!0},Cn.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new dn(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Cn.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof pn;)e=e.children[e.children.length-1];if(!e||!(e instanceof hn)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new gn(this.top,cn,t,null)),this.changed=!0}};var Mn=St.safari||St.chrome&&St.chrome_version<63;function xn(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(St.safari&&o&&"false"==o.contentEditable)return kn(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return kn(o);if(a)return kn(a)}}function kn(e){return e.contentEditable="true",St.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ln(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Pn(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Bn(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Bn(e)}function Bn(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function Un(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function Fn(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function zn(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function jn(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Gn(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return jn(e,new nt(t>0?r.$to:r.$from));var i=zn(e.state,t);return!!i&&jn(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=zn(e.state,t);return!!(o&&o instanceof it)&&jn(e,o)}if(!(St.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?jn(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!St.webkit&&jn(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Yn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Vn(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Hn(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(St.gecko&&1==n.nodeType&&r<Yn(n)&&Vn(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Vn(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if($n(n))break;for(var l=n.previousSibling;l&&Vn(l);)i=n.parentNode,o=Dt(l),l=l.previousSibling;if(l)r=Yn(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Wn(e,t,n,r):i&&Wn(e,t,i,o)}}function qn(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Yn(n);;)if(r<a){if(1!=n.nodeType)break;if(!Vn(n.childNodes[r]))break;i=n,o=++r}else{if($n(n))break;for(var s=n.nextSibling;s&&Vn(s);)i=s.parentNode,o=Dt(s)+1,s=s.nextSibling;if(s)r=0,a=Yn(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Wn(e,t,i,o)}}function $n(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Wn(e,t,n,r){if(Bt(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&In(e)}),50)}function Qn(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(St.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=zn(e.state,t);if(a&&a instanceof it)return jn(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&jn(e,l)}return!1}function Kn(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Xn(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Zn(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||St.mac&&72==n&&"c"==r?Kn(e,-1)||Hn(e):46==n||St.mac&&68==n&&"c"==r?Kn(e,1)||qn(e):13==n||27==n||(37==n?Gn(e,-1,r)||Hn(e):39==n?Gn(e,1,r)||qn(e):38==n?Qn(e,-1,r)||Hn(e):40==n?function(e){if(St.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Xn(e,i,!0),setTimeout((function(){return Xn(e,i,!1)}),20)}}}(e)||Qn(e,1,r)||qn(e):r==(St.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Jn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(St.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||St.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function er(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=Rn(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Bt(c)||d.push({node:c.focusNode,offset:c.focusOffset})),St.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:Jn,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(St.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((St.ios&&e.lastIOSEnter>Date.now()-225||St.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=tr(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),St.ie&&St.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((St.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||nr(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(nr(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||nr(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(8,"Backspace"))})))St.android&&St.chrome&&e.domObserver.suppressSelectionUpdates();else{St.chrome&&St.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),St.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)St.ie&&St.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return In(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=tr(e,O.doc,p.sel);M&&!(St.chrome&&St.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||St.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function tr(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Un(e,t.resolve(n.anchor),t.resolve(n.head))}function nr(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function rr(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=cr(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=sr[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ir(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=cr().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&sr[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(ar(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(ar(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(or(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=or(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function or(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function ar(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=ar(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var sr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},lr=null;function cr(){return lr||(lr=document.implementation.createHTMLDocument("title"))}var dr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ur=St.ie&&St.ie_version<=11,pr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};pr.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},pr.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var fr=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);St.ie&&St.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new pr,ur&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};fr.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},fr.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},fr.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,dr),ur&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},fr.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}ur&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},fr.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},fr.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},fr.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},fr.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&Fn(e)){var e;if(this.suppressingSelectionUpdates)return In(this.view);if(St.ie&&St.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Mt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},fr.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},fr.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},fr.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Fn(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(St.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(mr)return;mr=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||In(this.view),this.currentSelection.set(t))}},fr.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(St.ie&&St.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?Dt(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?Dt(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var mr=!1;var hr={},gr={};function _r(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function vr(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Er(e,t)})}))}function Er(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function br(e){return{left:e.clientX,top:e.clientY}}function yr(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Sr(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Tr(e,t,n,r,i){return yr(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Sr(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Sr(e,new it(n),"pointer"),!0)}(e,n))}function Nr(e,t,n,r){return yr(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function Or(e,t,n,r){return yr(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Sr(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Sr(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Sr(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Cr(e){return xr(e)}gr.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!Rr(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!St.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||Zn(e,t)?t.preventDefault():_r(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},gr.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},gr.keypress=function(e,t){if(!(Rr(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||St.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Ar=St.mac?"metaKey":"ctrlKey";hr.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Cr(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Ar]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(br(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new Dr(e,o,t,n)):("doubleClick"==i?Nr:Or)(e,o.pos,o.inside,t)?t.preventDefault():_r(e,"pointer"))};var Dr=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Ar],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&St.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_r(e,"pointer")};function Rr(e,t){return!!e.composing||!!(St.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}Dr.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Dr.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(br(e))),this.allowDefault||!t?_r(this.view,"pointer"):Tr(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||St.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||St.chrome&&!(this.view.state.selection instanceof nt)&&(t.pos==this.view.state.selection.from||t.pos==this.view.state.selection.to)?(Sr(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):_r(this.view,"pointer")}},Dr.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),_r(this.view,"pointer"),0==e.buttons&&this.done()},hr.touchdown=function(e){Cr(e),_r(e,"pointer")},hr.contextmenu=function(e){return Cr(e)};var wr=St.android?5e3:-1;function Ir(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return xr(e)}),t))}function Mr(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function xr(e,t){if(e.domObserver.forceFlush(),Mr(e),t||e.docView.dirty){var n=Rn(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}gr.compositionstart=gr.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),xr(e,!0),e.markCursor=null;else if(xr(e),St.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}Ir(e,wr)},gr.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,Ir(e,20))};var kr=St.ie&&St.ie_version<15||St.ios&&St.webkit_version<604;function Lr(e,t,n,r){var i=ir(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}hr.copy=gr.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=kr?null:t.clipboardData,o=rr(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},gr.paste=function(e,t){var n=kr?null:t.clipboardData;n&&Lr(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lr(e,r.value,null,t):Lr(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var Pr=function(e,t){this.slice=e,this.move=t},Br=St.mac?"altKey":"ctrlKey";for(var Ur in hr.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(br(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=rr(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(kr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",kr||t.dataTransfer.setData("text/plain",c),e.dragging=new Pr(a,!t[Br])}},hr.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},gr.dragover=gr.dragenter=function(e,t){return t.preventDefault()},gr.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(br(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice||ir(e,t.dataTransfer.getData(kr?"Text":"text/plain"),kr?null:t.dataTransfer.getData("text/html"),!1,i),a=n&&!t[Br];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(Un(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},hr.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&In(e)}),20))},hr.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},hr.beforeinput=function(e,t){if(St.chrome&&St.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,Ut(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},gr)hr[Ur]=gr[Ur];function Fr(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var zr=function(e,t){this.spec=t||qr,this.side=this.spec.side||0,this.toDOM=e};zr.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Yr(o-n,o-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(e){return this==e||e instanceof zr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fr(this.spec,e.spec))};var jr=function(e,t){this.spec=t||qr,this.attrs=e};jr.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Yr(i,o,this)},jr.prototype.valid=function(e,t){return t.from<t.to},jr.prototype.eq=function(e){return this==e||e instanceof jr&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)},jr.is=function(e){return e.type instanceof jr};var Gr=function(e,t){this.spec=t||qr,this.attrs=e};Gr.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Yr(i.pos-n,o.pos-n,this)},Gr.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},Gr.prototype.eq=function(e){return this==e||e instanceof Gr&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)};var Yr=function(e,t,n){this.from=e,this.to=t,this.type=n},Vr={spec:{configurable:!0},inline:{configurable:!0}};Yr.prototype.copy=function(e,t){return new Yr(e,t,this.type)},Yr.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Yr.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Yr.widget=function(e,t,n){return new Yr(e,e,new zr(t,n))},Yr.inline=function(e,t,n,r){return new Yr(e,t,new jr(n,r))},Yr.node=function(e,t,n,r){return new Yr(e,t,new Gr(n,r))},Vr.spec.get=function(){return this.type.spec},Vr.inline.get=function(){return this.type instanceof jr},Object.defineProperties(Yr.prototype,Vr);var Hr=[],qr={},$r=function(e,t){this.local=e&&e.length?e:Hr,this.children=t&&t.length?t:Hr};$r.create=function(e,t){return t.length?Jr(t,e,0,qr):Wr},$r.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},$r.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},$r.prototype.map=function(e,t,n){return this==Wr||0==e.maps.length?this:this.mapInner(e,t,0,0,n||qr)},$r.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Wr?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=Jr(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new $r(t&&t.sort(ei),s)}(this.children,o,e,t,n,r,i):o?new $r(o.sort(ei)):Wr},$r.prototype.add=function(e,t){return t.length?this==Wr?$r.create(e,t):this.addInner(e,t,0):this},$r.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=Xr(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,Jr(s,e,l+1,qr)),o+=3}}));for(var a=Kr(o?Zr(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new $r(a.length?this.local.concat(a).sort(ei):this.local,r||this.children)},$r.prototype.remove=function(e){return 0==e.length||this==Wr?this:this.removeInner(e,0)},$r.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Wr?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $r(r,n):Wr},$r.prototype.forChild=function(e,t){if(this==Wr)return this;if(t.isLeaf)return $r.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof jr){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new $r(r.sort(ei));return n?new Qr([u,n]):u}return n||Wr},$r.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof $r)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},$r.prototype.locals=function(e){return ti(this.localsInner(e))},$r.prototype.localsInner=function(e){if(this==Wr)return Hr;if(e.inlineContent||!this.local.some(jr.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof jr||t.push(this.local[n]);return t};var Wr=new $r;$r.empty=Wr,$r.removeOverlap=ti;var Qr=function(e){this.members=e};function Kr(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Yr(i.from+t,i.to+t,i.type))}return n}function Xr(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function Zr(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Jr(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=Xr(e,t,a+n);if(s){o=!0;var l=Jr(s,t,n+a+1,r);l!=Wr&&i.push(a,a+t.nodeSize,l)}}));for(var a=Kr(o?Zr(e):e,-n).sort(ei),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new $r(a,i):Wr}function ei(e,t){return e.from-t.from||e.to-t.to}function ti(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),ni(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),ni(t,i+1,o.copy(r.to,o.to)))}}return t}function ni(e,t,n){for(;t<e.length&&ei(n,e[t])>0;)t++;e.splice(t,0,n)}function ri(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Wr&&t.push(r)})),e.cursorWrapper&&t.push($r.create(e.state.doc,[e.cursorWrapper.deco])),Qr.from(t)}Qr.prototype.forChild=function(e,t){if(t.isLeaf)return $r.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Wr&&(i instanceof Qr?n=n.concat(i.members):n.push(i))}return Qr.from(n)},Qr.prototype.eq=function(e){if(!(e instanceof Qr)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},Qr.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ti(n?t:t.sort(ei)):Hr},Qr.from=function(e){switch(e.length){case 0:return Wr;case 1:return e[0];default:return new Qr(e)}};var ii=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=li(this),this.markCursor=null,this.cursorWrapper=null,si(this),this.nodeViews=ci(this),this.docView=mn(this.state.doc,ai(this),ri(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new fr(e,(function(t,n,r,i){return er(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=hr[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Er(e,t)||!e.editable&&t.type in gr||n(e,t)})};for(var n in hr)t(n);St.safari&&e.dom.addEventListener("input",(function(){return null})),vr(e)}(this),this.pluginViews=[],this.updatePluginViews()},oi={props:{configurable:!0},root:{configurable:!0}};function ai(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Yr.node(0,e.state.doc.content.size,t)]}function si(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Yr.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function li(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function ci(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}oi.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},ii.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vr(this),this._props=e,this.updateStateInner(e.state,!0)},ii.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},ii.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},ii.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(Mr(this),o=!0),this.state=e,t){var a=ci(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),vr(this)}this.editable=li(this),si(this);var s=ri(this),l=ai(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:Yt(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(St.ie||St.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=St.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=mn(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Mt(p.node,p.offset,f.anchorNode,f.anchorOffset)))?In(this,T):(Pn(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Gt(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Gt(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,Vt(b,0==y?0:y-E))},ii.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},ii.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},ii.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},ii.prototype.hasFocus=function(){return this.root.activeElement==this.dom},ii.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Ht)return e.focus(Ht);var t=Yt(e);e.focus(null==Ht?{get preventScroll(){return Ht={preventScroll:!0},!0}}:void 0),Ht||(Ht=!1,Vt(t,0))}(this.dom),In(this),this.domObserver.start()},oi.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},ii.prototype.posAtCoords=function(e){return Wt(this,e)},ii.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),Xt(this,e,t)},ii.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},ii.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},ii.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},ii.prototype.endOfTextblock=function(e,t){return an(this,t||this.state,e)},ii.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},ii.prototype.dispatchEvent=function(e){return function(e,t){Er(e,t)||!hr[t.type]||!e.editable&&t.type in gr||hr[t.type](e,t)}(this,e)},ii.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(ii.prototype,oi);for(var di={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},ui={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},pi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),fi="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),mi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),hi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),gi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),_i=pi&&(hi||+pi[1]<57)||mi&&hi,vi=0;vi<10;vi++)di[48+vi]=di[96+vi]=String(vi);for(vi=1;vi<=24;vi++)di[vi+111]="F"+vi;for(vi=65;vi<=90;vi++)di[vi]=String.fromCharCode(vi+32),ui[vi]=String.fromCharCode(vi);for(var Ei in di)ui.hasOwnProperty(Ei)||(ui[Ei]=di[Ei]);var bi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function yi(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(var s=0;s<o.length-1;s++){var l=o[s];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);bi?i=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),i&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function Si(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}function Ti(e){var t=function(e){var t=Object.create(null);for(var n in e)t[yi(n)]=e[n];return t}(e);return function(e,n){var r,i=function(e){var t=!(_i&&(e.ctrlKey||e.altKey||e.metaKey)||(fi||gi)&&e.shiftKey&&e.key&&1==e.key.length)&&e.key||(e.shiftKey?ui:di)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),o=1==i.length&&" "!=i,a=t[Si(i,n,!o)];if(a&&a(e.state,e.dispatch,e))return!0;if(o&&(n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(r=di[n.keyCode])&&r!=i){var s=t[Si(r,n,!0)];if(s&&s(e.state,e.dispatch,e))return!0}else if(o&&n.shiftKey){var l=t[Si(i,n,!0)];if(l&&l(e.state,e.dispatch,e))return!0}return!1}}var Ni=function(e,t){var n;this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,i){var o=n;if(t[1]){var a=t[0].lastIndexOf(t[1]);o+=t[0].slice(a+t[1].length);var s=(r+=a)-i;s>0&&(o=t[0].slice(a-s,a)+o,r=i)}return e.tr.insertText(o,r,i)}):t};function Oi(e,t,n,r,i,o){if(e.composing)return!1;var a=e.state,s=a.doc.resolve(t);if(s.parent.type.spec.code)return!1;for(var l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<i.length;c++){var d=i[c].match.exec(l),u=d&&i[c].handler(a,d,t-(d[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(o,{transform:u,from:t,to:n,text:r})),!0}return!1}var Ci=new Ni(/--$/,"—"),Ai=new Ni(/\.\.\.$/,"…"),Di=new Ni(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Ri=new Ni(/"$/,"”"),wi=new Ni(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Ii=new Ni(/'$/,"’");function Mi(e,t,n,r){return new Ni(e,(function(e,i,o,a){var s=n instanceof Function?n(i):n,l=e.tr.delete(o,a),c=l.doc.resolve(o).blockRange(),d=c&&xe(c,t,s);if(!d)return null;l.wrap(c,d);var u=l.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&Pe(l.doc,o-1)&&(!r||r(i,u))&&l.join(o-1),l}))}function xi(e,t,n){return new Ni(e,(function(e,r,i,o){var a=e.doc.resolve(i),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,s):null}))}function ki(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}function Li(e,t,n){var r=e.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",e):r.parentOffset>0))return!1;var i=Ui(r);if(!i){var o=r.blockRange(),a=o&&Me(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}var s=i.nodeBefore;if(!s.type.spec.isolating&&Ki(e,i,t))return!0;if(0==r.parent.content.size&&(Pi(s,"end")||it.isSelectable(s))){if(t){var l=e.tr.deleteRange(r.before(),r.after());l.setSelection(Pi(s,"end")?Je.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):it.create(l.doc,i.pos-s.nodeSize)),t(l.scrollIntoView())}return!0}return!(!s.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0)}function Pi(e,t){for(;e;e="start"==t?e.firstChild:e.lastChild)if(e.isTextblock)return!0;return!1}function Bi(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):i.parentOffset>0)return!1;o=Ui(i)}var a=o&&o.nodeBefore;return!(!a||!it.isSelectable(a))&&(t&&t(e.tr.setSelection(it.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)}function Ui(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Fi(e,t,n){var r=e.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size))return!1;var i=ji(r);if(!i)return!1;var o=i.nodeAfter;if(Ki(e,i,t))return!0;if(0==r.parent.content.size&&(Pi(o,"start")||it.isSelectable(o))){if(t){var a=e.tr.deleteRange(r.before(),r.after());a.setSelection(Pi(o,"start")?Je.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):it.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)}function zi(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):i.parentOffset<i.parent.content.size)return!1;o=ji(i)}var a=o&&o.nodeAfter;return!(!a||!it.isSelectable(a))&&(t&&t(e.tr.setSelection(it.create(e.doc,o.pos)).scrollIntoView()),!0)}function ji(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function Gi(e,t){var n=e.selection,r=n.$from,i=n.$to,o=r.blockRange(i),a=o&&Me(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}function Yi(e,t){var n=e.selection,r=n.$head,i=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(i))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)}function Vi(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Hi(e,t){var n=e.selection,r=n.$head,i=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(i))return!1;var o=r.node(-1),a=r.indexAfter(-1),s=Vi(o.contentMatchAt(a));if(!o.canReplaceWith(a,a,s))return!1;if(t){var l=r.after(),c=e.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Je.near(c.doc.resolve(l),1)),t(c.scrollIntoView())}return!0}function qi(e,t){var n=e.selection,r=n.$from,i=n.$to;if(n instanceof at||r.parent.inlineContent||i.parent.inlineContent)return!1;var o=Vi(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){var a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(a,o.createAndFill());s.setSelection(nt.create(s.doc,a+1)),t(s.scrollIntoView())}return!0}function $i(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(Le(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}var i=n.blockRange(),o=i&&Me(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)}function Wi(e,t){var n=e.selection,r=n.$from,i=n.$to;if(e.selection instanceof it&&e.selection.node.isBlock)return!(!r.parentOffset||!Le(e.doc,r.pos))&&(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(t){var o=i.parentOffset==i.parent.content.size,a=e.tr;(e.selection instanceof nt||e.selection instanceof at)&&a.deleteSelection();var l=0==r.depth?null:Vi(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=o&&l?[{type:l}]:null,d=Le(a.doc,a.mapping.map(r.pos),1,c);c||d||!Le(a.doc,a.mapping.map(r.pos),1,l&&[{type:l}])||(c=[{type:l}],d=!0),d&&(a.split(a.mapping.map(r.pos),1,c),o||r.parentOffset||r.parent.type==l||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from([l.create(),r.parent]))||a.setNodeMarkup(a.mapping.map(r.before()),l)),t(a.scrollIntoView())}return!0}function Qi(e,t){return t&&t(e.tr.setSelection(new at(e.doc))),!0}function Ki(e,t,n){var r,i,o=t.nodeBefore,a=t.nodeAfter;if(o.type.spec.isolating||a.type.spec.isolating)return!1;if(function(e,t,n){var r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!!(r&&i&&r.type.compatibleContent(i.type))&&(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!(!t.parent.canReplace(o,o+1)||!i.isTextblock&&!Pe(e.doc,t.pos))&&(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0))}(e,t,n))return!0;var l=t.parent.canReplace(t.index(),t.index()+1);if(l&&(r=(i=o.contentMatchAt(o.childCount)).findWrapping(a.type))&&i.matchType(r[0]||a.type).validEnd){if(n){for(var c=t.pos+a.nodeSize,d=s.empty,u=r.length-1;u>=0;u--)d=s.from(r[u].create(null,d));d=s.from(o.copy(d));var p=e.tr.step(new Re(t.pos-1,c,t.pos,c,new m(d,1,0),r.length,!0)),f=c+2*r.length;Pe(p.doc,f)&&p.join(f),n(p.scrollIntoView())}return!0}var h=Je.findFrom(t,1),g=h&&h.$from.blockRange(h.$to),_=g&&Me(g);if(null!=_&&_>=t.depth)return n&&n(e.tr.lift(g,_).scrollIntoView()),!0;if(l&&a.isTextblock&&Pi(o,"end")){for(var v=o,E=[];E.push(v),!v.isTextblock;)v=v.lastChild;if(v.canReplace(v.childCount,v.childCount,a.content)){if(n){for(var b=s.empty,y=E.length-1;y>=0;y--)b=s.from(E[y].copy(b));n(e.tr.step(new Re(t.pos-E.length,t.pos+a.nodeSize,t.pos+1,t.pos+a.nodeSize-1,new m(b,E.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Xi(e,t){return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a),l=s&&xe(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}function Zi(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(t,n,r){for(var i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var Ji=Zi(ki,Li,Bi),eo=Zi(ki,Fi,zi),to={Enter:Zi(Yi,qi,$i,Wi),"Mod-Enter":Hi,Backspace:Ji,"Mod-Backspace":Ji,Delete:eo,"Mod-Delete":eo,"Mod-a":Qi},no={"Ctrl-h":to.Backspace,"Alt-Backspace":to["Mod-Backspace"],"Ctrl-d":to.Delete,"Ctrl-Alt-Backspace":to["Mod-Delete"],"Alt-Delete":to["Mod-Delete"],"Alt-d":to["Mod-Delete"]};for(var ro in to)no[ro]=to[ro];"undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&os.platform();function io(e,t){return function(n,r){var i=n.selection,o=i.$from,a=i.$to,l=o.blockRange(a),c=!1,d=l;if(!l)return!1;if(l.depth>=2&&o.node(l.depth-1).type.compatibleContent(e)&&0==l.startIndex){if(0==o.index(l.depth-1))return!1;var u=n.doc.resolve(l.start-2);d=new D(u,u,l.depth),l.endIndex<l.parent.childCount&&(l=new D(o,n.doc.resolve(a.end(l.depth)),l.depth)),c=!0}var p=xe(d,e,t,l);return!!p&&(r&&r(function(e,t,n,r,i){for(var o=s.empty,a=n.length-1;a>=0;a--)o=s.from(n[a].type.create(n[a].attrs,o));e.step(new Re(t.start-(r?2:0),t.end,t.start,t.end,new m(o,0,0),n.length,!0));for(var l=0,c=0;c<n.length;c++)n[c].type==i&&(l=c+1);for(var d=n.length-l,u=t.start+n.length-(r?2:0),p=t.parent,f=t.startIndex,h=t.endIndex,g=!0;f<h;f++,g=!1)!g&&Le(e.doc,u,d)&&(e.split(u,d),u+=2*d),u+=p.child(f).nodeSize;return e}(n.tr,l,p,c,e).scrollIntoView()),!0)}}function oo(e){return function(t,n){var r=t.selection,i=r.$from,o=r.$to,a=i.blockRange(o,(function(t){return t.childCount&&t.firstChild.type==e}));return!!a&&(!n||(i.node(a.depth-1).type==e?function(e,t,n,r){var i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Re(o-1,a,o,a,new m(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new D(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));return t(i.lift(r,Me(r)).scrollIntoView()),!0}(t,n,e,a):function(e,t,n){for(var r=e.tr,i=n.parent,o=n.end,a=n.endIndex-1,l=n.startIndex;a>l;a--)o-=i.child(a).nodeSize,r.delete(o-1,o+1);var c=r.doc.resolve(n.start),d=c.nodeAfter,u=0==n.startIndex,p=n.endIndex==i.childCount,f=c.node(-1),h=c.index(-1);if(!f.canReplace(h+(u?0:1),h+1,d.content.append(p?s.empty:s.from(i))))return!1;var g=c.pos,_=g+d.nodeSize;return r.step(new Re(g-(u?1:0),_+(p?1:0),g+1,_-1,new m((u?s.empty:s.from(i.copy(s.empty))).append(p?s.empty:s.from(i.copy(s.empty))),u?0:1,p?0:1),u?0:1)),t(r.scrollIntoView()),!0}(t,n,a)))}}function ao(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function so(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function lo(e,t){const n=so(t,e.schema),{from:r,to:i}=e.selection;let o=[];e.doc.nodesBetween(r,i,e=>{o=[...o,e]});const a=o.reverse().find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function co(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function uo(e,t){const n=co(t,e.schema),{from:r,to:i,empty:o}=e.selection;let a=[];o?a=e.selection.$head.marks():e.doc.nodesBetween(r,i,e=>{a=[...a,...e.marks]});const s=a.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function po(e,t){const n=Object.keys(t);return!n.length||!!n.filter(n=>t[n]===e[n]).length}function fo(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?so(t,e.schema):null;let s=[];if(e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText){const n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s=[...s,{node:e,from:n,to:o}]}}),o)return!!s.filter(e=>!a||a.name===e.node.type.name).find(e=>po(e.node.attrs,n));const l=i-r;return s.filter(e=>!a||a.name===e.node.type.name).filter(e=>po(e.node.attrs,n)).reduce((e,t)=>e+(t.to-t.from),0)>=l}function mo(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?co(t,e.schema):null;if(o)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>po(e.attrs,n));let s=0,l=[];if(e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText){const n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s+=o-n,l=[...l,...e.marks.map(e=>({mark:e,from:n,to:o}))]}}),0===s)return!1;return l.filter(e=>!a||a.name===e.mark.type.name).filter(e=>po(e.mark.attrs,n)).reduce((e,t)=>e+(t.to-t.from),0)>=s}function ho(e){return(new window.DOMParser).parseFromString(e,"text/html").body}function go(e,t,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof e&&null!==e)try{return Array.isArray(e)?s.fromArray(e.map(e=>t.nodeFromJSON(e))):t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),go("",t,n)}if("string"==typeof e){const r=ne.fromSchema(t);return n.slice?r.parseSlice(ho(e),n.parseOptions).content:r.parse(ho(e),n.parseOptions)}return go("",t,n)}function _o(e,t,n={}){return go(e,t,{slice:!1,parseOptions:n})}function vo(e,t){const n=fe.fromSchema(t).serializeFragment(e.content),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}class Eo{constructor(e,t){this.editor=e,this.commands=t}createCommands(){const{commands:e,editor:t}=this,{state:n,view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(o);return i.getMeta("preventDispatch")||r.dispatch(i),n}]))}createChain(e,t=!0){const{commands:n,editor:r}=this,{state:i,view:o}=r,a=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),i=n(...e)(r);return a.push(i),c}])),run:()=>(s||!t||l.getMeta("preventDispatch")||o.dispatch(l),a.every(e=>!0===e))};return c}createCan(e){const{commands:t,editor:n}=this,{state:r}=n,i=e||r.tr,o=this.buildProps(i,void 0);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,void 0)}}buildProps(e,t=!0){const{editor:n,commands:r}=this,{state:i,view:o}=n;i.storedMarks&&e.setStoredMarks(i.storedMarks);const a={tr:e,editor:n,view:o,state:this.chainableState(e,i),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,(...e)=>t(...e)(a)]))}};return a}chainableState(e,t){let{selection:n}=e,{doc:r}=e,{storedMarks:i}=e;return{...t,schema:t.schema,plugins:t.plugins,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return n},get doc(){return r},get tr(){return n=e.selection,r=e.doc,i=e.storedMarks,e}}}}function bo(e,t,n={}){if(void 0===e.config[t]&&e.parent)return bo(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?bo(e.parent,t,n):null})}return e.config[t]}function yo(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function So(e){const t=[],{nodeExtensions:n,markExtensions:r}=yo(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return e.forEach(e=>{const n=bo(e,"addGlobalAttributes",{name:e.name,options:e.options});if(!n)return;n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{const n={name:e.name,options:e.options},r=bo(e,"addAttributes",n);if(!r)return;const i=r();Object.entries(i).forEach(([n,r])=>{t.push({type:e.name,name:n,attribute:{...o,...r}})})}),t}function To(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{n[e]?n[e]="class"===e?[n[e],t].join(" "):"style"===e?[n[e],t].join("; "):t:n[e]=t}),n},{})}function No(e,t){return t.filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>To(e,t),{})}function Oo(e,t){return e.style?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const i=t.filter(e=>e.attribute.rendered).reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n)||{}:{[t.name]:(i=n.getAttribute(t.name),"string"!=typeof i?i:i.match(/^\d*(\.\d+)?$/)?Number(i):"true"===i||"false"!==i&&i)};var i;return{...e,...Object.fromEntries(Object.entries(r).filter(([,e])=>null!=e))}},{});return{...r,...i}}}}function Co(e,t,...n){return"function"==typeof e?t?e.bind(t)(...n):e(...n):e}function Ao(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Do(e){var t;const n=So(e),{nodeExtensions:r,markExtensions:i}=yo(e),o=null===(t=r.find(e=>bo(e,"topNode")))||void 0===t?void 0:t.name,a=Object.fromEntries(r.map(t=>{const r=n.filter(e=>e.type===t.name),i={name:t.name,options:t.options},o=Ao({...e.reduce((e,n)=>{const r=bo(n,"extendNodeSchema",i);return{...e,...r?r(t):{}}},{}),content:Co(bo(t,"content",i)),marks:Co(bo(t,"marks",i)),group:Co(bo(t,"group",i)),inline:Co(bo(t,"inline",i)),atom:Co(bo(t,"atom",i)),selectable:Co(bo(t,"selectable",i)),draggable:Co(bo(t,"draggable",i)),code:Co(bo(t,"code",i)),defining:Co(bo(t,"defining",i)),isolating:Co(bo(t,"isolating",i)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),a=Co(bo(t,"parseHTML",i));a&&(o.parseDOM=a.map(e=>Oo(e,r)));const s=bo(t,"renderHTML",i);return s&&(o.toDOM=e=>s({node:e,HTMLAttributes:No(e,r)})),[t.name,o]})),s=Object.fromEntries(i.map(t=>{const r=n.filter(e=>e.type===t.name),i={name:t.name,options:t.options},o=Ao({...e.reduce((e,n)=>{const r=bo(n,"extendMarkSchema",i);return{...e,...r?r(t):{}}},{}),inclusive:Co(bo(t,"inclusive",i)),excludes:Co(bo(t,"excludes",i)),group:Co(bo(t,"group",i)),spanning:Co(bo(t,"spanning",i)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),a=Co(bo(t,"parseHTML",i));a&&(o.parseDOM=a.map(e=>Oo(e,r)));const s=bo(t,"renderHTML",i);return s&&(o.toDOM=e=>s({mark:e,HTMLAttributes:No(e,r)})),[t.name,o]}));return new ee({topNode:o,nodes:a,marks:s})}function Ro(e,t){return t.nodes[e]?t.nodes[e]:t.marks[e]?t.marks[e]:null}class wo{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=wo.resolve(e),this.schema=Do(this.extensions),this.extensions.forEach(e=>{var t;const n={name:e.name,options:e.options,editor:this.editor,type:Ro(e.name,this.schema)};if("mark"===e.type){(null===(t=Co(bo(e,"keepOnSplit",n)))||void 0===t||t)&&this.splittableMarks.push(e.name)}const r=bo(e,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const i=bo(e,"onCreate",n);i&&this.editor.on("create",i);const o=bo(e,"onUpdate",n);o&&this.editor.on("update",o);const a=bo(e,"onSelectionUpdate",n);a&&this.editor.on("selectionUpdate",a);const s=bo(e,"onTransaction",n);s&&this.editor.on("transaction",s);const l=bo(e,"onFocus",n);l&&this.editor.on("focus",l);const c=bo(e,"onBlur",n);c&&this.editor.on("blur",c);const d=bo(e,"onDestroy",n);d&&this.editor.on("destroy",d)})}static resolve(e){return wo.sort(wo.flatten(e))}static flatten(e){return e.map(e=>{const t=bo(e,"addExtensions",{name:e.name,options:e.options});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{const n=bo(e,"priority")||100,r=bo(t,"priority")||100;return n>r?-1:n<r?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const n=bo(t,"addCommands",{name:t.name,options:t.options,editor:this.editor,type:Ro(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){return[...this.extensions].reverse().map(e=>{const t={name:e.name,options:e.options,editor:this.editor,type:Ro(e.name,this.schema)},n=[],r=bo(e,"addKeyboardShortcuts",t);if(r){const e=function(e){return new vt({props:{handleKeyDown:Ti(e)}})}(Object.fromEntries(Object.entries(r()).map(([e,t])=>[e,()=>t({editor:this.editor})])));n.push(e)}const i=bo(e,"addInputRules",t);if(this.editor.options.enableInputRules&&i){const e=i(),t=e.length?[(o={rules:e},a=o.rules,s=new vt({state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,t,n,r){return Oi(e,t,n,r,a,s)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var t=e.state.selection.$cursor;t&&Oi(e,t.pos,t.pos,"",a,s)}))}}},isInputRules:!0}),s)]:[];n.push(...t)}var o,a,s;const l=bo(e,"addPasteRules",t);if(this.editor.options.enablePasteRules&&l){const e=l();n.push(...e)}const c=bo(e,"addProseMirrorPlugins",t);if(c){const e=c();n.push(...e)}return n}).flat()}get attributes(){return So(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=yo(this.extensions);return Object.fromEntries(t.filter(e=>!!bo(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,editor:e,type:so(t.name,this.schema)},i=bo(t,"addNodeView",r);if(!i)return[];return[t.name,(r,o,a,s)=>{const l=No(r,n);return i()({editor:e,node:r,getPos:a,decorations:s,HTMLAttributes:l,extension:t})}]}))}get textSerializers(){const{editor:e}=this,{nodeExtensions:t}=yo(this.extensions);return Object.fromEntries(t.filter(e=>!!bo(e,"renderText")).map(t=>{const n=bo(t,"renderText",{name:t.name,options:t.options,editor:e,type:so(t.name,this.schema)});if(!n)return[];return[t.name,e=>n(e)]}))}}function Io(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Mo(e,t){const n={...e};return Io(e)&&Io(t)&&Object.keys(t).forEach(r=>{Io(t[r])?r in e?n[r]=Mo(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}class xo{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new xo(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new xo(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}const ko=xo.create({name:"editable",addProseMirrorPlugins(){return[new vt({key:new yt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{from:t,to:n}=e.state.selection;return((e,t,n,r,i)=>{let o="",a=!0;return e.state.doc.nodesBetween(t,n,(s,l)=>{var c;const d=e.extensionManager.textSerializers[s.type.name];d?(o+=d({node:s}),a=!r):s.isText?(o+=null===(c=null==s?void 0:s.text)||void 0===c?void 0:c.slice(Math.max(t,l)-l,n-l),a=!r):s.isLeaf&&i?(o+=i,a=!r):!a&&s.isBlock&&(o+=r,a=!0)},0),o})(e,t,n,"\n")}}})]}});var Lo=Object.freeze({__proto__:null,blur:()=>({view:e})=>(e.dom.blur(),!0)});var Po=Object.freeze({__proto__:null,clearContent:(e=!1)=>({commands:t})=>t.setContent("",e)});var Bo=Object.freeze({__proto__:null,clearNodes:()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return i.forEach(r=>{e.doc.nodesBetween(r.$from.pos,r.$to.pos,(r,i)=>{if(!r.type.isText){const o=t.doc.resolve(t.mapping.map(i+1)),a=t.doc.resolve(t.mapping.map(i+r.nodeSize-1)),s=o.blockRange(a);if(s){const i=Me(s);r.type.isTextblock&&n&&t.setNodeMarkup(s.start,e.doc.type.contentMatch.defaultType),(i||0===i)&&n&&t.lift(s,i)}}})}),!0}});var Uo=Object.freeze({__proto__:null,command:e=>t=>e(t)});var Fo=Object.freeze({__proto__:null,createParagraphNear:()=>({state:e,dispatch:t})=>qi(e,t)});var zo=Object.freeze({__proto__:null,deleteRange:e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0}});var jo=Object.freeze({__proto__:null,deleteSelection:()=>({state:e,dispatch:t})=>ki(e,t)});var Go=Object.freeze({__proto__:null,enter:()=>({commands:e})=>e.keyboardShortcut("Enter")});var Yo=Object.freeze({__proto__:null,exitCode:()=>({state:e,dispatch:t})=>Hi(e,t)});function Vo(e,t){if(!e||!t)return;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const r=n.node.marks.find(e=>e.type===t);if(!r)return;let i=e.index(),o=e.start()+n.offset,a=i+1,s=o+n.node.nodeSize;for(;i>0&&r.isInSet(e.parent.child(i-1).marks);)i-=1,o-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&r.isInSet(e.parent.child(a).marks);)s+=e.parent.child(a).nodeSize,a+=1;return{from:o,to:s}}var Ho=Object.freeze({__proto__:null,extendMarkRange:e=>({tr:t,state:n,dispatch:r})=>{const i=co(e,n.schema),{doc:o,selection:a}=t,{$from:s,empty:l}=a;if(l&&r){const e=Vo(s,i);if(e){const n=nt.create(o,e.from,e.to);t.setSelection(n)}}return!0}});var qo=Object.freeze({__proto__:null,first:e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1}});function $o(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Wo(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!function(e){var t;return"class"===(null===(t=e.constructor)||void 0===t?void 0:t.toString().substring(0,5))}(e)}var Qo=Object.freeze({__proto__:null,focus:(e=null)=>({editor:t,view:n,tr:r,dispatch:i})=>{if(n.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!(Wo(o=t.state.selection)&&o instanceof nt))return n.focus(),!0;var o;const{from:a,to:s}=function(e,t=null){if(!t)return null;if("start"===t||!0===t)return{from:0,to:0};if("end"===t){const{size:t}=e.doc.content;return{from:t,to:t}}return{from:t,to:t}}(t.state,e)||t.state.selection,{doc:l,storedMarks:c}=r,d=$o(a,0,l.content.size),u=$o(s,0,l.content.size),p=nt.create(l,d,u),f=t.state.selection.eq(p);return i&&(r.setSelection(p),f&&c&&r.setStoredMarks(c),n.focus()),!0}});var Ko=Object.freeze({__proto__:null,insertContent:e=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},e)});var Xo=Object.freeze({__proto__:null,insertContentAt:(e,t)=>({tr:n,dispatch:r,editor:i})=>{if(r){const r=go(t,i.schema);n.replaceWith(e.from,e.to,r),function(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof De||i instanceof Re))return;const o=e.mapping.maps[r];let a=0;o.forEach((e,t,n,r)=>{0===a&&(a=r)}),e.setSelection(Je.near(e.doc.resolve(a),n))}(n,n.steps.length-1,1)}return!0}});var Zo=Object.freeze({__proto__:null,joinBackward:()=>({state:e,dispatch:t})=>Li(e,t)});var Jo=Object.freeze({__proto__:null,joinForward:()=>({state:e,dispatch:t})=>Fi(e,t)});const ea="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);var ta=Object.freeze({__proto__:null,keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:i})=>{const o=function(e){const t=e.split(/-(?!$)/);let n,r,i,o,a=t[t.length-1];"Space"===a&&(a=" ");for(let e=0;e<t.length-1;e+=1){const a=t[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);ea?o=!0:r=!0}}return n&&(a="Alt-"+a),r&&(a="Ctrl-"+a),o&&(a="Meta-"+a),i&&(a="Shift-"+a),a}(e).split(/-(?!$)/),a=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),s=new KeyboardEvent("keydown",{key:"Space"===a?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,s))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0}});var na=Object.freeze({__proto__:null,lift:(e,t={})=>({state:n,dispatch:r})=>!!fo(n,so(e,n.schema),t)&&Gi(n,r)});var ra=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:e,dispatch:t})=>$i(e,t)});var ia=Object.freeze({__proto__:null,liftListItem:e=>({state:t,dispatch:n})=>oo(so(e,t.schema))(t,n)});var oa=Object.freeze({__proto__:null,newlineInCode:()=>({state:e,dispatch:t})=>Yi(e,t)});var aa=Object.freeze({__proto__:null,replace:(e,t={})=>({state:n,commands:r})=>{console.warn("[tiptap warn]: replace() is deprecated. please use insertContent() instead.");const{from:i,to:o}=n.selection,a={from:i,to:o};return r.replaceRange(a,e,t)}});var sa=Object.freeze({__proto__:null,replaceRange:(e,t,n={})=>({tr:r,state:i,dispatch:o})=>{console.warn("[tiptap warn]: replaceRange() is deprecated. please use insertContent() instead.");const a=so(t,i.schema),{from:s,to:l}=e;return o&&r.replaceRangeWith(s,l,a.create(n)),!0}});function la(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ca=Object.freeze({__proto__:null,resetAttributes:(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=ao("string"==typeof e?e:e.name,r.schema);return!!s&&("node"===s&&(o=so(e,r.schema)),"mark"===s&&(a=co(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,la(e.attrs,t)),a&&e.marks.length&&e.marks.forEach(i=>{a===i.type&&n.addMark(r,r+e.nodeSize,a.create(la(i.attrs,t)))})})}),!0)}});var da=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0)});var ua=Object.freeze({__proto__:null,selectAll:()=>({state:e,dispatch:t})=>Qi(e,t)});var pa=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:e,dispatch:t})=>Bi(e,t)});var fa=Object.freeze({__proto__:null,selectNodeForward:()=>({state:e,dispatch:t})=>zi(e,t)});var ma=Object.freeze({__proto__:null,selectParentNode:()=>({state:e,dispatch:t})=>function(e,t){var n,r=e.selection,i=r.$from,o=r.to,a=i.sharedDepth(o);return 0!=a&&(n=i.before(a),t&&t(e.tr.setSelection(it.create(e.doc,n))),!0)}(e,t)});var ha=Object.freeze({__proto__:null,setContent:(e,t=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,s=_o(e,i.schema,n),l=nt.create(a,0,a.content.size);return o&&r.setSelection(l).replaceSelectionWith(s,!1).setMeta("preventUpdate",!t),!0}});var ga=Object.freeze({__proto__:null,setMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:a,ranges:s}=o,l=co(e,r.schema);if(i)if(a){const e=uo(r,l);n.addStoredMark(l.create({...e,...t}))}else s.forEach(e=>{const i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{const a=Math.max(r,i),s=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(a,s,l.create({...e.attrs,...t}))}):n.addMark(a,s,l.create(t))})});return!0}});var _a=Object.freeze({__proto__:null,setNode:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return(o=i,a=t,function(e,t){var n=e.selection,r=n.from,i=n.to,s=!1;return e.doc.nodesBetween(r,i,(function(t,n){if(s)return!1;if(t.isTextblock&&!t.hasMarkup(o,a))if(t.type==o)s=!0;else{var r=e.doc.resolve(n),i=r.index();s=r.parent.canReplaceWith(i,i+1,o)}})),!!s&&(t&&t(e.tr.setBlockType(r,i,o,a).scrollIntoView()),!0)})(n,r);var o,a}});var va=Object.freeze({__proto__:null,setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=$o(e,0,n.content.size),i=it.create(n,r);t.setSelection(i)}return!0}});var Ea=Object.freeze({__proto__:null,setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=$o(e.from,0,n.content.size),i=$o(e.to,0,n.content.size),o=nt.create(n,r,i);t.setSelection(o)}return!0}});var ba=Object.freeze({__proto__:null,sinkListItem:e=>({state:t,dispatch:n})=>{const r=so(e,t.schema);return(i=r,function(e,t){var n=e.selection,r=n.$from,o=n.$to,a=r.blockRange(o,(function(e){return e.childCount&&e.firstChild.type==i}));if(!a)return!1;var l=a.startIndex;if(0==l)return!1;var c=a.parent,d=c.child(l-1);if(d.type!=i)return!1;if(t){var u=d.lastChild&&d.lastChild.type==c.type,p=s.from(u?i.create():null),f=new m(s.from(i.create(null,s.from(c.type.create(null,p)))),u?3:1,0),h=a.start,g=a.end;t(e.tr.step(new Re(h-(u?3:1),g,h,g,f,1,!0)).scrollIntoView())}return!0})(t,n);var i}});function ya(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Sa(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var Ta=Object.freeze({__proto__:null,splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:a}=t,{$from:l,$to:c}=o,d=ya(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof it&&o.node.isBlock)return!(!l.parentOffset||!Le(a,l.pos))&&(r&&(e&&Sa(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const r=c.parentOffset===c.parent.content.size;o instanceof nt&&t.deleteSelection();const a=0===l.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let u=r&&a?[{type:a,attrs:d}]:void 0,p=Le(t.doc,t.mapping.map(l.pos),1,u);u||p||!Le(t.doc,t.mapping.map(l.pos),1,a?[{type:a}]:void 0)||(p=!0,u=a?[{type:a,attrs:d}]:void 0),p&&(t.split(t.mapping.map(l.pos),1,u),r||l.parentOffset||l.parent.type===a||!l.node(-1).canReplace(l.index(-1),l.indexAfter(-1),s.from(null==a?void 0:a.create()))||t.setNodeMarkup(t.mapping.map(l.before()),a||void 0)),e&&Sa(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return!0}});var Na=Object.freeze({__proto__:null,splitListItem:e=>({tr:t,state:n,dispatch:r,editor:i})=>{var o;const a=so(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const p=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let e=s.empty;const n=l.index(-1)>0;for(let t=l.depth-(n?1:2);t>=l.depth-3;t-=1)e=s.from(l.node(t).copy(e));const r=ya(p,l.node().type.name,l.node().attrs),i=(null===(o=a.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(r))||void 0;e=e.append(s.from(a.createAndFill(null,i)||void 0)),t.replace(l.before(n?void 0:-1),l.after(-3),new m(e,n?3:2,2)).setSelection(nt.near(t.doc.resolve(l.pos+(n?3:2)))).scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,h=ya(p,u.type.name,u.attrs),g=ya(p,l.node().type.name,l.node().attrs);t.delete(l.pos,c.pos);const _=f?[{type:a,attrs:h},{type:f,attrs:g}]:[{type:a,attrs:h}];return!!Le(t.doc,l.pos,2)&&(r&&t.split(l.pos,2,_).scrollIntoView(),!0)}});function Oa(e,t){const{nodeExtensions:n}=yo(t),r=n.find(t=>t.name===e);if(!r)return!1;const i=Co(bo(r,"group",{name:r.name,options:r.options}));return"string"==typeof i&&i.split(" ").includes("list")}var Ca=Object.freeze({__proto__:null,toggleList:(e,t)=>({editor:n,tr:r,state:i,dispatch:o,chain:a,commands:s,can:l})=>{const{extensions:c}=n.extensionManager,d=so(e,i.schema),u=so(t,i.schema),{selection:p}=i,{$from:f,$to:m}=p,h=f.blockRange(m);if(!h)return!1;const g=(_=e=>Oa(e.type.name,c),e=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(e.$from,_))(p);var _;if(h.depth>=1&&g&&h.depth-g.depth<=1){if(g.node.type===d)return s.liftListItem(u);if(Oa(g.node.type.name,c)&&d.validContent(g.node.content)&&o)return r.setNodeMarkup(g.pos,d),!0}return l().wrapInList(d)?s.wrapInList(d):a().clearNodes().wrapInList(d).run()}});var Aa=Object.freeze({__proto__:null,toggleMark:(e,t={})=>({state:n,commands:r})=>{const i=co(e,n.schema);return mo(n,i,t)?r.unsetMark(i):r.setMark(i,t)}});var Da=Object.freeze({__proto__:null,toggleNode:(e,t,n={})=>({state:r,commands:i})=>{const o=so(e,r.schema),a=so(t,r.schema);return fo(r,o,n)?i.setNode(a):i.setNode(o,n)}});var Ra=Object.freeze({__proto__:null,toggleWrap:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return fo(n,i,t)?Gi(n,r):Xi(i,t)(n,r)}});var wa=Object.freeze({__proto__:null,undoInputRule:()=>({state:e,dispatch:t})=>function(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var i=n[r],o=void 0;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){for(var a=e.tr,s=o.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(o.text){var c=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,e.schema.text(o.text,c))}else a.delete(o.from,o.to);t(a)}return!0}}return!1}(e,t)});var Ia=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:e,state:t,dispatch:n})=>{const{selection:r}=e,{empty:i,ranges:o}=r;return i||n&&Object.entries(t.schema.marks).forEach(([,t])=>{o.forEach(n=>{e.removeMark(n.$from.pos,n.$to.pos,t)})}),!0}});var Ma=Object.freeze({__proto__:null,unsetMark:e=>({tr:t,state:n,dispatch:r})=>{const{selection:i}=t,o=co(e,n.schema),{$from:a,empty:s,ranges:l}=i;if(r){if(s){let{from:e,to:n}=i;const r=Vo(a,o);r&&(e=r.from,n=r.to),t.removeMark(e,n,o)}else l.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos,o)});t.removeStoredMark(o)}return!0}});var xa=Object.freeze({__proto__:null,updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=ao("string"==typeof e?e:e.name,r.schema);return!!s&&("node"===s&&(o=so(e,r.schema)),"mark"===s&&(a=co(e,r.schema)),i&&n.selection.ranges.forEach(e=>{const i=e.$from.pos,s=e.$to.pos;r.doc.nodesBetween(i,s,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),a&&e.marks.length&&e.marks.forEach(o=>{if(a===o.type){const l=Math.max(r,i),c=Math.min(r+e.nodeSize,s);n.addMark(l,c,a.create({...o.attrs,...t}))}})})}),!0)}});var ka=Object.freeze({__proto__:null,wrapIn:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return!fo(n,i,t)&&Xi(i,t)(n,r)}});var La=Object.freeze({__proto__:null,wrapInList:(e,t={})=>({state:n,dispatch:r})=>io(so(e,n.schema),t)(n,r)});const Pa=xo.create({name:"commands",addCommands:()=>({...Lo,...Po,...Bo,...Uo,...Fo,...zo,...jo,...Go,...Yo,...Ho,...qo,...Qo,...Ko,...Xo,...Zo,...Jo,...ta,...na,...ra,...ia,...oa,...aa,...sa,...ca,...da,...ua,...pa,...fa,...ma,...ha,...ga,..._a,...va,...Ea,...ba,...Ta,...Na,...Ca,...Aa,...Da,...Ra,...wa,...Ia,...Ma,...xa,...ka,...La})}),Ba=xo.create({name:"editable",addProseMirrorPlugins(){return[new vt({key:new yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ua=xo.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new vt({key:new yt("focusEvents"),props:{attributes:{tabindex:"0"},handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Fa=xo.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]);return{Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>e(),"Mod-Backspace":()=>e(),Delete:()=>t(),"Mod-Delete":()=>t()}}});var za=Object.freeze({__proto__:null,ClipboardTextSerializer:ko,Commands:Pa,Editable:Ba,FocusEvents:Ua,Keymap:Fa});class ja{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new ja(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new ja(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}class Ga{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new Ga(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new Ga(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}function Ya(e,t,n){return new Ni(e,(e,r,i,o)=>{const a=n instanceof Function?n(r):n,{tr:s}=e;return r[0]&&s.replaceWith(i-1,o,t.create(a)),s})}function Va(e,t,n){return new Ni(e,(e,r,i,o)=>{const a=n instanceof Function?n(r):n,{tr:s}=e,l=r[r.length-1],c=r[0];let d=o;if(l){const n=c.search(/\S/),r=i+c.indexOf(l),u=r+l.length;if(function(e,t,n){let r=[];return n.doc.nodesBetween(e,t,(e,t)=>{r=[...r,...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n}))]}),r}(i,o,e).filter(e=>{const{excluded:n}=e.mark.type;return n.find(e=>e.name===t.name)}).filter(e=>e.to>r).length)return null;u<o&&s.delete(u,o),r>i&&s.delete(i+n,r),d=i+n+l.length,s.addMark(i+n,d,t.create(a)),s.removeStoredMark(t)}return s})}function Ha(e,t,n){const r=(i,o)=>{const a=[];return i.forEach(i=>{if(i.isText&&i.text){const{text:r}=i;let s,l=0;for(;null!==(s=e.exec(r));){const e=Math.max(s.length-2,0),r=Math.max(s.length-1,0);if(null==o?void 0:o.type.allowsMarkType(t)){const o=s.index+s[0].indexOf(s[e]),c=o+s[e].length,d=o+s[e].lastIndexOf(s[r]),u=d+s[r].length,p=n instanceof Function?n(s):n;o>0&&a.push(i.cut(l,o)),a.push(i.cut(d,u).mark(t.create(p).addToSet(i.marks))),l=c}}l<r.length&&a.push(i.cut(l))}else a.push(i.copy(r(i.content,i)))}),s.fromArray(a)};return new vt({key:new yt("markPasteRule"),props:{transformPasted:e=>new m(r(e.content),e.openStart,e.openEnd)}})}function qa(e,t,n){const r=document.createRange();return r.setEnd(e,"number"==typeof n?n:(e.nodeValue||"").length),r.setStart(e,Math.max(t||0,0)),r}function $a(e,t){const n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}function Wa(e,t,n=!1){const{node:r,offset:i}=e.domAtPos(t);let o=null,a=null;if(3===r.nodeType){const e=r.nodeValue||"";n&&i<e.length?(a=$a(qa(r,i-1,i),-1),o="right"):i<e.length&&(a=$a(qa(r,i,i+1),-1),o="left")}else if(r.firstChild){if(i<r.childNodes.length){const e=r.childNodes[i];a=$a(3===e.nodeType?qa(e):e,-1),o="left"}if((!a||a.top===a.bottom)&&i){const e=r.childNodes[i-1];a=$a(3===e.nodeType?qa(e):e,1),o="right"}}else{a=r.getBoundingClientRect(),o="left"}if(a&&o){const e=a[o];return{top:a.top,bottom:a.bottom,left:e,right:e}}return{top:0,bottom:0,left:0,right:0}}function Qa(e,t){const n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function Ka(e,t,n){const r=Wa(e,t),i=Wa(e,n,!0),o=Math.min(r.top,i.top),a=Math.max(r.bottom,i.bottom),s=Math.min(r.left,i.left),l=Math.max(r.right,i.right),c={top:o,bottom:a,left:s,right:l,width:l-s,height:a-o,x:s,y:o};return{...c,toJSON:()=>c}}function Xa(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function Za(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ja(e){var t=Za(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function es(e){return e instanceof Za(e).Element||e instanceof Element}function ts(e){return e instanceof Za(e).HTMLElement||e instanceof HTMLElement}function ns(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Za(e).ShadowRoot||e instanceof ShadowRoot)}function rs(e){return e?(e.nodeName||"").toLowerCase():null}function is(e){return((es(e)?e.ownerDocument:e.document)||window.document).documentElement}function as(e){return Xa(is(e)).left+Ja(e).scrollLeft}function ss(e){return Za(e).getComputedStyle(e)}function ls(e){var t=ss(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function cs(e,t,n){void 0===n&&(n=!1);var r,i,o=is(t),a=Xa(e),s=ts(t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==rs(t)||ls(o))&&(l=(r=t)!==Za(r)&&ts(r)?{scrollLeft:(i=r).scrollLeft,scrollTop:i.scrollTop}:Ja(r)),ts(t)?((c=Xa(t)).x+=t.clientLeft,c.y+=t.clientTop):o&&(c.x=as(o))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function ds(e){var t=Xa(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function us(e){return"html"===rs(e)?e:e.assignedSlot||e.parentNode||(ns(e)?e.host:null)||is(e)}function ps(e,t){var n;void 0===t&&(t=[]);var r=function e(t){return["html","body","#document"].indexOf(rs(t))>=0?t.ownerDocument.body:ts(t)&&ls(t)?t:e(us(t))}(e),i=r===(null==(n=e.ownerDocument)?void 0:n.body),o=Za(r),a=i?[o].concat(o.visualViewport||[],ls(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(ps(us(a)))}function fs(e){return["table","td","th"].indexOf(rs(e))>=0}function ms(e){return ts(e)&&"fixed"!==ss(e).position?e.offsetParent:null}function hs(e){for(var t=Za(e),n=ms(e);n&&fs(n)&&"static"===ss(n).position;)n=ms(n);return n&&("html"===rs(n)||"body"===rs(n)&&"static"===ss(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&ts(e)&&"fixed"===ss(e).position)return null;for(var n=us(e);ts(n)&&["html","body"].indexOf(rs(n))<0;){var r=ss(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var gs="top",_s="bottom",vs="right",Es="left",bs=[gs,_s,vs,Es],ys=bs.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),Ss=[].concat(bs,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),Ts=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Ns(e){var t=new Map,n=new Set,r=[];return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||function e(i){n.add(i.name),[].concat(i.requires||[],i.requiresIfExists||[]).forEach((function(r){if(!n.has(r)){var i=t.get(r);i&&e(i)}})),r.push(i)}(e)})),r}var Os={placement:"bottom",modifiers:[],strategy:"absolute"};function Cs(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function As(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,i=t.defaultOptions,o=void 0===i?Os:i;return function(e,t,n){void 0===n&&(n=o);var i,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},Os,o),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,d={state:s,setOptions:function(n){u(),s.options=Object.assign({},o,s.options,n),s.scrollParents={reference:es(e)?ps(e):e.contextElement?ps(e.contextElement):[],popper:ps(t)};var i=function(e){var t=Ns(e);return Ts.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(r,s.options.modifiers)));return s.orderedModifiers=i.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,i=e.effect;if("function"==typeof i){var o=i({state:s,name:t,instance:d,options:r});l.push(o||function(){})}})),d.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,n=e.popper;if(Cs(t,n)){s.rects={reference:cs(t,hs(n),"fixed"===s.options.strategy),popper:ds(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<s.orderedModifiers.length;r++)if(!0!==s.reset){var i=s.orderedModifiers[r],o=i.fn,a=i.options,l=void 0===a?{}:a,u=i.name;"function"==typeof o&&(s=o({state:s,options:l,name:u,instance:d})||s)}else s.reset=!1,r=-1}}},update:(i=function(){return new Promise((function(e){d.forceUpdate(),e(s)}))},function(){return a||(a=new Promise((function(e){Promise.resolve().then((function(){a=void 0,e(i())}))}))),a}),destroy:function(){u(),c=!0}};if(!Cs(e,t))return d;function u(){l.forEach((function(e){return e()})),l=[]}return d.setOptions(n).then((function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)})),d}}var Ds={passive:!0};var Rs={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=void 0===i||i,a=r.resize,s=void 0===a||a,l=Za(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach((function(e){e.addEventListener("scroll",n.update,Ds)})),s&&l.addEventListener("resize",n.update,Ds),function(){o&&c.forEach((function(e){e.removeEventListener("scroll",n.update,Ds)})),s&&l.removeEventListener("resize",n.update,Ds)}},data:{}};function ws(e){return e.split("-")[0]}function Is(e){return e.split("-")[1]}function Ms(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function xs(e){var t,n=e.reference,r=e.element,i=e.placement,o=i?ws(i):null,a=i?Is(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case gs:t={x:s,y:n.y-r.height};break;case _s:t={x:s,y:n.y+n.height};break;case vs:t={x:n.x+n.width,y:l};break;case Es:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var c=o?Ms(o):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case"start":t[c]=t[c]-(n[d]/2-r[d]/2);break;case"end":t[c]=t[c]+(n[d]/2-r[d]/2)}}return t}var ks={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=xs({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},Ls=Math.max,Ps=Math.min,Bs=Math.round,Us={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Fs(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.offsets,a=e.position,s=e.gpuAcceleration,l=e.adaptive,c=e.roundOffsets,d=!0===c?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Bs(Bs(t*r)/r)||0,y:Bs(Bs(n*r)/r)||0}}(o):"function"==typeof c?c(o):o,u=d.x,p=void 0===u?0:u,f=d.y,m=void 0===f?0:f,h=o.hasOwnProperty("x"),g=o.hasOwnProperty("y"),_=Es,v=gs,E=window;if(l){var b=hs(n),y="clientHeight",S="clientWidth";b===Za(n)&&"static"!==ss(b=is(n)).position&&(y="scrollHeight",S="scrollWidth"),b=b,i===gs&&(v=_s,m-=b[y]-r.height,m*=s?1:-1),i===Es&&(_=vs,p-=b[S]-r.width,p*=s?1:-1)}var T,N=Object.assign({position:a},l&&Us);return s?Object.assign({},N,((T={})[v]=g?"0":"",T[_]=h?"0":"",T.transform=(E.devicePixelRatio||1)<2?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",T)):Object.assign({},N,((t={})[v]=g?m+"px":"",t[_]=h?p+"px":"",t.transform="",t))}var zs={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];ts(i)&&rs(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],i=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});ts(r)&&rs(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};var js={left:"right",right:"left",bottom:"top",top:"bottom"};function Gs(e){return e.replace(/left|right|bottom|top/g,(function(e){return js[e]}))}var Ys={start:"end",end:"start"};function Vs(e){return e.replace(/start|end/g,(function(e){return Ys[e]}))}function Hs(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ns(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function qs(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function $s(e,t){return"viewport"===t?qs(function(e){var t=Za(e),n=is(e),r=t.visualViewport,i=n.clientWidth,o=n.clientHeight,a=0,s=0;return r&&(i=r.width,o=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:i,height:o,x:a+as(e),y:s}}(e)):ts(t)?function(e){var t=Xa(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):qs(function(e){var t,n=is(e),r=Ja(e),i=null==(t=e.ownerDocument)?void 0:t.body,o=Ls(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=Ls(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+as(e),l=-r.scrollTop;return"rtl"===ss(i||n).direction&&(s+=Ls(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(is(e)))}function Ws(e,t,n){var r="clippingParents"===t?function(e){var t=ps(us(e)),n=["absolute","fixed"].indexOf(ss(e).position)>=0&&ts(e)?hs(e):e;return es(n)?t.filter((function(e){return es(e)&&Hs(e,n)&&"body"!==rs(e)})):[]}(e):[].concat(t),i=[].concat(r,[n]),o=i[0],a=i.reduce((function(t,n){var r=$s(e,n);return t.top=Ls(r.top,t.top),t.right=Ps(r.right,t.right),t.bottom=Ps(r.bottom,t.bottom),t.left=Ls(r.left,t.left),t}),$s(e,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Qs(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Ks(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function Xs(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=void 0===r?e.placement:r,o=n.boundary,a=void 0===o?"clippingParents":o,s=n.rootBoundary,l=void 0===s?"viewport":s,c=n.elementContext,d=void 0===c?"popper":c,u=n.altBoundary,p=void 0!==u&&u,f=n.padding,m=void 0===f?0:f,h=Qs("number"!=typeof m?m:Ks(m,bs)),g="popper"===d?"reference":"popper",_=e.elements.reference,v=e.rects.popper,E=e.elements[p?g:d],b=Ws(es(E)?E:E.contextElement||is(e.elements.popper),a,l),y=Xa(_),S=xs({reference:y,element:v,strategy:"absolute",placement:i}),T=qs(Object.assign({},v,S)),N="popper"===d?T:y,O={top:b.top-N.top+h.top,bottom:N.bottom-b.bottom+h.bottom,left:b.left-N.left+h.left,right:N.right-b.right+h.right},C=e.modifiersData.offset;if("popper"===d&&C){var A=C[i];Object.keys(O).forEach((function(e){var t=[vs,_s].indexOf(e)>=0?1:-1,n=[gs,_s].indexOf(e)>=0?"y":"x";O[e]+=A[n]*t}))}return O}function Zs(e,t,n){return Ls(e,Ps(t,n))}function Js(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function el(e){return[gs,vs,_s,Es].some((function(t){return e[t]>=0}))}var tl=As({defaultModifiers:[Rs,ks,{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,a=void 0===o||o,s=n.roundOffsets,l=void 0===s||s,c={placement:ws(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,Fs(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,Fs(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},zs,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=void 0===i?[0,0]:i,a=Ss.reduce((function(e,n){return e[n]=function(e,t,n){var r=ws(e),i=[Es,gs].indexOf(r)>=0?-1:1,o="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[Es,vs].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,o),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,c=n.padding,d=n.boundary,u=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,m=void 0===f||f,h=n.allowedAutoPlacements,g=t.options.placement,_=ws(g),v=l||(_===g||!m?[Gs(g)]:function(e){if("auto"===ws(e))return[];var t=Gs(e);return[Vs(e),t,Vs(t)]}(g)),E=[g].concat(v).reduce((function(e,n){return e.concat("auto"===ws(n)?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?Ss:l,d=Is(r),u=d?s?ys:ys.filter((function(e){return Is(e)===d})):bs,p=u.filter((function(e){return c.indexOf(e)>=0}));0===p.length&&(p=u);var f=p.reduce((function(t,n){return t[n]=Xs(e,{placement:n,boundary:i,rootBoundary:o,padding:a})[ws(n)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}(t,{placement:n,boundary:d,rootBoundary:u,padding:c,flipVariations:m,allowedAutoPlacements:h}):n)}),[]),b=t.rects.reference,y=t.rects.popper,S=new Map,T=!0,N=E[0],O=0;O<E.length;O++){var C=E[O],A=ws(C),D="start"===Is(C),R=[gs,_s].indexOf(A)>=0,w=R?"width":"height",I=Xs(t,{placement:C,boundary:d,rootBoundary:u,altBoundary:p,padding:c}),M=R?D?vs:Es:D?_s:gs;b[w]>y[w]&&(M=Gs(M));var x=Gs(M),k=[];if(o&&k.push(I[A]<=0),s&&k.push(I[M]<=0,I[x]<=0),k.every((function(e){return e}))){N=C,T=!1;break}S.set(C,k)}if(T)for(var L=function(e){var t=E.find((function(t){var n=S.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return N=t,"break"},P=m?3:1;P>0;P--){if("break"===L(P))break}t.placement!==N&&(t.modifiersData[r]._skip=!0,t.placement=N,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0!==a&&a,l=n.boundary,c=n.rootBoundary,d=n.altBoundary,u=n.padding,p=n.tether,f=void 0===p||p,m=n.tetherOffset,h=void 0===m?0:m,g=Xs(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),_=ws(t.placement),v=Is(t.placement),E=!v,b=Ms(_),y="x"===b?"y":"x",S=t.modifiersData.popperOffsets,T=t.rects.reference,N=t.rects.popper,O="function"==typeof h?h(Object.assign({},t.rects,{placement:t.placement})):h,C={x:0,y:0};if(S){if(o||s){var A="y"===b?gs:Es,D="y"===b?_s:vs,R="y"===b?"height":"width",w=S[b],I=S[b]+g[A],M=S[b]-g[D],x=f?-N[R]/2:0,k="start"===v?T[R]:N[R],L="start"===v?-N[R]:-T[R],P=t.elements.arrow,B=f&&P?ds(P):{width:0,height:0},U=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},F=U[A],z=U[D],j=Zs(0,T[R],B[R]),G=E?T[R]/2-x-j-F-O:k-j-F-O,Y=E?-T[R]/2+x+j+z+O:L+j+z+O,V=t.elements.arrow&&hs(t.elements.arrow),H=V?"y"===b?V.clientTop||0:V.clientLeft||0:0,q=t.modifiersData.offset?t.modifiersData.offset[t.placement][b]:0,$=S[b]+G-q-H,W=S[b]+Y-q;if(o){var Q=Zs(f?Ps(I,$):I,w,f?Ls(M,W):M);S[b]=Q,C[b]=Q-w}if(s){var K="x"===b?gs:Es,X="x"===b?_s:vs,Z=S[y],J=Z+g[K],ee=Z-g[X],te=Zs(f?Ps(J,$):J,Z,f?Ls(ee,W):ee);S[y]=te,C[y]=te-Z}}t.modifiersData[r]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=ws(n.placement),l=Ms(s),c=[Es,vs].indexOf(s)>=0?"height":"width";if(o&&a){var d=function(e,t){return Qs("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Ks(e,bs))}(i.padding,n),u=ds(o),p="y"===l?gs:Es,f="y"===l?_s:vs,m=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],h=a[l]-n.rects.reference[l],g=hs(o),_=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,E=d[p],b=_-u[c]-d[f],y=_/2-u[c]/2+v,S=Zs(E,y,b),T=l;n.modifiersData[r]=((t={})[T]=S,t.centerOffset=S-y,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&Hs(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=Xs(t,{elementContext:"reference"}),s=Xs(t,{altBoundary:!0}),l=Js(a,r),c=Js(s,i,o),d=el(l),u=el(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]}),nl={passive:!0,capture:!0};function rl(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function il(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function ol(e,t){return"function"==typeof e?e.apply(void 0,t):e}function al(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function sl(e){return[].concat(e)}function ll(e,t){-1===e.indexOf(t)&&e.push(t)}function cl(e){return e.split("-")[0]}function dl(e){return[].slice.call(e)}function ul(){return document.createElement("div")}function pl(e){return["Element","Fragment"].some((function(t){return il(e,t)}))}function fl(e){return il(e,"MouseEvent")}function ml(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function hl(e){return pl(e)?[e]:function(e){return il(e,"NodeList")}(e)?dl(e):Array.isArray(e)?e:dl(document.querySelectorAll(e))}function gl(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function _l(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function vl(e){var t,n=sl(e)[0];return(null==n||null==(t=n.ownerDocument)?void 0:t.body)?n.ownerDocument:document}function El(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}var bl={isTouch:!1},yl=0;function Sl(){bl.isTouch||(bl.isTouch=!0,window.performance&&document.addEventListener("mousemove",Tl))}function Tl(){var e=performance.now();e-yl<20&&(bl.isTouch=!1,document.removeEventListener("mousemove",Tl)),yl=e}function Nl(){var e=document.activeElement;if(ml(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var Ol="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",Cl=/MSIE |Trident\//.test(Ol);var Al={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Dl=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Al,{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Rl=Object.keys(Dl);function wl(e){var t=(e.plugins||[]).reduce((function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=void 0!==e[r]?e[r]:i),t}),{});return Object.assign({},e,{},t)}function Il(e,t){var n=Object.assign({},t,{content:ol(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(wl(Object.assign({},Dl,{plugins:t}))):Rl).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},Dl.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function Ml(e,t){e.innerHTML=t}function xl(e){var t=ul();return!0===e?t.className="tippy-arrow":(t.className="tippy-svg-arrow",pl(e)?t.appendChild(e):Ml(t,e)),t}function kl(e,t){pl(t.content)?(Ml(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Ml(e,t.content):e.textContent=t.content)}function Ll(e){var t=e.firstElementChild,n=dl(t.children);return{box:t,content:n.find((function(e){return e.classList.contains("tippy-content")})),arrow:n.find((function(e){return e.classList.contains("tippy-arrow")||e.classList.contains("tippy-svg-arrow")})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function Pl(e){var t=ul(),n=ul();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ul();function i(n,r){var i=Ll(t),o=i.box,a=i.content,s=i.arrow;r.theme?o.setAttribute("data-theme",r.theme):o.removeAttribute("data-theme"),"string"==typeof r.animation?o.setAttribute("data-animation",r.animation):o.removeAttribute("data-animation"),r.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?o.setAttribute("role",r.role):o.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||kl(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(o.removeChild(s),o.appendChild(xl(r.arrow))):o.appendChild(xl(r.arrow)):s&&o.removeChild(s)}return r.className="tippy-content",r.setAttribute("data-state","hidden"),kl(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props),{popper:t,onUpdate:i}}Pl.$$tippy=!0;var Bl=1,Ul=[],Fl=[];function zl(e,t){var n,r,i,o,a,s,l,c,d,u=Il(e,Object.assign({},Dl,{},wl((n=t,Object.keys(n).reduce((function(e,t){return void 0!==n[t]&&(e[t]=n[t]),e}),{}))))),p=!1,f=!1,m=!1,h=!1,g=[],_=al(W,u.interactiveDebounce),v=Bl++,E=(d=u.plugins).filter((function(e,t){return d.indexOf(e)===t})),b={id:v,reference:e,popper:ul(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:E,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)},setProps:function(t){0;if(b.state.isDestroyed)return;k("onBeforeUpdate",[b,t]),q();var n=b.props,r=Il(e,Object.assign({},b.props,{},t,{ignoreAttributes:!0}));b.props=r,H(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),_=al(W,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?sl(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded");P(),x(),T&&T(n,r);b.popperInstance&&(Z(),ee().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})));k("onAfterUpdate",[b,t])},setContent:function(e){b.setProps({content:e})},show:function(){0;var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=bl.isTouch&&!b.props.touch,i=rl(b.props.duration,0,Dl.duration);if(e||t||n||r)return;if(R().hasAttribute("disabled"))return;if(k("onShow",[b],!1),!1===b.props.onShow(b))return;b.state.isVisible=!0,D()&&(S.style.visibility="visible");x(),j(),b.state.isMounted||(S.style.transition="none");if(D()){var o=I(),a=o.box,s=o.content;gl([a,s],0)}l=function(){var e;if(b.state.isVisible&&!h){if(h=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,D()&&b.props.animation){var t=I(),n=t.box,r=t.content;gl([n,r],i),_l([n,r],"visible")}L(),P(),ll(Fl,b),null==(e=b.popperInstance)||e.forceUpdate(),b.state.isMounted=!0,k("onMount",[b]),b.props.animation&&D()&&function(e,t){Y(e,t)}(i,(function(){b.state.isShown=!0,k("onShown",[b])}))}},function(){var e,t=b.props.appendTo,n=R();e=b.props.interactive&&t===Dl.appendTo||"parent"===t?n.parentNode:ol(t,[n]);e.contains(S)||e.appendChild(S);Z(),!1}()},hide:function(){0;var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=rl(b.props.duration,1,Dl.duration);if(e||t||n)return;if(k("onHide",[b],!1),!1===b.props.onHide(b))return;b.state.isVisible=!1,b.state.isShown=!1,h=!1,p=!1,D()&&(S.style.visibility="hidden");if(B(),G(),x(),D()){var i=I(),o=i.box,a=i.content;b.props.animation&&(gl([o,a],r),_l([o,a],"hidden"))}L(),P(),b.props.animation?D()&&function(e,t){Y(e,(function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()}))}(r,b.unmount):b.unmount()},hideWithInteractivity:function(e){0;w().addEventListener("mousemove",_),ll(Ul,_),_(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){0;b.state.isVisible&&b.hide();if(!b.state.isMounted)return;J(),ee().forEach((function(e){e._tippy.unmount()})),S.parentNode&&S.parentNode.removeChild(S);Fl=Fl.filter((function(e){return e!==b})),b.state.isMounted=!1,k("onHidden",[b])},destroy:function(){0;if(b.state.isDestroyed)return;b.clearDelayTimeouts(),b.unmount(),q(),delete e._tippy,b.state.isDestroyed=!0,k("onDestroy",[b])}};if(!u.render)return b;var y=u.render(b),S=y.popper,T=y.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+b.id,b.popper=S,e._tippy=b,S._tippy=b;var N=E.map((function(e){return e.fn(b)})),O=e.hasAttribute("aria-expanded");return H(),P(),x(),k("onCreate",[b]),u.showOnCreate&&te(),S.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),S.addEventListener("mouseleave",(function(e){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&(w().addEventListener("mousemove",_),_(e))})),b;function C(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function A(){return"hold"===C()[0]}function D(){var e;return!!(null==(e=b.props.render)?void 0:e.$$tippy)}function R(){return c||e}function w(){var e=R().parentNode;return e?vl(e):document}function I(){return Ll(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||bl.isTouch||a&&"focus"===a.type?0:rl(b.props.delay,e?0:1,Dl.delay)}function x(){S.style.pointerEvents=b.props.interactive&&b.state.isVisible?"":"none",S.style.zIndex=""+b.props.zIndex}function k(e,t,n){var r;(void 0===n&&(n=!0),N.forEach((function(n){n[e]&&n[e].apply(void 0,t)})),n)&&(r=b.props)[e].apply(r,t)}function L(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=S.id;sl(b.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var i=t&&t.replace(r,"").trim();i?e.setAttribute(n,i):e.removeAttribute(n)}}))}}function P(){!O&&b.props.aria.expanded&&sl(b.props.triggerTarget||e).forEach((function(e){b.props.interactive?e.setAttribute("aria-expanded",b.state.isVisible&&e===R()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){w().removeEventListener("mousemove",_),Ul=Ul.filter((function(e){return e!==_}))}function U(e){if(!(bl.isTouch&&(m||"mousedown"===e.type)||b.props.interactive&&S.contains(e.target))){if(R().contains(e.target)){if(bl.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else k("onClickOutside",[b,e]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),f=!0,setTimeout((function(){f=!1})),b.state.isMounted||G())}}function F(){m=!0}function z(){m=!1}function j(){var e=w();e.addEventListener("mousedown",U,!0),e.addEventListener("touchend",U,nl),e.addEventListener("touchstart",z,nl),e.addEventListener("touchmove",F,nl)}function G(){var e=w();e.removeEventListener("mousedown",U,!0),e.removeEventListener("touchend",U,nl),e.removeEventListener("touchstart",z,nl),e.removeEventListener("touchmove",F,nl)}function Y(e,t){var n=I().box;function r(e){e.target===n&&(El(n,"remove",r),t())}if(0===e)return t();El(n,"remove",s),El(n,"add",r),s=r}function V(t,n,r){void 0===r&&(r=!1),sl(b.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),g.push({node:e,eventType:t,handler:n,options:r})}))}function H(){var e;A()&&(V("touchstart",$,{passive:!0}),V("touchend",Q,{passive:!0})),(e=b.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(V(e,$),e){case"mouseenter":V("mouseleave",Q);break;case"focus":V(Cl?"focusout":"blur",K);break;case"focusin":V("focusout",K)}}))}function q(){g.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)})),g=[]}function $(e){var t,n=!1;if(b.state.isEnabled&&!X(e)&&!f){var r="focus"===(null==(t=a)?void 0:t.type);a=e,c=e.currentTarget,P(),!b.state.isVisible&&fl(e)&&Ul.forEach((function(t){return t(e)})),"click"===e.type&&(b.props.trigger.indexOf("mouseenter")<0||p)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:te(e),"click"===e.type&&(p=!n),n&&!r&&ne(e)}}function W(e){var t=e.target,n=R().contains(t)||S.contains(t);"mousemove"===e.type&&n||function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,i=e.popperState,o=e.props.interactiveBorder,a=cl(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l="bottom"===a?s.top.y:0,c="top"===a?s.bottom.y:0,d="right"===a?s.left.x:0,u="left"===a?s.right.x:0,p=t.top-r+l>o,f=r-t.bottom-c>o,m=t.left-n+d>o,h=n-t.right-u>o;return p||f||m||h}))}(ee().concat(S).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean),e)&&(B(),ne(e))}function Q(e){X(e)||b.props.trigger.indexOf("click")>=0&&p||(b.props.interactive?b.hideWithInteractivity(e):ne(e))}function K(e){b.props.trigger.indexOf("focusin")<0&&e.target!==R()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||ne(e)}function X(e){return!!bl.isTouch&&A()!==e.type.indexOf("touch")>=0}function Z(){J();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,o=t.getReferenceClientRect,a=t.moveTransition,s=D()?Ll(S).arrow:null,c=o?{getBoundingClientRect:o,contextElement:o.contextElement||R()}:e,d=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(D()){var n=I().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];D()&&s&&d.push({name:"arrow",options:{element:s,padding:3}}),d.push.apply(d,(null==n?void 0:n.modifiers)||[]),b.popperInstance=tl(c,S,Object.assign({},n,{placement:r,onFirstUpdate:l,modifiers:d}))}function J(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ee(){return dl(S.querySelectorAll("[data-tippy-root]"))}function te(e){b.clearDelayTimeouts(),e&&k("onTrigger",[b,e]),j();var t=M(!0),n=C(),i=n[0],o=n[1];bl.isTouch&&"hold"===i&&o&&(t=o),t?r=setTimeout((function(){b.show()}),t):b.show()}function ne(e){if(b.clearDelayTimeouts(),k("onUntrigger",[b,e]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&p)){var t=M(!1);t?i=setTimeout((function(){b.state.isVisible&&b.hide()}),t):o=requestAnimationFrame((function(){b.hide()}))}}else G()}}function jl(e,t){void 0===t&&(t={});var n=Dl.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",Sl,nl),window.addEventListener("blur",Nl);var r=Object.assign({},t,{plugins:n}),i=hl(e).reduce((function(e,t){var n=t&&zl(t,r);return n&&e.push(n),e}),[]);return pl(e)?i[0]:i}jl.defaultProps=Dl,jl.setDefaultProps=function(e){Object.keys(e).forEach((function(t){Dl[t]=e[t]}))},jl.currentInput=bl;Object.assign({},zs,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}});jl.setDefaultProps({render:Pl});var Gl=jl;class Yl{constructor({editor:e,element:t,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;this.preventHide?this.preventHide=!1:(null==e?void 0:e.relatedTarget)&&(null===(t=this.element.parentNode)||void 0===t?void 0:t.contains(e.relatedTarget))||this.hide()},this.editor=e,this.element=t,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(e={}){this.tippy=Gl(this.view.dom,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...e})}update(e,t){const{state:n,composing:r}=e,{doc:i,selection:o}=n,a=t&&t.doc.eq(i)&&t.selection.eq(o);if(r||a)return;const{empty:s,$anchor:l,ranges:c}=o,d=Math.min(...c.map(e=>e.$from.pos)),u=Math.max(...c.map(e=>e.$to.pos));!s&&l.parent.textContent?(this.tippy.setProps({getReferenceClientRect:()=>Ka(e,d,u)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Vl=new yt("menuBubble"),Hl=e=>new vt({key:Vl,view:t=>new Yl({view:t,...e})});xo.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Hl({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});class ql{constructor({editor:e,element:t,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;this.preventHide?this.preventHide=!1:(null==e?void 0:e.relatedTarget)&&(null===(t=this.element.parentNode)||void 0===t?void 0:t.contains(e.relatedTarget))||this.hide()},this.editor=e,this.element=t,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(e={}){this.tippy=Gl(this.view.dom,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...e})}update(e,t){const{state:n,composing:r}=e,{doc:i,selection:o}=n,a=t&&t.doc.eq(i)&&t.selection.eq(o);if(r||a)return;const{$anchor:s,empty:l,from:c,to:d}=o,u=1===s.depth,p=!o.$anchor.parent.isLeaf&&!o.$anchor.parent.textContent;l&&(u&&p)?(this.tippy.setProps({getReferenceClientRect:()=>Ka(e,c,d)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const $l=new yt("menuFloating"),Wl=e=>new vt({key:$l,view:t=>new ql({view:t,...e})});xo.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Wl({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});var Ql=n(12),Kl=n.n(Ql);const Xl=e=>{const t=Object(r.useRef)(null);return Object(r.useEffect)(()=>{const{editor:n,tippyOptions:r}=e;return n.registerPlugin(Hl({editor:n,element:t.current,tippyOptions:r})),()=>{n.unregisterPlugin(Vl)}},[]),i.a.createElement("div",{ref:t,className:e.className,style:{visibility:"hidden"}},e.children)};class Zl extends class extends class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}{constructor(e={}){super(),this.isFocused=!1,this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.commands.focus(this.options.autofocus),this.emit("create",{editor:this})},0)}get commands(){return this.commandManager.createCommands()}chain(){return this.commandManager.createChain()}can(){return this.commandManager.createCan()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e){const t=document.createElement("style");return t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t),t}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}'))}setOptions(e={}){this.options={...this.options,...e}}setEditable(e){this.setOptions({editable:e}),this.view&&this.state&&!this.isDestroyed&&this.view.updateState(this.state)}get isEditable(){return this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n="function"==typeof t?t(e,this.state.plugins):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(e){if(this.isDestroyed)return;const t="string"==typeof e?e+"$":e.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(e=>!e.key.startsWith(t))});this.view.updateState(n)}createExtensionManager(){const e=[...Object.entries(za).map(([,e])=>e),...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new wo(e,this)}createCommandManager(){this.commandManager=new Eo(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new ii(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:ht.create({doc:_o(this.options.content,this.schema,this.options.parseOptions)})});const e=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(e),this.createNodeViews();this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null===(t=this.capturedTransaction)||void 0===t?void 0:t.step(e)}):void(this.capturedTransaction=e);const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this});const r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event}),i&&this.emit("blur",{editor:this,event:i.event}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return function(e,t){const n=ao("string"==typeof t?t:t.name,e.schema);return"node"===n?lo(e,t):"mark"===n?uo(e,t):{}}(this.state,e)}getNodeAttributes(e){return console.warn("[tiptap warn]: editor.getNodeAttributes() is deprecated. please use editor.getAttributes() instead."),lo(this.state,e)}getMarkAttributes(e){return console.warn("[tiptap warn]: editor.getMarkAttributes() is deprecated. please use editor.getAttributes() instead."),uo(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return fo(e,null,n)||mo(e,null,n);const r=ao(t,e.schema);return"node"===r?fo(e,t,n):"mark"===r&&mo(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return vo(this.state.doc,this.schema)}get isEmpty(){return function(e){var t;const n=null===(t=e.type.createAndFill())||void 0===t?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){var e;this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),(e=this.css)&&e.parentNode&&e.parentNode.removeChild(e)}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}}{constructor(){super(...arguments),this.contentComponent=null}}const Jl=(e={})=>{const[t,n]=Object(r.useState)(null),i=function(){const[,e]=Object(r.useState)(0);return()=>e(e=>e+1)}();return Object(r.useEffect)(()=>{const t=new Zl(e);return n(t),t.on("transaction",i),()=>{t.destroy()}},[]),t};class ec{constructor(e,{editor:t,props:n={},as:r="div"}){this.ref=null,this.id=Math.floor(4294967295*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),this.render()}render(){var e;const t=this.component,n=this.props;(function(e){return!("function"!=typeof e||!e.prototype||!e.prototype.isReactComponent)})(t)&&(n.ref=e=>{this.ref=e}),this.reactElement=i.a.createElement(t,Object.assign({},n)),(null===(e=this.editor)||void 0===e?void 0:e.contentComponent)&&this.editor.contentComponent.setState({renderers:this.editor.contentComponent.state.renderers.set(this.id,this)})}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;if(null===(e=this.editor)||void 0===e?void 0:e.contentComponent){const{renderers:e}=this.editor.contentComponent.state;e.delete(this.id),this.editor.contentComponent.setState({renderers:e})}}}const tc=Object(r.createContext)({onDragStart:void 0});class nc extends class{constructor(e,t,n){this.isDragging=!1,this.options={stopEvent:null,update:null},this.component=e,this.options={...this.options,...n},this.editor=t.editor,this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return null}get contentDOM(){return null}onDragStart(e){var t,n,r;const{view:i}=this.editor,o=e.target,a=3===o.nodeType?null===(t=o.parentElement)||void 0===t?void 0:t.closest("[data-drag-handle]"):o.closest("[data-drag-handle]");if(!this.dom||(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(o))||!a)return;let s=0,l=0;if(this.dom!==a){const t=this.dom.getBoundingClientRect(),n=a.getBoundingClientRect();s=n.x-t.x+e.offsetX,l=n.y-t.y+e.offsetY}null===(r=e.dataTransfer)||void 0===r||r.setDragImage(this.dom,s,l);const c=it.create(i.state.doc,this.getPos()),d=i.state.tr.setSelection(c);i.dispatch(d)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent(e);const n=e.target;if(!(this.dom.contains(n)&&!(null===(t=this.contentDOM)||void 0===t?void 0:t.contains(n))))return!1;if(["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)return!0;const{isEditable:r}=this.editor,{isDragging:i}=this,o=!!this.node.type.spec.draggable,a=it.isSelectable(this.node),s="copy"===e.type,l="paste"===e.type,c="cut"===e.type,d="mousedown"===e.type,u=e.type.startsWith("drag")||"drop"===e.type;if(!o&&a&&u&&e.preventDefault(),o&&u&&!i)return e.preventDefault(),!1;if(o&&r&&!i&&d){const e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(i||s||l||c||d&&a)}ignoreMutation(e){if(!this.dom||!this.contentDOM)return!0;if(this.node.isLeaf)return!0;if("selection"===e.type)return!1;if(this.dom.contains(e.target)&&"childList"===e.type&&(["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document)){if([...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))return!1}return this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)}updateAttributes(e){if(!this.editor.view.editable)return;const{state:t}=this.editor.view,n=this.getPos(),r=t.tr.setNodeMarkup(n,void 0,{...this.node.attrs,...e});this.editor.view.dispatch(r)}}{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e)};if(!this.component.displayName){const e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}const t=e=>{const t=this.onDragStart.bind(this),n=this.component;return i.a.createElement(tc.Provider,{value:{onDragStart:t}},i.a.createElement(n,Object.assign({},e)))};t.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit"),this.renderer=new ec(t,{editor:this.editor,props:e,as:this.node.isInline?"span":"div"})}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null===(e=this.renderer.element.firstElementChild)||void 0===e?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){if(this.node.isLeaf)return null;const e=this.dom.querySelector("[data-node-view-content]");return this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement),this.contentDOMElement}update(e,t){return"function"==typeof this.options.update?this.options.update(e,t):e.type===this.node.type&&(e===this.node&&this.decorations===t||(this.node=e,this.decorations=t,this.renderer.updateProps({node:e,decorations:t})),!0)}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function rc(e,t){return n=>n.editor.contentComponent?new nc(e,n,t):{}}const ic=({renderers:e})=>i.a.createElement(i.a.Fragment,null,Array.from(e).map(([e,t])=>Kl.a.createPortal(t.reactElement,t.element,e)));class oc extends i.a.Component{constructor(e){super(e),this.editorContentRef=i.a.createRef(),this.state={renderers:new Map}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.appendChild(e.options.element.firstChild),e.setOptions({element:t}),e.contentComponent=this,setTimeout(()=>e.createNodeViews(),0)}}componentWillUnmount(){const{editor:e}=this.props;if(!e)return;if(e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild)return;const t=document.createElement("div");t.appendChild(e.options.element.firstChild),e.setOptions({element:t})}render(){return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{ref:this.editorContentRef}),i.a.createElement(ic,{renderers:this.state.renderers}))}}const ac=i.a.memo(oc),sc=e=>{const{onDragStart:t}=Object(r.useContext)(tc),n=e.as||"div";return i.a.createElement(n,Object.assign({},e,{"data-node-view-wrapper":"",onDragStart:t,style:{...e.style,whiteSpace:"normal"}}))},lc=e=>{const t=e.as||"div";return i.a.createElement(t,Object.assign({},e,{"data-node-view-content":"",style:{...e.style,whiteSpace:"pre-wrap"}}))};function cc(e){return void 0===e&&(e={}),new vt({view:function(t){return new dc(t,e)}})}var dc=function(e,t){var n=this;this.editorView=e,this.width=t.width||1,this.color=t.color||"black",this.class=t.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(t){var r=function(e){return n[t](e)};return e.dom.addEventListener(t,r),{name:t,handler:r}}))};dc.prototype.destroy=function(){var e=this;this.handlers.forEach((function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)}))},dc.prototype.update=function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&this.updateOverlay()},dc.prototype.setCursor=function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},dc.prototype.updateOverlay=function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos);if(!t.parent.inlineContent){var n=t.nodeBefore,r=t.nodeAfter;if(n||r){var i=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),o=n?i.bottom:i.top;n&&r&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:o-this.width/2,bottom:o+this.width/2}}}if(!e){var a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var s,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!c||c==document.body&&"static"==getComputedStyle(c).position)s=-pageXOffset,l=-pageYOffset;else{var d=c.getBoundingClientRect();s=d.left-c.scrollLeft,l=d.top-c.scrollTop}this.element.style.left=e.left-s+"px",this.element.style.top=e.top-l+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"},dc.prototype.scheduleRemoval=function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.setCursor(null)}),e)},dc.prototype.dragover=function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY});if(t){var n=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Ue(this.editorView.state.doc,n,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}},dc.prototype.dragend=function(){this.scheduleRemoval(20)},dc.prototype.drop=function(){this.scheduleRemoval(20)},dc.prototype.dragleave=function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)};var uc=xo.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[cc(this.options)]}}),pc=function(e){function t(t){e.call(this,t,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var i=n.resolve(r.map(this.head));return t.valid(i)?new t(i):e.near(i)},t.prototype.content=function(){return m.empty},t.prototype.eq=function(e){return e instanceof t&&e.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))},t.prototype.getBookmark=function(){return new fc(this.anchor)},t.valid=function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t);if(0!=n)for(var r=e.node(t).child(n-1);;r=r.lastChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var i=r.child(n);;i=i.firstChild){if(0==i.childCount&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock},t.findFrom=function(e,n,r){e:for(;;){if(!r&&t.valid(e))return e;for(var i=e.pos,o=null,a=e.depth;;a--){var s=e.node(a);if(n>0?e.indexAfter(a)<s.childCount:e.index(a)>0){o=s.child(n>0?e.indexAfter(a):e.index(a)-1);break}if(0==a)return null;i+=n;var l=e.doc.resolve(i);if(t.valid(l))return l}for(;;){var c=n>0?o.firstChild:o.lastChild;if(!c){if(o.isAtom&&!o.isText&&!it.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=c,i+=n;var d=e.doc.resolve(i);if(t.valid(d))return d}return null}},t}(Je);pc.prototype.visible=!1,Je.jsonID("gapcursor",pc);var fc=function(e){this.pos=e};fc.prototype.map=function(e){return new fc(e.map(this.pos))},fc.prototype.resolve=function(e){var t=e.resolve(this.pos);return pc.valid(t)?new pc(t):Je.near(t)};var mc=Ti({ArrowLeft:hc("horiz",-1),ArrowRight:hc("horiz",1),ArrowUp:hc("vert",-1),ArrowDown:hc("vert",1)});function hc(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){var o=e.selection,a=t>0?o.$to:o.$from,s=o.empty;if(o instanceof nt){if(!i.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var l=pc.findFrom(a,t,s);return!!l&&(r&&r(e.tr.setSelection(new pc(l))),!0)}}function gc(e,t,n){if(!e.editable)return!1;var r=e.state.doc.resolve(t);if(!pc.valid(r))return!1;var i=e.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(i>-1&&it.isSelectable(e.state.doc.nodeAt(i)))&&(e.dispatch(e.state.tr.setSelection(new pc(r))),!0)}function _c(e){if(!(e.selection instanceof pc))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",$r.create(e.doc,[Yr.widget(e.selection.head,t,{key:"gapcursor"})])}var vc=xo.create({name:"gapCursor",addProseMirrorPlugins:()=>[new vt({props:{decorations:_c,createSelectionBetween:function(e,t,n){if(t.pos==n.pos&&pc.valid(n))return new pc(n)},handleClick:gc,handleKeyDown:mc}})],extendNodeSchema(e){var t;return{allowGapCursor:null!==(t=Co(bo(e,"allowGapCursor",{name:e.name,options:e.options})))&&void 0!==t?t:null}}});var Ec=ja.create({name:"doc",topNode:!0,content:"block+"});var bc=ja.create({name:"paragraph",priority:1e3,defaultOptions:{HTMLAttributes:{}},group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setParagraph:()=>({commands:e})=>e.toggleNode("paragraph","paragraph")}),addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var yc=ja.create({name:"text",group:"inline"}),Sc=function(){};Sc.prototype.append=function(e){return e.length?(e=Sc.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},Sc.prototype.prepend=function(e){return e.length?Sc.from(e).append(this):this},Sc.prototype.appendInner=function(e){return new Nc(this,e)},Sc.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Sc.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Sc.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Sc.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Sc.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},Sc.from=function(e){return e instanceof Sc?e:e&&e.length?new Tc(e):Sc.empty};var Tc=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Sc);Sc.empty=new Tc([]);var Nc=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Sc),Oc=Sc,Cc=function(e,t){this.items=e,this.eventCount=t};Cc.prototype.popEvent=function(e,t){var n=this;if(0==this.eventCount)return null;for(var r,i,o=this.items.length;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(r=this.remapping(o,this.items.length),i=r.maps.length);var a,s,l=e.tr,c=[],d=[];return this.items.forEach((function(e,t){if(!e.step)return r||(r=n.remapping(o,t+1),i=r.maps.length),i--,void d.push(e);if(r){d.push(new Ac(e.map));var u,p=e.step.map(r.slice(i));p&&l.maybeStep(p).doc&&(u=l.mapping.maps[l.mapping.maps.length-1],c.push(new Ac(u,null,null,c.length+d.length))),i--,u&&r.appendMap(u,i)}else l.maybeStep(e.step);return e.selection?(a=r?e.selection.map(r.slice(i)):e.selection,s=new Cc(n.items.slice(0,o).append(d.reverse().concat(c)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:a}},Cc.prototype.addTransform=function(e,t,n,r){for(var i=[],o=this.eventCount,a=this.items,s=!r&&a.length?a.get(a.length-1):null,l=0;l<e.steps.length;l++){var c,d=e.steps[l].invert(e.docs[l]),u=new Ac(e.mapping.maps[l],d,t);(c=s&&s.merge(u))&&(u=c,l?i.pop():a=a.slice(0,a.length-1)),i.push(u),t&&(o++,t=null),r||(s=u)}var p,f,m,h=o-n.depth;return h>Rc&&(f=h,(p=a).forEach((function(e,t){if(e.selection&&0==f--)return m=t,!1})),a=p.slice(m),o-=h),new Cc(a.append(i),o)},Cc.prototype.remapping=function(e,t){var n=new be;return this.items.forEach((function(t,r){var i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:null;n.appendMap(t.map,i)}),e,t),n},Cc.prototype.addMaps=function(e){return 0==this.eventCount?this:new Cc(this.items.append(e.map((function(e){return new Ac(e)}))),this.eventCount)},Cc.prototype.rebased=function(e,t){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach((function(e){e.selection&&a--}),r);var s=t;this.items.forEach((function(t){var r=i.getMirror(--s);if(null!=r){o=Math.min(o,r);var l=i.maps[r];if(t.step){var c=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(i.slice(s+1,r));d&&a++,n.push(new Ac(l,c,d))}else n.push(new Ac(l))}}),r);for(var l=[],c=t;c<o;c++)l.push(new Ac(i.maps[c]));var d=this.items.slice(0,r).append(l).append(n),u=new Cc(d,a);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u},Cc.prototype.emptyItemCount=function(){var e=0;return this.items.forEach((function(t){t.step||e++})),e},Cc.prototype.compress=function(e){void 0===e&&(e=this.items.length);var t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((function(o,a){if(a>=e)r.push(o),o.selection&&i++;else if(o.step){var s=o.step.map(t.slice(n)),l=s&&s.getMap();if(n--,l&&t.appendMap(l,n),s){var c=o.selection&&o.selection.map(t.slice(n));c&&i++;var d,u=new Ac(l.invert(),s,c),p=r.length-1;(d=r.length&&r[p].merge(u))?r[p]=d:r.push(u)}}else o.map&&n--}),this.items.length,0),new Cc(Oc.from(r.reverse()),i)},Cc.empty=new Cc(Oc.empty,0);var Ac=function(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r};Ac.prototype.merge=function(e){if(this.step&&e.step&&!e.selection){var t=e.step.merge(this.step);if(t)return new Ac(t.getMap().invert(),t,this.selection)}};var Dc=function(e,t,n,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r},Rc=20;function wc(e){var t=[];return e.forEach((function(e,n,r,i){return t.push(r,i)})),t}function Ic(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}function Mc(e,t,n,r){var i=Lc(t),o=Pc.get(t).spec.config,a=(r?e.undone:e.done).popEvent(t,i);if(a){var s=a.selection.resolve(a.transform.doc),l=(r?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),o,i),c=new Dc(r?l:a.remaining,r?a.remaining:l,null,0);n(a.transform.setSelection(s).setMeta(Pc,{redo:r,historyState:c}).scrollIntoView())}}var xc=!1,kc=null;function Lc(e){var t=e.plugins;if(kc!=t){xc=!1,kc=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){xc=!0;break}}return xc}var Pc=new yt("history"),Bc=new yt("closeHistory");function Uc(e){return e={depth:e&&e.depth||100,newGroupDelay:e&&e.newGroupDelay||500},new vt({key:Pc,state:{init:function(){return new Dc(Cc.empty,Cc.empty,null,0)},apply:function(t,n,r){return function(e,t,n,r){var i,o=n.getMeta(Pc);if(o)return o.historyState;n.getMeta(Bc)&&(e=new Dc(e.done,e.undone,null,0));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(Pc))return a.getMeta(Pc).redo?new Dc(e.done.addTransform(n,null,r,Lc(t)),e.undone,wc(n.mapping.maps[n.steps.length-1]),e.prevTime):new Dc(e.done,e.undone.addTransform(n,null,r,Lc(t)),null,e.prevTime);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Dc(e.done.rebased(n,i),e.undone.rebased(n,i),Ic(e.prevRanges,n.mapping),e.prevTime):new Dc(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ic(e.prevRanges,n.mapping),e.prevTime);var s=0==e.prevTime||!a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach((function(e,r){for(var i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)})),n}(n,e.prevRanges)),l=a?Ic(e.prevRanges,n.mapping):wc(n.mapping.maps[n.steps.length-1]);return new Dc(e.done.addTransform(n,s?t.selection.getBookmark():null,r,Lc(t)),Cc.empty,l,n.time)}(n,r,t,e)}},config:e})}var Fc=xo.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands:()=>({undo:()=>({state:e,dispatch:t})=>function(e,t){var n=Pc.getState(e);return!(!n||0==n.done.eventCount)&&(t&&Mc(n,e,t,!1),!0)}(e,t),redo:()=>({state:e,dispatch:t})=>function(e,t){var n=Pc.getState(e);return!(!n||0==n.undone.eventCount)&&(t&&Mc(n,e,t,!0),!0)}(e,t)}),addProseMirrorPlugins(){return[Uc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}}});const zc=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,jc=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Gc=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,Yc=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm;var Vc=Ga.create({name:"bold",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],renderHTML({HTMLAttributes:e}){return["strong",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setBold:()=>({commands:e})=>e.setMark("bold"),toggleBold:()=>({commands:e})=>e.toggleMark("bold"),unsetBold:()=>({commands:e})=>e.unsetMark("bold")}),addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Va(zc,this.type),Va(Gc,this.type)]},addPasteRules(){return[Ha(jc,this.type),Ha(Yc,this.type)]}});const Hc=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,qc=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,$c=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,Wc=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm;var Qc=Ga.create({name:"italic",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:e}){return["em",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setItalic:()=>({commands:e})=>e.setMark("italic"),toggleItalic:()=>({commands:e})=>e.toggleMark("italic"),unsetItalic:()=>({commands:e})=>e.unsetMark("italic")}),addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Va(Hc,this.type),Va($c,this.type)]},addPasteRules(){return[Ha(qc,this.type),Ha(Wc,this.type)]}});const Kc=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm;var Xc=Ga.create({name:"code",defaultOptions:{HTMLAttributes:{}},excludes:"_",parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setCode:()=>({commands:e})=>e.setMark("code"),toggleCode:()=>({commands:e})=>e.toggleMark("code"),unsetCode:()=>({commands:e})=>e.unsetMark("code")}),addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Va(Kc,this.type)]},addPasteRules(){return[Ha(Kc,this.type)]}});const Zc=/^```(?<language>[a-z]*)? $/,Jc=/^~~~(?<language>[a-z]*)? $/;var ed=ja.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{var t;const n=null===(t=e.firstElementChild)||void 0===t?void 0:t.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:e}){return["pre",this.options.HTMLAttributes,["code",e,0]]},addCommands:()=>({setCodeBlock:e=>({commands:t})=>t.setNode("codeBlock",e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode("codeBlock","paragraph",e)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[xi(Zc,this.type,({groups:e})=>e),xi(Jc,this.type,({groups:e})=>e)]}});var td=ja.create({name:"heading",defaultOptions:{levels:[1,2,3,4,5,6],HTMLAttributes:{}},content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:"h"+e,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return["h"+(this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]),To(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode("heading",e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode("heading","paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,["Mod-Alt-"+t]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>xi(new RegExp(`^(#{1,${e}})\\s$`),this.type,{level:e}))}});var nd=ja.create({name:"hardBreak",defaultOptions:{HTMLAttributes:{}},inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",To(this.options.HTMLAttributes,e)]},addCommands(){return{setHardBreak:()=>({commands:e})=>e.first([()=>e.exitCode(),()=>e.insertContent({type:this.name})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const rd=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm;var id=Ga.create({name:"strike",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setStrike:()=>({commands:e})=>e.setMark("strike"),toggleStrike:()=>({commands:e})=>e.toggleMark("strike"),unsetStrike:()=>({commands:e})=>e.unsetMark("strike")}),addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Va(rd,this.type)]},addPasteRules(){return[Ha(rd,this.type)]}});const od=/^\s*>\s$/gm;var ad=ja.create({name:"blockquote",defaultOptions:{HTMLAttributes:{}},content:"block*",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setBlockquote:()=>({commands:e})=>e.wrapIn("blockquote"),toggleBlockquote:()=>({commands:e})=>e.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:e})=>e.lift("blockquote")}),addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Mi(od,this.type)]}});var sd=ja.create({name:"horizontalRule",defaultOptions:{HTMLAttributes:{}},group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",To(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e})=>e().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{var n;if(t){const{parent:t,pos:r}=e.selection.$from,i=r+1;if(!e.doc.nodeAt(i)){const r=null===(n=t.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(e.insert(i,r),e.setSelection(nt.create(e.doc,i)))}e.scrollIntoView()}return!0}).run()}},addInputRules(){return[Ya(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}});const ld=/^\s*([-+*])\s$/;var cd=ja.create({name:"bulletList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({toggleBulletList:()=>({commands:e})=>e.toggleList("bulletList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[Mi(ld,this.type)]}});const dd=/^(\d+)\.\s$/;var ud=ja.create({name:"orderedList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",addAttributes:()=>({start:{default:1,parseHTML:e=>({start:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1})}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",To(this.options.HTMLAttributes,n),0]:["ol",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({toggleOrderedList:()=>({commands:e})=>e.toggleList("orderedList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[Mi(dd,this.type,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order===+e[1])]}});var pd=ja.create({name:"listItem",defaultOptions:{HTMLAttributes:{}},content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",To(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}});var fd=xo.create({name:"starterKit",addExtensions(){var e,t,n,r,i,o,a,s,l,c,d,u,p,f,m,h,g,_;const v=[];return!1!==this.options.blockquote&&v.push(ad.configure(null===(e=this.options)||void 0===e?void 0:e.blockquote)),!1!==this.options.bold&&v.push(Vc.configure(null===(t=this.options)||void 0===t?void 0:t.bold)),!1!==this.options.bulletList&&v.push(cd.configure(null===(n=this.options)||void 0===n?void 0:n.bulletList)),!1!==this.options.code&&v.push(Xc.configure(null===(r=this.options)||void 0===r?void 0:r.code)),!1!==this.options.codeBlock&&v.push(ed.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&v.push(Ec.configure(null===(o=this.options)||void 0===o?void 0:o.document)),!1!==this.options.dropcursor&&v.push(uc.configure(null===(a=this.options)||void 0===a?void 0:a.dropcursor)),!1!==this.options.gapcursor&&v.push(vc.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&v.push(nd.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&v.push(td.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&v.push(Fc.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&v.push(sd.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&v.push(Qc.configure(null===(p=this.options)||void 0===p?void 0:p.italic)),!1!==this.options.listItem&&v.push(pd.configure(null===(f=this.options)||void 0===f?void 0:f.listItem)),!1!==this.options.orderedList&&v.push(ud.configure(null===(m=this.options)||void 0===m?void 0:m.orderedList)),!1!==this.options.paragraph&&v.push(bc.configure(null===(h=this.options)||void 0===h?void 0:h.paragraph)),!1!==this.options.strike&&v.push(id.configure(null===(g=this.options)||void 0===g?void 0:g.strike)),!1!==this.options.text&&v.push(yc.configure(null===(_=this.options)||void 0===_?void 0:_.text)),v}});const md=new Ni(/<-$/,"←"),hd=new Ni(/->$/,"→"),gd=new Ni(/\(c\)$/,"©"),_d=new Ni(/\(r\)$/,"®"),vd=new Ni(/1\/2$/,"½"),Ed=new Ni(/\+\/-$/,"±"),bd=new Ni(/!=$/,"≠"),yd=new Ni(/<<$/,"«"),Sd=new Ni(/>>$/,"»"),Td=new Ni(/\d+\s?([*x])\s?\d+$/,"×");var Nd=xo.create({name:"typography",addInputRules:()=>[Ci,Ai,Di,Ri,wi,Ii,md,hd,gd,_d,vd,Ed,bd,yd,Sd,Td]}),Od={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Cd=/Edge\/(\d+)/.exec(navigator.userAgent),Ad=/MSIE \d/.test(navigator.userAgent),Dd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Od.mac=/Mac/.test(navigator.platform);var Rd=Od.ie=!!(Ad||Dd||Cd);Od.ie_version=Ad?document.documentMode||6:Dd?+Dd[1]:Cd?+Cd[1]:null,Od.gecko=!Rd&&/gecko\/(\d+)/i.test(navigator.userAgent),Od.gecko_version=Od.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var wd=!Rd&&/Chrome\/(\d+)/.exec(navigator.userAgent);Od.chrome=!!wd,Od.chrome_version=wd&&+wd[1],Od.safari=!Rd&&/Apple Computer/.test(navigator.vendor),Od.ios=Od.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Od.android=/Android \d/.test(navigator.userAgent),Od.webkit="webkitFontSmoothing"in document.documentElement.style,Od.webkit_version=Od.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Id=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Md=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},xd=null,kd=function(e,t,n){var r=xd||(xd=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Ld=function(e,t,n,r){return n&&(Bd(e,t,n,r,-1)||Bd(e,t,n,r,1))},Pd=/^(img|br|input|textarea|hr)$/i;function Bd(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ud(e))){var o=e.parentNode;if(1!=o.nodeType||Fd(e)||Pd.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Id(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?Ud(e):0}}}function Ud(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Fd(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var zd=function(e){var t=e.isCollapsed;return t&&Od.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function jd(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Gd(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Yd(e,t){return"number"==typeof e?e:e[t]}function Vd(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Hd(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Md(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Gd(o):Vd(a),c=0,d=0;if(t.top<l.top+Yd(r,"top")?d=-(l.top-t.top+Yd(i,"top")):t.bottom>l.bottom-Yd(r,"bottom")&&(d=t.bottom-l.bottom+Yd(i,"bottom")),t.left<l.left+Yd(r,"left")?c=-(l.left-t.left+Yd(i,"left")):t.right>l.right-Yd(r,"right")&&(c=t.right-l.right+Yd(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function qd(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Md(e));return t}function $d(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Wd=null;function Qd(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=kd(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=Zd(r,1);if(o.top!=o.bottom&&Kd(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:Qd(n,r)}function Kd(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Xd(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!Kd(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(Kd(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(Od.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(Od.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=Qd(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function Zd(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var Jd=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function eu(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=Od.webkit||Od.gecko;if(3==i.nodeType){if(!a||!Jd.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,tu(Zd(kd(i,s,l),c),c<0)}var d=Zd(kd(i,o,o),n);if(Od.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=Zd(kd(i,o-1,o-1),-1);if(u.top==d.top){var p=Zd(kd(i,o,o+1),-1);if(p.top!=d.top)return tu(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==Ud(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return nu(f.getBoundingClientRect(),!1)}if(o<Ud(i)){var m=i.childNodes[o];if(1==m.nodeType)return nu(m.getBoundingClientRect(),!0)}return nu(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==Ud(i))){var h=i.childNodes[o-1],g=3==h.nodeType?kd(h,Ud(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return tu(Zd(g,1),!1)}if(o<Ud(i)){var _=i.childNodes[o],v=3==_.nodeType?kd(_,0,a?0:1):1==_.nodeType?_:null;if(v)return tu(Zd(v,-1),!0)}return tu(Zd(3==i.nodeType?kd(i):i,-n),n>=0)}function tu(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function nu(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ru(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var iu=/[\u0590-\u08ac]/;var ou=null,au=null,su=!1;function lu(e,t,n){return ou==t&&au==n?su:(ou=t,au=n,su="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return ru(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=eu(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=kd(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return iu.test(r.parent.textContent)&&s.modify?ru(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var cu=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},du={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};cu.prototype.matchesWidget=function(){return!1},cu.prototype.matchesMark=function(){return!1},cu.prototype.matchesNode=function(){return!1},cu.prototype.matchesHack=function(){return!1},du.beforePosition.get=function(){return!1},cu.prototype.parseRule=function(){return null},cu.prototype.stopEvent=function(){return!1},du.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},du.border.get=function(){return 0},cu.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},cu.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},du.posBefore.get=function(){return this.parent.posBeforeChild(this)},du.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},du.posAfter.get=function(){return this.posBefore+this.size},du.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},cu.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>Id(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},cu.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},cu.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},cu.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},cu.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},cu.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?Id(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},cu.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=Id(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Id(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},cu.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},cu.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},cu.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((Od.gecko||Od.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:Id(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(Od.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&Od.safari||!Ld(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Ld(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},cu.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},du.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},cu.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},cu.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},du.domAtom.get=function(){return!1},Object.defineProperties(cu.prototype,du);var uu=[],pu=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,uu,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(cu),fu=function(e){function t(t,n,r,i){e.call(this,t,uu,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(cu),mu=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=wu(o,n,a,r)),e>0&&(o=wu(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(cu),hu=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?uu:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Ou(u,r,n),d?l=new Eu(e,n,r,i,u,p,f,d,o,a+1):n.isText?new _u(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Cu(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Du(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(Ru);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():uu;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(uu,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=Au(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof mu){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=Au(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),Od.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=Ud(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new fu(this,o,n,i);e.compositionNodes.push(a),this.children=wu(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Cu(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tu(this.dom,this.nodeDOM,Su(this.outerDeco,this.node,t),Su(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(cu);function gu(e,t,n,r,i){return Ou(r,t,e),new hu(null,e,t,n,r,r,r,i,0)}var _u=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(hu),vu=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(cu),Eu=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(hu);function bu(e){e&&(this.nodeName=e)}bu.prototype=Object.create(null);var yu=[new bu];function Su(e,t,n){if(0==e.length)return yu;for(var r=n?yu[0]:new bu,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new bu(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new bu(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Tu(e,t,n,r){if(n==yu&&r==yu)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=yu[0]),i=l}Nu(i,s||yu[0],a)}return i}function Nu(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):uu,a=n.class?n.class.split(" ").filter(Boolean):uu,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Ou(e,t,n){return Tu(e,e,yu,Su(t,n,1!=e.nodeType))}function Cu(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Au(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Du=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function Ru(e,t){return e.type.side-t.type.side}function wu(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Iu(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(zd(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==Ud(e);r||i;){if(e==n)return!0;var o=Id(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Ud(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=zu(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function Mu(e){return e.editable?e.hasFocus():ju(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function xu(e,t){var n=e.state.selection;if(Uu(e,n),Mu(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Id(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&Od.ie&&Od.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!ku||n instanceof nt||(n.$from.parent.inlineContent||(r=Lu(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Lu(e,n.to))),e.docView.setSelection(o,a,e.root,t),ku&&(r&&Bu(r),i&&Bu(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){Mu(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Du.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Du.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Du.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=mu.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Du.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Du.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof hu){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Cu(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Du.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,hu.create(this.top,e,t,n,r,i)),this.changed=!0},Du.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new pu(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Du.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof mu;)e=e.children[e.children.length-1];if(!e||!(e instanceof _u)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new vu(this.top,uu,t,null)),this.changed=!0}};var ku=Od.safari||Od.chrome&&Od.chrome_version<63;function Lu(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Od.safari&&o&&"false"==o.contentEditable)return Pu(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return Pu(o);if(a)return Pu(a)}}function Pu(e){return e.contentEditable="true",Od.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Bu(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Uu(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Fu(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Fu(e)}function Fu(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function zu(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function ju(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Gu(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function Yu(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Vu(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return Yu(e,new nt(t>0?r.$to:r.$from));var i=Gu(e.state,t);return!!i&&Yu(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=Gu(e.state,t);return!!(o&&o instanceof it)&&Yu(e,o)}if(!(Od.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?Yu(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!Od.webkit&&Yu(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Hu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function qu(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function $u(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(Od.gecko&&1==n.nodeType&&r<Hu(n)&&qu(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(qu(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Qu(n))break;for(var l=n.previousSibling;l&&qu(l);)i=n.parentNode,o=Id(l),l=l.previousSibling;if(l)r=Hu(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Ku(e,t,n,r):i&&Ku(e,t,i,o)}}function Wu(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Hu(n);;)if(r<a){if(1!=n.nodeType)break;if(!qu(n.childNodes[r]))break;i=n,o=++r}else{if(Qu(n))break;for(var s=n.nextSibling;s&&qu(s);)i=s.parentNode,o=Id(s)+1,s=s.nextSibling;if(s)r=0,a=Hu(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Ku(e,t,i,o)}}function Qu(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ku(e,t,n,r){if(zd(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&xu(e)}),50)}function Xu(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(Od.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Gu(e.state,t);if(a&&a instanceof it)return Yu(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&Yu(e,l)}return!1}function Zu(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Ju(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ep(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||Od.mac&&72==n&&"c"==r?Zu(e,-1)||$u(e):46==n||Od.mac&&68==n&&"c"==r?Zu(e,1)||Wu(e):13==n||27==n||(37==n?Vu(e,-1,r)||$u(e):39==n?Vu(e,1,r)||Wu(e):38==n?Xu(e,-1,r)||$u(e):40==n?function(e){if(Od.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Ju(e,i,!0),setTimeout((function(){return Ju(e,i,!1)}),20)}}}(e)||Xu(e,1,r)||Wu(e):r==(Od.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function tp(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Od.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Od.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function np(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=Iu(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],zd(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Od.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:tp,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(Od.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((Od.ios&&e.lastIOSEnter>Date.now()-225||Od.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=rp(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),Od.ie&&Od.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((Od.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||ip(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(ip(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||ip(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,jd(8,"Backspace"))})))Od.android&&Od.chrome&&e.domObserver.suppressSelectionUpdates();else{Od.chrome&&Od.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),Od.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)Od.ie&&Od.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return xu(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=rp(e,O.doc,p.sel);M&&!(Od.chrome&&Od.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||Od.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function rp(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:zu(e,t.resolve(n.anchor),t.resolve(n.head))}function ip(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function op(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=up(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=cp[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ap(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=up().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&cp[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(lp(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(lp(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(sp(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=sp(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function sp(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function lp(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=lp(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var cp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},dp=null;function up(){return dp||(dp=document.implementation.createHTMLDocument("title"))}var pp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fp=Od.ie&&Od.ie_version<=11,mp=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};mp.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},mp.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var hp=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);Od.ie&&Od.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new mp,fp&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};hp.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},hp.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},hp.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,pp),fp&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},hp.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}fp&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},hp.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},hp.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},hp.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},hp.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&ju(e)){var e;if(this.suppressingSelectionUpdates)return xu(this.view);if(Od.ie&&Od.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Ld(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},hp.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},hp.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},hp.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&ju(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(Od.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(gp)return;gp=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||xu(this.view),this.currentSelection.set(t))}},hp.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(Od.ie&&Od.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?Id(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?Id(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var gp=!1;var _p={},vp={};function Ep(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function bp(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return yp(e,t)})}))}function yp(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Sp(e){return{left:e.clientX,top:e.clientY}}function Tp(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Np(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Op(e,t,n,r,i){return Tp(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Np(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Np(e,new it(n),"pointer"),!0)}(e,n))}function Cp(e,t,n,r){return Tp(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function Ap(e,t,n,r){return Tp(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Np(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Np(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Np(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Dp(e){return Lp(e)}vp.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!Ip(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!Od.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||ep(e,t)?t.preventDefault():Ep(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},vp.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},vp.keypress=function(e,t){if(!(Ip(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||Od.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Rp=Od.mac?"metaKey":"ctrlKey";_p.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Dp(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Rp]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Sp(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new wp(e,o,t,n)):("doubleClick"==i?Cp:Ap)(e,o.pos,o.inside,t)?t.preventDefault():Ep(e,"pointer"))};var wp=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Rp],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Od.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ep(e,"pointer")};function Ip(e,t){return!!e.composing||!!(Od.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}wp.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},wp.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Sp(e))),this.allowDefault||!t?Ep(this.view,"pointer"):Op(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||Od.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Od.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Np(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Ep(this.view,"pointer")}},wp.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Ep(this.view,"pointer"),0==e.buttons&&this.done()},_p.touchdown=function(e){Dp(e),Ep(e,"pointer")},_p.contextmenu=function(e){return Dp(e)};var Mp=Od.android?5e3:-1;function xp(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return Lp(e)}),t))}function kp(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function Lp(e,t){if(e.domObserver.forceFlush(),kp(e),t||e.docView.dirty){var n=Iu(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}vp.compositionstart=vp.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),Lp(e,!0),e.markCursor=null;else if(Lp(e),Od.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}xp(e,Mp)},vp.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,xp(e,20))};var Pp=Od.ie&&Od.ie_version<15||Od.ios&&Od.webkit_version<604;function Bp(e,t,n,r){var i=ap(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}_p.copy=vp.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=Pp?null:t.clipboardData,o=op(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},vp.paste=function(e,t){var n=Pp?null:t.clipboardData;n&&Bp(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Bp(e,r.value,null,t):Bp(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var Up=function(e,t){this.slice=e,this.move=t},Fp=Od.mac?"altKey":"ctrlKey";for(var zp in _p.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Sp(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=op(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Pp?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Pp||t.dataTransfer.setData("text/plain",c),e.dragging=new Up(a,!t[Fp])}},_p.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},vp.dragover=vp.dragenter=function(e,t){return t.preventDefault()},vp.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Sp(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=ap(e,t.dataTransfer.getData(Pp?"Text":"text/plain"),Pp?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[Fp];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(zu(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},_p.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&xu(e)}),20))},_p.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},_p.beforeinput=function(e,t){if(Od.chrome&&Od.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,jd(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},vp)_p[zp]=vp[zp];function jp(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Gp=function(e,t){this.spec=t||Wp,this.side=this.spec.side||0,this.toDOM=e};Gp.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Hp(o-n,o-n,this)},Gp.prototype.valid=function(){return!0},Gp.prototype.eq=function(e){return this==e||e instanceof Gp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&jp(this.spec,e.spec))};var Yp=function(e,t){this.spec=t||Wp,this.attrs=e};Yp.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Hp(i,o,this)},Yp.prototype.valid=function(e,t){return t.from<t.to},Yp.prototype.eq=function(e){return this==e||e instanceof Yp&&jp(this.attrs,e.attrs)&&jp(this.spec,e.spec)},Yp.is=function(e){return e.type instanceof Yp};var Vp=function(e,t){this.spec=t||Wp,this.attrs=e};Vp.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Hp(i.pos-n,o.pos-n,this)},Vp.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},Vp.prototype.eq=function(e){return this==e||e instanceof Vp&&jp(this.attrs,e.attrs)&&jp(this.spec,e.spec)};var Hp=function(e,t,n){this.from=e,this.to=t,this.type=n},qp={spec:{configurable:!0},inline:{configurable:!0}};Hp.prototype.copy=function(e,t){return new Hp(e,t,this.type)},Hp.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Hp.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Hp.widget=function(e,t,n){return new Hp(e,e,new Gp(t,n))},Hp.inline=function(e,t,n,r){return new Hp(e,t,new Yp(n,r))},Hp.node=function(e,t,n,r){return new Hp(e,t,new Vp(n,r))},qp.spec.get=function(){return this.type.spec},qp.inline.get=function(){return this.type instanceof Yp},Object.defineProperties(Hp.prototype,qp);var $p=[],Wp={},Qp=function(e,t){this.local=e&&e.length?e:$p,this.children=t&&t.length?t:$p};Qp.create=function(e,t){return t.length?tf(t,e,0,Wp):Kp},Qp.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},Qp.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},Qp.prototype.map=function(e,t,n){return this==Kp||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Wp)},Qp.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Kp?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=tf(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new Qp(t&&t.sort(nf),s)}(this.children,o,e,t,n,r,i):o?new Qp(o.sort(nf)):Kp},Qp.prototype.add=function(e,t){return t.length?this==Kp?Qp.create(e,t):this.addInner(e,t,0):this},Qp.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=Jp(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,tf(s,e,l+1,Wp)),o+=3}}));for(var a=Zp(o?ef(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new Qp(a.length?this.local.concat(a).sort(nf):this.local,r||this.children)},Qp.prototype.remove=function(e){return 0==e.length||this==Kp?this:this.removeInner(e,0)},Qp.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Kp?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Qp(r,n):Kp},Qp.prototype.forChild=function(e,t){if(this==Kp)return this;if(t.isLeaf)return Qp.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof Yp){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new Qp(r.sort(nf));return n?new Xp([u,n]):u}return n||Kp},Qp.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof Qp)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},Qp.prototype.locals=function(e){return rf(this.localsInner(e))},Qp.prototype.localsInner=function(e){if(this==Kp)return $p;if(e.inlineContent||!this.local.some(Yp.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Yp||t.push(this.local[n]);return t};var Kp=new Qp;Qp.empty=Kp,Qp.removeOverlap=rf;var Xp=function(e){this.members=e};function Zp(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Hp(i.from+t,i.to+t,i.type))}return n}function Jp(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function ef(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function tf(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=Jp(e,t,a+n);if(s){o=!0;var l=tf(s,t,n+a+1,r);l!=Kp&&i.push(a,a+t.nodeSize,l)}}));for(var a=Zp(o?ef(e):e,-n).sort(nf),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new Qp(a,i):Kp}function nf(e,t){return e.from-t.from||e.to-t.to}function rf(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),of(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),of(t,i+1,o.copy(r.to,o.to)))}}return t}function of(e,t,n){for(;t<e.length&&nf(n,e[t])>0;)t++;e.splice(t,0,n)}function af(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Kp&&t.push(r)})),e.cursorWrapper&&t.push(Qp.create(e.state.doc,[e.cursorWrapper.deco])),Xp.from(t)}Xp.prototype.forChild=function(e,t){if(t.isLeaf)return Qp.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Kp&&(i instanceof Xp?n=n.concat(i.members):n.push(i))}return Xp.from(n)},Xp.prototype.eq=function(e){if(!(e instanceof Xp)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},Xp.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?rf(n?t:t.sort(nf)):$p},Xp.from=function(e){switch(e.length){case 0:return Kp;case 1:return e[0];default:return new Xp(e)}};var sf=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=uf(this),this.markCursor=null,this.cursorWrapper=null,df(this),this.nodeViews=pf(this),this.docView=gu(this.state.doc,cf(this),af(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new hp(e,(function(t,n,r,i){return np(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=_p[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||yp(e,t)||!e.editable&&t.type in vp||n(e,t)})};for(var n in _p)t(n);Od.safari&&e.dom.addEventListener("input",(function(){return null})),bp(e)}(this),this.pluginViews=[],this.updatePluginViews()},lf={props:{configurable:!0},root:{configurable:!0}};function cf(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Hp.node(0,e.state.doc.content.size,t)]}function df(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Hp.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function uf(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function pf(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}lf.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},sf.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&bp(this),this._props=e,this.updateStateInner(e.state,!0)},sf.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},sf.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},sf.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(kp(this),o=!0),this.state=e,t){var a=pf(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),bp(this)}this.editable=uf(this),df(this);var s=af(this),l=cf(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:qd(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(Od.ie||Od.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=Od.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=gu(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Ld(p.node,p.offset,f.anchorNode,f.anchorOffset)))?xu(this,T):(Uu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Hd(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Hd(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,$d(b,0==y?0:y-E))},sf.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},sf.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},sf.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},sf.prototype.hasFocus=function(){return this.root.activeElement==this.dom},sf.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Wd)return e.focus(Wd);var t=qd(e);e.focus(null==Wd?{get preventScroll(){return Wd={preventScroll:!0},!0}}:void 0),Wd||(Wd=!1,$d(t,0))}(this.dom),xu(this),this.domObserver.start()},lf.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},sf.prototype.posAtCoords=function(e){return Xd(this,e)},sf.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),eu(this,e,t)},sf.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},sf.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},sf.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},sf.prototype.endOfTextblock=function(e,t){return lu(this,t||this.state,e)},sf.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],af(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},sf.prototype.dispatchEvent=function(e){return function(e,t){yp(e,t)||!_p[t.type]||!e.editable&&t.type in vp||_p[t.type](e,t)}(this,e)},sf.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(sf.prototype,lf);var ff=xo.create({name:"placeholder",defaultOptions:{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0},addProseMirrorPlugins(){return[new vt({props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(n)return e.descendants((e,t)=>{const n=r>=t&&r<=t+e.nodeSize,o=!e.isLeaf&&!e.textContent;if((n||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];this.editor.isEmpty&&n.push(this.options.emptyEditorClass);const r=Hp.node(t,t+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e}):this.options.placeholder});i.push(r)}return!1}),Qp.create(e,i)}}})]}});const mf=/(?:^|\s)((?:==)((?:[^~]+))(?:==))$/gm;var hf=Ga.create({name:"highlight",defaultOptions:{multicolor:!1,HTMLAttributes:{}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>({color:e.getAttribute("data-color")||e.style.backgroundColor}),renderHTML:e=>e.color?{"data-color":e.color,style:"background-color: "+e.color}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setHighlight:e=>({commands:t})=>t.setMark("highlight",e),toggleHighlight:e=>({commands:t})=>t.toggleMark("highlight",e),unsetHighlight:()=>({commands:e})=>e.unsetMark("highlight")}),addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Va(mf,this.type)]},addPasteRules(){return[Ha(mf,this.type)]}});var gf=xo.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[cc(this.options)]}});const _f=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,vf=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)$/gi;var Ef=Ga.create({name:"link",priority:1e3,inclusive:!1,defaultOptions:{openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow"}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target}}},parseHTML:()=>[{tag:"a[href]"}],renderHTML({HTMLAttributes:e}){return["a",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setLink:e=>({commands:t})=>t.setMark("link",e),toggleLink:e=>({commands:t})=>t.toggleMark("link",e),unsetLink:()=>({commands:e})=>e.unsetMark("link")}),addPasteRules(){return[Ha(_f,this.type,e=>({href:e[0]}))]},addProseMirrorPlugins(){const e=[];return this.options.openOnClick&&e.push(new vt({key:new yt("handleClickLink"),props:{handleClick:(e,t,n)=>{var r;const i=this.editor.getAttributes("link");return!(!(null===(r=n.target)||void 0===r?void 0:r.closest("a"))||!i.href)&&(window.open(i.href,i.target),!0)}}})),this.options.linkOnPaste&&e.push(new vt({key:new yt("handlePasteLink"),props:{handlePaste:(e,t,n)=>{const{state:r}=e,{selection:i}=r,{empty:o}=i;if(o)return!1;let a="";return n.content.forEach(e=>{a+=e.textContent}),!(!a||!a.match(vf))&&(this.editor.commands.setMark(this.type,{href:a}),!0)}}})),e}});const bf=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/;var yf=ja.create({name:"image",defaultOptions:{inline:!1,HTMLAttributes:{}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML:()=>[{tag:"img[src]"}],renderHTML({HTMLAttributes:e}){return["img",To(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ya(bf,this.type,e=>{const[,t,n,r]=e;return{src:n,alt:t,title:r}})]}});function Sf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sf(Object(n),!0).forEach((function(t){Nf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Of=yf.extend({name:"image",addAttributes:function(){return Tf(Tf({},yf.config.addAttributes()),{},{size:{default:"small",rendered:!1},float:{default:"none",rendered:!1}})},addCommands:function(){var e=this;return{setImage:function(t){return function(n){var r,i,o,a=n.tr,s=n.commands;return"image"==(null===(r=a.selection)||void 0===r||null===(i=r.node)||void 0===i||null===(o=i.type)||void 0===o?void 0:o.name)?s.updateAttributes("image",t):s.insertContent({type:e.name,attrs:t})}}}},renderHTML:function(e){var t=e.node,n=e.HTMLAttributes;return n.class=" image-"+t.attrs.size,n.class+=" image-float-"+t.attrs.float,["img",To(this.options.HTMLAttributes,n)]}}),Cf=n(13),Af=Object(Cf.a)({showImageUpload:!1,showURLInput:!1}),Df={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Rf=/Edge\/(\d+)/.exec(navigator.userAgent),wf=/MSIE \d/.test(navigator.userAgent),If=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Df.mac=/Mac/.test(navigator.platform);var Mf=Df.ie=!!(wf||If||Rf);Df.ie_version=wf?document.documentMode||6:If?+If[1]:Rf?+Rf[1]:null,Df.gecko=!Mf&&/gecko\/(\d+)/i.test(navigator.userAgent),Df.gecko_version=Df.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var xf=!Mf&&/Chrome\/(\d+)/.exec(navigator.userAgent);Df.chrome=!!xf,Df.chrome_version=xf&&+xf[1],Df.safari=!Mf&&/Apple Computer/.test(navigator.vendor),Df.ios=Df.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Df.android=/Android \d/.test(navigator.userAgent),Df.webkit="webkitFontSmoothing"in document.documentElement.style,Df.webkit_version=Df.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var kf=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Lf=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},Pf=null,Bf=function(e,t,n){var r=Pf||(Pf=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Uf=function(e,t,n,r){return n&&(zf(e,t,n,r,-1)||zf(e,t,n,r,1))},Ff=/^(img|br|input|textarea|hr)$/i;function zf(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:jf(e))){var o=e.parentNode;if(1!=o.nodeType||Gf(e)||Ff.test(e.nodeName)||"false"==e.contentEditable)return!1;t=kf(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?jf(e):0}}}function jf(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Gf(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Yf=function(e){var t=e.isCollapsed;return t&&Df.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function Vf(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Hf(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function qf(e,t){return"number"==typeof e?e:e[t]}function $f(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Wf(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Lf(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Hf(o):$f(a),c=0,d=0;if(t.top<l.top+qf(r,"top")?d=-(l.top-t.top+qf(i,"top")):t.bottom>l.bottom-qf(r,"bottom")&&(d=t.bottom-l.bottom+qf(i,"bottom")),t.left<l.left+qf(r,"left")?c=-(l.left-t.left+qf(i,"left")):t.right>l.right-qf(r,"right")&&(c=t.right-l.right+qf(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function Qf(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Lf(e));return t}function Kf(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Xf=null;function Zf(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=Bf(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=tm(r,1);if(o.top!=o.bottom&&Jf(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:Zf(n,r)}function Jf(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function em(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!Jf(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(Jf(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(Df.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(Df.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=Zf(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function tm(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var nm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rm(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=Df.webkit||Df.gecko;if(3==i.nodeType){if(!a||!nm.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,im(tm(Bf(i,s,l),c),c<0)}var d=tm(Bf(i,o,o),n);if(Df.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=tm(Bf(i,o-1,o-1),-1);if(u.top==d.top){var p=tm(Bf(i,o,o+1),-1);if(p.top!=d.top)return im(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==jf(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return om(f.getBoundingClientRect(),!1)}if(o<jf(i)){var m=i.childNodes[o];if(1==m.nodeType)return om(m.getBoundingClientRect(),!0)}return om(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==jf(i))){var h=i.childNodes[o-1],g=3==h.nodeType?Bf(h,jf(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return im(tm(g,1),!1)}if(o<jf(i)){var _=i.childNodes[o],v=3==_.nodeType?Bf(_,0,a?0:1):1==_.nodeType?_:null;if(v)return im(tm(v,-1),!0)}return im(tm(3==i.nodeType?Bf(i):i,-n),n>=0)}function im(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function om(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function am(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var sm=/[\u0590-\u08ac]/;var lm=null,cm=null,dm=!1;function um(e,t,n){return lm==t&&cm==n?dm:(lm=t,cm=n,dm="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return am(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=rm(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=Bf(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return sm.test(r.parent.textContent)&&s.modify?am(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var pm=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},fm={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};pm.prototype.matchesWidget=function(){return!1},pm.prototype.matchesMark=function(){return!1},pm.prototype.matchesNode=function(){return!1},pm.prototype.matchesHack=function(){return!1},fm.beforePosition.get=function(){return!1},pm.prototype.parseRule=function(){return null},pm.prototype.stopEvent=function(){return!1},fm.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},fm.border.get=function(){return 0},pm.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},pm.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},fm.posBefore.get=function(){return this.parent.posBeforeChild(this)},fm.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},fm.posAfter.get=function(){return this.posBefore+this.size},fm.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},pm.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>kf(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},pm.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},pm.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},pm.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},pm.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},pm.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?kf(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},pm.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=kf(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=kf(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},pm.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},pm.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},pm.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((Df.gecko||Df.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:kf(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(Df.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&Df.safari||!Uf(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Uf(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},pm.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},fm.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},pm.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},pm.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},fm.domAtom.get=function(){return!1},Object.defineProperties(pm.prototype,fm);var mm=[],hm=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,mm,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(pm),gm=function(e){function t(t,n,r,i){e.call(this,t,mm,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(pm),_m=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=xm(o,n,a,r)),e>0&&(o=xm(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(pm),vm=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?mm:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Dm(u,r,n),d?l=new Sm(e,n,r,i,u,p,f,d,o,a+1):n.isText?new bm(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Rm(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Im(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(Mm);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():mm;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(mm,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=wm(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof _m){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=wm(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),Df.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=jf(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new gm(this,o,n,i);e.compositionNodes.push(a),this.children=xm(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Rm(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Cm(this.dom,this.nodeDOM,Om(this.outerDeco,this.node,t),Om(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(pm);function Em(e,t,n,r,i){return Dm(r,t,e),new vm(null,e,t,n,r,r,r,i,0)}var bm=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(vm),ym=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(pm),Sm=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(vm);function Tm(e){e&&(this.nodeName=e)}Tm.prototype=Object.create(null);var Nm=[new Tm];function Om(e,t,n){if(0==e.length)return Nm;for(var r=n?Nm[0]:new Tm,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new Tm(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new Tm(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Cm(e,t,n,r){if(n==Nm&&r==Nm)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=Nm[0]),i=l}Am(i,s||Nm[0],a)}return i}function Am(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):mm,a=n.class?n.class.split(" ").filter(Boolean):mm,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Dm(e,t,n){return Cm(e,e,Nm,Om(t,n,1!=e.nodeType))}function Rm(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function wm(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Im=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function Mm(e,t){return e.type.side-t.type.side}function xm(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function km(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Yf(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==jf(e);r||i;){if(e==n)return!0;var o=kf(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==jf(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=Ym(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function Lm(e){return e.editable?e.hasFocus():Vm(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Pm(e,t){var n=e.state.selection;if(jm(e,n),Lm(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,kf(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&Df.ie&&Df.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!Bm||n instanceof nt||(n.$from.parent.inlineContent||(r=Um(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Um(e,n.to))),e.docView.setSelection(o,a,e.root,t),Bm&&(r&&zm(r),i&&zm(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){Lm(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Im.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Im.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Im.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=_m.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Im.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Im.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof vm){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Rm(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Im.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,vm.create(this.top,e,t,n,r,i)),this.changed=!0},Im.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new hm(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Im.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof _m;)e=e.children[e.children.length-1];if(!e||!(e instanceof bm)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new ym(this.top,mm,t,null)),this.changed=!0}};var Bm=Df.safari||Df.chrome&&Df.chrome_version<63;function Um(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Df.safari&&o&&"false"==o.contentEditable)return Fm(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return Fm(o);if(a)return Fm(a)}}function Fm(e){return e.contentEditable="true",Df.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function zm(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function jm(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Gm(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Gm(e)}function Gm(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function Ym(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function Vm(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Hm(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function qm(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $m(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return qm(e,new nt(t>0?r.$to:r.$from));var i=Hm(e.state,t);return!!i&&qm(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=Hm(e.state,t);return!!(o&&o instanceof it)&&qm(e,o)}if(!(Df.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?qm(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!Df.webkit&&qm(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Wm(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Qm(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Km(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(Df.gecko&&1==n.nodeType&&r<Wm(n)&&Qm(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Qm(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Zm(n))break;for(var l=n.previousSibling;l&&Qm(l);)i=n.parentNode,o=kf(l),l=l.previousSibling;if(l)r=Wm(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Jm(e,t,n,r):i&&Jm(e,t,i,o)}}function Xm(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Wm(n);;)if(r<a){if(1!=n.nodeType)break;if(!Qm(n.childNodes[r]))break;i=n,o=++r}else{if(Zm(n))break;for(var s=n.nextSibling;s&&Qm(s);)i=s.parentNode,o=kf(s)+1,s=s.nextSibling;if(s)r=0,a=Wm(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Jm(e,t,i,o)}}function Zm(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Jm(e,t,n,r){if(Yf(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&Pm(e)}),50)}function eh(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(Df.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Hm(e.state,t);if(a&&a instanceof it)return qm(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&qm(e,l)}return!1}function th(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function nh(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function rh(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||Df.mac&&72==n&&"c"==r?th(e,-1)||Km(e):46==n||Df.mac&&68==n&&"c"==r?th(e,1)||Xm(e):13==n||27==n||(37==n?$m(e,-1,r)||Km(e):39==n?$m(e,1,r)||Xm(e):38==n?eh(e,-1,r)||Km(e):40==n?function(e){if(Df.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;nh(e,i,!0),setTimeout((function(){return nh(e,i,!1)}),20)}}}(e)||eh(e,1,r)||Xm(e):r==(Df.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function ih(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Df.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Df.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function oh(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=km(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Yf(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Df.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:ih,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(Df.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((Df.ios&&e.lastIOSEnter>Date.now()-225||Df.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=ah(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),Df.ie&&Df.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((Df.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||sh(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(sh(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||sh(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(8,"Backspace"))})))Df.android&&Df.chrome&&e.domObserver.suppressSelectionUpdates();else{Df.chrome&&Df.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),Df.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)Df.ie&&Df.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Pm(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=ah(e,O.doc,p.sel);M&&!(Df.chrome&&Df.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||Df.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function ah(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ym(e,t.resolve(n.anchor),t.resolve(n.head))}function sh(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function lh(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=mh(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=ph[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ch(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=mh().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&ph[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(uh(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(uh(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(dh(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=dh(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function dh(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function uh(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=uh(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var ph={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},fh=null;function mh(){return fh||(fh=document.implementation.createHTMLDocument("title"))}var hh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gh=Df.ie&&Df.ie_version<=11,_h=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};_h.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},_h.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var vh=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);Df.ie&&Df.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new _h,gh&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};vh.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},vh.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},vh.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,hh),gh&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},vh.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}gh&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},vh.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},vh.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},vh.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},vh.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&Vm(e)){var e;if(this.suppressingSelectionUpdates)return Pm(this.view);if(Df.ie&&Df.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Uf(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},vh.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},vh.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},vh.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Vm(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(Df.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(Eh)return;Eh=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||Pm(this.view),this.currentSelection.set(t))}},vh.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(Df.ie&&Df.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?kf(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?kf(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var Eh=!1;var bh={},yh={};function Sh(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function Th(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Nh(e,t)})}))}function Nh(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Oh(e){return{left:e.clientX,top:e.clientY}}function Ch(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Ah(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Dh(e,t,n,r,i){return Ch(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Ah(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Ah(e,new it(n),"pointer"),!0)}(e,n))}function Rh(e,t,n,r){return Ch(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function wh(e,t,n,r){return Ch(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Ah(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Ah(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Ah(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Ih(e){return Uh(e)}yh.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!kh(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!Df.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||rh(e,t)?t.preventDefault():Sh(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},yh.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},yh.keypress=function(e,t){if(!(kh(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||Df.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Mh=Df.mac?"metaKey":"ctrlKey";bh.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Ih(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Mh]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Oh(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new xh(e,o,t,n)):("doubleClick"==i?Rh:wh)(e,o.pos,o.inside,t)?t.preventDefault():Sh(e,"pointer"))};var xh=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Mh],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Df.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Sh(e,"pointer")};function kh(e,t){return!!e.composing||!!(Df.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}xh.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xh.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Oh(e))),this.allowDefault||!t?Sh(this.view,"pointer"):Dh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||Df.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Df.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Ah(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Sh(this.view,"pointer")}},xh.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Sh(this.view,"pointer"),0==e.buttons&&this.done()},bh.touchdown=function(e){Ih(e),Sh(e,"pointer")},bh.contextmenu=function(e){return Ih(e)};var Lh=Df.android?5e3:-1;function Ph(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return Uh(e)}),t))}function Bh(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function Uh(e,t){if(e.domObserver.forceFlush(),Bh(e),t||e.docView.dirty){var n=km(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}yh.compositionstart=yh.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),Uh(e,!0),e.markCursor=null;else if(Uh(e),Df.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}Ph(e,Lh)},yh.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,Ph(e,20))};var Fh=Df.ie&&Df.ie_version<15||Df.ios&&Df.webkit_version<604;function zh(e,t,n,r){var i=ch(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}bh.copy=yh.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=Fh?null:t.clipboardData,o=lh(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},yh.paste=function(e,t){var n=Fh?null:t.clipboardData;n&&zh(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?zh(e,r.value,null,t):zh(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var jh=function(e,t){this.slice=e,this.move=t},Gh=Df.mac?"altKey":"ctrlKey";for(var Yh in bh.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Oh(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=lh(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Fh?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Fh||t.dataTransfer.setData("text/plain",c),e.dragging=new jh(a,!t[Gh])}},bh.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},yh.dragover=yh.dragenter=function(e,t){return t.preventDefault()},yh.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Oh(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=ch(e,t.dataTransfer.getData(Fh?"Text":"text/plain"),Fh?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[Gh];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(Ym(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},bh.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&Pm(e)}),20))},bh.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},bh.beforeinput=function(e,t){if(Df.chrome&&Df.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,Vf(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},yh)bh[Yh]=yh[Yh];function Vh(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Hh=function(e,t){this.spec=t||Xh,this.side=this.spec.side||0,this.toDOM=e};Hh.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Wh(o-n,o-n,this)},Hh.prototype.valid=function(){return!0},Hh.prototype.eq=function(e){return this==e||e instanceof Hh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vh(this.spec,e.spec))};var qh=function(e,t){this.spec=t||Xh,this.attrs=e};qh.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Wh(i,o,this)},qh.prototype.valid=function(e,t){return t.from<t.to},qh.prototype.eq=function(e){return this==e||e instanceof qh&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)},qh.is=function(e){return e.type instanceof qh};var $h=function(e,t){this.spec=t||Xh,this.attrs=e};$h.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Wh(i.pos-n,o.pos-n,this)},$h.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},$h.prototype.eq=function(e){return this==e||e instanceof $h&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)};var Wh=function(e,t,n){this.from=e,this.to=t,this.type=n},Qh={spec:{configurable:!0},inline:{configurable:!0}};Wh.prototype.copy=function(e,t){return new Wh(e,t,this.type)},Wh.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Wh.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Wh.widget=function(e,t,n){return new Wh(e,e,new Hh(t,n))},Wh.inline=function(e,t,n,r){return new Wh(e,t,new qh(n,r))},Wh.node=function(e,t,n,r){return new Wh(e,t,new $h(n,r))},Qh.spec.get=function(){return this.type.spec},Qh.inline.get=function(){return this.type instanceof qh},Object.defineProperties(Wh.prototype,Qh);var Kh=[],Xh={},Zh=function(e,t){this.local=e&&e.length?e:Kh,this.children=t&&t.length?t:Kh};Zh.create=function(e,t){return t.length?ig(t,e,0,Xh):Jh},Zh.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},Zh.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},Zh.prototype.map=function(e,t,n){return this==Jh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Xh)},Zh.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Jh?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=ig(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new Zh(t&&t.sort(og),s)}(this.children,o,e,t,n,r,i):o?new Zh(o.sort(og)):Jh},Zh.prototype.add=function(e,t){return t.length?this==Jh?Zh.create(e,t):this.addInner(e,t,0):this},Zh.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=ng(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,ig(s,e,l+1,Xh)),o+=3}}));for(var a=tg(o?rg(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new Zh(a.length?this.local.concat(a).sort(og):this.local,r||this.children)},Zh.prototype.remove=function(e){return 0==e.length||this==Jh?this:this.removeInner(e,0)},Zh.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Jh?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Zh(r,n):Jh},Zh.prototype.forChild=function(e,t){if(this==Jh)return this;if(t.isLeaf)return Zh.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof qh){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new Zh(r.sort(og));return n?new eg([u,n]):u}return n||Jh},Zh.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof Zh)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},Zh.prototype.locals=function(e){return ag(this.localsInner(e))},Zh.prototype.localsInner=function(e){if(this==Jh)return Kh;if(e.inlineContent||!this.local.some(qh.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qh||t.push(this.local[n]);return t};var Jh=new Zh;Zh.empty=Jh,Zh.removeOverlap=ag;var eg=function(e){this.members=e};function tg(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Wh(i.from+t,i.to+t,i.type))}return n}function ng(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function rg(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ig(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=ng(e,t,a+n);if(s){o=!0;var l=ig(s,t,n+a+1,r);l!=Jh&&i.push(a,a+t.nodeSize,l)}}));for(var a=tg(o?rg(e):e,-n).sort(og),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new Zh(a,i):Jh}function og(e,t){return e.from-t.from||e.to-t.to}function ag(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),sg(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),sg(t,i+1,o.copy(r.to,o.to)))}}return t}function sg(e,t,n){for(;t<e.length&&og(n,e[t])>0;)t++;e.splice(t,0,n)}function lg(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Jh&&t.push(r)})),e.cursorWrapper&&t.push(Zh.create(e.state.doc,[e.cursorWrapper.deco])),eg.from(t)}eg.prototype.forChild=function(e,t){if(t.isLeaf)return Zh.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Jh&&(i instanceof eg?n=n.concat(i.members):n.push(i))}return eg.from(n)},eg.prototype.eq=function(e){if(!(e instanceof eg)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},eg.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ag(n?t:t.sort(og)):Kh},eg.from=function(e){switch(e.length){case 0:return Jh;case 1:return e[0];default:return new eg(e)}};var cg=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=fg(this),this.markCursor=null,this.cursorWrapper=null,pg(this),this.nodeViews=mg(this),this.docView=Em(this.state.doc,ug(this),lg(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new vh(e,(function(t,n,r,i){return oh(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=bh[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Nh(e,t)||!e.editable&&t.type in yh||n(e,t)})};for(var n in bh)t(n);Df.safari&&e.dom.addEventListener("input",(function(){return null})),Th(e)}(this),this.pluginViews=[],this.updatePluginViews()},dg={props:{configurable:!0},root:{configurable:!0}};function ug(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Wh.node(0,e.state.doc.content.size,t)]}function pg(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Wh.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function fg(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function mg(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}dg.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},cg.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Th(this),this._props=e,this.updateStateInner(e.state,!0)},cg.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},cg.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},cg.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(Bh(this),o=!0),this.state=e,t){var a=mg(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Th(this)}this.editable=fg(this),pg(this);var s=lg(this),l=ug(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:Qf(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(Df.ie||Df.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=Df.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Em(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Uf(p.node,p.offset,f.anchorNode,f.anchorOffset)))?Pm(this,T):(jm(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Wf(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Wf(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,Kf(b,0==y?0:y-E))},cg.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},cg.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},cg.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},cg.prototype.hasFocus=function(){return this.root.activeElement==this.dom},cg.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Xf)return e.focus(Xf);var t=Qf(e);e.focus(null==Xf?{get preventScroll(){return Xf={preventScroll:!0},!0}}:void 0),Xf||(Xf=!1,Kf(t,0))}(this.dom),Pm(this),this.domObserver.start()},dg.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},cg.prototype.posAtCoords=function(e){return em(this,e)},cg.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),rm(this,e,t)},cg.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},cg.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},cg.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},cg.prototype.endOfTextblock=function(e,t){return um(this,t||this.state,e)},cg.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],lg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},cg.prototype.dispatchEvent=function(e){return function(e,t){Nh(e,t)||!bh[t.type]||!e.editable&&t.type in yh||bh[t.type](e,t)}(this,e)},cg.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(cg.prototype,dg);var hg=function({editor:e,char:t="@",allowSpaces:n=!1,startOfLine:r=!1,decorationTag:i="span",decorationClass:o="suggestion",command:a=(()=>null),items:s=(()=>[]),render:l=(()=>({})),allow:c=(()=>!0)}){const d=null==l?void 0:l();return new vt({key:new yt("suggestion"),view(){return{update:async(t,n)=>{var r,i,o,l,c;const u=null===(r=this.key)||void 0===r?void 0:r.getState(n),p=null===(i=this.key)||void 0===i?void 0:i.getState(t.state),f=u.active&&p.active&&u.range.from!==p.range.from,m=!u.active&&p.active,h=u.active&&!p.active,g=m||f,_=!m&&!h&&u.query!==p.query&&!f,v=h||f;if(!g&&!_&&!v)return;const E=v?u:p,b=document.querySelector(`[data-decoration-id="${E.decorationId}"]`),y={editor:e,range:E.range,query:E.query,text:E.text,items:_||g?await s(E.query):[],command:t=>{a({editor:e,range:E.range,props:t})},decorationNode:b,clientRect:b?()=>b.getBoundingClientRect():null};v&&(null===(o=null==d?void 0:d.onExit)||void 0===o||o.call(d,y)),_&&(null===(l=null==d?void 0:d.onUpdate)||void 0===l||l.call(d,y)),g&&(null===(c=null==d?void 0:d.onStart)||void 0===c||c.call(d,y))}}},state:{init:()=>({active:!1,range:{},query:null,text:null}),apply(i,o){const{selection:a}=i,s={...o};if(a.from===a.to){(a.from<o.range.from||a.from>o.range.to)&&(s.active=!1);const i=function(e){const{char:t,allowSpaces:n,startOfLine:r,$position:i}=e;if(i.depth<=0)return null;const o="\\"+t,a=new RegExp(`\\s${o}$`),s=r?"^":"",l=n?new RegExp(`${s}${o}.*?(?=\\s${o}|$)`,"gm"):new RegExp(`${s}(?:^)?${o}[^\\s${o}]*`,"gm"),c=i.before(),d=i.pos,u=i.doc.textBetween(c,d,"\0","\0"),p=Array.from(u.matchAll(l)).pop();if(!p||void 0===p.input||void 0===p.index)return null;const f=p.input.slice(Math.max(0,p.index-1),p.index);if(!/^[\s\0]?$/.test(f))return null;const m=p.index+i.start();let h=m+p[0].length;return n&&a.test(u.slice(h-1,h+1))&&(p[0]+=" ",h+=1),m<i.pos&&h>=i.pos?{range:{from:m,to:h},query:p[0].slice(t.length),text:p[0]}:null}({char:t,allowSpaces:n,startOfLine:r,$position:a.$from}),l="id_"+Math.floor(4294967295*Math.random());i&&c({editor:e,range:i.range})?(s.active=!0,s.decorationId=o.decorationId?o.decorationId:l,s.range=i.range,s.query=i.query,s.text=i.text):s.active=!1}else s.active=!1;return s.active||(s.decorationId=null,s.range={},s.query=null,s.text=null),s}},props:{handleKeyDown(e,t){var n;const{active:r,range:i}=this.getState(e.state);return r&&(null===(n=null==d?void 0:d.onKeyDown)||void 0===n?void 0:n.call(d,{view:e,event:t,range:i}))||!1},decorations(e){const{active:t,range:n,decorationId:r}=this.getState(e);return t?Zh.create(e.doc,[Wh.inline(n.from,n.to,{nodeName:i,class:o,"data-decoration-id":r})]):null}}})};function gg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gg(Object(n),!0).forEach((function(t){vg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Eg=xo.create({name:"mention",defaultOptions:{suggestion:{char:"/",startOfLine:!1,command:function(e){var t=e.editor,n=e.range;e.props.command({editor:t,range:n})}}},addProseMirrorPlugins:function(){return[hg(_g({editor:this.editor},this.options.suggestion))]}}),bg=n(2),yg=n.n(bg),Sg=n(5),Tg=n.n(Sg),Ng=n(21),Og={insert:"head",singleton:!1};Tg()(Ng.a,Og),Ng.a.locals;function Cg(e){return(Cg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ag(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dg(e,t){return(Dg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Rg(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ig(e);if(t){var i=Ig(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wg(this,n)}}function wg(e,t){return!t||"object"!==Cg(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ig(e){return(Ig=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mg=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Dg(e,t)}(a,e);var t,n,r,o=Rg(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=o.call(this,e)).state={selectedIndex:0},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e){this.props.items!==e.items&&this.setState({selectedIndex:0})}},{key:"onKeyDown",value:function(e){var t=e.event;return"ArrowUp"===t.key?(this.upHandler(),!0):"ArrowDown"===t.key?(this.downHandler(),!0):"Enter"===t.key&&(this.enterHandler(),!0)}},{key:"upHandler",value:function(){this.setState({selectedIndex:(this.state.selectedIndex+this.props.items.length-1)%this.props.items.length})}},{key:"downHandler",value:function(){this.setState({selectedIndex:(this.state.selectedIndex+1)%this.props.items.length})}},{key:"enterHandler",value:function(){this.selectItem(this.state.selectedIndex)}},{key:"selectItem",value:function(e){var t=this.props.items[e];if(t){var n=this.props,r=n.editor,i=n.range;t.command({editor:r,range:i})}}},{key:"render",value:function(){var e=this;return i.a.createElement("div",{className:"relative py-2 overflow-hidden bg-gray-900 rounded shadow"},this.props.items.map((function(t,n){return i.a.createElement(xg,{key:t.title,item:t,index:n,selectedIndex:e.state.selectedIndex,selectItem:e.selectItem})})))}}])&&Ag(t.prototype,n),r&&Ag(t,r),a}(i.a.Component),xg=function(e){var t=e.item,n=e.selectedIndex,r=e.index,o=e.selectItem,a=t.Icon;return i.a.createElement("div",{className:yg()("flex items-center w-full px-4 py-2 space-x-4 transition-all duration-100",{"bg-gray-800":r===n}),onClick:function(){return o(r)}},a&&i.a.createElement("div",{className:"p-1 text-gray-100 bg-gray-800 rounded-sm"},i.a.createElement(a,{size:18})),i.a.createElement("div",{className:"flex flex-col text-gray-100"},i.a.createElement("span",{className:"text-sm font-semibold"},t.title),i.a.createElement("span",{className:"text-xs text-gray-300"},t.description)))},kg=Mg,Lg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pg=i.a.createContext&&i.a.createContext(Lg),Bg=function(){return(Bg=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Ug=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Fg(e){return function(t){return i.a.createElement(zg,Bg({attr:Bg({},e.attr)},t),function e(t){return t&&t.map((function(t,n){return i.a.createElement(t.tag,Bg({key:n},t.attr),e(t.child))}))}(e.child))}}function zg(e){var t=function(t){var n,r=e.attr,o=e.size,a=e.title,s=Ug(e,["attr","size","title"]),l=o||t.size||"1em";return t.className&&(n=t.className),e.className&&(n=(n?n+" ":"")+e.className),i.a.createElement("svg",Bg({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,s,{className:n,style:Bg(Bg({color:e.color||t.color},t.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),a&&i.a.createElement("title",null,a),e.children)};return void 0!==Pg?i.a.createElement(Pg.Consumer,null,(function(e){return t(e)})):t(Lg)}function jg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.667 3h6.666C10.253 3 11 3.746 11 4.667v6.666c0 .92-.746 1.667-1.667 1.667H2.667C1.747 13 1 12.254 1 11.333V4.667C1 3.747 1.746 3 2.667 3z"}},{tag:"path",attr:{d:"M7.404 8.697l6.363 3.692c.54.313 1.233-.066 1.233-.697V4.308c0-.63-.693-1.01-1.233-.696L7.404 7.304a.802.802 0 000 1.393z"}}]})(e)}function Gg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M2 3.5a.5.5 0 01.5-.5h11a.5.5 0 010 1h-11a.5.5 0 01-.5-.5zm5 3a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5zm0 3a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5zm-5 3a.5.5 0 01.5-.5h11a.5.5 0 010 1h-11a.5.5 0 01-.5-.5z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M3.734 6.352a6.586 6.586 0 00-.445.275 1.94 1.94 0 00-.346.299 1.38 1.38 0 00-.252.369c-.058.129-.1.295-.123.498h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 01-.187.463c-.12.14-.289.21-.503.21-.336 0-.577-.108-.721-.327C2.072 8.619 2 8.328 2 7.969c0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352zm2.168 0a6.588 6.588 0 00-.445.275 1.94 1.94 0 00-.346.299c-.113.12-.199.246-.257.375a1.75 1.75 0 00-.118.492h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 01-.187.463c-.12.14-.289.21-.504.21-.335 0-.576-.108-.72-.327-.145-.223-.217-.514-.217-.873 0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352z"}}]})(e)}function Yg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M14.5 3h-13a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5zm-13-1A1.5 1.5 0 000 3.5v9A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-9A1.5 1.5 0 0014.5 2h-13z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M10.648 7.646a.5.5 0 01.577-.093L15.002 9.5V13h-14v-1l2.646-2.354a.5.5 0 01.63-.062l2.66 1.773 3.71-3.71z"}},{tag:"path",attr:{fillRule:"evenodd",d:"M4.502 7a1.5 1.5 0 100-3 1.5 1.5 0 000 3z",clipRule:"evenodd"}}]})(e)}function Vg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M14.5 3h-13a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5zm-13-1A1.5 1.5 0 000 3.5v9A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-9A1.5 1.5 0 0014.5 2h-13z",clipRule:"evenodd"}},{tag:"path",attr:{fillRule:"evenodd",d:"M3 5.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zM3 8a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9A.5.5 0 013 8zm0 2.5a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5z",clipRule:"evenodd"}}]})(e)}function Hg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M4.854 4.146a.5.5 0 010 .708L1.707 8l3.147 3.146a.5.5 0 01-.708.708l-3.5-3.5a.5.5 0 010-.708l3.5-3.5a.5.5 0 01.708 0zm6.292 0a.5.5 0 000 .708L14.293 8l-3.147 3.146a.5.5 0 00.708.708l3.5-3.5a.5.5 0 000-.708l-3.5-3.5a.5.5 0 00-.708 0zm-.999-3.124a.5.5 0 01.33.625l-4 13a.5.5 0 01-.955-.294l4-13a.5.5 0 01.625-.33z",clipRule:"evenodd"}}]})(e)}function qg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 11.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M1.713 11.865v-.474H2c.217 0 .363-.137.363-.317 0-.185-.158-.31-.361-.31-.223 0-.367.152-.373.31h-.59c.016-.467.373-.787.986-.787.588-.002.954.291.957.703a.595.595 0 01-.492.594v.033a.615.615 0 01.569.631c.003.533-.502.8-1.051.8-.656 0-1-.37-1.008-.794h.582c.008.178.186.306.422.309.254 0 .424-.145.422-.35-.002-.195-.155-.348-.414-.348h-.3zm-.004-4.699h-.604v-.035c0-.408.295-.844.958-.844.583 0 .96.326.96.756 0 .389-.257.617-.476.848l-.537.572v.03h1.054V9H1.143v-.395l.957-.99c.138-.142.293-.304.293-.508 0-.18-.147-.32-.342-.32a.33.33 0 00-.342.338v.041zM2.564 5h-.635V2.924h-.031l-.598.42v-.567l.629-.443h.635V5z"}}]})(e)}function $g(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 11.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm-3 1a1 1 0 100-2 1 1 0 000 2zm0 4a1 1 0 100-2 1 1 0 000 2zm0 4a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}}]})(e)}function Wg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.637 13V3.669H7.379V7.62H2.758V3.67H1.5V13h1.258V8.728h4.62V13h1.259zm5.329 0V3.669h-1.244L10.5 5.316v1.265l2.16-1.565h.062V13h1.244z"}}]})(e)}function Qg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.638 13V3.669H6.38V7.62H1.759V3.67H.5V13h1.258V8.728h4.62V13h1.259zm3.022-6.733v-.048c0-.889.63-1.668 1.716-1.668.957 0 1.675.608 1.675 1.572 0 .855-.554 1.504-1.067 2.085l-3.513 3.999V13H15.5v-1.094h-4.245v-.075l2.481-2.844c.875-.998 1.586-1.784 1.586-2.953 0-1.463-1.155-2.556-2.919-2.556-1.941 0-2.966 1.326-2.966 2.74v.049h1.223z"}}]})(e)}var Kg=Eg.configure({HTMLAttributes:{class:"commands"},suggestion:{items:function(e){return[{title:"Paragraph",description:"Add a plain text block",Icon:Vg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("paragraph").run()}},{title:"H1",description:"Add a big heading",Icon:Wg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("heading",{level:1}).run()}},{title:"H2",description:"Add a sub-heading",Icon:Qg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("heading",{level:2}).run()}},{title:"Numbered list",description:"Add a list with numbering",Icon:qg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleOrderedList().run()}},{title:"Bulleted list",description:"Add an list bullets",Icon:$g,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleBulletList().run()}},{title:"Blockquote",description:"Add a quote",Icon:Gg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleBlockquote().run()}},{title:"Image",description:"Add an image",Icon:Yg,command:function(e){var t=e.editor,n=e.range;Af.showImageUpload=!0,Af.range=n,t.chain().focus().deleteRange(n).run()}},{title:"Youtube/Vimeo",description:"Embed a video from major services",Icon:jg,command:function(e){var t=e.editor,n=e.range,r=prompt("Please enter Youtube/Vimeo embed URL");t.chain().focus().deleteRange(n).setExternalVideo({src:r}).run()}},{title:"Code block",description:"Add a code block with syntax highlighting",Icon:Hg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleCodeBlock().run()}}].filter((function(t){return t.title.toLowerCase().startsWith(e.toLowerCase())})).slice(0,10)},render:function(){var e,t;return{onStart:function(n){e=new ec(kg,{props:n,editor:n.editor}),t=Gl("body",{getReferenceClientRect:n.clientRect,appendTo:function(){return document.body},content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:function(n){e.updateProps(n),t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:function(t){var n;return null===(n=e.ref)||void 0===n?void 0:n.onKeyDown(t)},onExit:function(){t[0].destroy(),e.destroy()}}}}});const Xg=/^```(?<language>[a-z]*)? $/,Zg=/^~~~(?<language>[a-z]*)? $/;var Jg=ja.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{var t;const n=null===(t=e.firstElementChild)||void 0===t?void 0:t.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:e}){return["pre",this.options.HTMLAttributes,["code",e,0]]},addCommands:()=>({setCodeBlock:e=>({commands:t})=>t.setNode("codeBlock",e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode("codeBlock","paragraph",e)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[xi(Xg,this.type,({groups:e})=>e),xi(Zg,this.type,({groups:e})=>e)]}}),e_={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var t_=/Edge\/(\d+)/.exec(navigator.userAgent),n_=/MSIE \d/.test(navigator.userAgent),r_=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);e_.mac=/Mac/.test(navigator.platform);var i_=e_.ie=!!(n_||r_||t_);e_.ie_version=n_?document.documentMode||6:r_?+r_[1]:t_?+t_[1]:null,e_.gecko=!i_&&/gecko\/(\d+)/i.test(navigator.userAgent),e_.gecko_version=e_.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var o_=!i_&&/Chrome\/(\d+)/.exec(navigator.userAgent);e_.chrome=!!o_,e_.chrome_version=o_&&+o_[1],e_.safari=!i_&&/Apple Computer/.test(navigator.vendor),e_.ios=e_.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),e_.android=/Android \d/.test(navigator.userAgent),e_.webkit="webkitFontSmoothing"in document.documentElement.style,e_.webkit_version=e_.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var a_=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},s_=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},l_=null,c_=function(e,t,n){var r=l_||(l_=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},d_=function(e,t,n,r){return n&&(p_(e,t,n,r,-1)||p_(e,t,n,r,1))},u_=/^(img|br|input|textarea|hr)$/i;function p_(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:f_(e))){var o=e.parentNode;if(1!=o.nodeType||m_(e)||u_.test(e.nodeName)||"false"==e.contentEditable)return!1;t=a_(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?f_(e):0}}}function f_(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function m_(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var h_=function(e){var t=e.isCollapsed;return t&&e_.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function g_(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function __(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function v_(e,t){return"number"==typeof e?e:e[t]}function E_(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function b_(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=s_(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?__(o):E_(a),c=0,d=0;if(t.top<l.top+v_(r,"top")?d=-(l.top-t.top+v_(i,"top")):t.bottom>l.bottom-v_(r,"bottom")&&(d=t.bottom-l.bottom+v_(i,"bottom")),t.left<l.left+v_(r,"left")?c=-(l.left-t.left+v_(i,"left")):t.right>l.right-v_(r,"right")&&(c=t.right-l.right+v_(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function y_(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=s_(e));return t}function S_(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var T_=null;function N_(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=c_(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=A_(r,1);if(o.top!=o.bottom&&O_(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:N_(n,r)}function O_(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function C_(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!O_(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(O_(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(e_.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(e_.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=N_(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function A_(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var D_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function R_(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=e_.webkit||e_.gecko;if(3==i.nodeType){if(!a||!D_.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,w_(A_(c_(i,s,l),c),c<0)}var d=A_(c_(i,o,o),n);if(e_.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=A_(c_(i,o-1,o-1),-1);if(u.top==d.top){var p=A_(c_(i,o,o+1),-1);if(p.top!=d.top)return w_(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==f_(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return I_(f.getBoundingClientRect(),!1)}if(o<f_(i)){var m=i.childNodes[o];if(1==m.nodeType)return I_(m.getBoundingClientRect(),!0)}return I_(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==f_(i))){var h=i.childNodes[o-1],g=3==h.nodeType?c_(h,f_(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return w_(A_(g,1),!1)}if(o<f_(i)){var _=i.childNodes[o],v=3==_.nodeType?c_(_,0,a?0:1):1==_.nodeType?_:null;if(v)return w_(A_(v,-1),!0)}return w_(A_(3==i.nodeType?c_(i):i,-n),n>=0)}function w_(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function I_(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function M_(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var x_=/[\u0590-\u08ac]/;var k_=null,L_=null,P_=!1;function B_(e,t,n){return k_==t&&L_==n?P_:(k_=t,L_=n,P_="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return M_(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=R_(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=c_(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return x_.test(r.parent.textContent)&&s.modify?M_(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var U_=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},F_={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};U_.prototype.matchesWidget=function(){return!1},U_.prototype.matchesMark=function(){return!1},U_.prototype.matchesNode=function(){return!1},U_.prototype.matchesHack=function(){return!1},F_.beforePosition.get=function(){return!1},U_.prototype.parseRule=function(){return null},U_.prototype.stopEvent=function(){return!1},F_.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},F_.border.get=function(){return 0},U_.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},U_.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},F_.posBefore.get=function(){return this.parent.posBeforeChild(this)},F_.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},F_.posAfter.get=function(){return this.posBefore+this.size},F_.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},U_.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>a_(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},U_.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},U_.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},U_.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},U_.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},U_.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?a_(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},U_.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=a_(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=a_(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},U_.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},U_.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},U_.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((e_.gecko||e_.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:a_(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(e_.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&e_.safari||!d_(d.node,d.offset,p.anchorNode,p.anchorOffset)||!d_(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},U_.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},F_.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},U_.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},U_.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},F_.domAtom.get=function(){return!1},Object.defineProperties(U_.prototype,F_);var z_=[],j_=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,z_,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(U_),G_=function(e){function t(t,n,r,i){e.call(this,t,z_,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(U_),Y_=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=ov(o,n,a,r)),e>0&&(o=ov(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(U_),V_=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?z_:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=ev(u,r,n),d?l=new W_(e,n,r,i,u,p,f,d,o,a+1):n.isText?new q_(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&tv(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new rv(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(iv);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():z_;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(z_,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=nv(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof Y_){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=nv(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),e_.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=f_(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new G_(this,o,n,i);e.compositionNodes.push(a),this.children=ov(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!tv(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Z_(this.dom,this.nodeDOM,X_(this.outerDeco,this.node,t),X_(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(U_);function H_(e,t,n,r,i){return ev(r,t,e),new V_(null,e,t,n,r,r,r,i,0)}var q_=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(V_),$_=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(U_),W_=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(V_);function Q_(e){e&&(this.nodeName=e)}Q_.prototype=Object.create(null);var K_=[new Q_];function X_(e,t,n){if(0==e.length)return K_;for(var r=n?K_[0]:new Q_,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new Q_(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new Q_(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Z_(e,t,n,r){if(n==K_&&r==K_)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=K_[0]),i=l}J_(i,s||K_[0],a)}return i}function J_(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):z_,a=n.class?n.class.split(" ").filter(Boolean):z_,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function ev(e,t,n){return Z_(e,e,K_,X_(t,n,1!=e.nodeType))}function tv(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function nv(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var rv=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function iv(e,t){return e.type.side-t.type.side}function ov(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function av(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(h_(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==f_(e);r||i;){if(e==n)return!0;var o=a_(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==f_(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=hv(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function sv(e){return e.editable?e.hasFocus():gv(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function lv(e,t){var n=e.state.selection;if(fv(e,n),sv(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,a_(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&e_.ie&&e_.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!cv||n instanceof nt||(n.$from.parent.inlineContent||(r=dv(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=dv(e,n.to))),e.docView.setSelection(o,a,e.root,t),cv&&(r&&pv(r),i&&pv(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){sv(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}rv.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},rv.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},rv.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=Y_.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},rv.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},rv.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof V_){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&tv(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},rv.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,V_.create(this.top,e,t,n,r,i)),this.changed=!0},rv.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new j_(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},rv.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof Y_;)e=e.children[e.children.length-1];if(!e||!(e instanceof q_)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new $_(this.top,z_,t,null)),this.changed=!0}};var cv=e_.safari||e_.chrome&&e_.chrome_version<63;function dv(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(e_.safari&&o&&"false"==o.contentEditable)return uv(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return uv(o);if(a)return uv(a)}}function uv(e){return e.contentEditable="true",e_.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function pv(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function fv(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(mv(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else mv(e)}function mv(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function hv(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function gv(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function _v(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function vv(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ev(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return vv(e,new nt(t>0?r.$to:r.$from));var i=_v(e.state,t);return!!i&&vv(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=_v(e.state,t);return!!(o&&o instanceof it)&&vv(e,o)}if(!(e_.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?vv(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!e_.webkit&&vv(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function bv(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function yv(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Sv(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(e_.gecko&&1==n.nodeType&&r<bv(n)&&yv(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(yv(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Nv(n))break;for(var l=n.previousSibling;l&&yv(l);)i=n.parentNode,o=a_(l),l=l.previousSibling;if(l)r=bv(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Ov(e,t,n,r):i&&Ov(e,t,i,o)}}function Tv(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=bv(n);;)if(r<a){if(1!=n.nodeType)break;if(!yv(n.childNodes[r]))break;i=n,o=++r}else{if(Nv(n))break;for(var s=n.nextSibling;s&&yv(s);)i=s.parentNode,o=a_(s)+1,s=s.nextSibling;if(s)r=0,a=bv(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Ov(e,t,i,o)}}function Nv(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ov(e,t,n,r){if(h_(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&lv(e)}),50)}function Cv(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(e_.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=_v(e.state,t);if(a&&a instanceof it)return vv(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&vv(e,l)}return!1}function Av(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Dv(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Rv(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||e_.mac&&72==n&&"c"==r?Av(e,-1)||Sv(e):46==n||e_.mac&&68==n&&"c"==r?Av(e,1)||Tv(e):13==n||27==n||(37==n?Ev(e,-1,r)||Sv(e):39==n?Ev(e,1,r)||Tv(e):38==n?Cv(e,-1,r)||Sv(e):40==n?function(e){if(e_.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Dv(e,i,!0),setTimeout((function(){return Dv(e,i,!1)}),20)}}}(e)||Cv(e,1,r)||Tv(e):r==(e_.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function wv(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(e_.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||e_.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function Iv(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=av(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],h_(c)||d.push({node:c.focusNode,offset:c.focusOffset})),e_.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:wv,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(e_.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((e_.ios&&e.lastIOSEnter>Date.now()-225||e_.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=Mv(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),e_.ie&&e_.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((e_.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||xv(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(xv(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||xv(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,g_(8,"Backspace"))})))e_.android&&e_.chrome&&e.domObserver.suppressSelectionUpdates();else{e_.chrome&&e_.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),e_.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)e_.ie&&e_.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return lv(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=Mv(e,O.doc,p.sel);M&&!(e_.chrome&&e_.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||e_.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function Mv(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:hv(e,t.resolve(n.anchor),t.resolve(n.head))}function xv(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function kv(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=zv(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=Uv[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function Lv(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=zv().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&Uv[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(Bv(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(Bv(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(Pv(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=Pv(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function Pv(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function Bv(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=Bv(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var Uv={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Fv=null;function zv(){return Fv||(Fv=document.implementation.createHTMLDocument("title"))}var jv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gv=e_.ie&&e_.ie_version<=11,Yv=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Yv.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},Yv.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var Vv=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);e_.ie&&e_.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new Yv,Gv&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};Vv.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},Vv.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},Vv.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,jv),Gv&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},Vv.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}Gv&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},Vv.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},Vv.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},Vv.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},Vv.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&gv(e)){var e;if(this.suppressingSelectionUpdates)return lv(this.view);if(e_.ie&&e_.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&d_(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},Vv.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},Vv.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},Vv.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&gv(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(e_.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(Hv)return;Hv=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||lv(this.view),this.currentSelection.set(t))}},Vv.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(e_.ie&&e_.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?a_(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?a_(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var Hv=!1;var qv={},$v={};function Wv(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function Qv(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Kv(e,t)})}))}function Kv(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Xv(e){return{left:e.clientX,top:e.clientY}}function Zv(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Jv(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function eE(e,t,n,r,i){return Zv(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Jv(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Jv(e,new it(n),"pointer"),!0)}(e,n))}function tE(e,t,n,r){return Zv(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function nE(e,t,n,r){return Zv(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Jv(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Jv(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Jv(e,it.create(n,a),"pointer")}return!0}}(e,n)}function rE(e){return dE(e)}$v.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!aE(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!e_.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||Rv(e,t)?t.preventDefault():Wv(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},$v.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},$v.keypress=function(e,t){if(!(aE(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||e_.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var iE=e_.mac?"metaKey":"ctrlKey";qv.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=rE(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[iE]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Xv(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new oE(e,o,t,n)):("doubleClick"==i?tE:nE)(e,o.pos,o.inside,t)?t.preventDefault():Wv(e,"pointer"))};var oE=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[iE],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&e_.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wv(e,"pointer")};function aE(e,t){return!!e.composing||!!(e_.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}oE.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},oE.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Xv(e))),this.allowDefault||!t?Wv(this.view,"pointer"):eE(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||e_.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||e_.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Jv(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Wv(this.view,"pointer")}},oE.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Wv(this.view,"pointer"),0==e.buttons&&this.done()},qv.touchdown=function(e){rE(e),Wv(e,"pointer")},qv.contextmenu=function(e){return rE(e)};var sE=e_.android?5e3:-1;function lE(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return dE(e)}),t))}function cE(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function dE(e,t){if(e.domObserver.forceFlush(),cE(e),t||e.docView.dirty){var n=av(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}$v.compositionstart=$v.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),dE(e,!0),e.markCursor=null;else if(dE(e),e_.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}lE(e,sE)},$v.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,lE(e,20))};var uE=e_.ie&&e_.ie_version<15||e_.ios&&e_.webkit_version<604;function pE(e,t,n,r){var i=Lv(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}qv.copy=$v.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=uE?null:t.clipboardData,o=kv(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},$v.paste=function(e,t){var n=uE?null:t.clipboardData;n&&pE(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?pE(e,r.value,null,t):pE(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var fE=function(e,t){this.slice=e,this.move=t},mE=e_.mac?"altKey":"ctrlKey";for(var hE in qv.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Xv(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=kv(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(uE?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",uE||t.dataTransfer.setData("text/plain",c),e.dragging=new fE(a,!t[mE])}},qv.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},$v.dragover=$v.dragenter=function(e,t){return t.preventDefault()},$v.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Xv(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=Lv(e,t.dataTransfer.getData(uE?"Text":"text/plain"),uE?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[mE];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(hv(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},qv.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&lv(e)}),20))},qv.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},qv.beforeinput=function(e,t){if(e_.chrome&&e_.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,g_(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},$v)qv[hE]=$v[hE];function gE(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var _E=function(e,t){this.spec=t||TE,this.side=this.spec.side||0,this.toDOM=e};_E.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new bE(o-n,o-n,this)},_E.prototype.valid=function(){return!0},_E.prototype.eq=function(e){return this==e||e instanceof _E&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gE(this.spec,e.spec))};var vE=function(e,t){this.spec=t||TE,this.attrs=e};vE.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new bE(i,o,this)},vE.prototype.valid=function(e,t){return t.from<t.to},vE.prototype.eq=function(e){return this==e||e instanceof vE&&gE(this.attrs,e.attrs)&&gE(this.spec,e.spec)},vE.is=function(e){return e.type instanceof vE};var EE=function(e,t){this.spec=t||TE,this.attrs=e};EE.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new bE(i.pos-n,o.pos-n,this)},EE.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},EE.prototype.eq=function(e){return this==e||e instanceof EE&&gE(this.attrs,e.attrs)&&gE(this.spec,e.spec)};var bE=function(e,t,n){this.from=e,this.to=t,this.type=n},yE={spec:{configurable:!0},inline:{configurable:!0}};bE.prototype.copy=function(e,t){return new bE(e,t,this.type)},bE.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},bE.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},bE.widget=function(e,t,n){return new bE(e,e,new _E(t,n))},bE.inline=function(e,t,n,r){return new bE(e,t,new vE(n,r))},bE.node=function(e,t,n,r){return new bE(e,t,new EE(n,r))},yE.spec.get=function(){return this.type.spec},yE.inline.get=function(){return this.type instanceof vE},Object.defineProperties(bE.prototype,yE);var SE=[],TE={},NE=function(e,t){this.local=e&&e.length?e:SE,this.children=t&&t.length?t:SE};NE.create=function(e,t){return t.length?wE(t,e,0,TE):OE},NE.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},NE.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},NE.prototype.map=function(e,t,n){return this==OE||0==e.maps.length?this:this.mapInner(e,t,0,0,n||TE)},NE.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=OE?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=wE(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new NE(t&&t.sort(IE),s)}(this.children,o,e,t,n,r,i):o?new NE(o.sort(IE)):OE},NE.prototype.add=function(e,t){return t.length?this==OE?NE.create(e,t):this.addInner(e,t,0):this},NE.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=DE(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,wE(s,e,l+1,TE)),o+=3}}));for(var a=AE(o?RE(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new NE(a.length?this.local.concat(a).sort(IE):this.local,r||this.children)},NE.prototype.remove=function(e){return 0==e.length||this==OE?this:this.removeInner(e,0)},NE.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=OE?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new NE(r,n):OE},NE.prototype.forChild=function(e,t){if(this==OE)return this;if(t.isLeaf)return NE.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof vE){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new NE(r.sort(IE));return n?new CE([u,n]):u}return n||OE},NE.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof NE)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},NE.prototype.locals=function(e){return ME(this.localsInner(e))},NE.prototype.localsInner=function(e){if(this==OE)return SE;if(e.inlineContent||!this.local.some(vE.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof vE||t.push(this.local[n]);return t};var OE=new NE;NE.empty=OE,NE.removeOverlap=ME;var CE=function(e){this.members=e};function AE(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new bE(i.from+t,i.to+t,i.type))}return n}function DE(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function RE(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function wE(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=DE(e,t,a+n);if(s){o=!0;var l=wE(s,t,n+a+1,r);l!=OE&&i.push(a,a+t.nodeSize,l)}}));for(var a=AE(o?RE(e):e,-n).sort(IE),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new NE(a,i):OE}function IE(e,t){return e.from-t.from||e.to-t.to}function ME(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),xE(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),xE(t,i+1,o.copy(r.to,o.to)))}}return t}function xE(e,t,n){for(;t<e.length&&IE(n,e[t])>0;)t++;e.splice(t,0,n)}function kE(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=OE&&t.push(r)})),e.cursorWrapper&&t.push(NE.create(e.state.doc,[e.cursorWrapper.deco])),CE.from(t)}CE.prototype.forChild=function(e,t){if(t.isLeaf)return NE.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=OE&&(i instanceof CE?n=n.concat(i.members):n.push(i))}return CE.from(n)},CE.prototype.eq=function(e){if(!(e instanceof CE)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},CE.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ME(n?t:t.sort(IE)):SE},CE.from=function(e){switch(e.length){case 0:return OE;case 1:return e[0];default:return new CE(e)}};var LE=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=FE(this),this.markCursor=null,this.cursorWrapper=null,UE(this),this.nodeViews=zE(this),this.docView=H_(this.state.doc,BE(this),kE(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new Vv(e,(function(t,n,r,i){return Iv(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=qv[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Kv(e,t)||!e.editable&&t.type in $v||n(e,t)})};for(var n in qv)t(n);e_.safari&&e.dom.addEventListener("input",(function(){return null})),Qv(e)}(this),this.pluginViews=[],this.updatePluginViews()},PE={props:{configurable:!0},root:{configurable:!0}};function BE(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[bE.node(0,e.state.doc.content.size,t)]}function UE(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:bE.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function FE(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function zE(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}function jE(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];"object"!=typeof n||Object.isFrozen(n)||jE(n)})),e}PE.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},LE.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Qv(this),this._props=e,this.updateStateInner(e.state,!0)},LE.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},LE.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},LE.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(cE(this),o=!0),this.state=e,t){var a=zE(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Qv(this)}this.editable=FE(this),UE(this);var s=kE(this),l=BE(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:y_(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(e_.ie||e_.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=e_.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=H_(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),d_(p.node,p.offset,f.anchorNode,f.anchorOffset)))?lv(this,T):(fv(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?b_(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):b_(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,S_(b,0==y?0:y-E))},LE.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},LE.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},LE.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},LE.prototype.hasFocus=function(){return this.root.activeElement==this.dom},LE.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(T_)return e.focus(T_);var t=y_(e);e.focus(null==T_?{get preventScroll(){return T_={preventScroll:!0},!0}}:void 0),T_||(T_=!1,S_(t,0))}(this.dom),lv(this),this.domObserver.start()},PE.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},LE.prototype.posAtCoords=function(e){return C_(this,e)},LE.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),R_(this,e,t)},LE.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},LE.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},LE.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},LE.prototype.endOfTextblock=function(e,t){return B_(this,t||this.state,e)},LE.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},LE.prototype.dispatchEvent=function(e){return function(e,t){Kv(e,t)||!qv[t.type]||!e.editable&&t.type in $v||qv[t.type](e,t)}(this,e)},LE.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(LE.prototype,PE);var GE=jE,YE=jE;GE.default=YE;class VE{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function HE(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qE(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const $E=e=>!!e.kind;class WE{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=HE(e)}openNode(e){if(!$E(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){$E(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class QE{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{QE._collapse(e)}))}}class KE extends QE{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){return new WE(this,this.options).value()}finalize(){return!0}}function XE(e){return e?"string"==typeof e?e:e.source:null}const ZE=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;const JE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",eb={begin:"\\\\[\\s\\S]",relevance:0},tb={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[eb]},nb={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[eb]},rb={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ib=function(e,t,n={}){const r=qE({className:"comment",begin:e,end:t,contains:[]},n);return r.contains.push(rb),r.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),r},ob=ib("//","$"),ab=ib("/\\*","\\*/"),sb=ib("#","$"),lb={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},cb={className:"number",begin:JE,relevance:0},db={className:"number",begin:"\\b(0b[01]+)",relevance:0},ub={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},pb={begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[eb,{begin:/\[/,end:/\]/,relevance:0,contains:[eb]}]}]},fb={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},mb={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},hb={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var gb=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:JE,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=function(...e){return e.map(e=>XE(e)).join("")}(t,/.*\b/,e.binary,/\b.*/)),qE({className:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:eb,APOS_STRING_MODE:tb,QUOTE_STRING_MODE:nb,PHRASAL_WORDS_MODE:rb,COMMENT:ib,C_LINE_COMMENT_MODE:ob,C_BLOCK_COMMENT_MODE:ab,HASH_COMMENT_MODE:sb,NUMBER_MODE:lb,C_NUMBER_MODE:cb,BINARY_NUMBER_MODE:db,CSS_NUMBER_MODE:ub,REGEXP_MODE:pb,TITLE_MODE:fb,UNDERSCORE_TITLE_MODE:mb,METHOD_GUARD:hb,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})}});function _b(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function vb(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=_b,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function Eb(e,t){Array.isArray(e.illegal)&&(e.illegal=function(...e){return"("+e.map(e=>XE(e)).join("|")+")"}(...e.illegal))}function bb(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function yb(e,t){void 0===e.relevance&&(e.relevance=1)}const Sb=["of","and","for","in","not","or","if","then","parent","list","value"];function Tb(e,t){return t?Number(t):function(e){return Sb.includes(e.toLowerCase())}(e)?0:1}function Nb(e,{plugins:t}){function n(t,n){return new RegExp(XE(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class r{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=function(e){return new RegExp(e.toString()+"|").exec("").length-1}(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=n(function(e,t="|"){let n=0;return e.map(e=>{n+=1;const t=n;let r=XE(e),i="";for(;r.length>0;){const e=ZE.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}(e),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new r;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=qE(e.classNameAliases||{}),function t(r,o){const a=r;if(r.isCompiled)return a;[bb].forEach(e=>e(r,o)),e.compilerExtensions.forEach(e=>e(r,o)),r.__beforeBegin=null,[vb,Eb,yb].forEach(e=>e(r,o)),r.isCompiled=!0;let s=null;if("object"==typeof r.keywords&&(s=r.keywords.$pattern,delete r.keywords.$pattern),r.keywords&&(r.keywords=function e(t,n,r="keyword"){const i={};return"string"==typeof t?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach((function(r){Object.assign(i,e(t[r],n,r))})),i;function o(e,t){n&&(t=t.map(e=>e.toLowerCase())),t.forEach((function(t){const n=t.split("|");i[n[0]]=[e,Tb(n[0],n[1])]}))}}(r.keywords,e.case_insensitive)),r.lexemes&&s)throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return s=s||r.lexemes||/\w+/,a.keywordPatternRe=n(s,!0),o&&(r.begin||(r.begin=/\B|\b/),a.beginRe=n(r.begin),r.endSameAsBegin&&(r.end=r.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),r.end&&(a.endRe=n(r.end)),a.terminatorEnd=XE(r.end)||"",r.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(r.end?"|":"")+o.terminatorEnd)),r.illegal&&(a.illegalRe=n(r.illegal)),r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return qE(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(e))return qE(e,{starts:e.starts?qE(e.starts):null});if(Object.isFrozen(e))return qE(e);return e}("self"===e?r:e)}))),r.contains.forEach((function(e){t(e,a)})),r.starts&&t(r.starts,o),a.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(a),a}(e)}function Ob(e){const t={props:["language","code","autodetect"],data:function(){return{detectedLanguage:"",unknownLanguage:!1}},computed:{className(){return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){if(!this.autoDetect&&!e.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`),this.unknownLanguage=!0,HE(this.code);let t={};return this.autoDetect?(t=e.highlightAuto(this.code),this.detectedLanguage=t.language):(t=e.highlight(this.language,this.code,this.ignoreIllegals),this.detectedLanguage=this.language),t.value},autoDetect(){return!this.language||(e=this.autodetect,Boolean(e||""===e));var e},ignoreIllegals:()=>!0},render(e){return e("pre",{},[e("code",{class:this.className,domProps:{innerHTML:this.highlighted}})])}};return{Component:t,VuePlugin:{install(e){e.component("highlightjs",t)}}}}const Cb={"after:highlightElement":({el:e,result:t,text:n})=>{const r=Db(e);if(!r.length)return;const i=document.createElement("div");i.innerHTML=t.value,t.value=function(e,t,n){let r=0,i="";const o=[];function a(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function s(e){i+="<"+Ab(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+HE(e.value)+'"'})).join("")+">"}function l(e){i+="</"+Ab(e)+">"}function c(e){("start"===e.event?s:l)(e.node)}for(;e.length||t.length;){let t=a();if(i+=HE(n.substring(r,t[0].offset)),r=t[0].offset,t===e){o.reverse().forEach(l);do{c(t.splice(0,1)[0]),t=a()}while(t===e&&t.length&&t[0].offset===r);o.reverse().forEach(s)}else"start"===t[0].event?o.push(t[0].node):o.pop(),c(t.splice(0,1)[0])}return i+HE(n.substr(r))}(r,Db(i),n)}};function Ab(e){return e.nodeName.toLowerCase()}function Db(e){const t=[];return function e(n,r){for(let i=n.firstChild;i;i=i.nextSibling)3===i.nodeType?r+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:r,node:i}),r=e(i,r),Ab(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:r,node:i}));return r}(e,0),t}const Rb={},wb=e=>{console.error(e)},Ib=(e,...t)=>{console.log("WARN: "+e,...t)},Mb=(e,t)=>{Rb[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Rb[`${e}/${t}`]=!0)},xb=HE,kb=qE,Lb=Symbol("nomatch");var Pb=function(e){const t=Object.create(null),n=Object.create(null),r=[];let i=!0;const o=/(^(<[^>]+>|\t|)+|\n)/gm,a="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let l={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:KE};function c(e){return l.noHighlightRe.test(e)}function d(e,t,n,r){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language,r=void 0):(Mb("10.7.0","highlight(lang, code, ...args) has been deprecated."),Mb("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t);const a={code:i,language:o};T("before:highlight",a);const s=a.result?a.result:u(a.language,a.code,n,r);return s.code=a.code,T("after:highlight",s),s}function u(e,n,o,s){function c(e,t){const n=E.case_insensitive?t[0].toLowerCase():t[0];return Object.prototype.hasOwnProperty.call(e.keywords,n)&&e.keywords[n]}function d(){null!=T.subLanguage?function(){if(""===C)return;let e=null;if("string"==typeof T.subLanguage){if(!t[T.subLanguage])return void O.addText(C);e=u(T.subLanguage,C,!0,N[T.subLanguage]),N[T.subLanguage]=e.top}else e=p(C,T.subLanguage.length?T.subLanguage:null);T.relevance>0&&(A+=e.relevance),O.addSublanguage(e.emitter,e.language)}():function(){if(!T.keywords)return void O.addText(C);let e=0;T.keywordPatternRe.lastIndex=0;let t=T.keywordPatternRe.exec(C),n="";for(;t;){n+=C.substring(e,t.index);const r=c(T,t);if(r){const[e,i]=r;if(O.addText(n),n="",A+=i,e.startsWith("_"))n+=t[0];else{const n=E.classNameAliases[e]||e;O.addKeyword(t[0],n)}}else n+=t[0];e=T.keywordPatternRe.lastIndex,t=T.keywordPatternRe.exec(C)}n+=C.substr(e),O.addText(n)}(),C=""}function f(e){return e.className&&O.openNode(E.classNameAliases[e.className]||e.className),T=Object.create(e,{parent:{value:T}}),T}function m(e){return 0===T.matcher.regexIndex?(C+=e[0],1):(w=!0,0)}function h(e){const t=e[0],n=e.rule,r=new VE(n),i=[n.__beforeBegin,n["on:begin"]];for(const n of i)if(n&&(n(e,r),r.isMatchIgnored))return m(t);return n&&n.endSameAsBegin&&(n.endRe=new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")),n.skip?C+=t:(n.excludeBegin&&(C+=t),d(),n.returnBegin||n.excludeBegin||(C=t)),f(n),n.returnBegin?0:t.length}function g(e){const t=e[0],r=n.substr(e.index),i=function e(t,n,r){let i=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(t.endRe,r);if(i){if(t["on:end"]){const e=new VE(t);t["on:end"](n,e),e.isMatchIgnored&&(i=!1)}if(i){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,n,r)}(T,e,r);if(!i)return Lb;const o=T;o.skip?C+=t:(o.returnEnd||o.excludeEnd||(C+=t),d(),o.excludeEnd&&(C=t));do{T.className&&O.closeNode(),T.skip||T.subLanguage||(A+=T.relevance),T=T.parent}while(T!==i.parent);return i.starts&&(i.endSameAsBegin&&(i.starts.endRe=i.endRe),f(i.starts)),o.returnEnd?0:t.length}let _={};function v(t,r){const a=r&&r[0];if(C+=t,null==a)return d(),0;if("begin"===_.type&&"end"===r.type&&_.index===r.index&&""===a){if(C+=n.slice(r.index,r.index+1),!i){const t=new Error("0 width match regex");throw t.languageName=e,t.badRule=_.rule,t}return 1}if(_=r,"begin"===r.type)return h(r);if("illegal"===r.type&&!o){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(T.className||"<unnamed>")+'"');throw e.mode=T,e}if("end"===r.type){const e=g(r);if(e!==Lb)return e}if("illegal"===r.type&&""===a)return 1;if(R>1e5&&R>3*r.index){throw new Error("potential infinite loop, way more iterations than matches")}return C+=a,a.length}const E=b(e);if(!E)throw wb(a.replace("{}",e)),new Error('Unknown language: "'+e+'"');const y=Nb(E,{plugins:r});let S="",T=s||y;const N={},O=new l.__emitter(l);!function(){const e=[];for(let t=T;t!==E;t=t.parent)t.className&&e.unshift(t.className);e.forEach(e=>O.openNode(e))}();let C="",A=0,D=0,R=0,w=!1;try{for(T.matcher.considerAll();;){R++,w?w=!1:T.matcher.considerAll(),T.matcher.lastIndex=D;const e=T.matcher.exec(n);if(!e)break;const t=v(n.substring(D,e.index),e);D=e.index+t}return v(n.substr(D)),O.closeAllNodes(),O.finalize(),S=O.toHTML(),{relevance:Math.floor(A),value:S,language:e,illegal:!1,emitter:O,top:T}}catch(t){if(t.message&&t.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:t.message,context:n.slice(D-100,D+100),mode:t.mode},sofar:S,relevance:0,value:xb(n),emitter:O};if(i)return{illegal:!1,relevance:0,value:xb(n),emitter:O,language:e,top:T,errorRaised:t};throw t}}function p(e,n){n=n||l.languages||Object.keys(t);const r=function(e){const t={relevance:0,emitter:new l.__emitter(l),value:xb(e),illegal:!1,top:s};return t.emitter.addText(e),t}(e),i=n.filter(b).filter(S).map(t=>u(t,e,!1));i.unshift(r);const o=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(b(e.language).supersetOf===t.language)return 1;if(b(t.language).supersetOf===e.language)return-1}return 0}),[a,c]=o,d=a;return d.second_best=c,d}const f={"before:highlightElement":({el:e})=>{l.useBR&&(e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,"\n"))},"after:highlightElement":({result:e})=>{l.useBR&&(e.value=e.value.replace(/\n/g,"<br>"))}},m=/^(<[^>]+>|\t)+/gm,h={"after:highlightElement":({result:e})=>{l.tabReplace&&(e.value=e.value.replace(m,e=>e.replace(/\t/g,l.tabReplace)))}};function g(e){let t=null;const r=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=l.languageDetectRe.exec(t);if(n){const t=b(n[1]);return t||(Ib(a.replace("{}",n[1])),Ib("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>c(e)||b(e))}(e);if(c(r))return;T("before:highlightElement",{el:e,language:r}),t=e;const i=t.textContent,o=r?d(i,{language:r,ignoreIllegals:!0}):p(i);T("after:highlightElement",{el:e,result:o,text:i}),e.innerHTML=o.value,function(e,t,r){const i=t?n[t]:r;e.classList.add("hljs"),i&&e.classList.add(i)}(e,r,o.language),e.result={language:o.language,re:o.relevance,relavance:o.relevance},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.relevance,relavance:o.second_best.relevance})}const _=()=>{if(_.called)return;_.called=!0,Mb("10.6.0","initHighlighting() is deprecated. Use highlightAll() instead.");document.querySelectorAll("pre code").forEach(g)};let v=!1;function E(){if("loading"===document.readyState)return void(v=!0);document.querySelectorAll("pre code").forEach(g)}function b(e){return e=(e||"").toLowerCase(),t[e]||t[n[e]]}function y(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function S(e){const t=b(e);return t&&!t.disableAutodetect}function T(e,t){const n=e;r.forEach((function(e){e[n]&&e[n](t)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){v&&E()}),!1),Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:E,fixMarkup:function(e){return Mb("10.2.0","fixMarkup will be removed entirely in v11.0"),Mb("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"),t=e,l.tabReplace||l.useBR?t.replace(o,e=>"\n"===e?l.useBR?"<br>":e:l.tabReplace?e.replace(/\t/g,l.tabReplace):e):t;var t},highlightElement:g,highlightBlock:function(e){return Mb("10.7.0","highlightBlock will be removed entirely in v12.0"),Mb("10.7.0","Please use highlightElement now."),g(e)},configure:function(e){e.useBR&&(Mb("10.3.0","'useBR' will be removed entirely in v11.0"),Mb("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")),l=kb(l,e)},initHighlighting:_,initHighlightingOnLoad:function(){Mb("10.6.0","initHighlightingOnLoad() is deprecated. Use highlightAll() instead."),v=!0},registerLanguage:function(n,r){let o=null;try{o=r(e)}catch(e){if(wb("Language definition for '{}' could not be registered.".replace("{}",n)),!i)throw e;wb(e),o=s}o.name||(o.name=n),t[n]=o,o.rawDefinition=r.bind(null,e),o.aliases&&y(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:function(){return Object.keys(t)},getLanguage:b,registerAliases:y,requireLanguage:function(e){Mb("10.4.0","requireLanguage will be removed entirely in v11."),Mb("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844");const t=b(e);if(t)return t;throw new Error("The '{}' language is required, but not loaded.".replace("{}",e))},autoDetection:S,inherit:kb,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},vuePlugin:Ob(e).VuePlugin}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString="10.7.2";for(const e in gb)"object"==typeof gb[e]&&GE(gb[e]);return Object.assign(e,gb),e.addPlugin(f),e.addPlugin(Cb),e.addPlugin(h),e}({});var Bb=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){!function(){var t;function n(e){for(var t,n,r,i,o=1,a=[].slice.call(arguments),s=0,l=e.length,c="",d=!1,u=!1,p=function(){return a[o++]},f=function(){for(var n="";/\d/.test(e[s]);)n+=e[s++],t=e[s];return n.length>0?parseInt(n):null};s<l;++s)if(t=e[s],d)switch(d=!1,"."==t?(u=!1,t=e[++s]):"0"==t&&"."==e[s+1]?(u=!0,t=e[s+=2]):u=!0,i=f(),t){case"b":c+=parseInt(p(),10).toString(2);break;case"c":c+="string"==typeof(n=p())||n instanceof String?n:String.fromCharCode(parseInt(n,10));break;case"d":c+=parseInt(p(),10);break;case"f":r=String(parseFloat(p()).toFixed(i||6)),c+=u?r:r.replace(/^0/,"");break;case"j":c+=JSON.stringify(p());break;case"o":c+="0"+parseInt(p(),10).toString(8);break;case"s":c+=p();break;case"x":c+="0x"+parseInt(p(),10).toString(16);break;case"X":c+="0x"+parseInt(p(),10).toString(16).toUpperCase();break;default:c+=t}else"%"===t?d=!0:c+=t;return c}(t=e.exports=n).format=n,t.vsprintf=function(e,t){return n.apply(null,[e].concat(t))},"undefined"!=typeof console&&"function"==typeof console.log&&(t.printf=function(){console.log(n.apply(null,arguments))})}()})),Ub=zb(Error),Fb=Ub;function zb(e){return t.displayName=e.displayName||e.name,t;function t(t){return t&&(t=Bb.apply(null,arguments)),new e(t)}}Ub.eval=zb(EvalError),Ub.range=zb(RangeError),Ub.reference=zb(ReferenceError),Ub.syntax=zb(SyntaxError),Ub.type=zb(TypeError),Ub.uri=zb(URIError),Ub.create=zb;var jb=qb,Gb=function(e,t){var n=t||{},r=n.subset||Pb.listLanguages();n.prefix;var i,o,a,s,l=r.length,c=-1;if("string"!=typeof e)throw Fb("Expected `string` for value, got `%s`",e);o={relevance:0,language:null,value:[]},i={relevance:0,language:null,value:[]};for(;++c<l;)s=r[c],Pb.getLanguage(s)&&((a=qb(s,e,t)).language=s,a.relevance>o.relevance&&(o=a),a.relevance>i.relevance&&(o=i,i=a));o.language&&(i.secondBest=o);return i},Yb=function(e,t){Pb.registerLanguage(e,t)},Vb=function(){return Pb.listLanguages()},Hb=function(e,t){var n,r=e;t&&((r={})[e]=t);for(n in r)Pb.registerAliases(r[n],{languageName:n})};$b.prototype.addText=function(e){var t,n,r=this.stack;if(""===e)return;t=r[r.length-1],(n=t.children[t.children.length-1])&&"text"===n.type?n.value+=e:t.children.push({type:"text",value:e})},$b.prototype.addKeyword=function(e,t){this.openNode(t),this.addText(e),this.closeNode()},$b.prototype.addSublanguage=function(e,t){var n=this.stack,r=n[n.length-1],i=e.rootNode.children,o=t?{type:"element",tagName:"span",properties:{className:[t]},children:i}:i;r.children=r.children.concat(o)},$b.prototype.openNode=function(e){var t=this.stack,n=this.options.classPrefix+e,r=t[t.length-1],i={type:"element",tagName:"span",properties:{className:[n]},children:[]};r.children.push(i),t.push(i)},$b.prototype.closeNode=function(){this.stack.pop()},$b.prototype.closeAllNodes=Wb,$b.prototype.finalize=Wb,$b.prototype.toHTML=function(){return""};function qb(e,t,n){var r,i=Pb.configure({}),o=(n||{}).prefix;if("string"!=typeof e)throw Fb("Expected `string` for name, got `%s`",e);if(!Pb.getLanguage(e))throw Fb("Unknown language: `%s` is not registered",e);if("string"!=typeof t)throw Fb("Expected `string` for value, got `%s`",t);if(null==o&&(o="hljs-"),Pb.configure({__emitter:$b,classPrefix:o}),r=Pb.highlight(t,{language:e,ignoreIllegals:!0}),Pb.configure(i||{}),r.errorRaised)throw r.errorRaised;return{relevance:r.relevance,language:r.language,value:r.emitter.rootNode.children}}function $b(e){this.options=e,this.rootNode={children:[]},this.stack=[this.rootNode]}function Wb(){}var Qb={highlight:jb,highlightAuto:Gb,registerLanguage:Yb,listLanguages:Vb,registerAlias:Hb};function Kb({doc:e,name:t,lowlight:n}){const r=[];return Qa(e,e=>e.type.name===t).forEach(e=>{let t=e.pos+1;const{language:i}=e.node.attrs,o=n.listLanguages();(function e(t,n=[]){return t.map(t=>{const r=[...n,...t.properties?t.properties.className:[]];return t.children?e(t.children,r):{text:t.value,classes:r}}).flat()})(i&&o.includes(i)?n.highlight(i,e.node.textContent).value:n.highlightAuto(e.node.textContent).value).forEach(e=>{const n=t+e.text.length;if(e.classes.length){const i=bE.inline(t,n,{class:e.classes.join(" ")});r.push(i)}t=n})}),NE.create(e,r)}function Xb({name:e,lowlight:t}){return new vt({key:new yt("lowlight"),state:{init:(n,{doc:r})=>Kb({doc:r,name:e,lowlight:t}),apply:(n,r,i,o)=>{const a=i.selection.$head.parent.type.name,s=o.selection.$head.parent.type.name,l=Qa(i.doc,t=>t.type.name===e),c=Qa(o.doc,t=>t.type.name===e);return n.docChanged&&([a,s].includes(e)||c.length!==l.length||n.steps.some(e=>void 0!==e.from&&void 0!==e.to&&l.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?Kb({doc:n.doc,name:e,lowlight:t}):r.map(n.mapping,n.doc)}},props:{decorations(e){return this.getState(e)}}})}var Zb=Jg.extend({defaultOptions:{...Jg.options,lowlight:Qb},addProseMirrorPlugins(){var e;return[...(null===(e=this.parent)||void 0===e?void 0:e.call(this))||[],Xb({name:"codeBlock",lowlight:this.options.lowlight})]}});function Jb(){return i.a.createElement(sc,null,i.a.createElement("pre",null,i.a.createElement(lc,{as:"code"})))}var ey=n(50),ty=n.n(ey),ny=Zb.extend({addNodeView:function(){return new rc(Jb)}}).configure({lowlight:ty.a}),ry=n(4),iy=n.n(ry),oy=(n(30),n(43)),ay=n.n(oy),sy=(n(44),n(45),n(46),n(47),n(48),n(51)),ly=n.n(sy),cy=n(22),dy={insert:"head",singleton:!1},uy=(Tg()(cy.a,dy),cy.a.locals,n(23)),py={insert:"head",singleton:!1},fy=(Tg()(uy.a,py),uy.a.locals,Object(Cf.b)((function(e){var t=e.editor,n=new iy.a({allowMultipleUploads:!1,autoProceed:!0,debug:!0});return n.use(ly.a,{endpoint:"/api/v1/direct_uploads",formData:!0,fieldName:"blob"}),n.on("upload-success",(function(e,n){var r=n.body.imageURL;t.chain().focus().setImage({src:r}).run()})),i.a.createElement("div",null,i.a.createElement(ay.a,{uppy:n,proudlyDisplayPoweredByUppy:!1,closeModalOnClickOutside:!0,open:Af.showImageUpload,onRequestClose:function(){return Af.showImageUpload=!1}}))})));function my(e){return Fg({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"}}]})(e)}function hy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function gy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"}}]})(e)}function _y(e){return Fg({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"}}]})(e)}function vy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"}}]})(e)}function Ey(e){return Fg({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z"}}]})(e)}function by(){return(by=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function yy(e){var t=e.editor,n=e.formatterOptions;if(!t)return null;var r=[{Icon:my,command:function(){return t.chain().focus().toggleBold().run()},active:t.isActive("bold"),optionName:"bold"},{Icon:_y,command:function(){return t.chain().focus().toggleItalic().run()},active:t.isActive("italic"),optionName:"italic"},{Icon:Ey,command:function(){return t.chain().focus().toggleStrike().run()},active:t.isActive("strike"),optionName:"strike"},{Icon:vy,command:function(){if(t.isActive("link"))t.chain().focus().unsetLink().run();else{var e=window.prompt("Please enter your URL");t.chain().focus().setLink({href:e}).run()}},active:t.isActive("link"),optionName:"link"},{Icon:hy,command:function(){return t.chain().focus().toggleCode().run()},active:t.isActive("code"),optionName:"code"},{Icon:gy,command:function(){return t.chain().focus().toggleHighlight().run()},active:t.isActive("highlight"),optionName:"highlight"}];return i.a.createElement(Xl,{editor:t},i.a.createElement("div",{className:"relative flex items-center overflow-hidden bg-gray-900 rounded shadow"},r.filter((function(e){var t=e.optionName;return n.includes(t)})).map((function(e){return i.a.createElement(Sy,by({},e,{key:e.optionName}))}))))}var Sy=function(e){var t=e.Icon,n=e.command,r=e.active,o=e.iconSize;return i.a.createElement("div",{className:yg()("p-3 cursor-pointer hover:bg-gray-800",{"text-gray-400":!r,"text-white":r}),onClick:n},i.a.createElement(t,{size:o||15}))},Ty=ja.create({name:"external-video",defaultOptions:{inline:!1,HTMLAttributes:{}},inline:function(){return this.options.inline},group:function(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:function(){return{src:{default:null},title:{default:null},frameborder:{default:"0"},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"},allowfullscreen:{default:"allowfullscreen"}}},parseHTML:function(){return[{tag:"iframe[src]"}]},renderHTML:function(e){var t=e.HTMLAttributes;return["div",{class:"video-wrapper"},["iframe",To(this.options.HTMLAttributes,t)]]},addCommands:function(){var e=this;return{setExternalVideo:function(t){return function(n){return n.commands.insertContent({type:e.name,attrs:t})}}}}}),Ny=n(24),Oy={insert:"head",singleton:!1},Cy=(Tg()(Ny.a,Oy),Ny.a.locals,["hideBlockSelector","hideBubbleMenu","formatterOptions","className","initialValue","onChange"]);function Ay(e){return function(e){if(Array.isArray(e))return Dy(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dy(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ry(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var wy=function(e,t){var n,r=e.hideBlockSelector,o=void 0!==r&&r,a=e.hideBubbleMenu,s=void 0!==a&&a,l=e.formatterOptions,c=void 0===l?["bold","italic","code","highlight","strike","link"]:l,d=e.className,u=e.initialValue,p=void 0===u?"":u,f=e.onChange,m=void 0===f?function(){}:f,h=Ry(e,Cy);n=h.extensions?h.extensions:[fd,Nd,hf,ff,ny,Of,gf,Ty,Ef],o||(n=[].concat(Ay(n),[Kg]));var g=Jl({extensions:n,content:p,injectCSS:!1,editorProps:{attributes:{class:d||"prose focus:outline-none whitespace-pre-wrap"}},onUpdate:function(e){var t=e.editor;return m(t.getHTML())}});return i.a.useImperativeHandle(t,(function(){return{editor:g}})),i.a.createElement(i.a.Fragment,null,!s&&i.a.createElement(yy,{editor:g,formatterOptions:c}),i.a.createElement(fy,{editor:g}),i.a.createElement(ac,{editor:g}))};t.default=i.a.forwardRef(wy)}])}));
|
|
26
|
+
t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,d=-7,u=n?i-1:0,p=n?-1:1,f=e[t+u];for(u+=p,o=f&(1<<-d)-1,f>>=-d,d+=s;d>0;o=256*o+e[t+u],u+=p,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=256*a+e[t+u],u+=p,d-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,d=(1<<c)-1,u=d>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,m=r?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=d?(s=0,a=d):a+u>=1?(s=(t*l-1)*Math.pow(2,i),a+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=m,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=m,a/=256,c-=8);e[n+f-m]|=128*h}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var r=n(29);e.exports=function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return t.length>0?t:null}if("object"==typeof e&&r(e))return[e]}},function(e,t,n){var r=n(9),i=n(299),o=n(300);e.exports=function(e,t){var n=[],a=[];return r(e.items).forEach((function(e){var r=e.webkitGetAsEntry();r&&a.push(function e(r){return new Promise((function(a){if(r.isFile)r.file((function(e){e.relativePath=i(r),n.push(e),a()}),(function(e){t(e),a()}));else if(r.isDirectory){var s=r.createReader();o(s,[],t,{onSuccess:function(t){var n=t.map((function(t){return e(t)}));Promise.all(n).then((function(){return a()}))}})}}))}(r))})),Promise.all(a).then((function(){return n}))}},function(e,t){e.exports=function(e){return e.fullPath&&e.fullPath!=="/"+e.name?e.fullPath:null}},function(e,t){e.exports=function e(t,n,r,i){var o=i.onSuccess;t.readEntries((function(i){var a=[].concat(n,i);i.length?setTimeout((function(){e(t,a,r,{onSuccess:o})}),0):o(a)}),(function(e){r(e),o(n)}))}},function(e,t,n){var r=n(9);e.exports=function(e){var t=r(e.files);return Promise.resolve(t)}},function(e,t,n){var r=n(9),i=n(40),o=n(18);function a(e,t){var n=t[0];n&&(n.focus(),e.preventDefault())}function s(e,t,n){var s=i(n,t),l=r(s.querySelectorAll(o)),c=l.indexOf(document.activeElement);!function(e){return e.contains(document.activeElement)}(s)?a(e,l):e.shiftKey&&0===c?function(e,t){var n=t[t.length-1];n&&(n.focus(),e.preventDefault())}(e,l):e.shiftKey||c!==l.length-1||a(e,l)}e.exports={forModal:function(e,t,n){s(e,t,n)},forInline:function(e,t,n){null===t||s(e,t,n)}}},function(e,t,n){var r=n(304),i=n(18),o=n(40);e.exports=function(){var e=!1;return r((function(t,n){var r=o(t,n),a=r.contains(document.activeElement);if(!a||!e){var s=r.querySelector("[data-uppy-super-focusable]");if(!a||s)if(s)s.focus({preventScroll:!0}),e=!0;else{var l=r.querySelector(i);l&&l.focus({preventScroll:!0}),e=!1}}}),260)}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),d=Object.prototype.toString,u=Math.max,p=Math.min,f=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function h(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=i.test(e);return s||o.test(e)?a(e.slice(2),s?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var r,i,o,a,s,l,c=0,d=!1,g=!1,_=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,o=i;return r=i=void 0,c=t,a=e.apply(o,n)}function E(e){return c=e,s=setTimeout(y,t),d?v(e):a}function b(e){var n=e-l;return void 0===l||n>=t||n<0||g&&e-c>=o}function y(){var e=f();if(b(e))return S(e);s=setTimeout(y,function(e){var n=t-(e-l);return g?p(n,o-(e-c)):n}(e))}function S(e){return s=void 0,_&&r?v(e):(r=i=void 0,a)}function T(){var e=f(),n=b(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return E(l);if(g)return s=setTimeout(y,t),v(l)}return void 0===s&&(s=setTimeout(y,t)),a}return t=h(t)||0,m(n)&&(d=!!n.leading,o=(g="maxWait"in n)?u(h(n.maxWait)||0,t):o,_="trailing"in n?!!n.trailing:_),T.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=i=s=void 0},T.flush=function(){return void 0===s?a:S(f())},T}}).call(this,n(7))},function(e,t,n){"use strict";var r=n(306);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=n(4).Plugin,c=n(8),d=n(9),u=n(35),p=n(39),f=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).type="acquirer",r.id=r.opts.id||"DragDrop",r.title="Drag & Drop",r.defaultLocale={strings:{dropHereOr:"Drop files here or %{browse}",browse:"browse"}};return r.opts=o({},{target:null,inputName:"files[]",width:"100%",height:"100%",note:null},n),r.isDragDropSupported=u(),r.removeDragOverClassTimeout=null,r.i18nInit(),r.onInputChange=r.onInputChange.bind(a(r)),r.handleDragOver=r.handleDragOver.bind(a(r)),r.handleDragLeave=r.handleDragLeave.bind(a(r)),r.handleDrop=r.handleDrop.bind(a(r)),r.addFiles=r.addFiles.bind(a(r)),r.render=r.render.bind(a(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n);var i=r.prototype;return i.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new c([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.setPluginState()},i.addFiles=function(e){var t=this,n=e.map((function(e){return{source:t.id,name:e.name,type:e.type,data:e,meta:{relativePath:e.relativePath||null}}}));try{this.uppy.addFiles(n)}catch(e){this.uppy.log(e)}},i.onInputChange=function(e){this.uppy.log("[DragDrop] Files selected through input");var t=d(e.target.files);this.addFiles(t),e.target.value=null},i.handleDrop=function(e,t){var n=this;e.preventDefault(),e.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1}),this.uppy.log("[DragDrop] Files were dropped");p(e.dataTransfer,{logDropError:function(e){n.uppy.log(e,"error")}}).then((function(e){return n.addFiles(e)}))},i.handleDragOver=function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0})},i.handleDragLeave=function(e){var t=this;e.preventDefault(),e.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout((function(){t.setPluginState({isDraggingOver:!1})}),50)},i.renderHiddenFileInput=function(){var e=this,t=this.uppy.opts.restrictions;return f("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:function(t){e.fileInputRef=t},name:this.opts.inputName,multiple:1!==t.maxNumberOfFiles,accept:t.allowedFileTypes,onChange:this.onInputChange})},i.renderArrowSvg=function(){return f("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16"},f("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"}))},i.renderLabel=function(){return f("div",{className:"uppy-DragDrop-label"},this.i18nArray("dropHereOr",{browse:f("span",{className:"uppy-DragDrop-browse"},this.i18n("browse"))}))},i.renderNote=function(){return f("span",{className:"uppy-DragDrop-note"},this.opts.note)},i.render=function(e){var t=this,n="uppy-Root\n uppy-u-reset\n uppy-DragDrop-container\n "+(this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":"")+"\n "+(this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":"")+"\n ",r={width:this.opts.width,height:this.opts.height};return f("button",{type:"button",className:n,style:r,onClick:function(){return t.fileInputRef.click()},onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},this.renderHiddenFileInput(),f("div",{className:"uppy-DragDrop-inner"},this.renderArrowSvg(),this.renderLabel(),this.renderNote()))},i.install=function(){this.setPluginState({isDraggingOver:!1});var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(l),r.VERSION="1.4.27",i)},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=n(4).Plugin,l=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).id=r.opts.id||"ProgressBar",r.title="Progress Bar",r.type="progressindicator";return r.opts=o({},{target:"body",replaceTargetContent:!1,fixed:!1,hideAfterFinish:!0},n),r.render=r.render.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,a(t,n);var i=r.prototype;return i.render=function(e){var t=e.totalProgress||0,n=(0===t||100===t)&&this.opts.hideAfterFinish;return l("div",{className:"uppy uppy-ProgressBar",style:{position:this.opts.fixed?"fixed":"initial"},"aria-hidden":n},l("div",{className:"uppy-ProgressBar-inner",style:{width:t+"%"}}),l("div",{className:"uppy-ProgressBar-percentage"},t))},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(s),r.VERSION="1.3.27",i)},function(e,t,n){var r,i;function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=n(4).Plugin,c=n(9),d=n(8),u=n(1).h;e.exports=(i=r=function(e){var t,n;function r(t,n){var r;(r=e.call(this,t,n)||this).id=r.opts.id||"FileInput",r.title="File Input",r.type="acquirer",r.defaultLocale={strings:{chooseFiles:"Choose files"}};return r.opts=o({},{target:null,pretty:!0,inputName:"files[]"},n),r.i18nInit(),r.render=r.render.bind(a(r)),r.handleInputChange=r.handleInputChange.bind(a(r)),r.handleClick=r.handleClick.bind(a(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n);var i=r.prototype;return i.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new d([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.setPluginState()},i.addFiles=function(e){var t=this,n=e.map((function(e){return{source:t.id,name:e.name,type:e.type,data:e}}));try{this.uppy.addFiles(n)}catch(e){this.uppy.log(e)}},i.handleInputChange=function(e){this.uppy.log("[FileInput] Something selected through input...");var t=c(e.target.files);this.addFiles(t),e.target.value=null},i.handleClick=function(e){this.input.click()},i.render=function(e){var t=this,n=this.uppy.opts.restrictions,r=n.allowedFileTypes?n.allowedFileTypes.join(","):null;return u("div",{className:"uppy-Root uppy-FileInput-container"},u("input",{className:"uppy-FileInput-input",style:this.opts.pretty&&{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},type:"file",name:this.opts.inputName,onChange:this.handleInputChange,multiple:1!==n.maxNumberOfFiles,accept:r,ref:function(e){t.input=e}}),this.opts.pretty&&u("button",{className:"uppy-FileInput-btn",type:"button",onClick:this.handleClick},this.i18n("chooseFiles")))},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},r}(l),r.VERSION="1.4.25",i)},function(e,t,n){"use strict";var r=n(19),i=n(313),o=n(319),a=n(320);e.exports={RequestClient:r,Provider:i,SearchProvider:o,Socket:a}},function(e,t,n){"use strict";function r(e){var t="function"==typeof Map?new Map:void 0;return(r=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return i(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),a(r,e)})(e)}function i(e,t,n){return(i=o()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&a(i,n.prototype),i}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=function(e){var t,n;function r(){var t;return(t=e.call(this,"Authorization required")||this).name="AuthError",t.isAuthError=!0,t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,a(t,n),r}(r(Error));e.exports=l},function(e,t,n){var r=n(49);e.exports=function(){return fetch.apply(void 0,arguments).catch((function(e){throw"AbortError"===e.name?e:new r(e)}))}},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var o=n(314),a=n(315),s=n(19),l=n(318);e.exports=function(e){var t,n;function s(t,n){var r;return(r=e.call(this,t,n)||this).provider=n.provider,r.id=r.provider,r.name=r.opts.name||r.id.split("-").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join(" "),r.pluginId=r.opts.pluginId,r.tokenKey="companion-"+r.pluginId+"-auth-token",r.companionKeysParams=r.opts.companionKeysParams,r.preAuthToken=null,r}n=e,(t=s).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var c=s.prototype;return c.headers=function(){var t=this;return Promise.all([e.prototype.headers.call(this),this.getAuthToken()]).then((function(e){var n=e[0],i=e[1],o={};return i&&(o["uppy-auth-token"]=i),t.companionKeysParams&&(o["uppy-credentials-params"]=btoa(JSON.stringify({params:t.companionKeysParams}))),r({},n,o)}))},c.onReceiveResponse=function(t){t=e.prototype.onReceiveResponse.call(this,t);var n=this.uppy.getPlugin(this.pluginId),r=n.getPluginState().authenticated?401!==t.status:t.status<400;return n.setPluginState({authenticated:r}),t},c.setAuthToken=function(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)},c.getAuthToken=function(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)},c.authUrl=function(e){void 0===e&&(e={}),this.preAuthToken&&(e.uppyPreAuthToken=this.preAuthToken);var t=o(e);return t=t?"?"+t:t,this.hostname+"/"+this.id+"/connect"+t},c.fileUrl=function(e){return this.hostname+"/"+this.id+"/get/"+e},c.fetchPreAuthToken=function(){var e=this;return this.companionKeysParams?this.post(this.id+"/preauth/",{params:this.companionKeysParams}).then((function(t){e.preAuthToken=t.token})).catch((function(t){e.uppy.log("[CompanionClient] unable to fetch preAuthToken "+t,"warning")})):Promise.resolve()},c.list=function(e){return this.get(this.id+"/list/"+(e||""))},c.logout=function(){var e=this;return this.get(this.id+"/logout").then((function(t){return Promise.all([t,e.uppy.getPlugin(e.pluginId).storage.removeItem(e.tokenKey)])})).then((function(e){return e[0]}))},s.initPlugin=function(e,t,n){if(e.type="acquirer",e.files=[],n&&(e.opts=r({},n,t)),t.serverUrl||t.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(t.companionAllowedHosts){var i=t.companionAllowedHosts;if(!("string"==typeof i||Array.isArray(i)||i instanceof RegExp))throw new TypeError(e.id+': the option "companionAllowedHosts" must be one of string, Array, RegExp');e.opts.companionAllowedHosts=i}else/^(?!https?:\/\/).*$/i.test(t.companionUrl)?e.opts.companionAllowedHosts="https://"+t.companionUrl.replace(/^\/\//,""):e.opts.companionAllowedHosts=new a(t.companionUrl).origin;e.storage=e.opts.storage||l},s}(s)},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function e(t,r){var i=[];for(var o in t)if(n.call(t,o)){var a,s=t[o],l=encodeURIComponent(o);a="object"==typeof s?e(s,r?r+"["+l+"]":l):(r?r+"["+l+"]":l)+"="+encodeURIComponent(s),i.push(a)}return i.join("&")}},function(e,t,n){"use strict";(function(t){var r=n(316),i=n(317),o=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,a=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(s,"")}var c=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};function u(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},a=typeof(e=e||r);if("blob:"===e.protocol)i=new f(unescape(e.pathname),{});else if("string"===a)for(n in i=new f(e,{}),d)delete i[n];else if("object"===a){for(n in e)n in d||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=o.test(e.href))}return i}function p(e){e=l(e);var t=a.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!(t[2]&&t[2].length>=2),rest:t[2]&&1===t[2].length?"/"+t[3]:t[3]}}function f(e,t,n){if(e=l(e),!(this instanceof f))return new f(e,t,n);var o,a,s,d,m,h,g=c.slice(),_=typeof t,v=this,E=0;for("object"!==_&&"string"!==_&&(n=t,t=null),n&&"function"!=typeof n&&(n=i.parse),t=u(t),o=!(a=p(e||"")).protocol&&!a.slashes,v.slashes=a.slashes||o&&t.slashes,v.protocol=a.protocol||t.protocol||"",e=a.rest,a.slashes||(g[3]=[/(.*)/,"pathname"]);E<g.length;E++)"function"!=typeof(d=g[E])?(s=d[0],h=d[1],s!=s?v[h]=e:"string"==typeof s?~(m=e.indexOf(s))&&("number"==typeof d[2]?(v[h]=e.slice(0,m),e=e.slice(m+d[2])):(v[h]=e.slice(m),e=e.slice(0,m))):(m=s.exec(e))&&(v[h]=m[1],e=e.slice(0,m.index)),v[h]=v[h]||o&&d[3]&&t[h]||"",d[4]&&(v[h]=v[h].toLowerCase())):e=d(e);n&&(v.query=n(v.query)),o&&t.slashes&&"/"!==v.pathname.charAt(0)&&(""!==v.pathname||""!==t.pathname)&&(v.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,a=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),a++):a&&(0===r&&(o=!0),n.splice(r,1),a--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(v.pathname,t.pathname)),"/"!==v.pathname.charAt(0)&&v.hostname&&(v.pathname="/"+v.pathname),r(v.port,v.protocol)||(v.host=v.hostname,v.port=""),v.username=v.password="",v.auth&&(d=v.auth.split(":"),v.username=d[0]||"",v.password=d[1]||""),v.origin=v.protocol&&v.host&&"file:"!==v.protocol?v.protocol+"//"+v.host:"null",v.href=v.toString()}f.prototype={set:function(e,t,n){var o=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||i.parse)(t)),o[e]=t;break;case"port":o[e]=t,r(t,o.protocol)?t&&(o.host=o.hostname+":"+t):(o.host=o.hostname,o[e]="");break;case"hostname":o[e]=t,o.port&&(t+=":"+o.port),o.host=t;break;case"host":o[e]=t,/:\d+$/.test(t)?(t=t.split(":"),o.port=t.pop(),o.hostname=t.join(":")):(o.hostname=t,o.port="");break;case"protocol":o.protocol=t.toLowerCase(),o.slashes=!n;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";o[e]=t.charAt(0)!==a?a+t:t}else o[e]=t;break;default:o[e]=t}for(var s=0;s<c.length;s++){var l=c[s];l[4]&&(o[l[1]]=o[l[1]].toLowerCase())}return o.origin=o.protocol&&o.host&&"file:"!==o.protocol?o.protocol+"//"+o.host:"null",o.href=o.toString(),o},toString:function(e){e&&"function"==typeof e||(e=i.stringify);var t,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var o=r+(n.slashes?"//":"");return n.username&&(o+=n.username,n.password&&(o+=":"+n.password),o+="@"),o+=n.host+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},f.extractProtocol=p,f.location=u,f.trimLeft=l,f.qs=i,e.exports=f}).call(this,n(7))},function(e,t,n){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function o(e){try{return encodeURIComponent(e)}catch(e){return null}}t.stringify=function(e,t){t=t||"";var n,i,a=[];for(i in"string"!=typeof t&&(t="?"),e)if(r.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=o(i),n=o(n),null===i||null===n)continue;a.push(i+"="+n)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var o=i(t[1]),a=i(t[2]);null===o||null===a||o in r||(r[o]=a)}return r}},function(e,t,n){"use strict";e.exports.setItem=function(e,t){return new Promise((function(n){localStorage.setItem(e,t),n()}))},e.exports.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},e.exports.removeItem=function(e){return new Promise((function(t){localStorage.removeItem(e),t()}))}},function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var i=n(19);e.exports=function(e){var t,n;function i(t,n){var r;return(r=e.call(this,t,n)||this).provider=n.provider,r.id=r.provider,r.name=r.opts.name||r.id.split("-").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join(" "),r.pluginId=r.opts.pluginId,r}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var o=i.prototype;return o.fileUrl=function(e){return this.hostname+"/search/"+this.id+"/get/"+e},o.search=function(e,t){return t=t?"&"+t:"",this.get("search/"+this.id+"/list?q="+encodeURIComponent(e)+t)},i}(i)},function(e,t,n){var r=n(25);e.exports=function(){function e(e){this.opts=e,this._queued=[],this.isOpen=!1,this.emitter=r(),this._handleMessage=this._handleMessage.bind(this),this.close=this.close.bind(this),this.emit=this.emit.bind(this),this.on=this.on.bind(this),this.once=this.once.bind(this),this.send=this.send.bind(this),e&&!1===e.autoOpen||this.open()}var t=e.prototype;return t.open=function(){var e=this;this.socket=new WebSocket(this.opts.target),this.socket.onopen=function(t){for(e.isOpen=!0;e._queued.length>0&&e.isOpen;){var n=e._queued[0];e.send(n.action,n.payload),e._queued=e._queued.slice(1)}},this.socket.onclose=function(t){e.isOpen=!1},this.socket.onmessage=this._handleMessage},t.close=function(){this.socket&&this.socket.close()},t.send=function(e,t){this.isOpen?this.socket.send(JSON.stringify({action:e,payload:t})):this._queued.push({action:e,payload:t})},t.on=function(e,t){this.emitter.on(e,t)},t.emit=function(e,t){this.emitter.emit(e,t)},t.once=function(e,t){this.emitter.once(e,t)},t._handleMessage=function(e){try{var t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}},e}()},function(e,t,n){var r=n(15);e.exports=r((function(e,t,n){var r=t.progress,i=t.bytesUploaded,o=t.bytesTotal;r&&(e.uppy.log("Upload progress: "+r),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:i,bytesTotal:o}))}),300,{leading:!0,trailing:!0})},function(e,t){e.exports=function(e){var t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return(/^http:\/\//i.test(e)?"ws":"wss")+"://"+t}},function(e,t){e.exports=function(e){var t=[],n=[];function r(e){t.push(e)}function i(e){n.push(e)}return Promise.all(e.map((function(e){return e.then(r,i)}))).then((function(){return{successful:t,failed:n}}))}},function(e,t){e.exports=function(){function e(e){this._events=[],this._emitter=e}var t=e.prototype;return t.on=function(e,t){return this._events.push([e,t]),this._emitter.on(e,t)},t.remove=function(){var e=this;this._events.forEach((function(t){var n=t[0],r=t[1];e._emitter.off(n,r)}))},e}()},function(e,t){var n=function(){function e(e,t){this._timeout=e,this._onTimedOut=t,this._isDone=!1,this._aliveTimer=null,this._onTimedOut=this._onTimedOut.bind(this)}var t=e.prototype;return t.progress=function(){this._isDone||this._timeout>0&&(this._aliveTimer&&clearTimeout(this._aliveTimer),this._aliveTimer=setTimeout(this._onTimedOut,this._timeout))},t.done=function(){this._aliveTimer&&(clearTimeout(this._aliveTimer),this._aliveTimer=null),this._isDone=!0},e}();e.exports=n},function(e,t,n){var r=n(28);function i(){return new Error("Cancelled")}e.exports=function(){function e(e){this.limit="number"!=typeof e||0===e?1/0:e,this.activeRequests=0,this.queuedHandlers=[]}var t=e.prototype;return t._call=function(e){var t=this;this.activeRequests+=1;var n,r=!1;try{n=e()}catch(e){throw this.activeRequests-=1,e}return{abort:function(){r||(r=!0,t.activeRequests-=1,n(),t._queueNext())},done:function(){r||(r=!0,t.activeRequests-=1,t._queueNext())}}},t._queueNext=function(){var e=this;Promise.resolve().then((function(){e._next()}))},t._next=function(){if(!(this.activeRequests>=this.limit)&&0!==this.queuedHandlers.length){var e=this.queuedHandlers.shift(),t=this._call(e.fn);e.abort=t.abort,e.done=t.done}},t._queue=function(e,t){var n=this;void 0===t&&(t={});var i={fn:e,priority:t.priority||0,abort:function(){n._dequeue(i)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},o=r(this.queuedHandlers,(function(e){return i.priority>e.priority}));return-1===o?this.queuedHandlers.push(i):this.queuedHandlers.splice(o,0,i),i},t._dequeue=function(e){var t=this.queuedHandlers.indexOf(e);-1!==t&&this.queuedHandlers.splice(t,1)},t.run=function(e,t){return this.activeRequests<this.limit?this._call(e):this._queue(e,t)},t.wrapPromiseFunction=function(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var s,l=new Promise((function(r,a){s=n.run((function(){var t,n;try{n=Promise.resolve(e.apply(void 0,o))}catch(e){n=Promise.reject(e)}return n.then((function(e){t?a(t):(s.done(),r(e))}),(function(e){t?a(t):(s.done(),a(e))})),function(){t=i()}}),t)}));return l.abort=function(){s.abort()},l}},e}()},function(e,t){e.exports=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r);function o(e){this.content=e}o.prototype={constructor:o,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return-1==i?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new o(a)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new o(n)},addToStart:function(e,t){return new o([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new o(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(-1==a?i.length:a,0,t,n),new o(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=o.from(e)).size?new o(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=o.from(e)).size?new o(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=o.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},get size(){return this.content.length>>1}},o.from=function(e){if(e instanceof o)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new o(t)};var a=o;var s=function(e,t){if(this.content=e,this.size=t||0,null==t)for(var n=0;n<e.length;n++)this.size+=e[n].nodeSize},l={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(e,t,n,r,i){void 0===r&&(r=0);for(var o=0,a=0;a<t;o++){var s=this.content[o],l=a+s.nodeSize;if(l>e&&!1!==n(s,r+a,i,o)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,e-c),Math.min(s.content.size,t-c),n,r+c)}a=l}},s.prototype.descendants=function(e){this.nodesBetween(0,this.size,e)},s.prototype.textBetween=function(e,t,n,r){var i="",o=!0;return this.nodesBetween(e,t,(function(a,s){a.isText?(i+=a.text.slice(Math.max(e,s)-s,t-s),o=!n):a.isLeaf&&r?(i+=r,o=!n):!o&&a.isBlock&&(i+=n,o=!0)}),0),i},s.prototype.append=function(e){if(!e.size)return this;if(!this.size)return e;var t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new s(r,this.size+e.size)},s.prototype.cut=function(e,t){if(null==t&&(t=this.size),0==e&&t==this.size)return this;var n=[],r=0;if(t>e)for(var i=0,o=0;o<t;i++){var a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a=a.isText?a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),r+=a.nodeSize),o=l}return new s(n,r)},s.prototype.cutByIndex=function(e,t){return e==t?s.empty:0==e&&t==this.content.length?this:new s(this.content.slice(e,t))},s.prototype.replaceChild=function(e,t){var n=this.content[e];if(n==t)return this;var r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new s(r,i)},s.prototype.addToStart=function(e){return new s([e].concat(this.content),this.size+e.nodeSize)},s.prototype.addToEnd=function(e){return new s(this.content.concat(e),this.size+e.nodeSize)},s.prototype.eq=function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0},l.firstChild.get=function(){return this.content.length?this.content[0]:null},l.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},l.childCount.get=function(){return this.content.length},s.prototype.child=function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t},s.prototype.maybeChild=function(e){return this.content[e]},s.prototype.forEach=function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}},s.prototype.findDiffStart=function(e,t){return void 0===t&&(t=0),function e(t,n,r){for(var i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;var o=t.child(i),a=n.child(i);if(o!=a){if(!o.sameMarkup(a))return r;if(o.isText&&o.text!=a.text){for(var s=0;o.text[s]==a.text[s];s++)r++;return r}if(o.content.size||a.content.size){var l=e(o.content,a.content,r+1);if(null!=l)return l}r+=o.nodeSize}else r+=o.nodeSize}}(this,e,t)},s.prototype.findDiffEnd=function(e,t,n){return void 0===t&&(t=this.size),void 0===n&&(n=e.size),function e(t,n,r,i){for(var o=t.childCount,a=n.childCount;;){if(0==o||0==a)return o==a?null:{a:r,b:i};var s=t.child(--o),l=n.child(--a),c=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:r,b:i};if(s.isText&&s.text!=l.text){for(var d=0,u=Math.min(s.text.length,l.text.length);d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,r--,i--;return{a:r,b:i}}if(s.content.size||l.content.size){var p=e(s.content,l.content,r-1,i-1);if(p)return p}r-=c,i-=c}else r-=c,i-=c}}(this,e,t,n)},s.prototype.findIndex=function(e,t){if(void 0===t&&(t=-1),0==e)return d(0,e);if(e==this.size)return d(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position "+e+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var i=r+this.child(n).nodeSize;if(i>=e)return i==e||t>0?d(n+1,i):d(n,r);r=i}},s.prototype.toString=function(){return"<"+this.toStringInner()+">"},s.prototype.toStringInner=function(){return this.content.join(", ")},s.prototype.toJSON=function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null},s.fromJSON=function(e,t){if(!t)return s.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(t.map(e.nodeFromJSON))},s.fromArray=function(e){if(!e.length)return s.empty;for(var t,n=0,r=0;r<e.length;r++){var i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new s(t||e,n)},s.from=function(e){if(!e)return s.empty;if(e instanceof s)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new s([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,l);var c={index:0,offset:0};function d(e,t){return c.index=e,c.offset=t,c}function u(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!u(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!u(e[i],t[i]))return!1;for(var o in t)if(!(o in e))return!1}return!0}s.empty=new s([],0);var p=function(e,t){this.type=e,this.attrs=t};function f(e){var t=Error.call(this,e);return t.__proto__=f.prototype,t}p.prototype.addToSet=function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t},p.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e},p.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1},p.prototype.eq=function(e){return this==e||this.type==e.type&&u(this.attrs,e.attrs)},p.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e},p.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type "+t.type+" in this schema");return n.create(t.attrs)},p.sameSet=function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0},p.setFrom=function(e){if(!e||0==e.length)return p.none;if(e instanceof p)return[e];var t=e.slice();return t.sort((function(e,t){return e.type.rank-t.type.rank})),t},p.none=[],f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="ReplaceError";var m=function(e,t,n){this.content=e,this.openStart=t,this.openEnd=n},h={size:{configurable:!0}};function g(e,t,n){if(n.openStart>e.depth)throw new f("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new f("Inconsistent open depths");return function e(t,n,r,i){var o=t.index(i),a=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){var l=e(t,n,r,i+1);return a.copy(a.content.replaceChild(o,l))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){var c=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(s.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t),d=c.start,u=c.end;return y(a,function e(t,n,r,i,o){var a=t.depth>o&&v(t,n,o+1),l=i.depth>o&&v(r,i,o+1),c=[];b(null,t,o,c),a&&l&&n.index(o)==r.index(o)?(_(a,l),E(y(a,e(t,n,r,i,o+1)),c)):(a&&E(y(a,S(t,n,o+1)),c),b(n,r,o,c),l&&E(y(l,S(r,i,o+1)),c));return b(i,null,o,c),new s(c)}(t,d,u,n,i))}var p=t.parent,f=p.content;return y(p,f.cut(0,t.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return y(a,S(t,n,i))}(e,t,n,0)}function _(e,t){if(!t.type.compatibleContent(e.type))throw new f("Cannot join "+t.type.name+" onto "+e.type.name)}function v(e,t,n){var r=e.node(n);return _(r,t.node(n)),r}function E(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function b(e,t,n,r){var i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(E(e.nodeAfter,r),o++));for(var s=o;s<a;s++)E(i.child(s),r);t&&t.depth==n&&t.textOffset&&E(t.nodeBefore,r)}function y(e,t){if(!e.type.validContent(t))throw new f("Invalid content for node "+e.type.name);return e.copy(t)}function S(e,t,n){var r=[];(b(null,e,n,r),e.depth>n)&&E(y(v(e,t,n+1),S(e,t,n+1)),r);return b(t,null,n,r),new s(r)}h.size.get=function(){return this.content.size-this.openStart-this.openEnd},m.prototype.insertAt=function(e,t){var n=function e(t,n,r,i){var o=t.findIndex(n),a=o.index,s=o.offset,l=t.maybeChild(a);if(s==n||l.isText)return i&&!i.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));var c=e(l.content,n-s-1,r);return c&&t.replaceChild(a,l.copy(c))}(this.content,e+this.openStart,t,null);return n&&new m(n,this.openStart,this.openEnd)},m.prototype.removeBetween=function(e,t){return new m(function e(t,n,r){var i=t.findIndex(n),o=i.index,a=i.offset,s=t.maybeChild(o),l=t.findIndex(r),c=l.index,d=l.offset;if(a==n||s.isText){if(d!=r&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(o!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(e(s.content,n-a-1,r-a-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)},m.prototype.eq=function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd},m.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},m.prototype.toJSON=function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e},m.fromJSON=function(e,t){if(!t)return m.empty;var n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new m(s.fromJSON(e,t.content),n,r)},m.maxOpen=function(e,t){void 0===t&&(t=!0);for(var n=0,r=0,i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)n++;for(var o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new m(e,n,r)},Object.defineProperties(m.prototype,h),m.empty=new m(s.empty,0,0);var T=function(e,t,n){this.pos=e,this.path=t,this.depth=t.length/3-1,this.parentOffset=n},N={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};T.prototype.resolveDepth=function(e){return null==e?this.depth:e<0?this.depth+e:e},N.parent.get=function(){return this.node(this.depth)},N.doc.get=function(){return this.node(0)},T.prototype.node=function(e){return this.path[3*this.resolveDepth(e)]},T.prototype.index=function(e){return this.path[3*this.resolveDepth(e)+1]},T.prototype.indexAfter=function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)},T.prototype.start=function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1},T.prototype.end=function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size},T.prototype.before=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]},T.prototype.after=function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize},N.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},N.nodeAfter.get=function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r},N.nodeBefore.get=function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)},T.prototype.posAtIndex=function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r},T.prototype.marks=function(){var e=this.parent,t=this.index();if(0==e.content.size)return p.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var o=n.marks,a=0;a<o.length;a++)!1!==o[a].type.spec.inclusive||r&&o[a].isInSet(r.marks)||(o=o[a--].removeFromSet(o));return o},T.prototype.marksAcross=function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n},T.prototype.sharedDepth=function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0},T.prototype.blockRange=function(e,t){if(void 0===e&&(e=this),e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new D(this,e,n)},T.prototype.sameParent=function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset},T.prototype.max=function(e){return e.pos>this.pos?e:this},T.prototype.min=function(e){return e.pos<this.pos?e:this},T.prototype.toString=function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset},T.resolve=function(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");for(var n=[],r=0,i=t,o=e;;){var a=o.content.findIndex(i),s=a.index,l=a.offset,c=i-l;if(n.push(o,s,r+l),!c)break;if((o=o.child(s)).isText)break;i=c-1,r+=l+1}return new T(t,n,i)},T.resolveCached=function(e,t){for(var n=0;n<O.length;n++){var r=O[n];if(r.pos==t&&r.doc==e)return r}var i=O[C]=T.resolve(e,t);return C=(C+1)%A,i},Object.defineProperties(T.prototype,N);var O=[],C=0,A=12,D=function(e,t,n){this.$from=e,this.$to=t,this.depth=n},R={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};R.start.get=function(){return this.$from.before(this.depth+1)},R.end.get=function(){return this.$to.after(this.depth+1)},R.parent.get=function(){return this.$from.node(this.depth)},R.startIndex.get=function(){return this.$from.index(this.depth)},R.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(D.prototype,R);var w=Object.create(null),I=function(e,t,n,r){this.type=e,this.attrs=t,this.content=n||s.empty,this.marks=r||p.none},M={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};M.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},M.childCount.get=function(){return this.content.childCount},I.prototype.child=function(e){return this.content.child(e)},I.prototype.maybeChild=function(e){return this.content.maybeChild(e)},I.prototype.forEach=function(e){this.content.forEach(e)},I.prototype.nodesBetween=function(e,t,n,r){void 0===r&&(r=0),this.content.nodesBetween(e,t,n,r,this)},I.prototype.descendants=function(e){this.nodesBetween(0,this.content.size,e)},M.textContent.get=function(){return this.textBetween(0,this.content.size,"")},I.prototype.textBetween=function(e,t,n,r){return this.content.textBetween(e,t,n,r)},M.firstChild.get=function(){return this.content.firstChild},M.lastChild.get=function(){return this.content.lastChild},I.prototype.eq=function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)},I.prototype.sameMarkup=function(e){return this.hasMarkup(e.type,e.attrs,e.marks)},I.prototype.hasMarkup=function(e,t,n){return this.type==e&&u(this.attrs,t||e.defaultAttrs||w)&&p.sameSet(this.marks,n||p.none)},I.prototype.copy=function(e){return void 0===e&&(e=null),e==this.content?this:new this.constructor(this.type,this.attrs,e,this.marks)},I.prototype.mark=function(e){return e==this.marks?this:new this.constructor(this.type,this.attrs,this.content,e)},I.prototype.cut=function(e,t){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))},I.prototype.slice=function(e,t,n){if(void 0===t&&(t=this.content.size),void 0===n&&(n=!1),e==t)return m.empty;var r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),s=r.node(o).content.cut(r.pos-a,i.pos-a);return new m(s,r.depth-o,i.depth-o)},I.prototype.replace=function(e,t,n){return g(this.resolve(e),this.resolve(t),n)},I.prototype.nodeAt=function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(!(t=t.maybeChild(r)))return null;if(i==e||t.isText)return t;e-=i+1}},I.prototype.childAfter=function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},I.prototype.childBefore=function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}},I.prototype.resolve=function(e){return T.resolveCached(this,e)},I.prototype.resolveNoCache=function(e){return T.resolve(this,e)},I.prototype.rangeHasMark=function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r},M.isBlock.get=function(){return this.type.isBlock},M.isTextblock.get=function(){return this.type.isTextblock},M.inlineContent.get=function(){return this.type.inlineContent},M.isInline.get=function(){return this.type.isInline},M.isText.get=function(){return this.type.isText},M.isLeaf.get=function(){return this.type.isLeaf},M.isAtom.get=function(){return this.type.isAtom},I.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),k(this.marks,e)},I.prototype.contentMatchAt=function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t},I.prototype.canReplace=function(e,t,n,r,i){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===i&&(i=n.childCount);var o=this.contentMatchAt(e).matchFragment(n,r,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var l=r;l<i;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0},I.prototype.canReplaceWith=function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd},I.prototype.canAppend=function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)},I.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var e=p.none,t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!p.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(e){return e.type.name})));this.content.forEach((function(e){return e.check()}))},I.prototype.toJSON=function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((function(e){return e.toJSON()}))),e},I.fromJSON=function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=s.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)},Object.defineProperties(I.prototype,M);var x=function(e){function t(t,n,r,i){if(e.call(this,t,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return t.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):k(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},t.prototype.textBetween=function(e,t){return this.text.slice(e,t)},n.nodeSize.get=function(){return this.text.length},t.prototype.mark=function(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)},t.prototype.withText=function(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)},t.prototype.cut=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.text.length),0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))},t.prototype.eq=function(e){return this.sameMarkup(e)&&this.text==e.text},t.prototype.toJSON=function(){var t=e.prototype.toJSON.call(this);return t.text=this.text,t},Object.defineProperties(t.prototype,n),t}(I);function k(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var L=function(e){this.validEnd=e,this.next=[],this.wrapCache=[]},P={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};L.parse=function(e,t){var n=new B(e,t);if(null==n.next)return L.empty;var r=F(n);n.next&&n.err("Unexpected trailing text");var i=function(e){var t=Object.create(null);return function n(r){var i=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){var o=i.indexOf(n),a=o>-1&&i[o+1];H(e,r).forEach((function(e){a||i.push(n,a=[]),-1==a.indexOf(e)&&a.push(e)}))}}))}));for(var o=t[r.join(",")]=new L(r.indexOf(e.length-1)>-1),a=0;a<i.length;a+=2){var s=i[a+1].sort(V);o.next.push(i[a],t[s.join(",")]||n(s))}return o}(H(e,0))}(function(e){var t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,o))}),[]);if("seq"==t.type)for(var a=0;;a++){var s=e(t.exprs[a],o);if(a==t.exprs.length-1)return s;i(s,o=n())}else{if("star"==t.type){var l=n();return r(o,l),i(e(t.expr,l),l),[r(l)]}if("plus"==t.type){var c=n();return i(e(t.expr,o),c),i(e(t.expr,c),c),[r(c)]}if("opt"==t.type)return[r(o)].concat(e(t.expr,o));if("range"==t.type){for(var d=o,u=0;u<t.min;u++){var p=n();i(e(t.expr,d),p),d=p}if(-1==t.max)i(e(t.expr,d),d);else for(var f=t.min;f<t.max;f++){var m=n();r(d,m),i(e(t.expr,d),m),d=m}return[r(d)]}if("name"==t.type)return[r(o,null,t.value)]}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach((function(e){return e.to=t}))}}(r));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],o=!i.validEnd,a=[],s=0;s<i.next.length;s+=2){var l=i.next[s],c=i.next[s+1];a.push(l.name),!o||l.isText||l.hasRequiredAttrs()||(o=!1),-1==r.indexOf(c)&&r.push(c)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i},L.prototype.matchType=function(e){for(var t=0;t<this.next.length;t+=2)if(this.next[t]==e)return this.next[t+1];return null},L.prototype.matchFragment=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.childCount);for(var r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r},P.inlineContent.get=function(){var e=this.next[0];return!!e&&e.isInline},P.defaultType.get=function(){for(var e=0;e<this.next.length;e+=2){var t=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}},L.prototype.compatible=function(e){for(var t=0;t<this.next.length;t+=2)for(var n=0;n<e.next.length;n+=2)if(this.next[t]==e.next[n])return!0;return!1},L.prototype.fillBefore=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=0);var r=[this];return function i(o,a){var l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return s.from(a.map((function(e){return e.createAndFill()})));for(var c=0;c<o.next.length;c+=2){var d=o.next[c],u=o.next[c+1];if(!d.isText&&!d.hasRequiredAttrs()&&-1==r.indexOf(u)){r.push(u);var p=i(u,a.concat(d));if(p)return p}}}(this,[])},L.prototype.findWrapping=function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n},L.prototype.computeWrapping=function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var o=[],a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(var s=0;s<i.next.length;s+=2){var l=i.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in t||r.type&&!i.next[s+1].validEnd||(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}},P.edgeCount.get=function(){return this.next.length>>1},L.prototype.edge=function(e){var t=e<<1;if(t>=this.next.length)throw new RangeError("There's no "+e+"th edge in this content match");return{type:this.next[t],next:this.next[t+1]}},L.prototype.toString=function(){var e=[];return function t(n){e.push(n);for(var r=1;r<n.next.length;r+=2)-1==e.indexOf(n.next[r])&&t(n.next[r])}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",i=0;i<t.next.length;i+=2)r+=(i?", ":"")+t.next[i].name+"->"+e.indexOf(t.next[i+1]);return r})).join("\n")},Object.defineProperties(L.prototype,P),L.empty=new L(!0);var B=function(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},U={next:{configurable:!0}};function F(e){var t=[];do{t.push(z(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function z(e){var t=[];do{t.push(j(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function j(e){for(var t=function(e){if(e.eat("(")){var t=F(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var o in n){var a=n[o];a.groups.indexOf(t)>-1&&i.push(a)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Y(e,t)}return t}function G(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function Y(e,t){var n=G(e),r=n;return e.eat(",")&&(r="}"!=e.next?G(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function V(e,t){return t-e}function H(e,t){var n=[];return function t(r){var i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(var o=0;o<i.length;o++){var a=i[o],s=a.term,l=a.to;s||-1!=n.indexOf(l)||t(l)}}(t),n.sort(V)}function q(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function $(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(void 0===i){var o=e[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}n[r]=i}return n}function W(e){var t=Object.create(null);if(e)for(var n in e)t[n]=new X(e[n]);return t}U.next.get=function(){return this.tokens[this.pos]},B.prototype.eat=function(e){return this.next==e&&(this.pos++||!0)},B.prototype.err=function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")},Object.defineProperties(B.prototype,U);var Q=function(e,t,n){this.name=e,this.schema=t,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=W(n.attrs),this.defaultAttrs=q(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e},K={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};K.isInline.get=function(){return!this.isBlock},K.isTextblock.get=function(){return this.isBlock&&this.inlineContent},K.isLeaf.get=function(){return this.contentMatch==L.empty},K.isAtom.get=function(){return this.isLeaf||this.spec.atom},Q.prototype.hasRequiredAttrs=function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1},Q.prototype.compatibleContent=function(e){return this==e||this.contentMatch.compatible(e.contentMatch)},Q.prototype.computeAttrs=function(e){return!e&&this.defaultAttrs?this.defaultAttrs:$(this.attrs,e)},Q.prototype.create=function(e,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new I(this,this.computeAttrs(e),s.from(t),p.setFrom(n))},Q.prototype.createChecked=function(e,t,n){if(t=s.from(t),!this.validContent(t))throw new RangeError("Invalid content for node "+this.name);return new I(this,this.computeAttrs(e),t,p.setFrom(n))},Q.prototype.createAndFill=function(e,t,n){if(e=this.computeAttrs(e),(t=s.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t).fillBefore(s.empty,!0);return i?new I(this,e,t.append(i),p.setFrom(n)):null},Q.prototype.validContent=function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0},Q.prototype.allowsMarkType=function(e){return null==this.markSet||this.markSet.indexOf(e)>-1},Q.prototype.allowsMarks=function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0},Q.prototype.allowedMarks=function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:p.empty:e},Q.compile=function(e,t){var n=Object.create(null);e.forEach((function(e,r){return n[e]=new Q(e,t,r)}));var r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var i in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(Q.prototype,K);var X=function(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default},Z={isRequired:{configurable:!0}};Z.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(X.prototype,Z);var J=function(e,t,n,r){this.name=e,this.schema=n,this.spec=r,this.attrs=W(r.attrs),this.rank=t,this.excluded=null;var i=q(this.attrs);this.instance=i&&new p(this,i)};J.prototype.create=function(e){return!e&&this.instance?this.instance:new p(this,$(this.attrs,e))},J.compile=function(e,t){var n=Object.create(null),r=0;return e.forEach((function(e,i){return n[e]=new J(e,r++,t,i)})),n},J.prototype.removeFromSet=function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e},J.prototype.isInSet=function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]},J.prototype.excludes=function(e){return this.excluded.indexOf(e)>-1};var ee=function(e){for(var t in this.spec={},e)this.spec[t]=e[t];this.spec.nodes=a.from(e.nodes),this.spec.marks=a.from(e.marks),this.nodes=Q.compile(this.spec.nodes,this),this.marks=J.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var i=this.nodes[r],o=i.spec.content||"",s=i.spec.marks;i.contentMatch=n[o]||(n[o]=L.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==s?null:s?te(this,s.split(" ")):""!=s&&i.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],d=c.spec.excludes;c.excluded=null==d?[c]:""==d?[]:te(this,d.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function te(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(var s in e.marks){var l=e.marks[s];("_"==i||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}ee.prototype.node=function(e,t,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Q))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)},ee.prototype.text=function(e,t){var n=this.nodes.text;return new x(n,n.defaultAttrs,e,p.setFrom(t))},ee.prototype.mark=function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)},ee.prototype.nodeFromJSON=function(e){return I.fromJSON(this,e)},ee.prototype.markFromJSON=function(e){return p.fromJSON(this,e)},ee.prototype.nodeType=function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t};var ne=function(e,t){var n=this;this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((function(e){e.tag?n.tags.push(e):e.style&&n.styles.push(e)})),this.normalizeLists=!this.tags.some((function(t){if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;var n=e.nodes[t.node];return n.contentMatch.matchType(n)}))};ne.prototype.parse=function(e,t){void 0===t&&(t={});var n=new le(this,t,!1);return n.addAll(e,null,t.from,t.to),n.finish()},ne.prototype.parseSlice=function(e,t){void 0===t&&(t={});var n=new le(this,t,!0);return n.addAll(e,null,t.from,t.to),m.maxOpen(n.finish())},ne.prototype.matchTag=function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(de(e,i.tag)&&(void 0===i.namespace||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var o=i.getAttrs(e);if(!1===o)continue;i.attrs=o}return i}}},ne.prototype.matchStyle=function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var o=this.styles[i];if(!(0!=o.style.indexOf(e)||o.context&&!n.matchesContext(o.context)||o.style.length>e.length&&(61!=o.style.charCodeAt(e.length)||o.style.slice(e.length+1)!=t))){if(o.getAttrs){var a=o.getAttrs(t);if(!1===a)continue;o.attrs=a}return o}}},ne.schemaRules=function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((null==i.priority?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=ue(e)),e.mark=t}))};for(var i in e.marks)r(i);var o;for(var a in e.nodes)o=void 0,(o=e.nodes[a].spec.parseDOM)&&o.forEach((function(e){n(e=ue(e)),e.node=a}));return t},ne.fromSchema=function(e){return e.cached.domParser||(e.cached.domParser=new ne(e,ne.schemaRules(e)))};var re={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ie={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oe={ol:!0,ul:!0};function ae(e){return(e?1:0)|("full"===e?2:0)}var se=function(e,t,n,r,i,o,a){this.type=e,this.attrs=t,this.solid=i,this.match=o||(4&a?null:e.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r,this.stashMarks=[]};se.prototype.findWrapping=function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(s.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)},se.prototype.finish=function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length)))}var r=s.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},se.prototype.popFromStashMark=function(e){for(var t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]},se.prototype.applyPending=function(e){for(var t=0,n=this.pendingMarks;t<n.length;t++){var r=n[t];(this.type?this.type.allowsMarkType(r.type):pe(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var le=function(e,t,n){this.parser=e,this.options=t,this.isOpen=n;var r,i=t.topNode,o=ae(t.preserveWhitespace)|(n?4:0);r=i?new se(i.type,i.attrs,p.none,p.none,!0,t.topMatch||i.type.contentMatch,o):new se(n?null:e.schema.topNodeType,null,p.none,p.none,!0,null,o),this.nodes=[r],this.open=0,this.find=t.findPositions,this.needsBlock=!1},ce={top:{configurable:!0},currentPos:{configurable:!0}};function de(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ue(e){var t={};for(var n in e)t[n]=e[n];return t}function pe(e,t){var n=t.schema.nodes,r=function(r){var i=n[r];if(i.allowsMarkType(e)){var o=[],a=function(e){o.push(e);for(var n=0;n<e.edgeCount;n++){var r=e.edge(n),i=r.type,s=r.next;if(i==t)return!0;if(o.indexOf(s)<0&&a(s))return!0}};return a(i.contentMatch)?{v:!0}:void 0}};for(var i in n){var o=r(i);if(o)return o.v}}ce.top.get=function(){return this.nodes[this.open]},le.prototype.addDOM=function(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){var t=e.getAttribute("style"),n=t?this.readStyles(function(e){var t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t)):null,r=this.top;if(null!=n)for(var i=0;i<n.length;i++)this.addPendingMark(n[i]);if(this.addElement(e),null!=n)for(var o=0;o<n.length;o++)this.removePendingMark(n[o],r)}},le.prototype.addTextNode=function(e){var t=e.nodeValue,n=this.top;if(2&n.options||(n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],i=e.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)},le.prototype.addElement=function(e,t){var n,r=e.nodeName.toLowerCase();oe.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&oe.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(i?i.ignore:ie.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);var o,a=this.top,s=this.needsBlock;if(re.hasOwnProperty(r))o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),o&&this.sync(a),this.needsBlock=s}else this.addElementByRule(e,i,!1===i.consuming?n:null)},le.prototype.leafFallback=function(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))},le.prototype.ignoreFallback=function(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},le.prototype.readStyles=function(e){var t=p.none;e:for(var n=0;n<e.length;n+=2)for(var r=null;;){var i=this.parser.matchStyle(e[n],e[n+1],this,r);if(!i)continue e;if(i.ignore)return null;if(t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),!1!==i.consuming)break;r=i}return t},le.prototype.addElementByRule=function(e,t,n){var r,i,o,a=this;t.node?(i=this.parser.schema.nodes[t.node]).isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):r=this.enter(i,t.attrs,t.preserveWhitespace):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));var s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return a.insertNode(e)}));else{var l=t.contentElement;"string"==typeof l?l=e.querySelector(l):"function"==typeof l&&(l=l(e)),l||(l=e),this.findAround(e,l,!0),this.addAll(l,r)}r&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},le.prototype.addAll=function(e,t,n,r){for(var i=n||0,o=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o),t&&re.hasOwnProperty(o.nodeName.toLowerCase())&&this.sync(t);this.findAtPoint(e,i)},le.prototype.findPlace=function(e){for(var t,n,r=this.open;r>=0;r--){var i=this.nodes[r],o=i.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,n=i,!o.length))break;if(i.solid)break}if(!t)return!1;this.sync(n);for(var a=0;a<t.length;a++)this.enterInner(t[a],null,!1);return!0},le.prototype.insertNode=function(e){if(e.isInline&&this.needsBlock&&!this.top.type){var t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();var n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));for(var r=n.activeMarks,i=0;i<e.marks.length;i++)n.type&&!n.type.allowsMarkType(e.marks[i].type)||(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1},le.prototype.enter=function(e,t,n){var r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r},le.prototype.enterInner=function(e,t,n,r){this.closeExtra();var i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e,t);var o=null==r?-5&i.options:ae(r);4&i.options&&0==i.content.length&&(o|=4),this.nodes.push(new se(e,t,i.activeMarks,i.pendingMarks,n,null,o)),this.open++},le.prototype.closeExtra=function(e){var t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}},le.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},le.prototype.sync=function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return void(this.open=t)},ce.currentPos.get=function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e},le.prototype.findAtPoint=function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)},le.prototype.findInside=function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)},le.prototype.findAround=function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},le.prototype.findInText=function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))},le.prototype.matchesContext=function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=function(e,s){for(;e>=0;e--){var l=n[e];if(""==l){if(e==n.length-1||0==e)continue;for(;s>=o;s--)if(a(e-1,s))return!0;return!1}var c=s>0||0==s&&i?t.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;s--}return!0};return a(n.length-1,this.open)},le.prototype.textblockFromContext=function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}},le.prototype.addPendingMark=function(e){var t=function(e,t){for(var n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)},le.prototype.removePendingMark=function(e,t){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);var i=r.popFromStashMark(e);i&&r.type&&r.type.allowsMarkType(i.type)&&(r.activeMarks=i.addToSet(r.activeMarks))}if(r==t)break}},Object.defineProperties(le.prototype,ce);var fe=function(e,t){this.nodes=e||{},this.marks=t||{}};function me(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function he(e){return e.document||window.document}fe.prototype.serializeFragment=function(e,t,n){var r=this;void 0===t&&(t={}),n||(n=he(t).createDocumentFragment());var i=n,o=null;return e.forEach((function(e){if(o||e.marks.length){o||(o=[]);for(var n=0,a=0;n<o.length&&a<e.marks.length;){var s=e.marks[a];if(r.marks[s.type.name]){if(!s.eq(o[n])||!1===s.type.spec.spanning)break;n+=2,a++}else a++}for(;n<o.length;)i=o.pop(),o.pop();for(;a<e.marks.length;){var l=e.marks[a++],c=r.serializeMark(l,e.isInline,t);c&&(o.push(l,i),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(r.serializeNode(e,t))})),n},fe.prototype.serializeNode=function(e,t){void 0===t&&(t={});var n=fe.renderSpec(he(t),this.nodes[e.type.name](e)),r=n.dom,i=n.contentDOM;if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");t.onContent?t.onContent(e,i,t):this.serializeFragment(e.content,t,i)}return r},fe.prototype.serializeNodeAndMarks=function(e,t){void 0===t&&(t={});for(var n=this.serializeNode(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n},fe.prototype.serializeMark=function(e,t,n){void 0===n&&(n={});var r=this.marks[e.type.name];return r&&fe.renderSpec(he(n),r(e,t))},fe.renderSpec=function(e,t,n){if(void 0===n&&(n=null),"string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var r=t[0],i=r.indexOf(" ");i>0&&(n=r.slice(0,i),r=r.slice(i+1));var o=null,a=n?e.createElementNS(n,r):e.createElement(r),s=t[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s))for(var c in l=2,s)if(null!=s[c]){var d=c.indexOf(" ");d>0?a.setAttributeNS(c.slice(0,d),c.slice(d+1),s[c]):a.setAttribute(c,s[c])}for(var u=l;u<t.length;u++){var p=t[u];if(0===p){if(u<t.length-1||u>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var f=fe.renderSpec(e,p,n),m=f.dom,h=f.contentDOM;if(a.appendChild(m),h){if(o)throw new RangeError("Multiple content holes");o=h}}return{dom:a,contentDOM:o}},fe.fromSchema=function(e){return e.cached.domSerializer||(e.cached.domSerializer=new fe(this.nodesFromSchema(e),this.marksFromSchema(e)))},fe.nodesFromSchema=function(e){var t=me(e.nodes);return t.text||(t.text=function(e){return e.text}),t},fe.marksFromSchema=function(e){return me(e.marks)};var ge=Math.pow(2,16);function _e(e){return 65535&e}var ve=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=null),this.pos=e,this.deleted=t,this.recover=n},Ee=function(e,t){void 0===t&&(t=!1),this.ranges=e,this.inverted=t};Ee.prototype.recover=function(e){var t=0,n=_e(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/ge}(e)},Ee.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},Ee.prototype.map=function(e,t){return void 0===t&&(t=1),this._map(e,t,!0)},Ee.prototype._map=function(e,t,n){for(var r=0,i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var l=this.ranges[a+i],c=this.ranges[a+o],d=s+l;if(e<=d){var u=s+r+((l?e==s?-1:e==d?1:t:t)<0?0:c);if(n)return u;var p=e==(t<0?s:d)?null:a/3+(e-s)*ge;return new ve(u,t<0?e!=s:e!=d,p)}r+=c-l}return n?e+r:new ve(e+r)},Ee.prototype.touches=function(e,t){for(var n=0,r=_e(t),i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var l=this.ranges[a+i];if(e<=s+l&&a==3*r)return!0;n+=this.ranges[a+o]-l}return!1},Ee.prototype.forEach=function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r<this.ranges.length;r+=3){var o=this.ranges[r],a=o-(this.inverted?i:0),s=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(a,a+l,s,s+c),i+=c-l}},Ee.prototype.invert=function(){return new Ee(this.ranges,!this.inverted)},Ee.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},Ee.offset=function(e){return 0==e?Ee.empty:new Ee(e<0?[0,-e,0]:[0,0,e])},Ee.empty=new Ee([]);var be=function(e,t,n,r){this.maps=e||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=t};function ye(e){var t=Error.call(this,e);return t.__proto__=ye.prototype,t}be.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.maps.length),new be(this.maps,this.mirror,e,t)},be.prototype.copy=function(){return new be(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},be.prototype.appendMap=function(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)},be.prototype.appendMapping=function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:null)}},be.prototype.getMirror=function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]},be.prototype.setMirror=function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)},be.prototype.appendMappingInverted=function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:null)}},be.prototype.invert=function(){var e=new be;return e.appendMappingInverted(this),e},be.prototype.map=function(e,t){if(void 0===t&&(t=1),this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e},be.prototype.mapResult=function(e,t){return void 0===t&&(t=1),this._map(e,t,!1)},be.prototype._map=function(e,t,n){for(var r=!1,i=this.from;i<this.to;i++){var o=this.maps[i].mapResult(e,t);if(null!=o.recover){var a=this.getMirror(i);if(null!=a&&a>i&&a<this.to){i=a,e=this.maps[a].recover(o.recover);continue}}o.deleted&&(r=!0),e=o.pos}return n?e:new ve(e,r)},ye.prototype=Object.create(Error.prototype),ye.prototype.constructor=ye,ye.prototype.name="TransformError";var Se=function(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new be},Te={before:{configurable:!0},docChanged:{configurable:!0}};function Ne(){throw new Error("Override me")}Te.before.get=function(){return this.docs.length?this.docs[0]:this.doc},Se.prototype.step=function(e){var t=this.maybeStep(e);if(t.failed)throw new ye(t.failed);return this},Se.prototype.maybeStep=function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t},Te.docChanged.get=function(){return this.steps.length>0},Se.prototype.addStep=function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t},Object.defineProperties(Se.prototype,Te);var Oe=Object.create(null),Ce=function(){};Ce.prototype.apply=function(e){return Ne()},Ce.prototype.getMap=function(){return Ee.empty},Ce.prototype.invert=function(e){return Ne()},Ce.prototype.map=function(e){return Ne()},Ce.prototype.merge=function(e){return null},Ce.prototype.toJSON=function(){return Ne()},Ce.fromJSON=function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Oe[t.stepType];if(!n)throw new RangeError("No step type "+t.stepType+" defined");return n.fromJSON(e,t)},Ce.jsonID=function(e,t){if(e in Oe)throw new RangeError("Duplicate use of step JSON ID "+e);return Oe[e]=t,t.prototype.jsonID=e,t};var Ae=function(e,t){this.doc=e,this.failed=t};Ae.ok=function(e){return new Ae(e,null)},Ae.fail=function(e){return new Ae(null,e)},Ae.fromReplace=function(e,t,n,r){try{return Ae.ok(e.replace(t,n,r))}catch(e){if(e instanceof f)return Ae.fail(e.message);throw e}};var De=function(e){function t(t,n,r,i){e.call(this),this.from=t,this.to=n,this.slice=r,this.structure=!!i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){return this.structure&&we(e,this.from,this.to)?Ae.fail("Structure replace would overwrite content"):Ae.fromReplace(e,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new Ee([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice)},t.prototype.merge=function(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var n=this.slice.size+e.slice.size==0?m.empty:new m(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var r=this.slice.size+e.slice.size==0?m.empty:new m(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),r,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,m.fromJSON(e,n.slice),!!n.structure)},t}(Ce);Ce.jsonID("replace",De);var Re=function(e){function t(t,n,r,i,o,a,s){e.call(this),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=!!s}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){if(this.structure&&(we(e,this.from,this.gapFrom)||we(e,this.gapTo,this.to)))return Ae.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ae.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?Ae.fromReplace(e,this.from,this.to,n):Ae.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new Ee([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return n.deleted&&r.deleted||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,m.fromJSON(e,n.slice),n.insert,!!n.structure)},t}(Ce);function we(e,t,n){for(var r=e.resolve(t),i=n-t,o=r.depth;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0)for(var a=r.node(o).maybeChild(r.indexAfter(o));i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}return!1}function Ie(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Me(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),i=e.$from.index(n),o=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,o,t))return n;if(0==n||r.type.spec.isolating||!Ie(r,i,o))break}}function xe(e,t,n,r){void 0===r&&(r=e);var i=function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;var a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}(e,t),o=i&&function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,l=r;s&&l<i;l++)s=s.matchType(n.child(l).type);if(!s||!s.validEnd)return null;return a}(r,t);return o?i.map(ke).concat({type:t,attrs:n}).concat(o.map(ke)):null}function ke(e){return{type:e,attrs:null}}function Le(e,t,n,r){void 0===n&&(n=1);var i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(var s=i.depth-1,l=n-2;s>o;s--,l--){var c=i.node(s),d=i.index(s);if(c.type.spec.isolating)return!1;var u=c.content.cutByIndex(d,c.childCount),p=r&&r[l]||c;if(p!=c&&(u=u.replaceChild(0,p.type.create(p.attrs))),!c.canReplace(d+1,c.childCount)||!p.type.validContent(u))return!1}var f=i.indexAfter(o),m=r&&r[0];return i.node(o).canReplaceWith(f,f,m?m.type:i.node(o+1).type)}function Pe(e,t){var n=e.resolve(t),r=n.index();return Be(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Be(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}function Ue(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,o=0;o<n.openStart;o++)i=i.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(1==a)u=d.canReplace(c,c,i);else{var p=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Fe(e,t,n){for(var r=[],i=0;i<e.childCount;i++){var o=e.child(i);o.content.size&&(o=o.copy(Fe(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return s.fromArray(r)}Ce.jsonID("replaceAround",Re),Se.prototype.lift=function(e,t){for(var n=e.$from,r=e.$to,i=e.depth,o=n.before(i+1),a=r.after(i+1),l=o,c=a,d=s.empty,u=0,p=i,f=!1;p>t;p--)f||n.index(p)>0?(f=!0,d=s.from(n.node(p).copy(d)),u++):l--;for(var h=s.empty,g=0,_=i,v=!1;_>t;_--)v||r.after(_+1)<r.end(_)?(v=!0,h=s.from(r.node(_).copy(h)),g++):c++;return this.step(new Re(l,c,o,a,new m(d.append(h),u,g),d.size-u,!0))},Se.prototype.wrap=function(e,t){for(var n=s.empty,r=t.length-1;r>=0;r--)n=s.from(t[r].type.create(t[r].attrs,n));var i=e.start,o=e.end;return this.step(new Re(i,o,i,o,new m(n,0,0),t.length,!0))},Se.prototype.setBlockType=function(e,t,n,r){var i=this;if(void 0===t&&(t=e),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var o=this.steps.length;return this.doc.nodesBetween(e,t,(function(e,t){if(e.isTextblock&&!e.hasMarkup(n,r)&&function(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(i.doc,i.mapping.slice(o).map(t),n)){i.clearIncompatible(i.mapping.slice(o).map(t,1),n);var a=i.mapping.slice(o),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return i.step(new Re(l,c,l+1,c-1,new m(s.from(n.create(r,null,e.marks)),0,0),1,!0)),!1}})),this},Se.prototype.setNodeMarkup=function(e,t,n,r){var i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);var o=t.create(n,null,r||i.marks);if(i.isLeaf)return this.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new Re(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new m(s.from(o),0,0),1,!0))},Se.prototype.split=function(e,t,n){void 0===t&&(t=1);for(var r=this.doc.resolve(e),i=s.empty,o=s.empty,a=r.depth,l=r.depth-t,c=t-1;a>l;a--,c--){i=s.from(r.node(a).copy(i));var d=n&&n[c];o=s.from(d?d.type.create(d.attrs,o):r.node(a).copy(o))}return this.step(new De(e,e,new m(i.append(o),t,t),!0))},Se.prototype.join=function(e,t){void 0===t&&(t=1);var n=new De(e-t,e+t,m.empty,!0);return this.step(n)};var ze=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new m(Fe(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),i),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,o)},t.prototype.invert=function(){return new je(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(Ce);Ce.jsonID("addMark",ze);var je=function(e){function t(t,n,r){e.call(this),this.from=t,this.to=n,this.mark=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e){var t=this,n=e.slice(this.from,this.to),r=new m(Fe(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))})),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,r)},t.prototype.invert=function(){return new ze(this.from,this.to,this.mark)},t.prototype.map=function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)},t.prototype.merge=function(e){if(e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from)return new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))},t}(Ce);function Ge(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Ce.jsonID("removeMark",je),Se.prototype.addMark=function(e,t,n){var r=this,i=[],o=[],a=null,s=null;return this.doc.nodesBetween(e,t,(function(r,l,c){if(r.isInline){var d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){for(var u=Math.max(l,e),p=Math.min(l+r.nodeSize,t),f=n.addToSet(d),m=0;m<d.length;m++)d[m].isInSet(f)||(a&&a.to==u&&a.mark.eq(d[m])?a.to=p:i.push(a=new je(u,p,d[m])));s&&s.to==u?s.to=p:o.push(s=new ze(u,p,n))}}})),i.forEach((function(e){return r.step(e)})),o.forEach((function(e){return r.step(e)})),this},Se.prototype.removeMark=function(e,t,n){var r=this;void 0===n&&(n=null);var i=[],o=0;return this.doc.nodesBetween(e,t,(function(r,a){if(r.isInline){o++;var s=null;if(n instanceof J)for(var l,c=r.marks;l=n.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else n?n.isInSet(r.marks)&&(s=[n]):s=r.marks;if(s&&s.length)for(var d=Math.min(a+r.nodeSize,t),u=0;u<s.length;u++){for(var p=s[u],f=void 0,m=0;m<i.length;m++){var h=i[m];h.step==o-1&&p.eq(i[m].style)&&(f=h)}f?(f.to=d,f.step=o):i.push({style:p,from:Math.max(a,e),to:d,step:o})}}})),i.forEach((function(e){return r.step(new je(e.from,e.to,e.style))})),this},Se.prototype.clearIncompatible=function(e,t,n){void 0===n&&(n=t.contentMatch);for(var r=this.doc.nodeAt(e),i=[],o=e+1,a=0;a<r.childCount;a++){var l=r.child(a),c=o+l.nodeSize,d=n.matchType(l.type,l.attrs);if(d){n=d;for(var u=0;u<l.marks.length;u++)t.allowsMarkType(l.marks[u].type)||this.step(new je(o,c,l.marks[u]))}else i.push(new De(o,c,m.empty));o=c}if(!n.validEnd){var p=n.fillBefore(s.empty,!0);this.replace(o,o,new m(p,0,0))}for(var f=i.length-1;f>=0;f--)this.step(i[f]);return this},Se.prototype.replace=function(e,t,n){void 0===t&&(t=e),void 0===n&&(n=m.empty);var r=function(e,t,n,r){if(void 0===n&&(n=t),void 0===r&&(r=m.empty),t==n&&!r.size)return null;var i=e.resolve(t),o=e.resolve(n);return Ge(i,o,r)?new De(t,n,r):new Ye(i,o,r).fit()}(this.doc,e,t,n);return r&&this.step(r),this},Se.prototype.replaceWith=function(e,t,n){return this.replace(e,t,new m(s.from(n),0,0))},Se.prototype.delete=function(e,t){return this.replace(e,t,m.empty)},Se.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};var Ye=function(e,t,n){this.$to=t,this.$from=e,this.unplaced=n,this.frontier=[];for(var r=0;r<=e.depth;r++){var i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}this.placed=s.empty;for(var o=e.depth;o>0;o--)this.placed=s.from(e.node(o).copy(this.placed))},Ve={depth:{configurable:!0}};function He(e,t,n){return 0==t?e.cutByIndex(n):e.replaceChild(0,e.firstChild.copy(He(e.firstChild.content,t-1,n)))}function qe(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qe(e.lastChild.content,t-1,n)))}function $e(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function We(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,We(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(s.empty,!0)))),e.copy(r)}function Qe(e,t,n,r,i){var o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;var s=r.fillBefore(o.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,a)?s:null}function Ke(e,t,n,r,i){if(t<n){var o=e.firstChild;e=e.replaceChild(0,o.copy(Ke(o.content,t+1,n,r,o)))}if(t>r){var a=i.contentMatchAt(0),l=a.fillBefore(e).append(e);e=l.append(a.matchFragment(l).fillBefore(s.empty,!0))}return e}function Xe(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;i==t.start(r)&&n.push(r)}return n}Ve.depth.get=function(){return this.frontier.length-1},Ye.prototype.fit=function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;for(var o=this.placed,a=r.depth,s=i.depth;a&&s&&1==o.childCount;)o=o.firstChild.content,a--,s--;var l=new m(o,a,s);return t>-1?new Re(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new De(r.pos,i.pos,l):void 0},Ye.prototype.findFittable=function(){for(var e=1;e<=2;e++)for(var t=this.unplaced.openStart;t>=0;t--)for(var n=void 0,r=(t?(n=$e(this.unplaced.content,t-1).firstChild).content:this.unplaced.content).firstChild,i=this.depth;i>=0;i--){var o=this.frontier[i],a=o.type,l=o.match,c=void 0,d=void 0;if(1==e&&(r?l.matchType(r.type)||(d=l.fillBefore(s.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:t,frontierDepth:i,parent:n,inject:d};if(2==e&&r&&(c=l.findWrapping(r.type)))return{sliceDepth:t,frontierDepth:i,parent:n,wrap:c};if(n&&l.matchType(n.type))break}},Ye.prototype.openMore=function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=$e(t,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new m(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)},Ye.prototype.dropNode=function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=$e(t,n);if(i.childCount<=1&&n>0){var o=t.size-n<=n+i.size;this.unplaced=new m(He(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new m(He(t,n,1),n,r)},Ye.prototype.placeNodes=function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,i=e.inject,o=e.wrap;this.depth>n;)this.closeFrontierNode();if(o)for(var a=0;a<o.length;a++)this.openFrontierNode(o[a]);var l=this.unplaced,c=r?r.content:l.content,d=l.openStart-t,u=0,p=[],f=this.frontier[n],h=f.match,g=f.type;if(i){for(var _=0;_<i.childCount;_++)p.push(i.child(_));h=h.matchFragment(i)}for(var v=c.size+t-(l.content.size-l.openEnd);u<c.childCount;){var E=c.child(u),b=h.matchType(E.type);if(!b)break;(++u>1||0==d||E.content.size)&&(h=b,p.push(We(E.mark(g.allowedMarks(E.marks)),1==u?d:0,u==c.childCount?v:-1)))}var y=u==c.childCount;y||(v=-1),this.placed=qe(this.placed,n,s.from(p)),this.frontier[n].match=h,y&&v<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var S=0,T=c;S<v;S++){var N=T.lastChild;this.frontier.push({type:N.type,match:N.contentMatchAt(N.childCount)}),T=N.content}this.unplaced=y?0==t?m.empty:new m(He(l.content,t-1,1),t-1,v<0?l.openEnd:t-1):new m(He(l.content,t,u),l.openStart,l.openEnd)},Ye.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Qe(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},Ye.prototype.findCloseLevel=function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Qe(e,t,i,r,o);if(a){for(var s=t-1;s>=0;s--){var l=this.frontier[s],c=l.match,d=Qe(e,s,l.type,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}},Ye.prototype.close=function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qe(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e},Ye.prototype.openFrontierNode=function(e,t,n){var r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=qe(this.placed,this.depth,s.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})},Ye.prototype.closeFrontierNode=function(){var e=this.frontier.pop().match.fillBefore(s.empty,!0);e.childCount&&(this.placed=qe(this.placed,this.frontier.length,e))},Object.defineProperties(Ye.prototype,Ve),Se.prototype.replaceRange=function(e,t,n){if(!n.size)return this.deleteRange(e,t);var r=this.doc.resolve(e),i=this.doc.resolve(t);if(Ge(r,i,n))return this.step(new De(e,t,n));var o=Xe(r,this.doc.resolve(t));0==o[o.length-1]&&o.pop();var a=-(r.depth+1);o.unshift(a);for(var s=r.depth,l=r.pos-1;s>0;s--,l--){var c=r.node(s).type.spec;if(c.defining||c.isolating)break;o.indexOf(s)>-1?a=s:r.before(s)==l&&o.splice(1,0,-s)}for(var d=o.indexOf(a),u=[],p=n.openStart,f=n.content,h=0;;h++){var g=f.firstChild;if(u.push(g),h==n.openStart)break;f=g.content}p>0&&u[p-1].type.spec.defining&&r.node(d).type!=u[p-1].type?p-=1:p>=2&&u[p-1].isTextblock&&u[p-2].type.spec.defining&&r.node(d).type!=u[p-2].type&&(p-=2);for(var _=n.openStart;_>=0;_--){var v=(_+p+1)%(n.openStart+1),E=u[v];if(E)for(var b=0;b<o.length;b++){var y=o[(b+d)%o.length],S=!0;y<0&&(S=!1,y=-y);var T=r.node(y-1),N=r.index(y-1);if(T.canReplaceWith(N,N,E.type,E.marks))return this.replace(r.before(y),S?i.after(y):t,new m(Ke(n.content,0,n.openStart,v),v,n.openEnd))}}for(var O=this.steps.length,C=o.length-1;C>=0&&(this.replace(e,t,n),!(this.steps.length>O));C--){var A=o[C];A<0||(e=r.before(A),t=i.after(A))}return this},Se.prototype.replaceRangeWith=function(e,t,n){if(!n.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var r=function(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var i=r.depth-1;i>=0;i--){var o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}}(this.doc,e,n.type);null!=r&&(e=t=r)}return this.replaceRange(e,t,new m(s.from(n),0,0))},Se.prototype.deleteRange=function(e,t){for(var n=this.doc.resolve(e),r=this.doc.resolve(t),i=Xe(n,r),o=0;o<i.length;o++){var a=i[o],s=o==i.length-1;if(s&&0==a||n.node(a).type.contentMatch.validEnd)return this.delete(n.start(a),r.end(a));if(a>0&&(s||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return this.delete(n.before(a),r.after(a))}for(var l=1;l<=n.depth&&l<=r.depth;l++)if(e-n.start(l)==n.depth-l&&t>n.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(n.before(l),t);return this.delete(e,t)};var Ze=Object.create(null),Je=function(e,t,n){this.ranges=n||[new tt(e.min(t),e.max(t))],this.$anchor=e,this.$head=t},et={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};et.anchor.get=function(){return this.$anchor.pos},et.head.get=function(){return this.$head.pos},et.from.get=function(){return this.$from.pos},et.to.get=function(){return this.$to.pos},et.$from.get=function(){return this.ranges[0].$from},et.$to.get=function(){return this.ranges[0].$to},et.empty.get=function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0},Je.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Je.prototype.replace=function(e,t){void 0===t&&(t=m.empty);for(var n=t.content.lastChild,r=null,i=0;i<t.openEnd;i++)r=n,n=n.lastChild;for(var o=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,d=l.$to,u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),s?m.empty:t),0==s&&ct(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Je.prototype.replaceWith=function(e,t){for(var n=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var o=r[i],a=o.$from,s=o.$to,l=e.mapping.slice(n),c=l.map(a.pos),d=l.map(s.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),ct(e,n,t.isInline?-1:1))}},Je.findFrom=function(e,t,n){var r=e.parent.inlineContent?new nt(e):lt(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var i=e.depth-1;i>=0;i--){var o=t<0?lt(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):lt(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(o)return o}},Je.near=function(e,t){return void 0===t&&(t=1),this.findFrom(e,t)||this.findFrom(e,-t)||new at(e.node(0))},Je.atStart=function(e){return lt(e,e,0,0,1)||new at(e)},Je.atEnd=function(e){return lt(e,e,e.content.size,e.childCount,-1)||new at(e)},Je.fromJSON=function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ze[t.type];if(!n)throw new RangeError("No selection type "+t.type+" defined");return n.fromJSON(e,t)},Je.jsonID=function(e,t){if(e in Ze)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ze[e]=t,t.prototype.jsonID=e,t},Je.prototype.getBookmark=function(){return nt.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Je.prototype,et),Je.prototype.visible=!0;var tt=function(e,t){this.$from=e,this.$to=t},nt=function(e){function t(t,n){void 0===n&&(n=t),e.call(this,t,n)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},t.prototype.map=function(n,r){var i=n.resolve(r.map(this.head));if(!i.parent.inlineContent)return e.near(i);var o=n.resolve(r.map(this.anchor));return new t(o.parent.inlineContent?o:i,i)},t.prototype.replace=function(t,n){if(void 0===n&&(n=m.empty),e.prototype.replace.call(this,t,n),n==m.empty){var r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head},t.prototype.getBookmark=function(){return new rt(this.anchor,this.head)},t.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))},t.create=function(e,t,n){void 0===n&&(n=t);var r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))},t.between=function(n,r,i){var o=n.pos-r.pos;if(i&&!o||(i=o>=0?1:-1),!r.parent.inlineContent){var a=e.findFrom(r,i,!0)||e.findFrom(r,-i,!0);if(!a)return e.near(r,i);r=a.$head}return n.parent.inlineContent||(0==o||(n=(e.findFrom(n,-i,!0)||e.findFrom(n,i,!0)).$anchor).pos<r.pos!=o<0)&&(n=r),new t(n,r)},Object.defineProperties(t.prototype,n),t}(Je);Je.jsonID("text",nt);var rt=function(e,t){this.anchor=e,this.head=t};rt.prototype.map=function(e){return new rt(e.map(this.anchor),e.map(this.head))},rt.prototype.resolve=function(e){return nt.between(e.resolve(this.anchor),e.resolve(this.head))};var it=function(e){function t(t){var n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);e.call(this,t,r),this.node=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var i=r.mapResult(this.anchor),o=i.deleted,a=i.pos,s=n.resolve(a);return o?e.near(s):new t(s)},t.prototype.content=function(){return new m(s.from(this.node),0,0)},t.prototype.eq=function(e){return e instanceof t&&e.anchor==this.anchor},t.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},t.prototype.getBookmark=function(){return new ot(this.anchor)},t.fromJSON=function(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))},t.create=function(e,t){return new this(e.resolve(t))},t.isSelectable=function(e){return!e.isText&&!1!==e.type.spec.selectable},t}(Je);it.prototype.visible=!1,Je.jsonID("node",it);var ot=function(e){this.anchor=e};ot.prototype.map=function(e){var t=e.mapResult(this.anchor),n=t.deleted,r=t.pos;return n?new rt(r,r):new ot(r)},ot.prototype.resolve=function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&it.isSelectable(n)?new it(t):Je.near(t)};var at=function(e){function t(t){e.call(this,t.resolve(0),t.resolve(t.content.size))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.replace=function(t,n){if(void 0===n&&(n=m.empty),n==m.empty){t.delete(0,t.doc.content.size);var r=e.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else e.prototype.replace.call(this,t,n)},t.prototype.toJSON=function(){return{type:"all"}},t.fromJSON=function(e){return new t(e)},t.prototype.map=function(e){return new t(e)},t.prototype.eq=function(e){return e instanceof t},t.prototype.getBookmark=function(){return st},t}(Je);Je.jsonID("all",at);var st={map:function(){return this},resolve:function(e){return new at(e)}};function lt(e,t,n,r,i,o){if(t.inlineContent)return nt.create(e,n);for(var a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){var s=t.child(a);if(s.isAtom){if(!o&&it.isSelectable(s))return it.create(e,n-(i<0?s.nodeSize:0))}else{var l=lt(e,s,n+i,i<0?s.childCount:0,i,o);if(l)return l}n+=s.nodeSize*i}}function ct(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i,o=e.steps[r];if(o instanceof De||o instanceof Re)e.mapping.maps[r].forEach((function(e,t,n,r){null==i&&(i=r)})),e.setSelection(Je.near(e.doc.resolve(i),n))}}var dt=function(e){function t(t){e.call(this,t.doc),this.time=Date.now(),this.curSelection=t.selection,this.curSelectionFor=0,this.storedMarks=t.storedMarks,this.updated=0,this.meta=Object.create(null)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},t.prototype.setSelection=function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},t.prototype.setStoredMarks=function(e){return this.storedMarks=e,this.updated|=2,this},t.prototype.ensureMarks=function(e){return p.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this},t.prototype.addStoredMark=function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))},t.prototype.removeStoredMark=function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},t.prototype.addStep=function(t,n){e.prototype.addStep.call(this,t,n),this.updated=-3&this.updated,this.storedMarks=null},t.prototype.setTime=function(e){return this.time=e,this},t.prototype.replaceSelection=function(e){return this.selection.replace(this,e),this},t.prototype.replaceSelectionWith=function(e,t){var n=this.selection;return!1!==t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,e),this},t.prototype.deleteSelection=function(){return this.selection.replace(this),this},t.prototype.insertText=function(e,t,n){void 0===n&&(n=t);var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(!e)return this.deleteRange(t,n);var i=this.storedMarks;if(!i){var o=this.doc.resolve(t);i=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(Je.near(this.selection.$to)),this},t.prototype.setMeta=function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this},t.prototype.getMeta=function(e){return this.meta["string"==typeof e?e:e.key]},n.isGeneric.get=function(){for(var e in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(t.prototype,n),t}(Se);function ut(e,t){return t&&e?e.bind(t):e}var pt=function(e,t,n){this.name=e,this.init=ut(t.init,n),this.apply=ut(t.apply,n)},ft=[new pt("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new pt("selection",{init:function(e,t){return e.selection||Je.atStart(t.doc)},apply:function(e){return e.selection}}),new pt("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new pt("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],mt=function(e,t){var n=this;this.schema=e,this.fields=ft.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),t&&t.forEach((function(e){if(n.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");n.plugins.push(e),n.pluginsByKey[e.key]=e,e.spec.state&&n.fields.push(new pt(e.key,e.spec.state,e))}))},ht=function(e){this.config=e},gt={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};gt.schema.get=function(){return this.config.schema},gt.plugins.get=function(){return this.config.plugins},ht.prototype.apply=function(e){return this.applyTransaction(e).state},ht.prototype.filterTransaction=function(e,t){void 0===t&&(t=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0},ht.prototype.applyTransaction=function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var i=!1,o=0;o<this.config.plugins.length;o++){var a=this.config.plugins[o];if(a.spec.appendTransaction){var s=r?r[o].n:0,l=r?r[o].state:this,c=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var d=0;d<this.config.plugins.length;d++)r.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}},ht.prototype.applyInner=function(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var t=new ht(this.config),n=this.config.fields,r=0;r<n.length;r++){var i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}for(var o=0;o<_t.length;o++)_t[o](this,e,t);return t},gt.tr.get=function(){return new dt(this)},ht.create=function(e){for(var t=new mt(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new ht(t),r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n},ht.prototype.reconfigure=function(e){for(var t=new mt(this.schema,e.plugins),n=t.fields,r=new ht(t),i=0;i<n.length;i++){var o=n[i].name;r[o]=this.hasOwnProperty(o)?this[o]:n[i].init(e,r)}return r},ht.prototype.toJSON=function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((function(e){return e.toJSON()}))),e&&"object"==typeof e)for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t},ht.fromJSON=function(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");var r=new mt(e.schema,e.plugins),i=new ht(r);return r.fields.forEach((function(r){if("doc"==r.name)i.doc=I.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=Je.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(var o in n){var a=n[o],s=a.spec.state;if(a.key==r.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(t,o))return void(i[r.name]=s.fromJSON.call(a,e,t[o],i))}i[r.name]=r.init(e,i)}})),i},ht.addApplyListener=function(e){_t.push(e)},ht.removeApplyListener=function(e){var t=_t.indexOf(e);t>-1&&_t.splice(t,1)},Object.defineProperties(ht.prototype,gt);var _t=[];var vt=function(e){this.props={},e.props&&function e(t,n,r){for(var i in t){var o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.spec=e,this.key=e.key?e.key.key:bt("plugin")};vt.prototype.getState=function(e){return e[this.key]};var Et=Object.create(null);function bt(e){return e in Et?e+"$"+ ++Et[e]:(Et[e]=0,e+"$")}var yt=function(e){void 0===e&&(e="key"),this.key=bt(e)};yt.prototype.get=function(e){return e.config.pluginsByKey[this.key]},yt.prototype.getState=function(e){return e[this.key]};var St={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Tt=/Edge\/(\d+)/.exec(navigator.userAgent),Nt=/MSIE \d/.test(navigator.userAgent),Ot=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);St.mac=/Mac/.test(navigator.platform);var Ct=St.ie=!!(Nt||Ot||Tt);St.ie_version=Nt?document.documentMode||6:Ot?+Ot[1]:Tt?+Tt[1]:null,St.gecko=!Ct&&/gecko\/(\d+)/i.test(navigator.userAgent),St.gecko_version=St.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var At=!Ct&&/Chrome\/(\d+)/.exec(navigator.userAgent);St.chrome=!!At,St.chrome_version=At&&+At[1],St.safari=!Ct&&/Apple Computer/.test(navigator.vendor),St.ios=St.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),St.android=/Android \d/.test(navigator.userAgent),St.webkit="webkitFontSmoothing"in document.documentElement.style,St.webkit_version=St.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Dt=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Rt=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},wt=null,It=function(e,t,n){var r=wt||(wt=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Mt=function(e,t,n,r){return n&&(kt(e,t,n,r,-1)||kt(e,t,n,r,1))},xt=/^(img|br|input|textarea|hr)$/i;function kt(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Lt(e))){var o=e.parentNode;if(1!=o.nodeType||Pt(e)||xt.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Dt(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?Lt(e):0}}}function Lt(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Pt(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Bt=function(e){var t=e.isCollapsed;return t&&St.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function Ut(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Ft(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function zt(e,t){return"number"==typeof e?e:e[t]}function jt(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Gt(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Rt(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Ft(o):jt(a),c=0,d=0;if(t.top<l.top+zt(r,"top")?d=-(l.top-t.top+zt(i,"top")):t.bottom>l.bottom-zt(r,"bottom")&&(d=t.bottom-l.bottom+zt(i,"bottom")),t.left<l.left+zt(r,"left")?c=-(l.left-t.left+zt(i,"left")):t.right>l.right-zt(r,"right")&&(c=t.right-l.right+zt(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function Yt(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Rt(e));return t}function Vt(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Ht=null;function qt(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=It(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=Qt(r,1);if(o.top!=o.bottom&&$t(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:qt(n,r)}function $t(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Wt(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!$t(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if($t(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(St.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(St.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=qt(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function Qt(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var Kt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Xt(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=St.webkit||St.gecko;if(3==i.nodeType){if(!a||!Kt.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,Zt(Qt(It(i,s,l),c),c<0)}var d=Qt(It(i,o,o),n);if(St.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=Qt(It(i,o-1,o-1),-1);if(u.top==d.top){var p=Qt(It(i,o,o+1),-1);if(p.top!=d.top)return Zt(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==Lt(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return Jt(f.getBoundingClientRect(),!1)}if(o<Lt(i)){var m=i.childNodes[o];if(1==m.nodeType)return Jt(m.getBoundingClientRect(),!0)}return Jt(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==Lt(i))){var h=i.childNodes[o-1],g=3==h.nodeType?It(h,Lt(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return Zt(Qt(g,1),!1)}if(o<Lt(i)){var _=i.childNodes[o],v=3==_.nodeType?It(_,0,a?0:1):1==_.nodeType?_:null;if(v)return Zt(Qt(v,-1),!0)}return Zt(Qt(3==i.nodeType?It(i):i,-n),n>=0)}function Zt(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Jt(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function en(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var tn=/[\u0590-\u08ac]/;var nn=null,rn=null,on=!1;function an(e,t,n){return nn==t&&rn==n?on:(nn=t,rn=n,on="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return en(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=Xt(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=It(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return tn.test(r.parent.textContent)&&s.modify?en(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var sn=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},ln={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};sn.prototype.matchesWidget=function(){return!1},sn.prototype.matchesMark=function(){return!1},sn.prototype.matchesNode=function(){return!1},sn.prototype.matchesHack=function(){return!1},ln.beforePosition.get=function(){return!1},sn.prototype.parseRule=function(){return null},sn.prototype.stopEvent=function(){return!1},ln.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},ln.border.get=function(){return 0},sn.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},sn.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},ln.posBefore.get=function(){return this.parent.posBeforeChild(this)},ln.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},ln.posAfter.get=function(){return this.posBefore+this.size},ln.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},sn.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>Dt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},sn.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},sn.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},sn.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},sn.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},sn.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?Dt(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},sn.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=Dt(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Dt(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},sn.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},sn.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},sn.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((St.gecko||St.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:Dt(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(r||f&&St.safari||!Mt(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Mt(u.node,u.offset,p.focusNode,p.focusOffset)){var _=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),_=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!_){if(e>t){var v=d;d=u,u=v}var E=document.createRange();E.setEnd(u.node,u.offset),E.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(E)}}},sn.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},ln.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},sn.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},sn.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},ln.domAtom.get=function(){return!1},Object.defineProperties(sn.prototype,ln);var cn=[],dn=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,cn,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(sn),un=function(e){function t(t,n,r,i){e.call(this,t,cn,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(sn),pn=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=Dn(o,n,a,r)),e>0&&(o=Dn(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(sn),fn=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?cn:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Tn(u,r,n),d?l=new _n(e,n,r,i,u,p,f,d,o,a+1):n.isText?new hn(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Nn(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Cn(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(An);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():cn;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(cn,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=On(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof pn){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=On(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),St.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=Lt(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new un(this,o,n,i);e.compositionNodes.push(a),this.children=Dn(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Nn(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=yn(this.dom,this.nodeDOM,bn(this.outerDeco,this.node,t),bn(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(sn);function mn(e,t,n,r,i){return Tn(r,t,e),new fn(null,e,t,n,r,r,r,i,0)}var hn=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(fn),gn=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(sn),_n=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(fn);function vn(e){e&&(this.nodeName=e)}vn.prototype=Object.create(null);var En=[new vn];function bn(e,t,n){if(0==e.length)return En;for(var r=n?En[0]:new vn,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new vn(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new vn(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function yn(e,t,n,r){if(n==En&&r==En)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=En[0]),i=l}Sn(i,s||En[0],a)}return i}function Sn(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):cn,a=n.class?n.class.split(" ").filter(Boolean):cn,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Tn(e,t,n){return yn(e,e,En,bn(t,n,1!=e.nodeType))}function Nn(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function On(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Cn=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function An(e,t){return e.type.side-t.type.side}function Dn(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Rn(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Bt(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==Lt(e);r||i;){if(e==n)return!0;var o=Dt(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Lt(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=Un(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function wn(e){return e.editable?e.hasFocus():Fn(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function In(e,t){var n=e.state.selection;if(Pn(e,n),wn(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Dt(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&St.ie&&St.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!Mn||n instanceof nt||(n.$from.parent.inlineContent||(r=xn(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=xn(e,n.to))),e.docView.setSelection(o,a,e.root,t),Mn&&(r&&Ln(r),i&&Ln(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){wn(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Cn.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Cn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Cn.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=pn.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Cn.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Cn.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof fn){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Nn(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Cn.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,fn.create(this.top,e,t,n,r,i)),this.changed=!0},Cn.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new dn(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Cn.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof pn;)e=e.children[e.children.length-1];if(!e||!(e instanceof hn)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new gn(this.top,cn,t,null)),this.changed=!0}};var Mn=St.safari||St.chrome&&St.chrome_version<63;function xn(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(St.safari&&o&&"false"==o.contentEditable)return kn(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return kn(o);if(a)return kn(a)}}function kn(e){return e.contentEditable="true",St.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ln(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Pn(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Bn(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Bn(e)}function Bn(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function Un(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function Fn(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function zn(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function jn(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Gn(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return jn(e,new nt(t>0?r.$to:r.$from));var i=zn(e.state,t);return!!i&&jn(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=zn(e.state,t);return!!(o&&o instanceof it)&&jn(e,o)}if(!(St.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?jn(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!St.webkit&&jn(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Yn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Vn(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Hn(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(St.gecko&&1==n.nodeType&&r<Yn(n)&&Vn(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Vn(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if($n(n))break;for(var l=n.previousSibling;l&&Vn(l);)i=n.parentNode,o=Dt(l),l=l.previousSibling;if(l)r=Yn(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Wn(e,t,n,r):i&&Wn(e,t,i,o)}}function qn(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Yn(n);;)if(r<a){if(1!=n.nodeType)break;if(!Vn(n.childNodes[r]))break;i=n,o=++r}else{if($n(n))break;for(var s=n.nextSibling;s&&Vn(s);)i=s.parentNode,o=Dt(s)+1,s=s.nextSibling;if(s)r=0,a=Yn(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Wn(e,t,i,o)}}function $n(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Wn(e,t,n,r){if(Bt(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&In(e)}),50)}function Qn(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(St.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=zn(e.state,t);if(a&&a instanceof it)return jn(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&jn(e,l)}return!1}function Kn(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Xn(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Zn(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||St.mac&&72==n&&"c"==r?Kn(e,-1)||Hn(e):46==n||St.mac&&68==n&&"c"==r?Kn(e,1)||qn(e):13==n||27==n||(37==n?Gn(e,-1,r)||Hn(e):39==n?Gn(e,1,r)||qn(e):38==n?Qn(e,-1,r)||Hn(e):40==n?function(e){if(St.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Xn(e,i,!0),setTimeout((function(){return Xn(e,i,!1)}),20)}}}(e)||Qn(e,1,r)||qn(e):r==(St.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Jn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(St.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||St.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function er(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=Rn(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Bt(c)||d.push({node:c.focusNode,offset:c.focusOffset})),St.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:Jn,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(St.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((St.ios&&e.lastIOSEnter>Date.now()-225||St.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=tr(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),St.ie&&St.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((St.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||nr(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(nr(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||nr(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,Ut(8,"Backspace"))})))St.android&&St.chrome&&e.domObserver.suppressSelectionUpdates();else{St.chrome&&St.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),St.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)St.ie&&St.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return In(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=tr(e,O.doc,p.sel);M&&!(St.chrome&&St.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||St.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function tr(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Un(e,t.resolve(n.anchor),t.resolve(n.head))}function nr(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function rr(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=cr(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=sr[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ir(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=cr().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&sr[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(ar(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(ar(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(or(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=or(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function or(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function ar(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=ar(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var sr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},lr=null;function cr(){return lr||(lr=document.implementation.createHTMLDocument("title"))}var dr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ur=St.ie&&St.ie_version<=11,pr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};pr.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},pr.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var fr=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);St.ie&&St.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new pr,ur&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};fr.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},fr.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},fr.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,dr),ur&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},fr.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}ur&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},fr.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},fr.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},fr.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},fr.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&Fn(e)){var e;if(this.suppressingSelectionUpdates)return In(this.view);if(St.ie&&St.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Mt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},fr.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},fr.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},fr.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Fn(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(St.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(mr)return;mr=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||In(this.view),this.currentSelection.set(t))}},fr.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(St.ie&&St.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?Dt(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?Dt(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var mr=!1;var hr={},gr={};function _r(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function vr(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Er(e,t)})}))}function Er(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function br(e){return{left:e.clientX,top:e.clientY}}function yr(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Sr(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Tr(e,t,n,r,i){return yr(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Sr(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Sr(e,new it(n),"pointer"),!0)}(e,n))}function Nr(e,t,n,r){return yr(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function Or(e,t,n,r){return yr(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Sr(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Sr(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Sr(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Cr(e){return xr(e)}gr.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!Rr(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!St.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||Zn(e,t)?t.preventDefault():_r(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,Ut(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},gr.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},gr.keypress=function(e,t){if(!(Rr(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||St.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Ar=St.mac?"metaKey":"ctrlKey";hr.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Cr(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Ar]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(br(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new Dr(e,o,t,n)):("doubleClick"==i?Nr:Or)(e,o.pos,o.inside,t)?t.preventDefault():_r(e,"pointer"))};var Dr=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Ar],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&St.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_r(e,"pointer")};function Rr(e,t){return!!e.composing||!!(St.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}Dr.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Dr.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(br(e))),this.allowDefault||!t?_r(this.view,"pointer"):Tr(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||St.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||St.chrome&&!(this.view.state.selection instanceof nt)&&(t.pos==this.view.state.selection.from||t.pos==this.view.state.selection.to)?(Sr(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):_r(this.view,"pointer")}},Dr.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),_r(this.view,"pointer"),0==e.buttons&&this.done()},hr.touchdown=function(e){Cr(e),_r(e,"pointer")},hr.contextmenu=function(e){return Cr(e)};var wr=St.android?5e3:-1;function Ir(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return xr(e)}),t))}function Mr(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function xr(e,t){if(e.domObserver.forceFlush(),Mr(e),t||e.docView.dirty){var n=Rn(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}gr.compositionstart=gr.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),xr(e,!0),e.markCursor=null;else if(xr(e),St.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}Ir(e,wr)},gr.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,Ir(e,20))};var kr=St.ie&&St.ie_version<15||St.ios&&St.webkit_version<604;function Lr(e,t,n,r){var i=ir(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}hr.copy=gr.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=kr?null:t.clipboardData,o=rr(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},gr.paste=function(e,t){var n=kr?null:t.clipboardData;n&&Lr(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lr(e,r.value,null,t):Lr(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var Pr=function(e,t){this.slice=e,this.move=t},Br=St.mac?"altKey":"ctrlKey";for(var Ur in hr.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(br(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=rr(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(kr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",kr||t.dataTransfer.setData("text/plain",c),e.dragging=new Pr(a,!t[Br])}},hr.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},gr.dragover=gr.dragenter=function(e,t){return t.preventDefault()},gr.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(br(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice||ir(e,t.dataTransfer.getData(kr?"Text":"text/plain"),kr?null:t.dataTransfer.getData("text/html"),!1,i),a=n&&!t[Br];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(Un(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},hr.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&In(e)}),20))},hr.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},hr.beforeinput=function(e,t){if(St.chrome&&St.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,Ut(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},gr)hr[Ur]=gr[Ur];function Fr(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var zr=function(e,t){this.spec=t||qr,this.side=this.spec.side||0,this.toDOM=e};zr.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Yr(o-n,o-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(e){return this==e||e instanceof zr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fr(this.spec,e.spec))};var jr=function(e,t){this.spec=t||qr,this.attrs=e};jr.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Yr(i,o,this)},jr.prototype.valid=function(e,t){return t.from<t.to},jr.prototype.eq=function(e){return this==e||e instanceof jr&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)},jr.is=function(e){return e.type instanceof jr};var Gr=function(e,t){this.spec=t||qr,this.attrs=e};Gr.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Yr(i.pos-n,o.pos-n,this)},Gr.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},Gr.prototype.eq=function(e){return this==e||e instanceof Gr&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)};var Yr=function(e,t,n){this.from=e,this.to=t,this.type=n},Vr={spec:{configurable:!0},inline:{configurable:!0}};Yr.prototype.copy=function(e,t){return new Yr(e,t,this.type)},Yr.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Yr.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Yr.widget=function(e,t,n){return new Yr(e,e,new zr(t,n))},Yr.inline=function(e,t,n,r){return new Yr(e,t,new jr(n,r))},Yr.node=function(e,t,n,r){return new Yr(e,t,new Gr(n,r))},Vr.spec.get=function(){return this.type.spec},Vr.inline.get=function(){return this.type instanceof jr},Object.defineProperties(Yr.prototype,Vr);var Hr=[],qr={},$r=function(e,t){this.local=e&&e.length?e:Hr,this.children=t&&t.length?t:Hr};$r.create=function(e,t){return t.length?Jr(t,e,0,qr):Wr},$r.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},$r.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},$r.prototype.map=function(e,t,n){return this==Wr||0==e.maps.length?this:this.mapInner(e,t,0,0,n||qr)},$r.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Wr?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=Jr(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new $r(t&&t.sort(ei),s)}(this.children,o,e,t,n,r,i):o?new $r(o.sort(ei)):Wr},$r.prototype.add=function(e,t){return t.length?this==Wr?$r.create(e,t):this.addInner(e,t,0):this},$r.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=Xr(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,Jr(s,e,l+1,qr)),o+=3}}));for(var a=Kr(o?Zr(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new $r(a.length?this.local.concat(a).sort(ei):this.local,r||this.children)},$r.prototype.remove=function(e){return 0==e.length||this==Wr?this:this.removeInner(e,0)},$r.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Wr?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $r(r,n):Wr},$r.prototype.forChild=function(e,t){if(this==Wr)return this;if(t.isLeaf)return $r.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof jr){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new $r(r.sort(ei));return n?new Qr([u,n]):u}return n||Wr},$r.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof $r)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},$r.prototype.locals=function(e){return ti(this.localsInner(e))},$r.prototype.localsInner=function(e){if(this==Wr)return Hr;if(e.inlineContent||!this.local.some(jr.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof jr||t.push(this.local[n]);return t};var Wr=new $r;$r.empty=Wr,$r.removeOverlap=ti;var Qr=function(e){this.members=e};function Kr(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Yr(i.from+t,i.to+t,i.type))}return n}function Xr(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function Zr(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Jr(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=Xr(e,t,a+n);if(s){o=!0;var l=Jr(s,t,n+a+1,r);l!=Wr&&i.push(a,a+t.nodeSize,l)}}));for(var a=Kr(o?Zr(e):e,-n).sort(ei),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new $r(a,i):Wr}function ei(e,t){return e.from-t.from||e.to-t.to}function ti(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),ni(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),ni(t,i+1,o.copy(r.to,o.to)))}}return t}function ni(e,t,n){for(;t<e.length&&ei(n,e[t])>0;)t++;e.splice(t,0,n)}function ri(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Wr&&t.push(r)})),e.cursorWrapper&&t.push($r.create(e.state.doc,[e.cursorWrapper.deco])),Qr.from(t)}Qr.prototype.forChild=function(e,t){if(t.isLeaf)return $r.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Wr&&(i instanceof Qr?n=n.concat(i.members):n.push(i))}return Qr.from(n)},Qr.prototype.eq=function(e){if(!(e instanceof Qr)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},Qr.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ti(n?t:t.sort(ei)):Hr},Qr.from=function(e){switch(e.length){case 0:return Wr;case 1:return e[0];default:return new Qr(e)}};var ii=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=li(this),this.markCursor=null,this.cursorWrapper=null,si(this),this.nodeViews=ci(this),this.docView=mn(this.state.doc,ai(this),ri(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new fr(e,(function(t,n,r,i){return er(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=hr[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Er(e,t)||!e.editable&&t.type in gr||n(e,t)})};for(var n in hr)t(n);St.safari&&e.dom.addEventListener("input",(function(){return null})),vr(e)}(this),this.pluginViews=[],this.updatePluginViews()},oi={props:{configurable:!0},root:{configurable:!0}};function ai(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Yr.node(0,e.state.doc.content.size,t)]}function si(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Yr.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function li(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function ci(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}oi.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},ii.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vr(this),this._props=e,this.updateStateInner(e.state,!0)},ii.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},ii.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},ii.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(Mr(this),o=!0),this.state=e,t){var a=ci(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),vr(this)}this.editable=li(this),si(this);var s=ri(this),l=ai(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:Yt(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(St.ie||St.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=St.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=mn(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Mt(p.node,p.offset,f.anchorNode,f.anchorOffset)))?In(this,T):(Pn(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Gt(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Gt(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,Vt(b,0==y?0:y-E))},ii.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},ii.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},ii.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},ii.prototype.hasFocus=function(){return this.root.activeElement==this.dom},ii.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Ht)return e.focus(Ht);var t=Yt(e);e.focus(null==Ht?{get preventScroll(){return Ht={preventScroll:!0},!0}}:void 0),Ht||(Ht=!1,Vt(t,0))}(this.dom),In(this),this.domObserver.start()},oi.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},ii.prototype.posAtCoords=function(e){return Wt(this,e)},ii.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),Xt(this,e,t)},ii.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},ii.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},ii.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},ii.prototype.endOfTextblock=function(e,t){return an(this,t||this.state,e)},ii.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},ii.prototype.dispatchEvent=function(e){return function(e,t){Er(e,t)||!hr[t.type]||!e.editable&&t.type in gr||hr[t.type](e,t)}(this,e)},ii.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(ii.prototype,oi);for(var di={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},ui={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},pi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),fi="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),mi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),hi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),gi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),_i=pi&&(hi||+pi[1]<57)||mi&&hi,vi=0;vi<10;vi++)di[48+vi]=di[96+vi]=String(vi);for(vi=1;vi<=24;vi++)di[vi+111]="F"+vi;for(vi=65;vi<=90;vi++)di[vi]=String.fromCharCode(vi+32),ui[vi]=String.fromCharCode(vi);for(var Ei in di)ui.hasOwnProperty(Ei)||(ui[Ei]=di[Ei]);var bi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function yi(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(var s=0;s<o.length-1;s++){var l=o[s];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);bi?i=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),i&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function Si(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}function Ti(e){var t=function(e){var t=Object.create(null);for(var n in e)t[yi(n)]=e[n];return t}(e);return function(e,n){var r,i=function(e){var t=!(_i&&(e.ctrlKey||e.altKey||e.metaKey)||(fi||gi)&&e.shiftKey&&e.key&&1==e.key.length)&&e.key||(e.shiftKey?ui:di)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),o=1==i.length&&" "!=i,a=t[Si(i,n,!o)];if(a&&a(e.state,e.dispatch,e))return!0;if(o&&(n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(r=di[n.keyCode])&&r!=i){var s=t[Si(r,n,!0)];if(s&&s(e.state,e.dispatch,e))return!0}else if(o&&n.shiftKey){var l=t[Si(i,n,!0)];if(l&&l(e.state,e.dispatch,e))return!0}return!1}}var Ni=function(e,t){var n;this.match=e,this.handler="string"==typeof t?(n=t,function(e,t,r,i){var o=n;if(t[1]){var a=t[0].lastIndexOf(t[1]);o+=t[0].slice(a+t[1].length);var s=(r+=a)-i;s>0&&(o=t[0].slice(a-s,a)+o,r=i)}return e.tr.insertText(o,r,i)}):t};function Oi(e,t,n,r,i,o){if(e.composing)return!1;var a=e.state,s=a.doc.resolve(t);if(s.parent.type.spec.code)return!1;for(var l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<i.length;c++){var d=i[c].match.exec(l),u=d&&i[c].handler(a,d,t-(d[0].length-r.length),n);if(u)return e.dispatch(u.setMeta(o,{transform:u,from:t,to:n,text:r})),!0}return!1}var Ci=new Ni(/--$/,"—"),Ai=new Ni(/\.\.\.$/,"…"),Di=new Ni(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Ri=new Ni(/"$/,"”"),wi=new Ni(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Ii=new Ni(/'$/,"’");function Mi(e,t,n,r){return new Ni(e,(function(e,i,o,a){var s=n instanceof Function?n(i):n,l=e.tr.delete(o,a),c=l.doc.resolve(o).blockRange(),d=c&&xe(c,t,s);if(!d)return null;l.wrap(c,d);var u=l.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&Pe(l.doc,o-1)&&(!r||r(i,u))&&l.join(o-1),l}))}function xi(e,t,n){return new Ni(e,(function(e,r,i,o){var a=e.doc.resolve(i),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,s):null}))}function ki(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}function Li(e,t,n){var r=e.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",e):r.parentOffset>0))return!1;var i=Ui(r);if(!i){var o=r.blockRange(),a=o&&Me(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}var s=i.nodeBefore;if(!s.type.spec.isolating&&Ki(e,i,t))return!0;if(0==r.parent.content.size&&(Pi(s,"end")||it.isSelectable(s))){if(t){var l=e.tr.deleteRange(r.before(),r.after());l.setSelection(Pi(s,"end")?Je.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):it.create(l.doc,i.pos-s.nodeSize)),t(l.scrollIntoView())}return!0}return!(!s.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0)}function Pi(e,t){for(;e;e="start"==t?e.firstChild:e.lastChild)if(e.isTextblock)return!0;return!1}function Bi(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):i.parentOffset>0)return!1;o=Ui(i)}var a=o&&o.nodeBefore;return!(!a||!it.isSelectable(a))&&(t&&t(e.tr.setSelection(it.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)}function Ui(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Fi(e,t,n){var r=e.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size))return!1;var i=ji(r);if(!i)return!1;var o=i.nodeAfter;if(Ki(e,i,t))return!0;if(0==r.parent.content.size&&(Pi(o,"start")||it.isSelectable(o))){if(t){var a=e.tr.deleteRange(r.before(),r.after());a.setSelection(Pi(o,"start")?Je.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):it.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)}function zi(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):i.parentOffset<i.parent.content.size)return!1;o=ji(i)}var a=o&&o.nodeAfter;return!(!a||!it.isSelectable(a))&&(t&&t(e.tr.setSelection(it.create(e.doc,o.pos)).scrollIntoView()),!0)}function ji(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function Gi(e,t){var n=e.selection,r=n.$from,i=n.$to,o=r.blockRange(i),a=o&&Me(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}function Yi(e,t){var n=e.selection,r=n.$head,i=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(i))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)}function Vi(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Hi(e,t){var n=e.selection,r=n.$head,i=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(i))return!1;var o=r.node(-1),a=r.indexAfter(-1),s=Vi(o.contentMatchAt(a));if(!o.canReplaceWith(a,a,s))return!1;if(t){var l=r.after(),c=e.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Je.near(c.doc.resolve(l),1)),t(c.scrollIntoView())}return!0}function qi(e,t){var n=e.selection,r=n.$from,i=n.$to;if(n instanceof at||r.parent.inlineContent||i.parent.inlineContent)return!1;var o=Vi(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){var a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(a,o.createAndFill());s.setSelection(nt.create(s.doc,a+1)),t(s.scrollIntoView())}return!0}function $i(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(Le(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}var i=n.blockRange(),o=i&&Me(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)}function Wi(e,t){var n=e.selection,r=n.$from,i=n.$to;if(e.selection instanceof it&&e.selection.node.isBlock)return!(!r.parentOffset||!Le(e.doc,r.pos))&&(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(t){var o=i.parentOffset==i.parent.content.size,a=e.tr;(e.selection instanceof nt||e.selection instanceof at)&&a.deleteSelection();var l=0==r.depth?null:Vi(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=o&&l?[{type:l}]:null,d=Le(a.doc,a.mapping.map(r.pos),1,c);c||d||!Le(a.doc,a.mapping.map(r.pos),1,l&&[{type:l}])||(c=[{type:l}],d=!0),d&&(a.split(a.mapping.map(r.pos),1,c),o||r.parentOffset||r.parent.type==l||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from([l.create(),r.parent]))||a.setNodeMarkup(a.mapping.map(r.before()),l)),t(a.scrollIntoView())}return!0}function Qi(e,t){return t&&t(e.tr.setSelection(new at(e.doc))),!0}function Ki(e,t,n){var r,i,o=t.nodeBefore,a=t.nodeAfter;if(o.type.spec.isolating||a.type.spec.isolating)return!1;if(function(e,t,n){var r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!!(r&&i&&r.type.compatibleContent(i.type))&&(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!(!t.parent.canReplace(o,o+1)||!i.isTextblock&&!Pe(e.doc,t.pos))&&(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0))}(e,t,n))return!0;var l=t.parent.canReplace(t.index(),t.index()+1);if(l&&(r=(i=o.contentMatchAt(o.childCount)).findWrapping(a.type))&&i.matchType(r[0]||a.type).validEnd){if(n){for(var c=t.pos+a.nodeSize,d=s.empty,u=r.length-1;u>=0;u--)d=s.from(r[u].create(null,d));d=s.from(o.copy(d));var p=e.tr.step(new Re(t.pos-1,c,t.pos,c,new m(d,1,0),r.length,!0)),f=c+2*r.length;Pe(p.doc,f)&&p.join(f),n(p.scrollIntoView())}return!0}var h=Je.findFrom(t,1),g=h&&h.$from.blockRange(h.$to),_=g&&Me(g);if(null!=_&&_>=t.depth)return n&&n(e.tr.lift(g,_).scrollIntoView()),!0;if(l&&a.isTextblock&&Pi(o,"end")){for(var v=o,E=[];E.push(v),!v.isTextblock;)v=v.lastChild;if(v.canReplace(v.childCount,v.childCount,a.content)){if(n){for(var b=s.empty,y=E.length-1;y>=0;y--)b=s.from(E[y].copy(b));n(e.tr.step(new Re(t.pos-E.length,t.pos+a.nodeSize,t.pos+1,t.pos+a.nodeSize-1,new m(b,E.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Xi(e,t){return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a),l=s&&xe(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}function Zi(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(t,n,r){for(var i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var Ji=Zi(ki,Li,Bi),eo=Zi(ki,Fi,zi),to={Enter:Zi(Yi,qi,$i,Wi),"Mod-Enter":Hi,Backspace:Ji,"Mod-Backspace":Ji,Delete:eo,"Mod-Delete":eo,"Mod-a":Qi},no={"Ctrl-h":to.Backspace,"Alt-Backspace":to["Mod-Backspace"],"Ctrl-d":to.Delete,"Ctrl-Alt-Backspace":to["Mod-Delete"],"Alt-Delete":to["Mod-Delete"],"Alt-d":to["Mod-Delete"]};for(var ro in to)no[ro]=to[ro];"undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&os.platform();function io(e,t){return function(n,r){var i=n.selection,o=i.$from,a=i.$to,l=o.blockRange(a),c=!1,d=l;if(!l)return!1;if(l.depth>=2&&o.node(l.depth-1).type.compatibleContent(e)&&0==l.startIndex){if(0==o.index(l.depth-1))return!1;var u=n.doc.resolve(l.start-2);d=new D(u,u,l.depth),l.endIndex<l.parent.childCount&&(l=new D(o,n.doc.resolve(a.end(l.depth)),l.depth)),c=!0}var p=xe(d,e,t,l);return!!p&&(r&&r(function(e,t,n,r,i){for(var o=s.empty,a=n.length-1;a>=0;a--)o=s.from(n[a].type.create(n[a].attrs,o));e.step(new Re(t.start-(r?2:0),t.end,t.start,t.end,new m(o,0,0),n.length,!0));for(var l=0,c=0;c<n.length;c++)n[c].type==i&&(l=c+1);for(var d=n.length-l,u=t.start+n.length-(r?2:0),p=t.parent,f=t.startIndex,h=t.endIndex,g=!0;f<h;f++,g=!1)!g&&Le(e.doc,u,d)&&(e.split(u,d),u+=2*d),u+=p.child(f).nodeSize;return e}(n.tr,l,p,c,e).scrollIntoView()),!0)}}function oo(e){return function(t,n){var r=t.selection,i=r.$from,o=r.$to,a=i.blockRange(o,(function(t){return t.childCount&&t.firstChild.type==e}));return!!a&&(!n||(i.node(a.depth-1).type==e?function(e,t,n,r){var i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Re(o-1,a,o,a,new m(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new D(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));return t(i.lift(r,Me(r)).scrollIntoView()),!0}(t,n,e,a):function(e,t,n){for(var r=e.tr,i=n.parent,o=n.end,a=n.endIndex-1,l=n.startIndex;a>l;a--)o-=i.child(a).nodeSize,r.delete(o-1,o+1);var c=r.doc.resolve(n.start),d=c.nodeAfter,u=0==n.startIndex,p=n.endIndex==i.childCount,f=c.node(-1),h=c.index(-1);if(!f.canReplace(h+(u?0:1),h+1,d.content.append(p?s.empty:s.from(i))))return!1;var g=c.pos,_=g+d.nodeSize;return r.step(new Re(g-(u?1:0),_+(p?1:0),g+1,_-1,new m((u?s.empty:s.from(i.copy(s.empty))).append(p?s.empty:s.from(i.copy(s.empty))),u?0:1,p?0:1),u?0:1)),t(r.scrollIntoView()),!0}(t,n,a)))}}function ao(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function so(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function lo(e,t){const n=so(t,e.schema),{from:r,to:i}=e.selection;let o=[];e.doc.nodesBetween(r,i,e=>{o=[...o,e]});const a=o.reverse().find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function co(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function uo(e,t){const n=co(t,e.schema),{from:r,to:i,empty:o}=e.selection;let a=[];o?a=e.selection.$head.marks():e.doc.nodesBetween(r,i,e=>{a=[...a,...e.marks]});const s=a.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function po(e,t){const n=Object.keys(t);return!n.length||!!n.filter(n=>t[n]===e[n]).length}function fo(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?so(t,e.schema):null;let s=[];if(e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText){const n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s=[...s,{node:e,from:n,to:o}]}}),o)return!!s.filter(e=>!a||a.name===e.node.type.name).find(e=>po(e.node.attrs,n));const l=i-r;return s.filter(e=>!a||a.name===e.node.type.name).filter(e=>po(e.node.attrs,n)).reduce((e,t)=>e+(t.to-t.from),0)>=l}function mo(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?co(t,e.schema):null;if(o)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>po(e.attrs,n));let s=0,l=[];if(e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText){const n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s+=o-n,l=[...l,...e.marks.map(e=>({mark:e,from:n,to:o}))]}}),0===s)return!1;return l.filter(e=>!a||a.name===e.mark.type.name).filter(e=>po(e.mark.attrs,n)).reduce((e,t)=>e+(t.to-t.from),0)>=s}function ho(e){return(new window.DOMParser).parseFromString(e,"text/html").body}function go(e,t,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof e&&null!==e)try{return Array.isArray(e)?s.fromArray(e.map(e=>t.nodeFromJSON(e))):t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),go("",t,n)}if("string"==typeof e){const r=ne.fromSchema(t);return n.slice?r.parseSlice(ho(e),n.parseOptions).content:r.parse(ho(e),n.parseOptions)}return go("",t,n)}function _o(e,t,n={}){return go(e,t,{slice:!1,parseOptions:n})}function vo(e,t){const n=fe.fromSchema(t).serializeFragment(e.content),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}class Eo{constructor(e,t){this.editor=e,this.commands=t}createCommands(){const{commands:e,editor:t}=this,{state:n,view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(o);return i.getMeta("preventDispatch")||r.dispatch(i),n}]))}createChain(e,t=!0){const{commands:n,editor:r}=this,{state:i,view:o}=r,a=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),i=n(...e)(r);return a.push(i),c}])),run:()=>(s||!t||l.getMeta("preventDispatch")||o.dispatch(l),a.every(e=>!0===e))};return c}createCan(e){const{commands:t,editor:n}=this,{state:r}=n,i=e||r.tr,o=this.buildProps(i,void 0);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,void 0)}}buildProps(e,t=!0){const{editor:n,commands:r}=this,{state:i,view:o}=n;i.storedMarks&&e.setStoredMarks(i.storedMarks);const a={tr:e,editor:n,view:o,state:this.chainableState(e,i),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,(...e)=>t(...e)(a)]))}};return a}chainableState(e,t){let{selection:n}=e,{doc:r}=e,{storedMarks:i}=e;return{...t,schema:t.schema,plugins:t.plugins,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return n},get doc(){return r},get tr(){return n=e.selection,r=e.doc,i=e.storedMarks,e}}}}function bo(e,t,n={}){if(void 0===e.config[t]&&e.parent)return bo(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?bo(e.parent,t,n):null})}return e.config[t]}function yo(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function So(e){const t=[],{nodeExtensions:n,markExtensions:r}=yo(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return e.forEach(e=>{const n=bo(e,"addGlobalAttributes",{name:e.name,options:e.options});if(!n)return;n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{const n={name:e.name,options:e.options},r=bo(e,"addAttributes",n);if(!r)return;const i=r();Object.entries(i).forEach(([n,r])=>{t.push({type:e.name,name:n,attribute:{...o,...r}})})}),t}function To(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{n[e]?n[e]="class"===e?[n[e],t].join(" "):"style"===e?[n[e],t].join("; "):t:n[e]=t}),n},{})}function No(e,t){return t.filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>To(e,t),{})}function Oo(e,t){return e.style?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const i=t.filter(e=>e.attribute.rendered).reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n)||{}:{[t.name]:(i=n.getAttribute(t.name),"string"!=typeof i?i:i.match(/^\d*(\.\d+)?$/)?Number(i):"true"===i||"false"!==i&&i)};var i;return{...e,...Object.fromEntries(Object.entries(r).filter(([,e])=>null!=e))}},{});return{...r,...i}}}}function Co(e,t,...n){return"function"==typeof e?t?e.bind(t)(...n):e(...n):e}function Ao(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Do(e){var t;const n=So(e),{nodeExtensions:r,markExtensions:i}=yo(e),o=null===(t=r.find(e=>bo(e,"topNode")))||void 0===t?void 0:t.name,a=Object.fromEntries(r.map(t=>{const r=n.filter(e=>e.type===t.name),i={name:t.name,options:t.options},o=Ao({...e.reduce((e,n)=>{const r=bo(n,"extendNodeSchema",i);return{...e,...r?r(t):{}}},{}),content:Co(bo(t,"content",i)),marks:Co(bo(t,"marks",i)),group:Co(bo(t,"group",i)),inline:Co(bo(t,"inline",i)),atom:Co(bo(t,"atom",i)),selectable:Co(bo(t,"selectable",i)),draggable:Co(bo(t,"draggable",i)),code:Co(bo(t,"code",i)),defining:Co(bo(t,"defining",i)),isolating:Co(bo(t,"isolating",i)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),a=Co(bo(t,"parseHTML",i));a&&(o.parseDOM=a.map(e=>Oo(e,r)));const s=bo(t,"renderHTML",i);return s&&(o.toDOM=e=>s({node:e,HTMLAttributes:No(e,r)})),[t.name,o]})),s=Object.fromEntries(i.map(t=>{const r=n.filter(e=>e.type===t.name),i={name:t.name,options:t.options},o=Ao({...e.reduce((e,n)=>{const r=bo(n,"extendMarkSchema",i);return{...e,...r?r(t):{}}},{}),inclusive:Co(bo(t,"inclusive",i)),excludes:Co(bo(t,"excludes",i)),group:Co(bo(t,"group",i)),spanning:Co(bo(t,"spanning",i)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),a=Co(bo(t,"parseHTML",i));a&&(o.parseDOM=a.map(e=>Oo(e,r)));const s=bo(t,"renderHTML",i);return s&&(o.toDOM=e=>s({mark:e,HTMLAttributes:No(e,r)})),[t.name,o]}));return new ee({topNode:o,nodes:a,marks:s})}function Ro(e,t){return t.nodes[e]?t.nodes[e]:t.marks[e]?t.marks[e]:null}class wo{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=wo.resolve(e),this.schema=Do(this.extensions),this.extensions.forEach(e=>{var t;const n={name:e.name,options:e.options,editor:this.editor,type:Ro(e.name,this.schema)};if("mark"===e.type){(null===(t=Co(bo(e,"keepOnSplit",n)))||void 0===t||t)&&this.splittableMarks.push(e.name)}const r=bo(e,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const i=bo(e,"onCreate",n);i&&this.editor.on("create",i);const o=bo(e,"onUpdate",n);o&&this.editor.on("update",o);const a=bo(e,"onSelectionUpdate",n);a&&this.editor.on("selectionUpdate",a);const s=bo(e,"onTransaction",n);s&&this.editor.on("transaction",s);const l=bo(e,"onFocus",n);l&&this.editor.on("focus",l);const c=bo(e,"onBlur",n);c&&this.editor.on("blur",c);const d=bo(e,"onDestroy",n);d&&this.editor.on("destroy",d)})}static resolve(e){return wo.sort(wo.flatten(e))}static flatten(e){return e.map(e=>{const t=bo(e,"addExtensions",{name:e.name,options:e.options});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{const n=bo(e,"priority")||100,r=bo(t,"priority")||100;return n>r?-1:n<r?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const n=bo(t,"addCommands",{name:t.name,options:t.options,editor:this.editor,type:Ro(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){return[...this.extensions].reverse().map(e=>{const t={name:e.name,options:e.options,editor:this.editor,type:Ro(e.name,this.schema)},n=[],r=bo(e,"addKeyboardShortcuts",t);if(r){const e=function(e){return new vt({props:{handleKeyDown:Ti(e)}})}(Object.fromEntries(Object.entries(r()).map(([e,t])=>[e,()=>t({editor:this.editor})])));n.push(e)}const i=bo(e,"addInputRules",t);if(this.editor.options.enableInputRules&&i){const e=i(),t=e.length?[(o={rules:e},a=o.rules,s=new vt({state:{init:function(){return null},apply:function(e,t){var n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,t,n,r){return Oi(e,t,n,r,a,s)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var t=e.state.selection.$cursor;t&&Oi(e,t.pos,t.pos,"",a,s)}))}}},isInputRules:!0}),s)]:[];n.push(...t)}var o,a,s;const l=bo(e,"addPasteRules",t);if(this.editor.options.enablePasteRules&&l){const e=l();n.push(...e)}const c=bo(e,"addProseMirrorPlugins",t);if(c){const e=c();n.push(...e)}return n}).flat()}get attributes(){return So(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=yo(this.extensions);return Object.fromEntries(t.filter(e=>!!bo(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,editor:e,type:so(t.name,this.schema)},i=bo(t,"addNodeView",r);if(!i)return[];return[t.name,(r,o,a,s)=>{const l=No(r,n);return i()({editor:e,node:r,getPos:a,decorations:s,HTMLAttributes:l,extension:t})}]}))}get textSerializers(){const{editor:e}=this,{nodeExtensions:t}=yo(this.extensions);return Object.fromEntries(t.filter(e=>!!bo(e,"renderText")).map(t=>{const n=bo(t,"renderText",{name:t.name,options:t.options,editor:e,type:so(t.name,this.schema)});if(!n)return[];return[t.name,e=>n(e)]}))}}function Io(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Mo(e,t){const n={...e};return Io(e)&&Io(t)&&Object.keys(t).forEach(r=>{Io(t[r])?r in e?n[r]=Mo(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}class xo{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new xo(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new xo(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}const ko=xo.create({name:"editable",addProseMirrorPlugins(){return[new vt({key:new yt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{from:t,to:n}=e.state.selection;return((e,t,n,r,i)=>{let o="",a=!0;return e.state.doc.nodesBetween(t,n,(s,l)=>{var c;const d=e.extensionManager.textSerializers[s.type.name];d?(o+=d({node:s}),a=!r):s.isText?(o+=null===(c=null==s?void 0:s.text)||void 0===c?void 0:c.slice(Math.max(t,l)-l,n-l),a=!r):s.isLeaf&&i?(o+=i,a=!r):!a&&s.isBlock&&(o+=r,a=!0)},0),o})(e,t,n,"\n")}}})]}});var Lo=Object.freeze({__proto__:null,blur:()=>({view:e})=>(e.dom.blur(),!0)});var Po=Object.freeze({__proto__:null,clearContent:(e=!1)=>({commands:t})=>t.setContent("",e)});var Bo=Object.freeze({__proto__:null,clearNodes:()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return i.forEach(r=>{e.doc.nodesBetween(r.$from.pos,r.$to.pos,(r,i)=>{if(!r.type.isText){const o=t.doc.resolve(t.mapping.map(i+1)),a=t.doc.resolve(t.mapping.map(i+r.nodeSize-1)),s=o.blockRange(a);if(s){const i=Me(s);r.type.isTextblock&&n&&t.setNodeMarkup(s.start,e.doc.type.contentMatch.defaultType),(i||0===i)&&n&&t.lift(s,i)}}})}),!0}});var Uo=Object.freeze({__proto__:null,command:e=>t=>e(t)});var Fo=Object.freeze({__proto__:null,createParagraphNear:()=>({state:e,dispatch:t})=>qi(e,t)});var zo=Object.freeze({__proto__:null,deleteRange:e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0}});var jo=Object.freeze({__proto__:null,deleteSelection:()=>({state:e,dispatch:t})=>ki(e,t)});var Go=Object.freeze({__proto__:null,enter:()=>({commands:e})=>e.keyboardShortcut("Enter")});var Yo=Object.freeze({__proto__:null,exitCode:()=>({state:e,dispatch:t})=>Hi(e,t)});function Vo(e,t){if(!e||!t)return;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const r=n.node.marks.find(e=>e.type===t);if(!r)return;let i=e.index(),o=e.start()+n.offset,a=i+1,s=o+n.node.nodeSize;for(;i>0&&r.isInSet(e.parent.child(i-1).marks);)i-=1,o-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&r.isInSet(e.parent.child(a).marks);)s+=e.parent.child(a).nodeSize,a+=1;return{from:o,to:s}}var Ho=Object.freeze({__proto__:null,extendMarkRange:e=>({tr:t,state:n,dispatch:r})=>{const i=co(e,n.schema),{doc:o,selection:a}=t,{$from:s,empty:l}=a;if(l&&r){const e=Vo(s,i);if(e){const n=nt.create(o,e.from,e.to);t.setSelection(n)}}return!0}});var qo=Object.freeze({__proto__:null,first:e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1}});function $o(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Wo(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!function(e){var t;return"class"===(null===(t=e.constructor)||void 0===t?void 0:t.toString().substring(0,5))}(e)}var Qo=Object.freeze({__proto__:null,focus:(e=null)=>({editor:t,view:n,tr:r,dispatch:i})=>{if(n.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!(Wo(o=t.state.selection)&&o instanceof nt))return n.focus(),!0;var o;const{from:a,to:s}=function(e,t=null){if(!t)return null;if("start"===t||!0===t)return{from:0,to:0};if("end"===t){const{size:t}=e.doc.content;return{from:t,to:t}}return{from:t,to:t}}(t.state,e)||t.state.selection,{doc:l,storedMarks:c}=r,d=$o(a,0,l.content.size),u=$o(s,0,l.content.size),p=nt.create(l,d,u),f=t.state.selection.eq(p);return i&&(r.setSelection(p),f&&c&&r.setStoredMarks(c),n.focus()),!0}});var Ko=Object.freeze({__proto__:null,insertContent:e=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},e)});var Xo=Object.freeze({__proto__:null,insertContentAt:(e,t)=>({tr:n,dispatch:r,editor:i})=>{if(r){const r=go(t,i.schema);n.replaceWith(e.from,e.to,r),function(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof De||i instanceof Re))return;const o=e.mapping.maps[r];let a=0;o.forEach((e,t,n,r)=>{0===a&&(a=r)}),e.setSelection(Je.near(e.doc.resolve(a),n))}(n,n.steps.length-1,1)}return!0}});var Zo=Object.freeze({__proto__:null,joinBackward:()=>({state:e,dispatch:t})=>Li(e,t)});var Jo=Object.freeze({__proto__:null,joinForward:()=>({state:e,dispatch:t})=>Fi(e,t)});const ea="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);var ta=Object.freeze({__proto__:null,keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:i})=>{const o=function(e){const t=e.split(/-(?!$)/);let n,r,i,o,a=t[t.length-1];"Space"===a&&(a=" ");for(let e=0;e<t.length-1;e+=1){const a=t[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);ea?o=!0:r=!0}}return n&&(a="Alt-"+a),r&&(a="Ctrl-"+a),o&&(a="Meta-"+a),i&&(a="Shift-"+a),a}(e).split(/-(?!$)/),a=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),s=new KeyboardEvent("keydown",{key:"Space"===a?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,s))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0}});var na=Object.freeze({__proto__:null,lift:(e,t={})=>({state:n,dispatch:r})=>!!fo(n,so(e,n.schema),t)&&Gi(n,r)});var ra=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:e,dispatch:t})=>$i(e,t)});var ia=Object.freeze({__proto__:null,liftListItem:e=>({state:t,dispatch:n})=>oo(so(e,t.schema))(t,n)});var oa=Object.freeze({__proto__:null,newlineInCode:()=>({state:e,dispatch:t})=>Yi(e,t)});var aa=Object.freeze({__proto__:null,replace:(e,t={})=>({state:n,commands:r})=>{console.warn("[tiptap warn]: replace() is deprecated. please use insertContent() instead.");const{from:i,to:o}=n.selection,a={from:i,to:o};return r.replaceRange(a,e,t)}});var sa=Object.freeze({__proto__:null,replaceRange:(e,t,n={})=>({tr:r,state:i,dispatch:o})=>{console.warn("[tiptap warn]: replaceRange() is deprecated. please use insertContent() instead.");const a=so(t,i.schema),{from:s,to:l}=e;return o&&r.replaceRangeWith(s,l,a.create(n)),!0}});function la(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ca=Object.freeze({__proto__:null,resetAttributes:(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=ao("string"==typeof e?e:e.name,r.schema);return!!s&&("node"===s&&(o=so(e,r.schema)),"mark"===s&&(a=co(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,la(e.attrs,t)),a&&e.marks.length&&e.marks.forEach(i=>{a===i.type&&n.addMark(r,r+e.nodeSize,a.create(la(i.attrs,t)))})})}),!0)}});var da=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0)});var ua=Object.freeze({__proto__:null,selectAll:()=>({state:e,dispatch:t})=>Qi(e,t)});var pa=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:e,dispatch:t})=>Bi(e,t)});var fa=Object.freeze({__proto__:null,selectNodeForward:()=>({state:e,dispatch:t})=>zi(e,t)});var ma=Object.freeze({__proto__:null,selectParentNode:()=>({state:e,dispatch:t})=>function(e,t){var n,r=e.selection,i=r.$from,o=r.to,a=i.sharedDepth(o);return 0!=a&&(n=i.before(a),t&&t(e.tr.setSelection(it.create(e.doc,n))),!0)}(e,t)});var ha=Object.freeze({__proto__:null,setContent:(e,t=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,s=_o(e,i.schema,n),l=nt.create(a,0,a.content.size);return o&&r.setSelection(l).replaceSelectionWith(s,!1).setMeta("preventUpdate",!t),!0}});var ga=Object.freeze({__proto__:null,setMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:a,ranges:s}=o,l=co(e,r.schema);if(i)if(a){const e=uo(r,l);n.addStoredMark(l.create({...e,...t}))}else s.forEach(e=>{const i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{const a=Math.max(r,i),s=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(a,s,l.create({...e.attrs,...t}))}):n.addMark(a,s,l.create(t))})});return!0}});var _a=Object.freeze({__proto__:null,setNode:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return(o=i,a=t,function(e,t){var n=e.selection,r=n.from,i=n.to,s=!1;return e.doc.nodesBetween(r,i,(function(t,n){if(s)return!1;if(t.isTextblock&&!t.hasMarkup(o,a))if(t.type==o)s=!0;else{var r=e.doc.resolve(n),i=r.index();s=r.parent.canReplaceWith(i,i+1,o)}})),!!s&&(t&&t(e.tr.setBlockType(r,i,o,a).scrollIntoView()),!0)})(n,r);var o,a}});var va=Object.freeze({__proto__:null,setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=$o(e,0,n.content.size),i=it.create(n,r);t.setSelection(i)}return!0}});var Ea=Object.freeze({__proto__:null,setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=$o(e.from,0,n.content.size),i=$o(e.to,0,n.content.size),o=nt.create(n,r,i);t.setSelection(o)}return!0}});var ba=Object.freeze({__proto__:null,sinkListItem:e=>({state:t,dispatch:n})=>{const r=so(e,t.schema);return(i=r,function(e,t){var n=e.selection,r=n.$from,o=n.$to,a=r.blockRange(o,(function(e){return e.childCount&&e.firstChild.type==i}));if(!a)return!1;var l=a.startIndex;if(0==l)return!1;var c=a.parent,d=c.child(l-1);if(d.type!=i)return!1;if(t){var u=d.lastChild&&d.lastChild.type==c.type,p=s.from(u?i.create():null),f=new m(s.from(i.create(null,s.from(c.type.create(null,p)))),u?3:1,0),h=a.start,g=a.end;t(e.tr.step(new Re(h-(u?3:1),g,h,g,f,1,!0)).scrollIntoView())}return!0})(t,n);var i}});function ya(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Sa(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var Ta=Object.freeze({__proto__:null,splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:a}=t,{$from:l,$to:c}=o,d=ya(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof it&&o.node.isBlock)return!(!l.parentOffset||!Le(a,l.pos))&&(r&&(e&&Sa(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const r=c.parentOffset===c.parent.content.size;o instanceof nt&&t.deleteSelection();const a=0===l.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let u=r&&a?[{type:a,attrs:d}]:void 0,p=Le(t.doc,t.mapping.map(l.pos),1,u);u||p||!Le(t.doc,t.mapping.map(l.pos),1,a?[{type:a}]:void 0)||(p=!0,u=a?[{type:a,attrs:d}]:void 0),p&&(t.split(t.mapping.map(l.pos),1,u),r||l.parentOffset||l.parent.type===a||!l.node(-1).canReplace(l.index(-1),l.indexAfter(-1),s.from(null==a?void 0:a.create()))||t.setNodeMarkup(t.mapping.map(l.before()),a||void 0)),e&&Sa(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return!0}});var Na=Object.freeze({__proto__:null,splitListItem:e=>({tr:t,state:n,dispatch:r,editor:i})=>{var o;const a=so(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const p=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let e=s.empty;const n=l.index(-1)>0;for(let t=l.depth-(n?1:2);t>=l.depth-3;t-=1)e=s.from(l.node(t).copy(e));const r=ya(p,l.node().type.name,l.node().attrs),i=(null===(o=a.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(r))||void 0;e=e.append(s.from(a.createAndFill(null,i)||void 0)),t.replace(l.before(n?void 0:-1),l.after(-3),new m(e,n?3:2,2)).setSelection(nt.near(t.doc.resolve(l.pos+(n?3:2)))).scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,h=ya(p,u.type.name,u.attrs),g=ya(p,l.node().type.name,l.node().attrs);t.delete(l.pos,c.pos);const _=f?[{type:a,attrs:h},{type:f,attrs:g}]:[{type:a,attrs:h}];return!!Le(t.doc,l.pos,2)&&(r&&t.split(l.pos,2,_).scrollIntoView(),!0)}});function Oa(e,t){const{nodeExtensions:n}=yo(t),r=n.find(t=>t.name===e);if(!r)return!1;const i=Co(bo(r,"group",{name:r.name,options:r.options}));return"string"==typeof i&&i.split(" ").includes("list")}var Ca=Object.freeze({__proto__:null,toggleList:(e,t)=>({editor:n,tr:r,state:i,dispatch:o,chain:a,commands:s,can:l})=>{const{extensions:c}=n.extensionManager,d=so(e,i.schema),u=so(t,i.schema),{selection:p}=i,{$from:f,$to:m}=p,h=f.blockRange(m);if(!h)return!1;const g=(_=e=>Oa(e.type.name,c),e=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(e.$from,_))(p);var _;if(h.depth>=1&&g&&h.depth-g.depth<=1){if(g.node.type===d)return s.liftListItem(u);if(Oa(g.node.type.name,c)&&d.validContent(g.node.content)&&o)return r.setNodeMarkup(g.pos,d),!0}return l().wrapInList(d)?s.wrapInList(d):a().clearNodes().wrapInList(d).run()}});var Aa=Object.freeze({__proto__:null,toggleMark:(e,t={})=>({state:n,commands:r})=>{const i=co(e,n.schema);return mo(n,i,t)?r.unsetMark(i):r.setMark(i,t)}});var Da=Object.freeze({__proto__:null,toggleNode:(e,t,n={})=>({state:r,commands:i})=>{const o=so(e,r.schema),a=so(t,r.schema);return fo(r,o,n)?i.setNode(a):i.setNode(o,n)}});var Ra=Object.freeze({__proto__:null,toggleWrap:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return fo(n,i,t)?Gi(n,r):Xi(i,t)(n,r)}});var wa=Object.freeze({__proto__:null,undoInputRule:()=>({state:e,dispatch:t})=>function(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var i=n[r],o=void 0;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){for(var a=e.tr,s=o.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(o.text){var c=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,e.schema.text(o.text,c))}else a.delete(o.from,o.to);t(a)}return!0}}return!1}(e,t)});var Ia=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:e,state:t,dispatch:n})=>{const{selection:r}=e,{empty:i,ranges:o}=r;return i||n&&Object.entries(t.schema.marks).forEach(([,t])=>{o.forEach(n=>{e.removeMark(n.$from.pos,n.$to.pos,t)})}),!0}});var Ma=Object.freeze({__proto__:null,unsetMark:e=>({tr:t,state:n,dispatch:r})=>{const{selection:i}=t,o=co(e,n.schema),{$from:a,empty:s,ranges:l}=i;if(r){if(s){let{from:e,to:n}=i;const r=Vo(a,o);r&&(e=r.from,n=r.to),t.removeMark(e,n,o)}else l.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos,o)});t.removeStoredMark(o)}return!0}});var xa=Object.freeze({__proto__:null,updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=ao("string"==typeof e?e:e.name,r.schema);return!!s&&("node"===s&&(o=so(e,r.schema)),"mark"===s&&(a=co(e,r.schema)),i&&n.selection.ranges.forEach(e=>{const i=e.$from.pos,s=e.$to.pos;r.doc.nodesBetween(i,s,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),a&&e.marks.length&&e.marks.forEach(o=>{if(a===o.type){const l=Math.max(r,i),c=Math.min(r+e.nodeSize,s);n.addMark(l,c,a.create({...o.attrs,...t}))}})})}),!0)}});var ka=Object.freeze({__proto__:null,wrapIn:(e,t={})=>({state:n,dispatch:r})=>{const i=so(e,n.schema);return!fo(n,i,t)&&Xi(i,t)(n,r)}});var La=Object.freeze({__proto__:null,wrapInList:(e,t={})=>({state:n,dispatch:r})=>io(so(e,n.schema),t)(n,r)});const Pa=xo.create({name:"commands",addCommands:()=>({...Lo,...Po,...Bo,...Uo,...Fo,...zo,...jo,...Go,...Yo,...Ho,...qo,...Qo,...Ko,...Xo,...Zo,...Jo,...ta,...na,...ra,...ia,...oa,...aa,...sa,...ca,...da,...ua,...pa,...fa,...ma,...ha,...ga,..._a,...va,...Ea,...ba,...Ta,...Na,...Ca,...Aa,...Da,...Ra,...wa,...Ia,...Ma,...xa,...ka,...La})}),Ba=xo.create({name:"editable",addProseMirrorPlugins(){return[new vt({key:new yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ua=xo.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new vt({key:new yt("focusEvents"),props:{attributes:{tabindex:"0"},handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Fa=xo.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]);return{Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>e(),"Mod-Backspace":()=>e(),Delete:()=>t(),"Mod-Delete":()=>t()}}});var za=Object.freeze({__proto__:null,ClipboardTextSerializer:ko,Commands:Pa,Editable:Ba,FocusEvents:Ua,Keymap:Fa});class ja{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new ja(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new ja(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}class Ga{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,this.options=this.config.defaultOptions}static create(e={}){return new Ga(e)}configure(e={}){return this.options=Mo(this.options,e),this.extend()}extend(e={}){const t=new Ga(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,t.options=e.defaultOptions?e.defaultOptions:t.parent.options,t}}function Ya(e,t,n){return new Ni(e,(e,r,i,o)=>{const a=n instanceof Function?n(r):n,{tr:s}=e;return r[0]&&s.replaceWith(i-1,o,t.create(a)),s})}function Va(e,t,n){return new Ni(e,(e,r,i,o)=>{const a=n instanceof Function?n(r):n,{tr:s}=e,l=r[r.length-1],c=r[0];let d=o;if(l){const n=c.search(/\S/),r=i+c.indexOf(l),u=r+l.length;if(function(e,t,n){let r=[];return n.doc.nodesBetween(e,t,(e,t)=>{r=[...r,...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n}))]}),r}(i,o,e).filter(e=>{const{excluded:n}=e.mark.type;return n.find(e=>e.name===t.name)}).filter(e=>e.to>r).length)return null;u<o&&s.delete(u,o),r>i&&s.delete(i+n,r),d=i+n+l.length,s.addMark(i+n,d,t.create(a)),s.removeStoredMark(t)}return s})}function Ha(e,t,n){const r=(i,o)=>{const a=[];return i.forEach(i=>{if(i.isText&&i.text){const{text:r}=i;let s,l=0;for(;null!==(s=e.exec(r));){const e=Math.max(s.length-2,0),r=Math.max(s.length-1,0);if(null==o?void 0:o.type.allowsMarkType(t)){const o=s.index+s[0].indexOf(s[e]),c=o+s[e].length,d=o+s[e].lastIndexOf(s[r]),u=d+s[r].length,p=n instanceof Function?n(s):n;o>0&&a.push(i.cut(l,o)),a.push(i.cut(d,u).mark(t.create(p).addToSet(i.marks))),l=c}}l<r.length&&a.push(i.cut(l))}else a.push(i.copy(r(i.content,i)))}),s.fromArray(a)};return new vt({key:new yt("markPasteRule"),props:{transformPasted:e=>new m(r(e.content),e.openStart,e.openEnd)}})}function qa(e,t,n){const r=document.createRange();return r.setEnd(e,"number"==typeof n?n:(e.nodeValue||"").length),r.setStart(e,Math.max(t||0,0)),r}function $a(e,t){const n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}function Wa(e,t,n=!1){const{node:r,offset:i}=e.domAtPos(t);let o=null,a=null;if(3===r.nodeType){const e=r.nodeValue||"";n&&i<e.length?(a=$a(qa(r,i-1,i),-1),o="right"):i<e.length&&(a=$a(qa(r,i,i+1),-1),o="left")}else if(r.firstChild){if(i<r.childNodes.length){const e=r.childNodes[i];a=$a(3===e.nodeType?qa(e):e,-1),o="left"}if((!a||a.top===a.bottom)&&i){const e=r.childNodes[i-1];a=$a(3===e.nodeType?qa(e):e,1),o="right"}}else{a=r.getBoundingClientRect(),o="left"}if(a&&o){const e=a[o];return{top:a.top,bottom:a.bottom,left:e,right:e}}return{top:0,bottom:0,left:0,right:0}}function Qa(e,t){const n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function Ka(e,t,n){const r=Wa(e,t),i=Wa(e,n,!0),o=Math.min(r.top,i.top),a=Math.max(r.bottom,i.bottom),s=Math.min(r.left,i.left),l=Math.max(r.right,i.right),c={top:o,bottom:a,left:s,right:l,width:l-s,height:a-o,x:s,y:o};return{...c,toJSON:()=>c}}function Xa(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function Za(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ja(e){var t=Za(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function es(e){return e instanceof Za(e).Element||e instanceof Element}function ts(e){return e instanceof Za(e).HTMLElement||e instanceof HTMLElement}function ns(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Za(e).ShadowRoot||e instanceof ShadowRoot)}function rs(e){return e?(e.nodeName||"").toLowerCase():null}function is(e){return((es(e)?e.ownerDocument:e.document)||window.document).documentElement}function as(e){return Xa(is(e)).left+Ja(e).scrollLeft}function ss(e){return Za(e).getComputedStyle(e)}function ls(e){var t=ss(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function cs(e,t,n){void 0===n&&(n=!1);var r,i,o=is(t),a=Xa(e),s=ts(t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==rs(t)||ls(o))&&(l=(r=t)!==Za(r)&&ts(r)?{scrollLeft:(i=r).scrollLeft,scrollTop:i.scrollTop}:Ja(r)),ts(t)?((c=Xa(t)).x+=t.clientLeft,c.y+=t.clientTop):o&&(c.x=as(o))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function ds(e){var t=Xa(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function us(e){return"html"===rs(e)?e:e.assignedSlot||e.parentNode||(ns(e)?e.host:null)||is(e)}function ps(e,t){var n;void 0===t&&(t=[]);var r=function e(t){return["html","body","#document"].indexOf(rs(t))>=0?t.ownerDocument.body:ts(t)&&ls(t)?t:e(us(t))}(e),i=r===(null==(n=e.ownerDocument)?void 0:n.body),o=Za(r),a=i?[o].concat(o.visualViewport||[],ls(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(ps(us(a)))}function fs(e){return["table","td","th"].indexOf(rs(e))>=0}function ms(e){return ts(e)&&"fixed"!==ss(e).position?e.offsetParent:null}function hs(e){for(var t=Za(e),n=ms(e);n&&fs(n)&&"static"===ss(n).position;)n=ms(n);return n&&("html"===rs(n)||"body"===rs(n)&&"static"===ss(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&ts(e)&&"fixed"===ss(e).position)return null;for(var n=us(e);ts(n)&&["html","body"].indexOf(rs(n))<0;){var r=ss(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var gs="top",_s="bottom",vs="right",Es="left",bs=[gs,_s,vs,Es],ys=bs.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),Ss=[].concat(bs,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),Ts=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Ns(e){var t=new Map,n=new Set,r=[];return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||function e(i){n.add(i.name),[].concat(i.requires||[],i.requiresIfExists||[]).forEach((function(r){if(!n.has(r)){var i=t.get(r);i&&e(i)}})),r.push(i)}(e)})),r}var Os={placement:"bottom",modifiers:[],strategy:"absolute"};function Cs(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function As(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,i=t.defaultOptions,o=void 0===i?Os:i;return function(e,t,n){void 0===n&&(n=o);var i,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},Os,o),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,d={state:s,setOptions:function(n){u(),s.options=Object.assign({},o,s.options,n),s.scrollParents={reference:es(e)?ps(e):e.contextElement?ps(e.contextElement):[],popper:ps(t)};var i=function(e){var t=Ns(e);return Ts.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(r,s.options.modifiers)));return s.orderedModifiers=i.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,i=e.effect;if("function"==typeof i){var o=i({state:s,name:t,instance:d,options:r});l.push(o||function(){})}})),d.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,n=e.popper;if(Cs(t,n)){s.rects={reference:cs(t,hs(n),"fixed"===s.options.strategy),popper:ds(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<s.orderedModifiers.length;r++)if(!0!==s.reset){var i=s.orderedModifiers[r],o=i.fn,a=i.options,l=void 0===a?{}:a,u=i.name;"function"==typeof o&&(s=o({state:s,options:l,name:u,instance:d})||s)}else s.reset=!1,r=-1}}},update:(i=function(){return new Promise((function(e){d.forceUpdate(),e(s)}))},function(){return a||(a=new Promise((function(e){Promise.resolve().then((function(){a=void 0,e(i())}))}))),a}),destroy:function(){u(),c=!0}};if(!Cs(e,t))return d;function u(){l.forEach((function(e){return e()})),l=[]}return d.setOptions(n).then((function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)})),d}}var Ds={passive:!0};var Rs={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=void 0===i||i,a=r.resize,s=void 0===a||a,l=Za(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach((function(e){e.addEventListener("scroll",n.update,Ds)})),s&&l.addEventListener("resize",n.update,Ds),function(){o&&c.forEach((function(e){e.removeEventListener("scroll",n.update,Ds)})),s&&l.removeEventListener("resize",n.update,Ds)}},data:{}};function ws(e){return e.split("-")[0]}function Is(e){return e.split("-")[1]}function Ms(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function xs(e){var t,n=e.reference,r=e.element,i=e.placement,o=i?ws(i):null,a=i?Is(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case gs:t={x:s,y:n.y-r.height};break;case _s:t={x:s,y:n.y+n.height};break;case vs:t={x:n.x+n.width,y:l};break;case Es:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var c=o?Ms(o):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case"start":t[c]=t[c]-(n[d]/2-r[d]/2);break;case"end":t[c]=t[c]+(n[d]/2-r[d]/2)}}return t}var ks={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=xs({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},Ls=Math.max,Ps=Math.min,Bs=Math.round,Us={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Fs(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.offsets,a=e.position,s=e.gpuAcceleration,l=e.adaptive,c=e.roundOffsets,d=!0===c?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Bs(Bs(t*r)/r)||0,y:Bs(Bs(n*r)/r)||0}}(o):"function"==typeof c?c(o):o,u=d.x,p=void 0===u?0:u,f=d.y,m=void 0===f?0:f,h=o.hasOwnProperty("x"),g=o.hasOwnProperty("y"),_=Es,v=gs,E=window;if(l){var b=hs(n),y="clientHeight",S="clientWidth";b===Za(n)&&"static"!==ss(b=is(n)).position&&(y="scrollHeight",S="scrollWidth"),b=b,i===gs&&(v=_s,m-=b[y]-r.height,m*=s?1:-1),i===Es&&(_=vs,p-=b[S]-r.width,p*=s?1:-1)}var T,N=Object.assign({position:a},l&&Us);return s?Object.assign({},N,((T={})[v]=g?"0":"",T[_]=h?"0":"",T.transform=(E.devicePixelRatio||1)<2?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",T)):Object.assign({},N,((t={})[v]=g?m+"px":"",t[_]=h?p+"px":"",t.transform="",t))}var zs={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];ts(i)&&rs(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],i=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});ts(r)&&rs(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};var js={left:"right",right:"left",bottom:"top",top:"bottom"};function Gs(e){return e.replace(/left|right|bottom|top/g,(function(e){return js[e]}))}var Ys={start:"end",end:"start"};function Vs(e){return e.replace(/start|end/g,(function(e){return Ys[e]}))}function Hs(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ns(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function qs(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function $s(e,t){return"viewport"===t?qs(function(e){var t=Za(e),n=is(e),r=t.visualViewport,i=n.clientWidth,o=n.clientHeight,a=0,s=0;return r&&(i=r.width,o=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:i,height:o,x:a+as(e),y:s}}(e)):ts(t)?function(e){var t=Xa(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):qs(function(e){var t,n=is(e),r=Ja(e),i=null==(t=e.ownerDocument)?void 0:t.body,o=Ls(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=Ls(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+as(e),l=-r.scrollTop;return"rtl"===ss(i||n).direction&&(s+=Ls(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(is(e)))}function Ws(e,t,n){var r="clippingParents"===t?function(e){var t=ps(us(e)),n=["absolute","fixed"].indexOf(ss(e).position)>=0&&ts(e)?hs(e):e;return es(n)?t.filter((function(e){return es(e)&&Hs(e,n)&&"body"!==rs(e)})):[]}(e):[].concat(t),i=[].concat(r,[n]),o=i[0],a=i.reduce((function(t,n){var r=$s(e,n);return t.top=Ls(r.top,t.top),t.right=Ps(r.right,t.right),t.bottom=Ps(r.bottom,t.bottom),t.left=Ls(r.left,t.left),t}),$s(e,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Qs(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Ks(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function Xs(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=void 0===r?e.placement:r,o=n.boundary,a=void 0===o?"clippingParents":o,s=n.rootBoundary,l=void 0===s?"viewport":s,c=n.elementContext,d=void 0===c?"popper":c,u=n.altBoundary,p=void 0!==u&&u,f=n.padding,m=void 0===f?0:f,h=Qs("number"!=typeof m?m:Ks(m,bs)),g="popper"===d?"reference":"popper",_=e.elements.reference,v=e.rects.popper,E=e.elements[p?g:d],b=Ws(es(E)?E:E.contextElement||is(e.elements.popper),a,l),y=Xa(_),S=xs({reference:y,element:v,strategy:"absolute",placement:i}),T=qs(Object.assign({},v,S)),N="popper"===d?T:y,O={top:b.top-N.top+h.top,bottom:N.bottom-b.bottom+h.bottom,left:b.left-N.left+h.left,right:N.right-b.right+h.right},C=e.modifiersData.offset;if("popper"===d&&C){var A=C[i];Object.keys(O).forEach((function(e){var t=[vs,_s].indexOf(e)>=0?1:-1,n=[gs,_s].indexOf(e)>=0?"y":"x";O[e]+=A[n]*t}))}return O}function Zs(e,t,n){return Ls(e,Ps(t,n))}function Js(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function el(e){return[gs,vs,_s,Es].some((function(t){return e[t]>=0}))}var tl=As({defaultModifiers:[Rs,ks,{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,a=void 0===o||o,s=n.roundOffsets,l=void 0===s||s,c={placement:ws(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,Fs(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,Fs(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},zs,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=void 0===i?[0,0]:i,a=Ss.reduce((function(e,n){return e[n]=function(e,t,n){var r=ws(e),i=[Es,gs].indexOf(r)>=0?-1:1,o="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[Es,vs].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,o),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,c=n.padding,d=n.boundary,u=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,m=void 0===f||f,h=n.allowedAutoPlacements,g=t.options.placement,_=ws(g),v=l||(_===g||!m?[Gs(g)]:function(e){if("auto"===ws(e))return[];var t=Gs(e);return[Vs(e),t,Vs(t)]}(g)),E=[g].concat(v).reduce((function(e,n){return e.concat("auto"===ws(n)?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?Ss:l,d=Is(r),u=d?s?ys:ys.filter((function(e){return Is(e)===d})):bs,p=u.filter((function(e){return c.indexOf(e)>=0}));0===p.length&&(p=u);var f=p.reduce((function(t,n){return t[n]=Xs(e,{placement:n,boundary:i,rootBoundary:o,padding:a})[ws(n)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}(t,{placement:n,boundary:d,rootBoundary:u,padding:c,flipVariations:m,allowedAutoPlacements:h}):n)}),[]),b=t.rects.reference,y=t.rects.popper,S=new Map,T=!0,N=E[0],O=0;O<E.length;O++){var C=E[O],A=ws(C),D="start"===Is(C),R=[gs,_s].indexOf(A)>=0,w=R?"width":"height",I=Xs(t,{placement:C,boundary:d,rootBoundary:u,altBoundary:p,padding:c}),M=R?D?vs:Es:D?_s:gs;b[w]>y[w]&&(M=Gs(M));var x=Gs(M),k=[];if(o&&k.push(I[A]<=0),s&&k.push(I[M]<=0,I[x]<=0),k.every((function(e){return e}))){N=C,T=!1;break}S.set(C,k)}if(T)for(var L=function(e){var t=E.find((function(t){var n=S.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return N=t,"break"},P=m?3:1;P>0;P--){if("break"===L(P))break}t.placement!==N&&(t.modifiersData[r]._skip=!0,t.placement=N,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0!==a&&a,l=n.boundary,c=n.rootBoundary,d=n.altBoundary,u=n.padding,p=n.tether,f=void 0===p||p,m=n.tetherOffset,h=void 0===m?0:m,g=Xs(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),_=ws(t.placement),v=Is(t.placement),E=!v,b=Ms(_),y="x"===b?"y":"x",S=t.modifiersData.popperOffsets,T=t.rects.reference,N=t.rects.popper,O="function"==typeof h?h(Object.assign({},t.rects,{placement:t.placement})):h,C={x:0,y:0};if(S){if(o||s){var A="y"===b?gs:Es,D="y"===b?_s:vs,R="y"===b?"height":"width",w=S[b],I=S[b]+g[A],M=S[b]-g[D],x=f?-N[R]/2:0,k="start"===v?T[R]:N[R],L="start"===v?-N[R]:-T[R],P=t.elements.arrow,B=f&&P?ds(P):{width:0,height:0},U=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},F=U[A],z=U[D],j=Zs(0,T[R],B[R]),G=E?T[R]/2-x-j-F-O:k-j-F-O,Y=E?-T[R]/2+x+j+z+O:L+j+z+O,V=t.elements.arrow&&hs(t.elements.arrow),H=V?"y"===b?V.clientTop||0:V.clientLeft||0:0,q=t.modifiersData.offset?t.modifiersData.offset[t.placement][b]:0,$=S[b]+G-q-H,W=S[b]+Y-q;if(o){var Q=Zs(f?Ps(I,$):I,w,f?Ls(M,W):M);S[b]=Q,C[b]=Q-w}if(s){var K="x"===b?gs:Es,X="x"===b?_s:vs,Z=S[y],J=Z+g[K],ee=Z-g[X],te=Zs(f?Ps(J,$):J,Z,f?Ls(ee,W):ee);S[y]=te,C[y]=te-Z}}t.modifiersData[r]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=ws(n.placement),l=Ms(s),c=[Es,vs].indexOf(s)>=0?"height":"width";if(o&&a){var d=function(e,t){return Qs("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Ks(e,bs))}(i.padding,n),u=ds(o),p="y"===l?gs:Es,f="y"===l?_s:vs,m=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],h=a[l]-n.rects.reference[l],g=hs(o),_=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,E=d[p],b=_-u[c]-d[f],y=_/2-u[c]/2+v,S=Zs(E,y,b),T=l;n.modifiersData[r]=((t={})[T]=S,t.centerOffset=S-y,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&Hs(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=Xs(t,{elementContext:"reference"}),s=Xs(t,{altBoundary:!0}),l=Js(a,r),c=Js(s,i,o),d=el(l),u=el(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]}),nl={passive:!0,capture:!0};function rl(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function il(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function ol(e,t){return"function"==typeof e?e.apply(void 0,t):e}function al(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function sl(e){return[].concat(e)}function ll(e,t){-1===e.indexOf(t)&&e.push(t)}function cl(e){return e.split("-")[0]}function dl(e){return[].slice.call(e)}function ul(){return document.createElement("div")}function pl(e){return["Element","Fragment"].some((function(t){return il(e,t)}))}function fl(e){return il(e,"MouseEvent")}function ml(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function hl(e){return pl(e)?[e]:function(e){return il(e,"NodeList")}(e)?dl(e):Array.isArray(e)?e:dl(document.querySelectorAll(e))}function gl(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function _l(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function vl(e){var t,n=sl(e)[0];return(null==n||null==(t=n.ownerDocument)?void 0:t.body)?n.ownerDocument:document}function El(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}var bl={isTouch:!1},yl=0;function Sl(){bl.isTouch||(bl.isTouch=!0,window.performance&&document.addEventListener("mousemove",Tl))}function Tl(){var e=performance.now();e-yl<20&&(bl.isTouch=!1,document.removeEventListener("mousemove",Tl)),yl=e}function Nl(){var e=document.activeElement;if(ml(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var Ol="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",Cl=/MSIE |Trident\//.test(Ol);var Al={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Dl=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Al,{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Rl=Object.keys(Dl);function wl(e){var t=(e.plugins||[]).reduce((function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=void 0!==e[r]?e[r]:i),t}),{});return Object.assign({},e,{},t)}function Il(e,t){var n=Object.assign({},t,{content:ol(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(wl(Object.assign({},Dl,{plugins:t}))):Rl).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},Dl.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function Ml(e,t){e.innerHTML=t}function xl(e){var t=ul();return!0===e?t.className="tippy-arrow":(t.className="tippy-svg-arrow",pl(e)?t.appendChild(e):Ml(t,e)),t}function kl(e,t){pl(t.content)?(Ml(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Ml(e,t.content):e.textContent=t.content)}function Ll(e){var t=e.firstElementChild,n=dl(t.children);return{box:t,content:n.find((function(e){return e.classList.contains("tippy-content")})),arrow:n.find((function(e){return e.classList.contains("tippy-arrow")||e.classList.contains("tippy-svg-arrow")})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function Pl(e){var t=ul(),n=ul();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ul();function i(n,r){var i=Ll(t),o=i.box,a=i.content,s=i.arrow;r.theme?o.setAttribute("data-theme",r.theme):o.removeAttribute("data-theme"),"string"==typeof r.animation?o.setAttribute("data-animation",r.animation):o.removeAttribute("data-animation"),r.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?o.setAttribute("role",r.role):o.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||kl(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(o.removeChild(s),o.appendChild(xl(r.arrow))):o.appendChild(xl(r.arrow)):s&&o.removeChild(s)}return r.className="tippy-content",r.setAttribute("data-state","hidden"),kl(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props),{popper:t,onUpdate:i}}Pl.$$tippy=!0;var Bl=1,Ul=[],Fl=[];function zl(e,t){var n,r,i,o,a,s,l,c,d,u=Il(e,Object.assign({},Dl,{},wl((n=t,Object.keys(n).reduce((function(e,t){return void 0!==n[t]&&(e[t]=n[t]),e}),{}))))),p=!1,f=!1,m=!1,h=!1,g=[],_=al(W,u.interactiveDebounce),v=Bl++,E=(d=u.plugins).filter((function(e,t){return d.indexOf(e)===t})),b={id:v,reference:e,popper:ul(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:E,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)},setProps:function(t){0;if(b.state.isDestroyed)return;k("onBeforeUpdate",[b,t]),q();var n=b.props,r=Il(e,Object.assign({},b.props,{},t,{ignoreAttributes:!0}));b.props=r,H(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),_=al(W,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?sl(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded");P(),x(),T&&T(n,r);b.popperInstance&&(Z(),ee().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})));k("onAfterUpdate",[b,t])},setContent:function(e){b.setProps({content:e})},show:function(){0;var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=bl.isTouch&&!b.props.touch,i=rl(b.props.duration,0,Dl.duration);if(e||t||n||r)return;if(R().hasAttribute("disabled"))return;if(k("onShow",[b],!1),!1===b.props.onShow(b))return;b.state.isVisible=!0,D()&&(S.style.visibility="visible");x(),j(),b.state.isMounted||(S.style.transition="none");if(D()){var o=I(),a=o.box,s=o.content;gl([a,s],0)}l=function(){var e;if(b.state.isVisible&&!h){if(h=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,D()&&b.props.animation){var t=I(),n=t.box,r=t.content;gl([n,r],i),_l([n,r],"visible")}L(),P(),ll(Fl,b),null==(e=b.popperInstance)||e.forceUpdate(),b.state.isMounted=!0,k("onMount",[b]),b.props.animation&&D()&&function(e,t){Y(e,t)}(i,(function(){b.state.isShown=!0,k("onShown",[b])}))}},function(){var e,t=b.props.appendTo,n=R();e=b.props.interactive&&t===Dl.appendTo||"parent"===t?n.parentNode:ol(t,[n]);e.contains(S)||e.appendChild(S);Z(),!1}()},hide:function(){0;var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=rl(b.props.duration,1,Dl.duration);if(e||t||n)return;if(k("onHide",[b],!1),!1===b.props.onHide(b))return;b.state.isVisible=!1,b.state.isShown=!1,h=!1,p=!1,D()&&(S.style.visibility="hidden");if(B(),G(),x(),D()){var i=I(),o=i.box,a=i.content;b.props.animation&&(gl([o,a],r),_l([o,a],"hidden"))}L(),P(),b.props.animation?D()&&function(e,t){Y(e,(function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()}))}(r,b.unmount):b.unmount()},hideWithInteractivity:function(e){0;w().addEventListener("mousemove",_),ll(Ul,_),_(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){0;b.state.isVisible&&b.hide();if(!b.state.isMounted)return;J(),ee().forEach((function(e){e._tippy.unmount()})),S.parentNode&&S.parentNode.removeChild(S);Fl=Fl.filter((function(e){return e!==b})),b.state.isMounted=!1,k("onHidden",[b])},destroy:function(){0;if(b.state.isDestroyed)return;b.clearDelayTimeouts(),b.unmount(),q(),delete e._tippy,b.state.isDestroyed=!0,k("onDestroy",[b])}};if(!u.render)return b;var y=u.render(b),S=y.popper,T=y.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+b.id,b.popper=S,e._tippy=b,S._tippy=b;var N=E.map((function(e){return e.fn(b)})),O=e.hasAttribute("aria-expanded");return H(),P(),x(),k("onCreate",[b]),u.showOnCreate&&te(),S.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),S.addEventListener("mouseleave",(function(e){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&(w().addEventListener("mousemove",_),_(e))})),b;function C(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function A(){return"hold"===C()[0]}function D(){var e;return!!(null==(e=b.props.render)?void 0:e.$$tippy)}function R(){return c||e}function w(){var e=R().parentNode;return e?vl(e):document}function I(){return Ll(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||bl.isTouch||a&&"focus"===a.type?0:rl(b.props.delay,e?0:1,Dl.delay)}function x(){S.style.pointerEvents=b.props.interactive&&b.state.isVisible?"":"none",S.style.zIndex=""+b.props.zIndex}function k(e,t,n){var r;(void 0===n&&(n=!0),N.forEach((function(n){n[e]&&n[e].apply(void 0,t)})),n)&&(r=b.props)[e].apply(r,t)}function L(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=S.id;sl(b.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var i=t&&t.replace(r,"").trim();i?e.setAttribute(n,i):e.removeAttribute(n)}}))}}function P(){!O&&b.props.aria.expanded&&sl(b.props.triggerTarget||e).forEach((function(e){b.props.interactive?e.setAttribute("aria-expanded",b.state.isVisible&&e===R()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){w().removeEventListener("mousemove",_),Ul=Ul.filter((function(e){return e!==_}))}function U(e){if(!(bl.isTouch&&(m||"mousedown"===e.type)||b.props.interactive&&S.contains(e.target))){if(R().contains(e.target)){if(bl.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else k("onClickOutside",[b,e]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),f=!0,setTimeout((function(){f=!1})),b.state.isMounted||G())}}function F(){m=!0}function z(){m=!1}function j(){var e=w();e.addEventListener("mousedown",U,!0),e.addEventListener("touchend",U,nl),e.addEventListener("touchstart",z,nl),e.addEventListener("touchmove",F,nl)}function G(){var e=w();e.removeEventListener("mousedown",U,!0),e.removeEventListener("touchend",U,nl),e.removeEventListener("touchstart",z,nl),e.removeEventListener("touchmove",F,nl)}function Y(e,t){var n=I().box;function r(e){e.target===n&&(El(n,"remove",r),t())}if(0===e)return t();El(n,"remove",s),El(n,"add",r),s=r}function V(t,n,r){void 0===r&&(r=!1),sl(b.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),g.push({node:e,eventType:t,handler:n,options:r})}))}function H(){var e;A()&&(V("touchstart",$,{passive:!0}),V("touchend",Q,{passive:!0})),(e=b.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(V(e,$),e){case"mouseenter":V("mouseleave",Q);break;case"focus":V(Cl?"focusout":"blur",K);break;case"focusin":V("focusout",K)}}))}function q(){g.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)})),g=[]}function $(e){var t,n=!1;if(b.state.isEnabled&&!X(e)&&!f){var r="focus"===(null==(t=a)?void 0:t.type);a=e,c=e.currentTarget,P(),!b.state.isVisible&&fl(e)&&Ul.forEach((function(t){return t(e)})),"click"===e.type&&(b.props.trigger.indexOf("mouseenter")<0||p)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:te(e),"click"===e.type&&(p=!n),n&&!r&&ne(e)}}function W(e){var t=e.target,n=R().contains(t)||S.contains(t);"mousemove"===e.type&&n||function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,i=e.popperState,o=e.props.interactiveBorder,a=cl(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l="bottom"===a?s.top.y:0,c="top"===a?s.bottom.y:0,d="right"===a?s.left.x:0,u="left"===a?s.right.x:0,p=t.top-r+l>o,f=r-t.bottom-c>o,m=t.left-n+d>o,h=n-t.right-u>o;return p||f||m||h}))}(ee().concat(S).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:u}:null})).filter(Boolean),e)&&(B(),ne(e))}function Q(e){X(e)||b.props.trigger.indexOf("click")>=0&&p||(b.props.interactive?b.hideWithInteractivity(e):ne(e))}function K(e){b.props.trigger.indexOf("focusin")<0&&e.target!==R()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||ne(e)}function X(e){return!!bl.isTouch&&A()!==e.type.indexOf("touch")>=0}function Z(){J();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,o=t.getReferenceClientRect,a=t.moveTransition,s=D()?Ll(S).arrow:null,c=o?{getBoundingClientRect:o,contextElement:o.contextElement||R()}:e,d=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(D()){var n=I().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];D()&&s&&d.push({name:"arrow",options:{element:s,padding:3}}),d.push.apply(d,(null==n?void 0:n.modifiers)||[]),b.popperInstance=tl(c,S,Object.assign({},n,{placement:r,onFirstUpdate:l,modifiers:d}))}function J(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ee(){return dl(S.querySelectorAll("[data-tippy-root]"))}function te(e){b.clearDelayTimeouts(),e&&k("onTrigger",[b,e]),j();var t=M(!0),n=C(),i=n[0],o=n[1];bl.isTouch&&"hold"===i&&o&&(t=o),t?r=setTimeout((function(){b.show()}),t):b.show()}function ne(e){if(b.clearDelayTimeouts(),k("onUntrigger",[b,e]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&p)){var t=M(!1);t?i=setTimeout((function(){b.state.isVisible&&b.hide()}),t):o=requestAnimationFrame((function(){b.hide()}))}}else G()}}function jl(e,t){void 0===t&&(t={});var n=Dl.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",Sl,nl),window.addEventListener("blur",Nl);var r=Object.assign({},t,{plugins:n}),i=hl(e).reduce((function(e,t){var n=t&&zl(t,r);return n&&e.push(n),e}),[]);return pl(e)?i[0]:i}jl.defaultProps=Dl,jl.setDefaultProps=function(e){Object.keys(e).forEach((function(t){Dl[t]=e[t]}))},jl.currentInput=bl;Object.assign({},zs,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}});jl.setDefaultProps({render:Pl});var Gl=jl;class Yl{constructor({editor:e,element:t,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;this.preventHide?this.preventHide=!1:(null==e?void 0:e.relatedTarget)&&(null===(t=this.element.parentNode)||void 0===t?void 0:t.contains(e.relatedTarget))||this.hide()},this.editor=e,this.element=t,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(e={}){this.tippy=Gl(this.view.dom,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...e})}update(e,t){const{state:n,composing:r}=e,{doc:i,selection:o}=n,a=t&&t.doc.eq(i)&&t.selection.eq(o);if(r||a)return;const{empty:s,$anchor:l,ranges:c}=o,d=Math.min(...c.map(e=>e.$from.pos)),u=Math.max(...c.map(e=>e.$to.pos));!s&&l.parent.textContent?(this.tippy.setProps({getReferenceClientRect:()=>Ka(e,d,u)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Vl=new yt("menuBubble"),Hl=e=>new vt({key:Vl,view:t=>new Yl({view:t,...e})});xo.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Hl({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});class ql{constructor({editor:e,element:t,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;this.preventHide?this.preventHide=!1:(null==e?void 0:e.relatedTarget)&&(null===(t=this.element.parentNode)||void 0===t?void 0:t.contains(e.relatedTarget))||this.hide()},this.editor=e,this.element=t,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(e={}){this.tippy=Gl(this.view.dom,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...e})}update(e,t){const{state:n,composing:r}=e,{doc:i,selection:o}=n,a=t&&t.doc.eq(i)&&t.selection.eq(o);if(r||a)return;const{$anchor:s,empty:l,from:c,to:d}=o,u=1===s.depth,p=!o.$anchor.parent.isLeaf&&!o.$anchor.parent.textContent;l&&(u&&p)?(this.tippy.setProps({getReferenceClientRect:()=>Ka(e,c,d)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const $l=new yt("menuFloating"),Wl=e=>new vt({key:$l,view:t=>new ql({view:t,...e})});xo.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Wl({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});var Ql=n(12),Kl=n.n(Ql);const Xl=e=>{const t=Object(r.useRef)(null);return Object(r.useEffect)(()=>{const{editor:n,tippyOptions:r}=e;return n.registerPlugin(Hl({editor:n,element:t.current,tippyOptions:r})),()=>{n.unregisterPlugin(Vl)}},[]),i.a.createElement("div",{ref:t,className:e.className,style:{visibility:"hidden"}},e.children)};class Zl extends class extends class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}{constructor(e={}){super(),this.isFocused=!1,this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.commands.focus(this.options.autofocus),this.emit("create",{editor:this})},0)}get commands(){return this.commandManager.createCommands()}chain(){return this.commandManager.createChain()}can(){return this.commandManager.createCan()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e){const t=document.createElement("style");return t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t),t}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}'))}setOptions(e={}){this.options={...this.options,...e}}setEditable(e){this.setOptions({editable:e}),this.view&&this.state&&!this.isDestroyed&&this.view.updateState(this.state)}get isEditable(){return this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n="function"==typeof t?t(e,this.state.plugins):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(e){if(this.isDestroyed)return;const t="string"==typeof e?e+"$":e.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(e=>!e.key.startsWith(t))});this.view.updateState(n)}createExtensionManager(){const e=[...Object.entries(za).map(([,e])=>e),...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new wo(e,this)}createCommandManager(){this.commandManager=new Eo(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new ii(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:ht.create({doc:_o(this.options.content,this.schema,this.options.parseOptions)})});const e=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(e),this.createNodeViews();this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null===(t=this.capturedTransaction)||void 0===t?void 0:t.step(e)}):void(this.capturedTransaction=e);const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this});const r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event}),i&&this.emit("blur",{editor:this,event:i.event}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return function(e,t){const n=ao("string"==typeof t?t:t.name,e.schema);return"node"===n?lo(e,t):"mark"===n?uo(e,t):{}}(this.state,e)}getNodeAttributes(e){return console.warn("[tiptap warn]: editor.getNodeAttributes() is deprecated. please use editor.getAttributes() instead."),lo(this.state,e)}getMarkAttributes(e){return console.warn("[tiptap warn]: editor.getMarkAttributes() is deprecated. please use editor.getAttributes() instead."),uo(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return fo(e,null,n)||mo(e,null,n);const r=ao(t,e.schema);return"node"===r?fo(e,t,n):"mark"===r&&mo(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return vo(this.state.doc,this.schema)}get isEmpty(){return function(e){var t;const n=null===(t=e.type.createAndFill())||void 0===t?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){var e;this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),(e=this.css)&&e.parentNode&&e.parentNode.removeChild(e)}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}}{constructor(){super(...arguments),this.contentComponent=null}}const Jl=(e={})=>{const[t,n]=Object(r.useState)(null),i=function(){const[,e]=Object(r.useState)(0);return()=>e(e=>e+1)}();return Object(r.useEffect)(()=>{const t=new Zl(e);return n(t),t.on("transaction",i),()=>{t.destroy()}},[]),t};class ec{constructor(e,{editor:t,props:n={},as:r="div"}){this.ref=null,this.id=Math.floor(4294967295*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),this.render()}render(){var e;const t=this.component,n=this.props;(function(e){return!("function"!=typeof e||!e.prototype||!e.prototype.isReactComponent)})(t)&&(n.ref=e=>{this.ref=e}),this.reactElement=i.a.createElement(t,Object.assign({},n)),(null===(e=this.editor)||void 0===e?void 0:e.contentComponent)&&this.editor.contentComponent.setState({renderers:this.editor.contentComponent.state.renderers.set(this.id,this)})}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;if(null===(e=this.editor)||void 0===e?void 0:e.contentComponent){const{renderers:e}=this.editor.contentComponent.state;e.delete(this.id),this.editor.contentComponent.setState({renderers:e})}}}const tc=Object(r.createContext)({onDragStart:void 0});class nc extends class{constructor(e,t,n){this.isDragging=!1,this.options={stopEvent:null,update:null},this.component=e,this.options={...this.options,...n},this.editor=t.editor,this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return null}get contentDOM(){return null}onDragStart(e){var t,n,r;const{view:i}=this.editor,o=e.target,a=3===o.nodeType?null===(t=o.parentElement)||void 0===t?void 0:t.closest("[data-drag-handle]"):o.closest("[data-drag-handle]");if(!this.dom||(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(o))||!a)return;let s=0,l=0;if(this.dom!==a){const t=this.dom.getBoundingClientRect(),n=a.getBoundingClientRect();s=n.x-t.x+e.offsetX,l=n.y-t.y+e.offsetY}null===(r=e.dataTransfer)||void 0===r||r.setDragImage(this.dom,s,l);const c=it.create(i.state.doc,this.getPos()),d=i.state.tr.setSelection(c);i.dispatch(d)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent(e);const n=e.target;if(!(this.dom.contains(n)&&!(null===(t=this.contentDOM)||void 0===t?void 0:t.contains(n))))return!1;if(["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)return!0;const{isEditable:r}=this.editor,{isDragging:i}=this,o=!!this.node.type.spec.draggable,a=it.isSelectable(this.node),s="copy"===e.type,l="paste"===e.type,c="cut"===e.type,d="mousedown"===e.type,u=e.type.startsWith("drag")||"drop"===e.type;if(!o&&a&&u&&e.preventDefault(),o&&u&&!i)return e.preventDefault(),!1;if(o&&r&&!i&&d){const e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(i||s||l||c||d&&a)}ignoreMutation(e){if(!this.dom||!this.contentDOM)return!0;if(this.node.isLeaf)return!0;if("selection"===e.type)return!1;if(this.dom.contains(e.target)&&"childList"===e.type&&(["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document)){if([...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))return!1}return this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)}updateAttributes(e){if(!this.editor.view.editable)return;const{state:t}=this.editor.view,n=this.getPos(),r=t.tr.setNodeMarkup(n,void 0,{...this.node.attrs,...e});this.editor.view.dispatch(r)}}{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e)};if(!this.component.displayName){const e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}const t=e=>{const t=this.onDragStart.bind(this),n=this.component;return i.a.createElement(tc.Provider,{value:{onDragStart:t}},i.a.createElement(n,Object.assign({},e)))};t.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit"),this.renderer=new ec(t,{editor:this.editor,props:e,as:this.node.isInline?"span":"div"})}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null===(e=this.renderer.element.firstElementChild)||void 0===e?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){if(this.node.isLeaf)return null;const e=this.dom.querySelector("[data-node-view-content]");return this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement),this.contentDOMElement}update(e,t){return"function"==typeof this.options.update?this.options.update(e,t):e.type===this.node.type&&(e===this.node&&this.decorations===t||(this.node=e,this.decorations=t,this.renderer.updateProps({node:e,decorations:t})),!0)}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function rc(e,t){return n=>n.editor.contentComponent?new nc(e,n,t):{}}const ic=({renderers:e})=>i.a.createElement(i.a.Fragment,null,Array.from(e).map(([e,t])=>Kl.a.createPortal(t.reactElement,t.element,e)));class oc extends i.a.Component{constructor(e){super(e),this.editorContentRef=i.a.createRef(),this.state={renderers:new Map}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.appendChild(e.options.element.firstChild),e.setOptions({element:t}),e.contentComponent=this,setTimeout(()=>e.createNodeViews(),0)}}componentWillUnmount(){const{editor:e}=this.props;if(!e)return;if(e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild)return;const t=document.createElement("div");t.appendChild(e.options.element.firstChild),e.setOptions({element:t})}render(){return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{ref:this.editorContentRef}),i.a.createElement(ic,{renderers:this.state.renderers}))}}const ac=i.a.memo(oc),sc=e=>{const{onDragStart:t}=Object(r.useContext)(tc),n=e.as||"div";return i.a.createElement(n,Object.assign({},e,{"data-node-view-wrapper":"",onDragStart:t,style:{...e.style,whiteSpace:"normal"}}))},lc=e=>{const t=e.as||"div";return i.a.createElement(t,Object.assign({},e,{"data-node-view-content":"",style:{...e.style,whiteSpace:"pre-wrap"}}))};function cc(e){return void 0===e&&(e={}),new vt({view:function(t){return new dc(t,e)}})}var dc=function(e,t){var n=this;this.editorView=e,this.width=t.width||1,this.color=t.color||"black",this.class=t.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(t){var r=function(e){return n[t](e)};return e.dom.addEventListener(t,r),{name:t,handler:r}}))};dc.prototype.destroy=function(){var e=this;this.handlers.forEach((function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)}))},dc.prototype.update=function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&this.updateOverlay()},dc.prototype.setCursor=function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},dc.prototype.updateOverlay=function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos);if(!t.parent.inlineContent){var n=t.nodeBefore,r=t.nodeAfter;if(n||r){var i=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),o=n?i.bottom:i.top;n&&r&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:o-this.width/2,bottom:o+this.width/2}}}if(!e){var a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var s,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!c||c==document.body&&"static"==getComputedStyle(c).position)s=-pageXOffset,l=-pageYOffset;else{var d=c.getBoundingClientRect();s=d.left-c.scrollLeft,l=d.top-c.scrollTop}this.element.style.left=e.left-s+"px",this.element.style.top=e.top-l+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"},dc.prototype.scheduleRemoval=function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.setCursor(null)}),e)},dc.prototype.dragover=function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY});if(t){var n=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Ue(this.editorView.state.doc,n,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}},dc.prototype.dragend=function(){this.scheduleRemoval(20)},dc.prototype.drop=function(){this.scheduleRemoval(20)},dc.prototype.dragleave=function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)};var uc=xo.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[cc(this.options)]}}),pc=function(e){function t(t){e.call(this,t,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,r){var i=n.resolve(r.map(this.head));return t.valid(i)?new t(i):e.near(i)},t.prototype.content=function(){return m.empty},t.prototype.eq=function(e){return e instanceof t&&e.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))},t.prototype.getBookmark=function(){return new fc(this.anchor)},t.valid=function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t);if(0!=n)for(var r=e.node(t).child(n-1);;r=r.lastChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var i=r.child(n);;i=i.firstChild){if(0==i.childCount&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock},t.findFrom=function(e,n,r){e:for(;;){if(!r&&t.valid(e))return e;for(var i=e.pos,o=null,a=e.depth;;a--){var s=e.node(a);if(n>0?e.indexAfter(a)<s.childCount:e.index(a)>0){o=s.child(n>0?e.indexAfter(a):e.index(a)-1);break}if(0==a)return null;i+=n;var l=e.doc.resolve(i);if(t.valid(l))return l}for(;;){var c=n>0?o.firstChild:o.lastChild;if(!c){if(o.isAtom&&!o.isText&&!it.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=c,i+=n;var d=e.doc.resolve(i);if(t.valid(d))return d}return null}},t}(Je);pc.prototype.visible=!1,Je.jsonID("gapcursor",pc);var fc=function(e){this.pos=e};fc.prototype.map=function(e){return new fc(e.map(this.pos))},fc.prototype.resolve=function(e){var t=e.resolve(this.pos);return pc.valid(t)?new pc(t):Je.near(t)};var mc=Ti({ArrowLeft:hc("horiz",-1),ArrowRight:hc("horiz",1),ArrowUp:hc("vert",-1),ArrowDown:hc("vert",1)});function hc(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){var o=e.selection,a=t>0?o.$to:o.$from,s=o.empty;if(o instanceof nt){if(!i.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var l=pc.findFrom(a,t,s);return!!l&&(r&&r(e.tr.setSelection(new pc(l))),!0)}}function gc(e,t,n){if(!e.editable)return!1;var r=e.state.doc.resolve(t);if(!pc.valid(r))return!1;var i=e.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(i>-1&&it.isSelectable(e.state.doc.nodeAt(i)))&&(e.dispatch(e.state.tr.setSelection(new pc(r))),!0)}function _c(e){if(!(e.selection instanceof pc))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",$r.create(e.doc,[Yr.widget(e.selection.head,t,{key:"gapcursor"})])}var vc=xo.create({name:"gapCursor",addProseMirrorPlugins:()=>[new vt({props:{decorations:_c,createSelectionBetween:function(e,t,n){if(t.pos==n.pos&&pc.valid(n))return new pc(n)},handleClick:gc,handleKeyDown:mc}})],extendNodeSchema(e){var t;return{allowGapCursor:null!==(t=Co(bo(e,"allowGapCursor",{name:e.name,options:e.options})))&&void 0!==t?t:null}}});var Ec=ja.create({name:"doc",topNode:!0,content:"block+"});var bc=ja.create({name:"paragraph",priority:1e3,defaultOptions:{HTMLAttributes:{}},group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setParagraph:()=>({commands:e})=>e.toggleNode("paragraph","paragraph")}),addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var yc=ja.create({name:"text",group:"inline"}),Sc=function(){};Sc.prototype.append=function(e){return e.length?(e=Sc.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},Sc.prototype.prepend=function(e){return e.length?Sc.from(e).append(this):this},Sc.prototype.appendInner=function(e){return new Nc(this,e)},Sc.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Sc.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Sc.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Sc.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Sc.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},Sc.from=function(e){return e instanceof Sc?e:e&&e.length?new Tc(e):Sc.empty};var Tc=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Sc);Sc.empty=new Tc([]);var Nc=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Sc),Oc=Sc,Cc=function(e,t){this.items=e,this.eventCount=t};Cc.prototype.popEvent=function(e,t){var n=this;if(0==this.eventCount)return null;for(var r,i,o=this.items.length;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(r=this.remapping(o,this.items.length),i=r.maps.length);var a,s,l=e.tr,c=[],d=[];return this.items.forEach((function(e,t){if(!e.step)return r||(r=n.remapping(o,t+1),i=r.maps.length),i--,void d.push(e);if(r){d.push(new Ac(e.map));var u,p=e.step.map(r.slice(i));p&&l.maybeStep(p).doc&&(u=l.mapping.maps[l.mapping.maps.length-1],c.push(new Ac(u,null,null,c.length+d.length))),i--,u&&r.appendMap(u,i)}else l.maybeStep(e.step);return e.selection?(a=r?e.selection.map(r.slice(i)):e.selection,s=new Cc(n.items.slice(0,o).append(d.reverse().concat(c)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:a}},Cc.prototype.addTransform=function(e,t,n,r){for(var i=[],o=this.eventCount,a=this.items,s=!r&&a.length?a.get(a.length-1):null,l=0;l<e.steps.length;l++){var c,d=e.steps[l].invert(e.docs[l]),u=new Ac(e.mapping.maps[l],d,t);(c=s&&s.merge(u))&&(u=c,l?i.pop():a=a.slice(0,a.length-1)),i.push(u),t&&(o++,t=null),r||(s=u)}var p,f,m,h=o-n.depth;return h>Rc&&(f=h,(p=a).forEach((function(e,t){if(e.selection&&0==f--)return m=t,!1})),a=p.slice(m),o-=h),new Cc(a.append(i),o)},Cc.prototype.remapping=function(e,t){var n=new be;return this.items.forEach((function(t,r){var i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:null;n.appendMap(t.map,i)}),e,t),n},Cc.prototype.addMaps=function(e){return 0==this.eventCount?this:new Cc(this.items.append(e.map((function(e){return new Ac(e)}))),this.eventCount)},Cc.prototype.rebased=function(e,t){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach((function(e){e.selection&&a--}),r);var s=t;this.items.forEach((function(t){var r=i.getMirror(--s);if(null!=r){o=Math.min(o,r);var l=i.maps[r];if(t.step){var c=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(i.slice(s+1,r));d&&a++,n.push(new Ac(l,c,d))}else n.push(new Ac(l))}}),r);for(var l=[],c=t;c<o;c++)l.push(new Ac(i.maps[c]));var d=this.items.slice(0,r).append(l).append(n),u=new Cc(d,a);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u},Cc.prototype.emptyItemCount=function(){var e=0;return this.items.forEach((function(t){t.step||e++})),e},Cc.prototype.compress=function(e){void 0===e&&(e=this.items.length);var t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((function(o,a){if(a>=e)r.push(o),o.selection&&i++;else if(o.step){var s=o.step.map(t.slice(n)),l=s&&s.getMap();if(n--,l&&t.appendMap(l,n),s){var c=o.selection&&o.selection.map(t.slice(n));c&&i++;var d,u=new Ac(l.invert(),s,c),p=r.length-1;(d=r.length&&r[p].merge(u))?r[p]=d:r.push(u)}}else o.map&&n--}),this.items.length,0),new Cc(Oc.from(r.reverse()),i)},Cc.empty=new Cc(Oc.empty,0);var Ac=function(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r};Ac.prototype.merge=function(e){if(this.step&&e.step&&!e.selection){var t=e.step.merge(this.step);if(t)return new Ac(t.getMap().invert(),t,this.selection)}};var Dc=function(e,t,n,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r},Rc=20;function wc(e){var t=[];return e.forEach((function(e,n,r,i){return t.push(r,i)})),t}function Ic(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}function Mc(e,t,n,r){var i=Lc(t),o=Pc.get(t).spec.config,a=(r?e.undone:e.done).popEvent(t,i);if(a){var s=a.selection.resolve(a.transform.doc),l=(r?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),o,i),c=new Dc(r?l:a.remaining,r?a.remaining:l,null,0);n(a.transform.setSelection(s).setMeta(Pc,{redo:r,historyState:c}).scrollIntoView())}}var xc=!1,kc=null;function Lc(e){var t=e.plugins;if(kc!=t){xc=!1,kc=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){xc=!0;break}}return xc}var Pc=new yt("history"),Bc=new yt("closeHistory");function Uc(e){return e={depth:e&&e.depth||100,newGroupDelay:e&&e.newGroupDelay||500},new vt({key:Pc,state:{init:function(){return new Dc(Cc.empty,Cc.empty,null,0)},apply:function(t,n,r){return function(e,t,n,r){var i,o=n.getMeta(Pc);if(o)return o.historyState;n.getMeta(Bc)&&(e=new Dc(e.done,e.undone,null,0));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(Pc))return a.getMeta(Pc).redo?new Dc(e.done.addTransform(n,null,r,Lc(t)),e.undone,wc(n.mapping.maps[n.steps.length-1]),e.prevTime):new Dc(e.done,e.undone.addTransform(n,null,r,Lc(t)),null,e.prevTime);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Dc(e.done.rebased(n,i),e.undone.rebased(n,i),Ic(e.prevRanges,n.mapping),e.prevTime):new Dc(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ic(e.prevRanges,n.mapping),e.prevTime);var s=0==e.prevTime||!a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach((function(e,r){for(var i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)})),n}(n,e.prevRanges)),l=a?Ic(e.prevRanges,n.mapping):wc(n.mapping.maps[n.steps.length-1]);return new Dc(e.done.addTransform(n,s?t.selection.getBookmark():null,r,Lc(t)),Cc.empty,l,n.time)}(n,r,t,e)}},config:e})}var Fc=xo.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands:()=>({undo:()=>({state:e,dispatch:t})=>function(e,t){var n=Pc.getState(e);return!(!n||0==n.done.eventCount)&&(t&&Mc(n,e,t,!1),!0)}(e,t),redo:()=>({state:e,dispatch:t})=>function(e,t){var n=Pc.getState(e);return!(!n||0==n.undone.eventCount)&&(t&&Mc(n,e,t,!0),!0)}(e,t)}),addProseMirrorPlugins(){return[Uc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}}});const zc=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,jc=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Gc=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,Yc=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm;var Vc=Ga.create({name:"bold",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],renderHTML({HTMLAttributes:e}){return["strong",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setBold:()=>({commands:e})=>e.setMark("bold"),toggleBold:()=>({commands:e})=>e.toggleMark("bold"),unsetBold:()=>({commands:e})=>e.unsetMark("bold")}),addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Va(zc,this.type),Va(Gc,this.type)]},addPasteRules(){return[Ha(jc,this.type),Ha(Yc,this.type)]}});const Hc=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,qc=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,$c=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,Wc=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm;var Qc=Ga.create({name:"italic",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:e}){return["em",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setItalic:()=>({commands:e})=>e.setMark("italic"),toggleItalic:()=>({commands:e})=>e.toggleMark("italic"),unsetItalic:()=>({commands:e})=>e.unsetMark("italic")}),addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Va(Hc,this.type),Va($c,this.type)]},addPasteRules(){return[Ha(qc,this.type),Ha(Wc,this.type)]}});const Kc=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm;var Xc=Ga.create({name:"code",defaultOptions:{HTMLAttributes:{}},excludes:"_",parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setCode:()=>({commands:e})=>e.setMark("code"),toggleCode:()=>({commands:e})=>e.toggleMark("code"),unsetCode:()=>({commands:e})=>e.unsetMark("code")}),addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Va(Kc,this.type)]},addPasteRules(){return[Ha(Kc,this.type)]}});const Zc=/^```(?<language>[a-z]*)? $/,Jc=/^~~~(?<language>[a-z]*)? $/;var ed=ja.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{var t;const n=null===(t=e.firstElementChild)||void 0===t?void 0:t.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:e}){return["pre",this.options.HTMLAttributes,["code",e,0]]},addCommands:()=>({setCodeBlock:e=>({commands:t})=>t.setNode("codeBlock",e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode("codeBlock","paragraph",e)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[xi(Zc,this.type,({groups:e})=>e),xi(Jc,this.type,({groups:e})=>e)]}});var td=ja.create({name:"heading",defaultOptions:{levels:[1,2,3,4,5,6],HTMLAttributes:{}},content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:"h"+e,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return["h"+(this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]),To(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode("heading",e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode("heading","paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,["Mod-Alt-"+t]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>xi(new RegExp(`^(#{1,${e}})\\s$`),this.type,{level:e}))}});var nd=ja.create({name:"hardBreak",defaultOptions:{HTMLAttributes:{}},inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",To(this.options.HTMLAttributes,e)]},addCommands(){return{setHardBreak:()=>({commands:e})=>e.first([()=>e.exitCode(),()=>e.insertContent({type:this.name})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const rd=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm;var id=Ga.create({name:"strike",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setStrike:()=>({commands:e})=>e.setMark("strike"),toggleStrike:()=>({commands:e})=>e.toggleMark("strike"),unsetStrike:()=>({commands:e})=>e.unsetMark("strike")}),addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Va(rd,this.type)]},addPasteRules(){return[Ha(rd,this.type)]}});const od=/^\s*>\s$/gm;var ad=ja.create({name:"blockquote",defaultOptions:{HTMLAttributes:{}},content:"block*",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setBlockquote:()=>({commands:e})=>e.wrapIn("blockquote"),toggleBlockquote:()=>({commands:e})=>e.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:e})=>e.lift("blockquote")}),addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Mi(od,this.type)]}});var sd=ja.create({name:"horizontalRule",defaultOptions:{HTMLAttributes:{}},group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",To(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e})=>e().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{var n;if(t){const{parent:t,pos:r}=e.selection.$from,i=r+1;if(!e.doc.nodeAt(i)){const r=null===(n=t.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(e.insert(i,r),e.setSelection(nt.create(e.doc,i)))}e.scrollIntoView()}return!0}).run()}},addInputRules(){return[Ya(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}});const ld=/^\s*([-+*])\s$/;var cd=ja.create({name:"bulletList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({toggleBulletList:()=>({commands:e})=>e.toggleList("bulletList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[Mi(ld,this.type)]}});const dd=/^(\d+)\.\s$/;var ud=ja.create({name:"orderedList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",addAttributes:()=>({start:{default:1,parseHTML:e=>({start:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1})}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",To(this.options.HTMLAttributes,n),0]:["ol",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({toggleOrderedList:()=>({commands:e})=>e.toggleList("orderedList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[Mi(dd,this.type,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order===+e[1])]}});var pd=ja.create({name:"listItem",defaultOptions:{HTMLAttributes:{}},content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",To(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}});var fd=xo.create({name:"starterKit",addExtensions(){var e,t,n,r,i,o,a,s,l,c,d,u,p,f,m,h,g,_;const v=[];return!1!==this.options.blockquote&&v.push(ad.configure(null===(e=this.options)||void 0===e?void 0:e.blockquote)),!1!==this.options.bold&&v.push(Vc.configure(null===(t=this.options)||void 0===t?void 0:t.bold)),!1!==this.options.bulletList&&v.push(cd.configure(null===(n=this.options)||void 0===n?void 0:n.bulletList)),!1!==this.options.code&&v.push(Xc.configure(null===(r=this.options)||void 0===r?void 0:r.code)),!1!==this.options.codeBlock&&v.push(ed.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&v.push(Ec.configure(null===(o=this.options)||void 0===o?void 0:o.document)),!1!==this.options.dropcursor&&v.push(uc.configure(null===(a=this.options)||void 0===a?void 0:a.dropcursor)),!1!==this.options.gapcursor&&v.push(vc.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&v.push(nd.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&v.push(td.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&v.push(Fc.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&v.push(sd.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&v.push(Qc.configure(null===(p=this.options)||void 0===p?void 0:p.italic)),!1!==this.options.listItem&&v.push(pd.configure(null===(f=this.options)||void 0===f?void 0:f.listItem)),!1!==this.options.orderedList&&v.push(ud.configure(null===(m=this.options)||void 0===m?void 0:m.orderedList)),!1!==this.options.paragraph&&v.push(bc.configure(null===(h=this.options)||void 0===h?void 0:h.paragraph)),!1!==this.options.strike&&v.push(id.configure(null===(g=this.options)||void 0===g?void 0:g.strike)),!1!==this.options.text&&v.push(yc.configure(null===(_=this.options)||void 0===_?void 0:_.text)),v}});const md=new Ni(/<-$/,"←"),hd=new Ni(/->$/,"→"),gd=new Ni(/\(c\)$/,"©"),_d=new Ni(/\(r\)$/,"®"),vd=new Ni(/1\/2$/,"½"),Ed=new Ni(/\+\/-$/,"±"),bd=new Ni(/!=$/,"≠"),yd=new Ni(/<<$/,"«"),Sd=new Ni(/>>$/,"»"),Td=new Ni(/\d+\s?([*x])\s?\d+$/,"×");var Nd=xo.create({name:"typography",addInputRules:()=>[Ci,Ai,Di,Ri,wi,Ii,md,hd,gd,_d,vd,Ed,bd,yd,Sd,Td]}),Od={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Cd=/Edge\/(\d+)/.exec(navigator.userAgent),Ad=/MSIE \d/.test(navigator.userAgent),Dd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Od.mac=/Mac/.test(navigator.platform);var Rd=Od.ie=!!(Ad||Dd||Cd);Od.ie_version=Ad?document.documentMode||6:Dd?+Dd[1]:Cd?+Cd[1]:null,Od.gecko=!Rd&&/gecko\/(\d+)/i.test(navigator.userAgent),Od.gecko_version=Od.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var wd=!Rd&&/Chrome\/(\d+)/.exec(navigator.userAgent);Od.chrome=!!wd,Od.chrome_version=wd&&+wd[1],Od.safari=!Rd&&/Apple Computer/.test(navigator.vendor),Od.ios=Od.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Od.android=/Android \d/.test(navigator.userAgent),Od.webkit="webkitFontSmoothing"in document.documentElement.style,Od.webkit_version=Od.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Id=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Md=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},xd=null,kd=function(e,t,n){var r=xd||(xd=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Ld=function(e,t,n,r){return n&&(Bd(e,t,n,r,-1)||Bd(e,t,n,r,1))},Pd=/^(img|br|input|textarea|hr)$/i;function Bd(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ud(e))){var o=e.parentNode;if(1!=o.nodeType||Fd(e)||Pd.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Id(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?Ud(e):0}}}function Ud(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Fd(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var zd=function(e){var t=e.isCollapsed;return t&&Od.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function jd(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Gd(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Yd(e,t){return"number"==typeof e?e:e[t]}function Vd(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Hd(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Md(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Gd(o):Vd(a),c=0,d=0;if(t.top<l.top+Yd(r,"top")?d=-(l.top-t.top+Yd(i,"top")):t.bottom>l.bottom-Yd(r,"bottom")&&(d=t.bottom-l.bottom+Yd(i,"bottom")),t.left<l.left+Yd(r,"left")?c=-(l.left-t.left+Yd(i,"left")):t.right>l.right-Yd(r,"right")&&(c=t.right-l.right+Yd(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function qd(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Md(e));return t}function $d(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Wd=null;function Qd(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=kd(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=Zd(r,1);if(o.top!=o.bottom&&Kd(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:Qd(n,r)}function Kd(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Xd(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!Kd(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(Kd(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(Od.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(Od.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=Qd(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function Zd(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var Jd=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function eu(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=Od.webkit||Od.gecko;if(3==i.nodeType){if(!a||!Jd.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,tu(Zd(kd(i,s,l),c),c<0)}var d=Zd(kd(i,o,o),n);if(Od.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=Zd(kd(i,o-1,o-1),-1);if(u.top==d.top){var p=Zd(kd(i,o,o+1),-1);if(p.top!=d.top)return tu(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==Ud(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return nu(f.getBoundingClientRect(),!1)}if(o<Ud(i)){var m=i.childNodes[o];if(1==m.nodeType)return nu(m.getBoundingClientRect(),!0)}return nu(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==Ud(i))){var h=i.childNodes[o-1],g=3==h.nodeType?kd(h,Ud(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return tu(Zd(g,1),!1)}if(o<Ud(i)){var _=i.childNodes[o],v=3==_.nodeType?kd(_,0,a?0:1):1==_.nodeType?_:null;if(v)return tu(Zd(v,-1),!0)}return tu(Zd(3==i.nodeType?kd(i):i,-n),n>=0)}function tu(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function nu(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ru(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var iu=/[\u0590-\u08ac]/;var ou=null,au=null,su=!1;function lu(e,t,n){return ou==t&&au==n?su:(ou=t,au=n,su="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return ru(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=eu(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=kd(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return iu.test(r.parent.textContent)&&s.modify?ru(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var cu=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},du={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};cu.prototype.matchesWidget=function(){return!1},cu.prototype.matchesMark=function(){return!1},cu.prototype.matchesNode=function(){return!1},cu.prototype.matchesHack=function(){return!1},du.beforePosition.get=function(){return!1},cu.prototype.parseRule=function(){return null},cu.prototype.stopEvent=function(){return!1},du.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},du.border.get=function(){return 0},cu.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},cu.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},du.posBefore.get=function(){return this.parent.posBeforeChild(this)},du.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},du.posAfter.get=function(){return this.posBefore+this.size},du.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},cu.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>Id(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},cu.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},cu.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},cu.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},cu.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},cu.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?Id(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},cu.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=Id(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Id(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},cu.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},cu.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},cu.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((Od.gecko||Od.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:Id(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(Od.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&Od.safari||!Ld(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Ld(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},cu.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},du.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},cu.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},cu.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},du.domAtom.get=function(){return!1},Object.defineProperties(cu.prototype,du);var uu=[],pu=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,uu,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(cu),fu=function(e){function t(t,n,r,i){e.call(this,t,uu,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(cu),mu=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=wu(o,n,a,r)),e>0&&(o=wu(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(cu),hu=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?uu:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Ou(u,r,n),d?l=new Eu(e,n,r,i,u,p,f,d,o,a+1):n.isText?new _u(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Cu(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Du(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(Ru);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():uu;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(uu,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=Au(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof mu){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=Au(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),Od.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=Ud(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new fu(this,o,n,i);e.compositionNodes.push(a),this.children=wu(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Cu(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tu(this.dom,this.nodeDOM,Su(this.outerDeco,this.node,t),Su(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(cu);function gu(e,t,n,r,i){return Ou(r,t,e),new hu(null,e,t,n,r,r,r,i,0)}var _u=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(hu),vu=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(cu),Eu=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(hu);function bu(e){e&&(this.nodeName=e)}bu.prototype=Object.create(null);var yu=[new bu];function Su(e,t,n){if(0==e.length)return yu;for(var r=n?yu[0]:new bu,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new bu(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new bu(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Tu(e,t,n,r){if(n==yu&&r==yu)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=yu[0]),i=l}Nu(i,s||yu[0],a)}return i}function Nu(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):uu,a=n.class?n.class.split(" ").filter(Boolean):uu,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Ou(e,t,n){return Tu(e,e,yu,Su(t,n,1!=e.nodeType))}function Cu(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Au(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Du=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function Ru(e,t){return e.type.side-t.type.side}function wu(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Iu(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(zd(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==Ud(e);r||i;){if(e==n)return!0;var o=Id(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Ud(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=zu(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function Mu(e){return e.editable?e.hasFocus():ju(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function xu(e,t){var n=e.state.selection;if(Uu(e,n),Mu(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Id(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&Od.ie&&Od.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!ku||n instanceof nt||(n.$from.parent.inlineContent||(r=Lu(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Lu(e,n.to))),e.docView.setSelection(o,a,e.root,t),ku&&(r&&Bu(r),i&&Bu(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){Mu(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Du.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Du.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Du.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=mu.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Du.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Du.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof hu){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Cu(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Du.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,hu.create(this.top,e,t,n,r,i)),this.changed=!0},Du.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new pu(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Du.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof mu;)e=e.children[e.children.length-1];if(!e||!(e instanceof _u)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new vu(this.top,uu,t,null)),this.changed=!0}};var ku=Od.safari||Od.chrome&&Od.chrome_version<63;function Lu(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Od.safari&&o&&"false"==o.contentEditable)return Pu(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return Pu(o);if(a)return Pu(a)}}function Pu(e){return e.contentEditable="true",Od.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Bu(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Uu(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Fu(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Fu(e)}function Fu(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function zu(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function ju(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Gu(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function Yu(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Vu(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return Yu(e,new nt(t>0?r.$to:r.$from));var i=Gu(e.state,t);return!!i&&Yu(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=Gu(e.state,t);return!!(o&&o instanceof it)&&Yu(e,o)}if(!(Od.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?Yu(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!Od.webkit&&Yu(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Hu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function qu(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function $u(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(Od.gecko&&1==n.nodeType&&r<Hu(n)&&qu(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(qu(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Qu(n))break;for(var l=n.previousSibling;l&&qu(l);)i=n.parentNode,o=Id(l),l=l.previousSibling;if(l)r=Hu(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Ku(e,t,n,r):i&&Ku(e,t,i,o)}}function Wu(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Hu(n);;)if(r<a){if(1!=n.nodeType)break;if(!qu(n.childNodes[r]))break;i=n,o=++r}else{if(Qu(n))break;for(var s=n.nextSibling;s&&qu(s);)i=s.parentNode,o=Id(s)+1,s=s.nextSibling;if(s)r=0,a=Hu(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Ku(e,t,i,o)}}function Qu(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ku(e,t,n,r){if(zd(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&xu(e)}),50)}function Xu(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(Od.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Gu(e.state,t);if(a&&a instanceof it)return Yu(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&Yu(e,l)}return!1}function Zu(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Ju(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ep(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||Od.mac&&72==n&&"c"==r?Zu(e,-1)||$u(e):46==n||Od.mac&&68==n&&"c"==r?Zu(e,1)||Wu(e):13==n||27==n||(37==n?Vu(e,-1,r)||$u(e):39==n?Vu(e,1,r)||Wu(e):38==n?Xu(e,-1,r)||$u(e):40==n?function(e){if(Od.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Ju(e,i,!0),setTimeout((function(){return Ju(e,i,!1)}),20)}}}(e)||Xu(e,1,r)||Wu(e):r==(Od.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function tp(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Od.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Od.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function np(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=Iu(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],zd(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Od.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:tp,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(Od.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((Od.ios&&e.lastIOSEnter>Date.now()-225||Od.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=rp(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),Od.ie&&Od.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((Od.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||ip(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(ip(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||ip(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,jd(8,"Backspace"))})))Od.android&&Od.chrome&&e.domObserver.suppressSelectionUpdates();else{Od.chrome&&Od.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),Od.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)Od.ie&&Od.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return xu(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=rp(e,O.doc,p.sel);M&&!(Od.chrome&&Od.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||Od.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function rp(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:zu(e,t.resolve(n.anchor),t.resolve(n.head))}function ip(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function op(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=up(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=cp[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ap(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=up().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&cp[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(lp(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(lp(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(sp(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=sp(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function sp(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function lp(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=lp(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var cp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},dp=null;function up(){return dp||(dp=document.implementation.createHTMLDocument("title"))}var pp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fp=Od.ie&&Od.ie_version<=11,mp=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};mp.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},mp.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var hp=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);Od.ie&&Od.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new mp,fp&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};hp.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},hp.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},hp.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,pp),fp&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},hp.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}fp&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},hp.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},hp.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},hp.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},hp.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&ju(e)){var e;if(this.suppressingSelectionUpdates)return xu(this.view);if(Od.ie&&Od.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Ld(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},hp.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},hp.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},hp.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&ju(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(Od.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(gp)return;gp=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||xu(this.view),this.currentSelection.set(t))}},hp.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(Od.ie&&Od.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?Id(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?Id(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var gp=!1;var _p={},vp={};function Ep(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function bp(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return yp(e,t)})}))}function yp(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Sp(e){return{left:e.clientX,top:e.clientY}}function Tp(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Np(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Op(e,t,n,r,i){return Tp(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Np(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Np(e,new it(n),"pointer"),!0)}(e,n))}function Cp(e,t,n,r){return Tp(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function Ap(e,t,n,r){return Tp(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Np(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Np(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Np(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Dp(e){return Lp(e)}vp.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!Ip(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!Od.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||ep(e,t)?t.preventDefault():Ep(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,jd(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},vp.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},vp.keypress=function(e,t){if(!(Ip(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||Od.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Rp=Od.mac?"metaKey":"ctrlKey";_p.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Dp(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Rp]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Sp(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new wp(e,o,t,n)):("doubleClick"==i?Cp:Ap)(e,o.pos,o.inside,t)?t.preventDefault():Ep(e,"pointer"))};var wp=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Rp],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Od.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ep(e,"pointer")};function Ip(e,t){return!!e.composing||!!(Od.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}wp.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},wp.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Sp(e))),this.allowDefault||!t?Ep(this.view,"pointer"):Op(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||Od.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Od.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Np(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Ep(this.view,"pointer")}},wp.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Ep(this.view,"pointer"),0==e.buttons&&this.done()},_p.touchdown=function(e){Dp(e),Ep(e,"pointer")},_p.contextmenu=function(e){return Dp(e)};var Mp=Od.android?5e3:-1;function xp(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return Lp(e)}),t))}function kp(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function Lp(e,t){if(e.domObserver.forceFlush(),kp(e),t||e.docView.dirty){var n=Iu(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}vp.compositionstart=vp.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),Lp(e,!0),e.markCursor=null;else if(Lp(e),Od.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}xp(e,Mp)},vp.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,xp(e,20))};var Pp=Od.ie&&Od.ie_version<15||Od.ios&&Od.webkit_version<604;function Bp(e,t,n,r){var i=ap(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}_p.copy=vp.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=Pp?null:t.clipboardData,o=op(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},vp.paste=function(e,t){var n=Pp?null:t.clipboardData;n&&Bp(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Bp(e,r.value,null,t):Bp(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var Up=function(e,t){this.slice=e,this.move=t},Fp=Od.mac?"altKey":"ctrlKey";for(var zp in _p.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Sp(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=op(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Pp?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Pp||t.dataTransfer.setData("text/plain",c),e.dragging=new Up(a,!t[Fp])}},_p.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},vp.dragover=vp.dragenter=function(e,t){return t.preventDefault()},vp.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Sp(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=ap(e,t.dataTransfer.getData(Pp?"Text":"text/plain"),Pp?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[Fp];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(zu(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},_p.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&xu(e)}),20))},_p.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},_p.beforeinput=function(e,t){if(Od.chrome&&Od.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,jd(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},vp)_p[zp]=vp[zp];function jp(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Gp=function(e,t){this.spec=t||Wp,this.side=this.spec.side||0,this.toDOM=e};Gp.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Hp(o-n,o-n,this)},Gp.prototype.valid=function(){return!0},Gp.prototype.eq=function(e){return this==e||e instanceof Gp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&jp(this.spec,e.spec))};var Yp=function(e,t){this.spec=t||Wp,this.attrs=e};Yp.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Hp(i,o,this)},Yp.prototype.valid=function(e,t){return t.from<t.to},Yp.prototype.eq=function(e){return this==e||e instanceof Yp&&jp(this.attrs,e.attrs)&&jp(this.spec,e.spec)},Yp.is=function(e){return e.type instanceof Yp};var Vp=function(e,t){this.spec=t||Wp,this.attrs=e};Vp.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Hp(i.pos-n,o.pos-n,this)},Vp.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},Vp.prototype.eq=function(e){return this==e||e instanceof Vp&&jp(this.attrs,e.attrs)&&jp(this.spec,e.spec)};var Hp=function(e,t,n){this.from=e,this.to=t,this.type=n},qp={spec:{configurable:!0},inline:{configurable:!0}};Hp.prototype.copy=function(e,t){return new Hp(e,t,this.type)},Hp.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Hp.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Hp.widget=function(e,t,n){return new Hp(e,e,new Gp(t,n))},Hp.inline=function(e,t,n,r){return new Hp(e,t,new Yp(n,r))},Hp.node=function(e,t,n,r){return new Hp(e,t,new Vp(n,r))},qp.spec.get=function(){return this.type.spec},qp.inline.get=function(){return this.type instanceof Yp},Object.defineProperties(Hp.prototype,qp);var $p=[],Wp={},Qp=function(e,t){this.local=e&&e.length?e:$p,this.children=t&&t.length?t:$p};Qp.create=function(e,t){return t.length?tf(t,e,0,Wp):Kp},Qp.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},Qp.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},Qp.prototype.map=function(e,t,n){return this==Kp||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Wp)},Qp.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Kp?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=tf(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new Qp(t&&t.sort(nf),s)}(this.children,o,e,t,n,r,i):o?new Qp(o.sort(nf)):Kp},Qp.prototype.add=function(e,t){return t.length?this==Kp?Qp.create(e,t):this.addInner(e,t,0):this},Qp.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=Jp(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,tf(s,e,l+1,Wp)),o+=3}}));for(var a=Zp(o?ef(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new Qp(a.length?this.local.concat(a).sort(nf):this.local,r||this.children)},Qp.prototype.remove=function(e){return 0==e.length||this==Kp?this:this.removeInner(e,0)},Qp.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Kp?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Qp(r,n):Kp},Qp.prototype.forChild=function(e,t){if(this==Kp)return this;if(t.isLeaf)return Qp.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof Yp){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new Qp(r.sort(nf));return n?new Xp([u,n]):u}return n||Kp},Qp.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof Qp)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},Qp.prototype.locals=function(e){return rf(this.localsInner(e))},Qp.prototype.localsInner=function(e){if(this==Kp)return $p;if(e.inlineContent||!this.local.some(Yp.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Yp||t.push(this.local[n]);return t};var Kp=new Qp;Qp.empty=Kp,Qp.removeOverlap=rf;var Xp=function(e){this.members=e};function Zp(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Hp(i.from+t,i.to+t,i.type))}return n}function Jp(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function ef(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function tf(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=Jp(e,t,a+n);if(s){o=!0;var l=tf(s,t,n+a+1,r);l!=Kp&&i.push(a,a+t.nodeSize,l)}}));for(var a=Zp(o?ef(e):e,-n).sort(nf),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new Qp(a,i):Kp}function nf(e,t){return e.from-t.from||e.to-t.to}function rf(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),of(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),of(t,i+1,o.copy(r.to,o.to)))}}return t}function of(e,t,n){for(;t<e.length&&nf(n,e[t])>0;)t++;e.splice(t,0,n)}function af(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Kp&&t.push(r)})),e.cursorWrapper&&t.push(Qp.create(e.state.doc,[e.cursorWrapper.deco])),Xp.from(t)}Xp.prototype.forChild=function(e,t){if(t.isLeaf)return Qp.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Kp&&(i instanceof Xp?n=n.concat(i.members):n.push(i))}return Xp.from(n)},Xp.prototype.eq=function(e){if(!(e instanceof Xp)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},Xp.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?rf(n?t:t.sort(nf)):$p},Xp.from=function(e){switch(e.length){case 0:return Kp;case 1:return e[0];default:return new Xp(e)}};var sf=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=uf(this),this.markCursor=null,this.cursorWrapper=null,df(this),this.nodeViews=pf(this),this.docView=gu(this.state.doc,cf(this),af(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new hp(e,(function(t,n,r,i){return np(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=_p[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||yp(e,t)||!e.editable&&t.type in vp||n(e,t)})};for(var n in _p)t(n);Od.safari&&e.dom.addEventListener("input",(function(){return null})),bp(e)}(this),this.pluginViews=[],this.updatePluginViews()},lf={props:{configurable:!0},root:{configurable:!0}};function cf(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Hp.node(0,e.state.doc.content.size,t)]}function df(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Hp.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function uf(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function pf(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}lf.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},sf.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&bp(this),this._props=e,this.updateStateInner(e.state,!0)},sf.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},sf.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},sf.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(kp(this),o=!0),this.state=e,t){var a=pf(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),bp(this)}this.editable=uf(this),df(this);var s=af(this),l=cf(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:qd(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(Od.ie||Od.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=Od.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=gu(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Ld(p.node,p.offset,f.anchorNode,f.anchorOffset)))?xu(this,T):(Uu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Hd(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Hd(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,$d(b,0==y?0:y-E))},sf.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},sf.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},sf.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},sf.prototype.hasFocus=function(){return this.root.activeElement==this.dom},sf.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Wd)return e.focus(Wd);var t=qd(e);e.focus(null==Wd?{get preventScroll(){return Wd={preventScroll:!0},!0}}:void 0),Wd||(Wd=!1,$d(t,0))}(this.dom),xu(this),this.domObserver.start()},lf.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},sf.prototype.posAtCoords=function(e){return Xd(this,e)},sf.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),eu(this,e,t)},sf.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},sf.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},sf.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},sf.prototype.endOfTextblock=function(e,t){return lu(this,t||this.state,e)},sf.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],af(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},sf.prototype.dispatchEvent=function(e){return function(e,t){yp(e,t)||!_p[t.type]||!e.editable&&t.type in vp||_p[t.type](e,t)}(this,e)},sf.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(sf.prototype,lf);var ff=xo.create({name:"placeholder",defaultOptions:{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0},addProseMirrorPlugins(){return[new vt({props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(n)return e.descendants((e,t)=>{const n=r>=t&&r<=t+e.nodeSize,o=!e.isLeaf&&!e.textContent;if((n||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];this.editor.isEmpty&&n.push(this.options.emptyEditorClass);const r=Hp.node(t,t+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e}):this.options.placeholder});i.push(r)}return!1}),Qp.create(e,i)}}})]}});const mf=/(?:^|\s)((?:==)((?:[^~]+))(?:==))$/gm;var hf=Ga.create({name:"highlight",defaultOptions:{multicolor:!1,HTMLAttributes:{}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>({color:e.getAttribute("data-color")||e.style.backgroundColor}),renderHTML:e=>e.color?{"data-color":e.color,style:"background-color: "+e.color}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setHighlight:e=>({commands:t})=>t.setMark("highlight",e),toggleHighlight:e=>({commands:t})=>t.toggleMark("highlight",e),unsetHighlight:()=>({commands:e})=>e.unsetMark("highlight")}),addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Va(mf,this.type)]},addPasteRules(){return[Ha(mf,this.type)]}});var gf=xo.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[cc(this.options)]}});const _f=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,vf=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)$/gi;var Ef=Ga.create({name:"link",priority:1e3,inclusive:!1,defaultOptions:{openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow"}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target}}},parseHTML:()=>[{tag:"a[href]"}],renderHTML({HTMLAttributes:e}){return["a",To(this.options.HTMLAttributes,e),0]},addCommands:()=>({setLink:e=>({commands:t})=>t.setMark("link",e),toggleLink:e=>({commands:t})=>t.toggleMark("link",e),unsetLink:()=>({commands:e})=>e.unsetMark("link")}),addPasteRules(){return[Ha(_f,this.type,e=>({href:e[0]}))]},addProseMirrorPlugins(){const e=[];return this.options.openOnClick&&e.push(new vt({key:new yt("handleClickLink"),props:{handleClick:(e,t,n)=>{var r;const i=this.editor.getAttributes("link");return!(!(null===(r=n.target)||void 0===r?void 0:r.closest("a"))||!i.href)&&(window.open(i.href,i.target),!0)}}})),this.options.linkOnPaste&&e.push(new vt({key:new yt("handlePasteLink"),props:{handlePaste:(e,t,n)=>{const{state:r}=e,{selection:i}=r,{empty:o}=i;if(o)return!1;let a="";return n.content.forEach(e=>{a+=e.textContent}),!(!a||!a.match(vf))&&(this.editor.commands.setMark(this.type,{href:a}),!0)}}})),e}});const bf=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/;var yf=ja.create({name:"image",defaultOptions:{inline:!1,HTMLAttributes:{}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML:()=>[{tag:"img[src]"}],renderHTML({HTMLAttributes:e}){return["img",To(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ya(bf,this.type,e=>{const[,t,n,r]=e;return{src:n,alt:t,title:r}})]}});function Sf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sf(Object(n),!0).forEach((function(t){Nf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Of=yf.extend({name:"image",addAttributes:function(){return Tf(Tf({},yf.config.addAttributes()),{},{size:{default:"small",rendered:!1},float:{default:"none",rendered:!1}})},addCommands:function(){var e=this;return{setImage:function(t){return function(n){var r,i,o,a=n.tr,s=n.commands;return"image"==(null===(r=a.selection)||void 0===r||null===(i=r.node)||void 0===i||null===(o=i.type)||void 0===o?void 0:o.name)?s.updateAttributes("image",t):s.insertContent({type:e.name,attrs:t})}}}},renderHTML:function(e){var t=e.node,n=e.HTMLAttributes;return n.class=" image-"+t.attrs.size,n.class+=" image-float-"+t.attrs.float,["img",To(this.options.HTMLAttributes,n)]}}),Cf=n(13),Af=Object(Cf.a)({showImageUpload:!1,showURLInput:!1}),Df={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Rf=/Edge\/(\d+)/.exec(navigator.userAgent),wf=/MSIE \d/.test(navigator.userAgent),If=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Df.mac=/Mac/.test(navigator.platform);var Mf=Df.ie=!!(wf||If||Rf);Df.ie_version=wf?document.documentMode||6:If?+If[1]:Rf?+Rf[1]:null,Df.gecko=!Mf&&/gecko\/(\d+)/i.test(navigator.userAgent),Df.gecko_version=Df.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var xf=!Mf&&/Chrome\/(\d+)/.exec(navigator.userAgent);Df.chrome=!!xf,Df.chrome_version=xf&&+xf[1],Df.safari=!Mf&&/Apple Computer/.test(navigator.vendor),Df.ios=Df.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Df.android=/Android \d/.test(navigator.userAgent),Df.webkit="webkitFontSmoothing"in document.documentElement.style,Df.webkit_version=Df.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var kf=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Lf=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},Pf=null,Bf=function(e,t,n){var r=Pf||(Pf=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Uf=function(e,t,n,r){return n&&(zf(e,t,n,r,-1)||zf(e,t,n,r,1))},Ff=/^(img|br|input|textarea|hr)$/i;function zf(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:jf(e))){var o=e.parentNode;if(1!=o.nodeType||Gf(e)||Ff.test(e.nodeName)||"false"==e.contentEditable)return!1;t=kf(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?jf(e):0}}}function jf(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Gf(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Yf=function(e){var t=e.isCollapsed;return t&&Df.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function Vf(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Hf(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function qf(e,t){return"number"==typeof e?e:e[t]}function $f(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Wf(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=Lf(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?Hf(o):$f(a),c=0,d=0;if(t.top<l.top+qf(r,"top")?d=-(l.top-t.top+qf(i,"top")):t.bottom>l.bottom-qf(r,"bottom")&&(d=t.bottom-l.bottom+qf(i,"bottom")),t.left<l.left+qf(r,"left")?c=-(l.left-t.left+qf(i,"left")):t.right>l.right-qf(r,"right")&&(c=t.right-l.right+qf(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function Qf(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=Lf(e));return t}function Kf(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Xf=null;function Zf(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=Bf(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=tm(r,1);if(o.top!=o.bottom&&Jf(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:Zf(n,r)}function Jf(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function em(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!Jf(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(Jf(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(Df.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(Df.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=Zf(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function tm(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var nm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rm(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=Df.webkit||Df.gecko;if(3==i.nodeType){if(!a||!nm.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,im(tm(Bf(i,s,l),c),c<0)}var d=tm(Bf(i,o,o),n);if(Df.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=tm(Bf(i,o-1,o-1),-1);if(u.top==d.top){var p=tm(Bf(i,o,o+1),-1);if(p.top!=d.top)return im(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==jf(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return om(f.getBoundingClientRect(),!1)}if(o<jf(i)){var m=i.childNodes[o];if(1==m.nodeType)return om(m.getBoundingClientRect(),!0)}return om(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==jf(i))){var h=i.childNodes[o-1],g=3==h.nodeType?Bf(h,jf(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return im(tm(g,1),!1)}if(o<jf(i)){var _=i.childNodes[o],v=3==_.nodeType?Bf(_,0,a?0:1):1==_.nodeType?_:null;if(v)return im(tm(v,-1),!0)}return im(tm(3==i.nodeType?Bf(i):i,-n),n>=0)}function im(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function om(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function am(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var sm=/[\u0590-\u08ac]/;var lm=null,cm=null,dm=!1;function um(e,t,n){return lm==t&&cm==n?dm:(lm=t,cm=n,dm="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return am(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=rm(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=Bf(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return sm.test(r.parent.textContent)&&s.modify?am(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var pm=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},fm={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};pm.prototype.matchesWidget=function(){return!1},pm.prototype.matchesMark=function(){return!1},pm.prototype.matchesNode=function(){return!1},pm.prototype.matchesHack=function(){return!1},fm.beforePosition.get=function(){return!1},pm.prototype.parseRule=function(){return null},pm.prototype.stopEvent=function(){return!1},fm.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},fm.border.get=function(){return 0},pm.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},pm.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},fm.posBefore.get=function(){return this.parent.posBeforeChild(this)},fm.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},fm.posAfter.get=function(){return this.posBefore+this.size},fm.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},pm.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>kf(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},pm.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},pm.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},pm.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},pm.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},pm.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?kf(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},pm.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=kf(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=kf(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},pm.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},pm.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},pm.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((Df.gecko||Df.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:kf(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(Df.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&Df.safari||!Uf(d.node,d.offset,p.anchorNode,p.anchorOffset)||!Uf(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},pm.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},fm.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},pm.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},pm.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},fm.domAtom.get=function(){return!1},Object.defineProperties(pm.prototype,fm);var mm=[],hm=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,mm,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(pm),gm=function(e){function t(t,n,r,i){e.call(this,t,mm,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(pm),_m=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=xm(o,n,a,r)),e>0&&(o=xm(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(pm),vm=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?mm:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Dm(u,r,n),d?l=new Sm(e,n,r,i,u,p,f,d,o,a+1):n.isText?new bm(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Rm(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new Im(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(Mm);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():mm;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(mm,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=wm(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof _m){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=wm(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),Df.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=jf(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new gm(this,o,n,i);e.compositionNodes.push(a),this.children=xm(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!Rm(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Cm(this.dom,this.nodeDOM,Om(this.outerDeco,this.node,t),Om(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(pm);function Em(e,t,n,r,i){return Dm(r,t,e),new vm(null,e,t,n,r,r,r,i,0)}var bm=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(vm),ym=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(pm),Sm=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(vm);function Tm(e){e&&(this.nodeName=e)}Tm.prototype=Object.create(null);var Nm=[new Tm];function Om(e,t,n){if(0==e.length)return Nm;for(var r=n?Nm[0]:new Tm,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new Tm(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new Tm(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Cm(e,t,n,r){if(n==Nm&&r==Nm)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=Nm[0]),i=l}Am(i,s||Nm[0],a)}return i}function Am(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):mm,a=n.class?n.class.split(" ").filter(Boolean):mm,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Dm(e,t,n){return Cm(e,e,Nm,Om(t,n,1!=e.nodeType))}function Rm(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function wm(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Im=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function Mm(e,t){return e.type.side-t.type.side}function xm(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function km(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Yf(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==jf(e);r||i;){if(e==n)return!0;var o=kf(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==jf(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=Ym(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function Lm(e){return e.editable?e.hasFocus():Vm(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Pm(e,t){var n=e.state.selection;if(jm(e,n),Lm(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,kf(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&Df.ie&&Df.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!Bm||n instanceof nt||(n.$from.parent.inlineContent||(r=Um(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Um(e,n.to))),e.docView.setSelection(o,a,e.root,t),Bm&&(r&&zm(r),i&&zm(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){Lm(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}Im.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},Im.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Im.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=_m.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},Im.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},Im.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof vm){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Rm(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Im.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,vm.create(this.top,e,t,n,r,i)),this.changed=!0},Im.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new hm(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},Im.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof _m;)e=e.children[e.children.length-1];if(!e||!(e instanceof bm)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new ym(this.top,mm,t,null)),this.changed=!0}};var Bm=Df.safari||Df.chrome&&Df.chrome_version<63;function Um(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Df.safari&&o&&"false"==o.contentEditable)return Fm(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return Fm(o);if(a)return Fm(a)}}function Fm(e){return e.contentEditable="true",Df.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function zm(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function jm(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Gm(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Gm(e)}function Gm(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function Ym(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function Vm(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Hm(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function qm(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $m(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return qm(e,new nt(t>0?r.$to:r.$from));var i=Hm(e.state,t);return!!i&&qm(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=Hm(e.state,t);return!!(o&&o instanceof it)&&qm(e,o)}if(!(Df.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?qm(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!Df.webkit&&qm(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function Wm(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Qm(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Km(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(Df.gecko&&1==n.nodeType&&r<Wm(n)&&Qm(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Qm(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Zm(n))break;for(var l=n.previousSibling;l&&Qm(l);)i=n.parentNode,o=kf(l),l=l.previousSibling;if(l)r=Wm(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Jm(e,t,n,r):i&&Jm(e,t,i,o)}}function Xm(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=Wm(n);;)if(r<a){if(1!=n.nodeType)break;if(!Qm(n.childNodes[r]))break;i=n,o=++r}else{if(Zm(n))break;for(var s=n.nextSibling;s&&Qm(s);)i=s.parentNode,o=kf(s)+1,s=s.nextSibling;if(s)r=0,a=Wm(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Jm(e,t,i,o)}}function Zm(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Jm(e,t,n,r){if(Yf(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&Pm(e)}),50)}function eh(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(Df.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Hm(e.state,t);if(a&&a instanceof it)return qm(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&qm(e,l)}return!1}function th(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function nh(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function rh(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||Df.mac&&72==n&&"c"==r?th(e,-1)||Km(e):46==n||Df.mac&&68==n&&"c"==r?th(e,1)||Xm(e):13==n||27==n||(37==n?$m(e,-1,r)||Km(e):39==n?$m(e,1,r)||Xm(e):38==n?eh(e,-1,r)||Km(e):40==n?function(e){if(Df.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;nh(e,i,!0),setTimeout((function(){return nh(e,i,!1)}),20)}}}(e)||eh(e,1,r)||Xm(e):r==(Df.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function ih(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Df.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Df.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function oh(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=km(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Yf(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Df.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:ih,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(Df.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((Df.ios&&e.lastIOSEnter>Date.now()-225||Df.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=ah(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),Df.ie&&Df.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((Df.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||sh(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(sh(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||sh(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,Vf(8,"Backspace"))})))Df.android&&Df.chrome&&e.domObserver.suppressSelectionUpdates();else{Df.chrome&&Df.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),Df.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)Df.ie&&Df.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Pm(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=ah(e,O.doc,p.sel);M&&!(Df.chrome&&Df.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||Df.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function ah(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ym(e,t.resolve(n.anchor),t.resolve(n.head))}function sh(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function lh(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=mh(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=ph[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function ch(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=mh().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&ph[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(uh(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(uh(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(dh(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=dh(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function dh(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function uh(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=uh(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var ph={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},fh=null;function mh(){return fh||(fh=document.implementation.createHTMLDocument("title"))}var hh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gh=Df.ie&&Df.ie_version<=11,_h=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};_h.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},_h.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var vh=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);Df.ie&&Df.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new _h,gh&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};vh.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},vh.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},vh.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,hh),gh&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},vh.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}gh&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},vh.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},vh.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},vh.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},vh.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&Vm(e)){var e;if(this.suppressingSelectionUpdates)return Pm(this.view);if(Df.ie&&Df.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Uf(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},vh.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},vh.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},vh.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Vm(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(Df.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(Eh)return;Eh=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||Pm(this.view),this.currentSelection.set(t))}},vh.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(Df.ie&&Df.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?kf(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?kf(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var Eh=!1;var bh={},yh={};function Sh(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function Th(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Nh(e,t)})}))}function Nh(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Oh(e){return{left:e.clientX,top:e.clientY}}function Ch(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Ah(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Dh(e,t,n,r,i){return Ch(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Ah(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Ah(e,new it(n),"pointer"),!0)}(e,n))}function Rh(e,t,n,r){return Ch(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function wh(e,t,n,r){return Ch(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Ah(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Ah(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Ah(e,it.create(n,a),"pointer")}return!0}}(e,n)}function Ih(e){return Uh(e)}yh.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!kh(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!Df.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||rh(e,t)?t.preventDefault():Sh(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,Vf(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},yh.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},yh.keypress=function(e,t){if(!(kh(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||Df.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var Mh=Df.mac?"metaKey":"ctrlKey";bh.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=Ih(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[Mh]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Oh(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new xh(e,o,t,n)):("doubleClick"==i?Rh:wh)(e,o.pos,o.inside,t)?t.preventDefault():Sh(e,"pointer"))};var xh=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[Mh],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Df.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Sh(e,"pointer")};function kh(e,t){return!!e.composing||!!(Df.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}xh.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xh.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Oh(e))),this.allowDefault||!t?Sh(this.view,"pointer"):Dh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||Df.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Df.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Ah(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Sh(this.view,"pointer")}},xh.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Sh(this.view,"pointer"),0==e.buttons&&this.done()},bh.touchdown=function(e){Ih(e),Sh(e,"pointer")},bh.contextmenu=function(e){return Ih(e)};var Lh=Df.android?5e3:-1;function Ph(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return Uh(e)}),t))}function Bh(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function Uh(e,t){if(e.domObserver.forceFlush(),Bh(e),t||e.docView.dirty){var n=km(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}yh.compositionstart=yh.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),Uh(e,!0),e.markCursor=null;else if(Uh(e),Df.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}Ph(e,Lh)},yh.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,Ph(e,20))};var Fh=Df.ie&&Df.ie_version<15||Df.ios&&Df.webkit_version<604;function zh(e,t,n,r){var i=ch(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}bh.copy=yh.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=Fh?null:t.clipboardData,o=lh(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},yh.paste=function(e,t){var n=Fh?null:t.clipboardData;n&&zh(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?zh(e,r.value,null,t):zh(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var jh=function(e,t){this.slice=e,this.move=t},Gh=Df.mac?"altKey":"ctrlKey";for(var Yh in bh.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Oh(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=lh(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Fh?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Fh||t.dataTransfer.setData("text/plain",c),e.dragging=new jh(a,!t[Gh])}},bh.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},yh.dragover=yh.dragenter=function(e,t){return t.preventDefault()},yh.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Oh(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=ch(e,t.dataTransfer.getData(Fh?"Text":"text/plain"),Fh?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[Gh];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(Ym(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},bh.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&Pm(e)}),20))},bh.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},bh.beforeinput=function(e,t){if(Df.chrome&&Df.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,Vf(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},yh)bh[Yh]=yh[Yh];function Vh(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Hh=function(e,t){this.spec=t||Xh,this.side=this.spec.side||0,this.toDOM=e};Hh.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Wh(o-n,o-n,this)},Hh.prototype.valid=function(){return!0},Hh.prototype.eq=function(e){return this==e||e instanceof Hh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vh(this.spec,e.spec))};var qh=function(e,t){this.spec=t||Xh,this.attrs=e};qh.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Wh(i,o,this)},qh.prototype.valid=function(e,t){return t.from<t.to},qh.prototype.eq=function(e){return this==e||e instanceof qh&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)},qh.is=function(e){return e.type instanceof qh};var $h=function(e,t){this.spec=t||Xh,this.attrs=e};$h.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Wh(i.pos-n,o.pos-n,this)},$h.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},$h.prototype.eq=function(e){return this==e||e instanceof $h&&Vh(this.attrs,e.attrs)&&Vh(this.spec,e.spec)};var Wh=function(e,t,n){this.from=e,this.to=t,this.type=n},Qh={spec:{configurable:!0},inline:{configurable:!0}};Wh.prototype.copy=function(e,t){return new Wh(e,t,this.type)},Wh.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},Wh.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},Wh.widget=function(e,t,n){return new Wh(e,e,new Hh(t,n))},Wh.inline=function(e,t,n,r){return new Wh(e,t,new qh(n,r))},Wh.node=function(e,t,n,r){return new Wh(e,t,new $h(n,r))},Qh.spec.get=function(){return this.type.spec},Qh.inline.get=function(){return this.type instanceof qh},Object.defineProperties(Wh.prototype,Qh);var Kh=[],Xh={},Zh=function(e,t){this.local=e&&e.length?e:Kh,this.children=t&&t.length?t:Kh};Zh.create=function(e,t){return t.length?ig(t,e,0,Xh):Jh},Zh.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},Zh.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},Zh.prototype.map=function(e,t,n){return this==Jh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Xh)},Zh.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=Jh?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=ig(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new Zh(t&&t.sort(og),s)}(this.children,o,e,t,n,r,i):o?new Zh(o.sort(og)):Jh},Zh.prototype.add=function(e,t){return t.length?this==Jh?Zh.create(e,t):this.addInner(e,t,0):this},Zh.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=ng(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,ig(s,e,l+1,Xh)),o+=3}}));for(var a=tg(o?rg(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new Zh(a.length?this.local.concat(a).sort(og):this.local,r||this.children)},Zh.prototype.remove=function(e){return 0==e.length||this==Jh?this:this.removeInner(e,0)},Zh.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=Jh?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Zh(r,n):Jh},Zh.prototype.forChild=function(e,t){if(this==Jh)return this;if(t.isLeaf)return Zh.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof qh){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new Zh(r.sort(og));return n?new eg([u,n]):u}return n||Jh},Zh.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof Zh)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},Zh.prototype.locals=function(e){return ag(this.localsInner(e))},Zh.prototype.localsInner=function(e){if(this==Jh)return Kh;if(e.inlineContent||!this.local.some(qh.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qh||t.push(this.local[n]);return t};var Jh=new Zh;Zh.empty=Jh,Zh.removeOverlap=ag;var eg=function(e){this.members=e};function tg(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Wh(i.from+t,i.to+t,i.type))}return n}function ng(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function rg(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ig(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=ng(e,t,a+n);if(s){o=!0;var l=ig(s,t,n+a+1,r);l!=Jh&&i.push(a,a+t.nodeSize,l)}}));for(var a=tg(o?rg(e):e,-n).sort(og),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new Zh(a,i):Jh}function og(e,t){return e.from-t.from||e.to-t.to}function ag(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),sg(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),sg(t,i+1,o.copy(r.to,o.to)))}}return t}function sg(e,t,n){for(;t<e.length&&og(n,e[t])>0;)t++;e.splice(t,0,n)}function lg(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=Jh&&t.push(r)})),e.cursorWrapper&&t.push(Zh.create(e.state.doc,[e.cursorWrapper.deco])),eg.from(t)}eg.prototype.forChild=function(e,t){if(t.isLeaf)return Zh.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=Jh&&(i instanceof eg?n=n.concat(i.members):n.push(i))}return eg.from(n)},eg.prototype.eq=function(e){if(!(e instanceof eg)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},eg.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ag(n?t:t.sort(og)):Kh},eg.from=function(e){switch(e.length){case 0:return Jh;case 1:return e[0];default:return new eg(e)}};var cg=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=fg(this),this.markCursor=null,this.cursorWrapper=null,pg(this),this.nodeViews=mg(this),this.docView=Em(this.state.doc,ug(this),lg(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new vh(e,(function(t,n,r,i){return oh(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=bh[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Nh(e,t)||!e.editable&&t.type in yh||n(e,t)})};for(var n in bh)t(n);Df.safari&&e.dom.addEventListener("input",(function(){return null})),Th(e)}(this),this.pluginViews=[],this.updatePluginViews()},dg={props:{configurable:!0},root:{configurable:!0}};function ug(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[Wh.node(0,e.state.doc.content.size,t)]}function pg(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:Wh.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function fg(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function mg(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}dg.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},cg.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Th(this),this._props=e,this.updateStateInner(e.state,!0)},cg.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},cg.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},cg.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(Bh(this),o=!0),this.state=e,t){var a=mg(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Th(this)}this.editable=fg(this),pg(this);var s=lg(this),l=ug(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:Qf(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(Df.ie||Df.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=Df.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Em(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),Uf(p.node,p.offset,f.anchorNode,f.anchorOffset)))?Pm(this,T):(jm(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?Wf(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):Wf(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,Kf(b,0==y?0:y-E))},cg.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},cg.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},cg.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},cg.prototype.hasFocus=function(){return this.root.activeElement==this.dom},cg.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Xf)return e.focus(Xf);var t=Qf(e);e.focus(null==Xf?{get preventScroll(){return Xf={preventScroll:!0},!0}}:void 0),Xf||(Xf=!1,Kf(t,0))}(this.dom),Pm(this),this.domObserver.start()},dg.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},cg.prototype.posAtCoords=function(e){return em(this,e)},cg.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),rm(this,e,t)},cg.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},cg.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},cg.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},cg.prototype.endOfTextblock=function(e,t){return um(this,t||this.state,e)},cg.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],lg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},cg.prototype.dispatchEvent=function(e){return function(e,t){Nh(e,t)||!bh[t.type]||!e.editable&&t.type in yh||bh[t.type](e,t)}(this,e)},cg.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(cg.prototype,dg);var hg=function({editor:e,char:t="@",allowSpaces:n=!1,startOfLine:r=!1,decorationTag:i="span",decorationClass:o="suggestion",command:a=(()=>null),items:s=(()=>[]),render:l=(()=>({})),allow:c=(()=>!0)}){const d=null==l?void 0:l();return new vt({key:new yt("suggestion"),view(){return{update:async(t,n)=>{var r,i,o,l,c;const u=null===(r=this.key)||void 0===r?void 0:r.getState(n),p=null===(i=this.key)||void 0===i?void 0:i.getState(t.state),f=u.active&&p.active&&u.range.from!==p.range.from,m=!u.active&&p.active,h=u.active&&!p.active,g=m||f,_=!m&&!h&&u.query!==p.query&&!f,v=h||f;if(!g&&!_&&!v)return;const E=v?u:p,b=document.querySelector(`[data-decoration-id="${E.decorationId}"]`),y={editor:e,range:E.range,query:E.query,text:E.text,items:_||g?await s(E.query):[],command:t=>{a({editor:e,range:E.range,props:t})},decorationNode:b,clientRect:b?()=>b.getBoundingClientRect():null};v&&(null===(o=null==d?void 0:d.onExit)||void 0===o||o.call(d,y)),_&&(null===(l=null==d?void 0:d.onUpdate)||void 0===l||l.call(d,y)),g&&(null===(c=null==d?void 0:d.onStart)||void 0===c||c.call(d,y))}}},state:{init:()=>({active:!1,range:{},query:null,text:null}),apply(i,o){const{selection:a}=i,s={...o};if(a.from===a.to){(a.from<o.range.from||a.from>o.range.to)&&(s.active=!1);const i=function(e){const{char:t,allowSpaces:n,startOfLine:r,$position:i}=e;if(i.depth<=0)return null;const o="\\"+t,a=new RegExp(`\\s${o}$`),s=r?"^":"",l=n?new RegExp(`${s}${o}.*?(?=\\s${o}|$)`,"gm"):new RegExp(`${s}(?:^)?${o}[^\\s${o}]*`,"gm"),c=i.before(),d=i.pos,u=i.doc.textBetween(c,d,"\0","\0"),p=Array.from(u.matchAll(l)).pop();if(!p||void 0===p.input||void 0===p.index)return null;const f=p.input.slice(Math.max(0,p.index-1),p.index);if(!/^[\s\0]?$/.test(f))return null;const m=p.index+i.start();let h=m+p[0].length;return n&&a.test(u.slice(h-1,h+1))&&(p[0]+=" ",h+=1),m<i.pos&&h>=i.pos?{range:{from:m,to:h},query:p[0].slice(t.length),text:p[0]}:null}({char:t,allowSpaces:n,startOfLine:r,$position:a.$from}),l="id_"+Math.floor(4294967295*Math.random());i&&c({editor:e,range:i.range})?(s.active=!0,s.decorationId=o.decorationId?o.decorationId:l,s.range=i.range,s.query=i.query,s.text=i.text):s.active=!1}else s.active=!1;return s.active||(s.decorationId=null,s.range={},s.query=null,s.text=null),s}},props:{handleKeyDown(e,t){var n;const{active:r,range:i}=this.getState(e.state);return r&&(null===(n=null==d?void 0:d.onKeyDown)||void 0===n?void 0:n.call(d,{view:e,event:t,range:i}))||!1},decorations(e){const{active:t,range:n,decorationId:r}=this.getState(e);return t?Zh.create(e.doc,[Wh.inline(n.from,n.to,{nodeName:i,class:o,"data-decoration-id":r})]):null}}})};function gg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gg(Object(n),!0).forEach((function(t){vg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Eg=xo.create({name:"mention",defaultOptions:{suggestion:{char:"/",startOfLine:!1,command:function(e){var t=e.editor,n=e.range;e.props.command({editor:t,range:n})}}},addProseMirrorPlugins:function(){return[hg(_g({editor:this.editor},this.options.suggestion))]}}),bg=n(2),yg=n.n(bg),Sg=n(5),Tg=n.n(Sg),Ng=n(21),Og={insert:"head",singleton:!1};Tg()(Ng.a,Og),Ng.a.locals;function Cg(e){return(Cg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ag(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dg(e,t){return(Dg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Rg(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ig(e);if(t){var i=Ig(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wg(this,n)}}function wg(e,t){return!t||"object"!==Cg(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ig(e){return(Ig=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mg=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Dg(e,t)}(a,e);var t,n,r,o=Rg(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=o.call(this,e)).state={selectedIndex:0},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e){this.props.items!==e.items&&this.setState({selectedIndex:0})}},{key:"onKeyDown",value:function(e){var t=e.event;return"ArrowUp"===t.key?(this.upHandler(),!0):"ArrowDown"===t.key?(this.downHandler(),!0):"Enter"===t.key&&(this.enterHandler(),!0)}},{key:"upHandler",value:function(){this.setState({selectedIndex:(this.state.selectedIndex+this.props.items.length-1)%this.props.items.length})}},{key:"downHandler",value:function(){this.setState({selectedIndex:(this.state.selectedIndex+1)%this.props.items.length})}},{key:"enterHandler",value:function(){this.selectItem(this.state.selectedIndex)}},{key:"selectItem",value:function(e){var t=this.props.items[e];if(t){var n=this.props,r=n.editor,i=n.range;t.command({editor:r,range:i})}}},{key:"render",value:function(){var e=this;return i.a.createElement("div",{className:"relative py-2 overflow-hidden bg-gray-900 rounded shadow"},this.props.items.map((function(t,n){return i.a.createElement(xg,{key:t.title,item:t,index:n,selectedIndex:e.state.selectedIndex,selectItem:e.selectItem})})))}}])&&Ag(t.prototype,n),r&&Ag(t,r),a}(i.a.Component),xg=function(e){var t=e.item,n=e.selectedIndex,r=e.index,o=e.selectItem,a=t.Icon;return i.a.createElement("div",{className:yg()("flex items-center w-full px-4 py-2 space-x-4 transition-all duration-100",{"bg-gray-800":r===n}),onClick:function(){return o(r)}},a&&i.a.createElement("div",{className:"p-1 text-gray-100 bg-gray-800 rounded-sm"},i.a.createElement(a,{size:18})),i.a.createElement("div",{className:"flex flex-col text-gray-100"},i.a.createElement("span",{className:"text-sm font-semibold"},t.title),i.a.createElement("span",{className:"text-xs text-gray-300"},t.description)))},kg=Mg,Lg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pg=i.a.createContext&&i.a.createContext(Lg),Bg=function(){return(Bg=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Ug=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Fg(e){return function(t){return i.a.createElement(zg,Bg({attr:Bg({},e.attr)},t),function e(t){return t&&t.map((function(t,n){return i.a.createElement(t.tag,Bg({key:n},t.attr),e(t.child))}))}(e.child))}}function zg(e){var t=function(t){var n,r=e.attr,o=e.size,a=e.title,s=Ug(e,["attr","size","title"]),l=o||t.size||"1em";return t.className&&(n=t.className),e.className&&(n=(n?n+" ":"")+e.className),i.a.createElement("svg",Bg({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,s,{className:n,style:Bg(Bg({color:e.color||t.color},t.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),a&&i.a.createElement("title",null,a),e.children)};return void 0!==Pg?i.a.createElement(Pg.Consumer,null,(function(e){return t(e)})):t(Lg)}function jg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.667 3h6.666C10.253 3 11 3.746 11 4.667v6.666c0 .92-.746 1.667-1.667 1.667H2.667C1.747 13 1 12.254 1 11.333V4.667C1 3.747 1.746 3 2.667 3z"}},{tag:"path",attr:{d:"M7.404 8.697l6.363 3.692c.54.313 1.233-.066 1.233-.697V4.308c0-.63-.693-1.01-1.233-.696L7.404 7.304a.802.802 0 000 1.393z"}}]})(e)}function Gg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M2 3.5a.5.5 0 01.5-.5h11a.5.5 0 010 1h-11a.5.5 0 01-.5-.5zm5 3a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5zm0 3a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5zm-5 3a.5.5 0 01.5-.5h11a.5.5 0 010 1h-11a.5.5 0 01-.5-.5z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M3.734 6.352a6.586 6.586 0 00-.445.275 1.94 1.94 0 00-.346.299 1.38 1.38 0 00-.252.369c-.058.129-.1.295-.123.498h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 01-.187.463c-.12.14-.289.21-.503.21-.336 0-.577-.108-.721-.327C2.072 8.619 2 8.328 2 7.969c0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352zm2.168 0a6.588 6.588 0 00-.445.275 1.94 1.94 0 00-.346.299c-.113.12-.199.246-.257.375a1.75 1.75 0 00-.118.492h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 01-.187.463c-.12.14-.289.21-.504.21-.335 0-.576-.108-.72-.327-.145-.223-.217-.514-.217-.873 0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352z"}}]})(e)}function Yg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M14.5 3h-13a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5zm-13-1A1.5 1.5 0 000 3.5v9A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-9A1.5 1.5 0 0014.5 2h-13z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M10.648 7.646a.5.5 0 01.577-.093L15.002 9.5V13h-14v-1l2.646-2.354a.5.5 0 01.63-.062l2.66 1.773 3.71-3.71z"}},{tag:"path",attr:{fillRule:"evenodd",d:"M4.502 7a1.5 1.5 0 100-3 1.5 1.5 0 000 3z",clipRule:"evenodd"}}]})(e)}function Vg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M14.5 3h-13a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5zm-13-1A1.5 1.5 0 000 3.5v9A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-9A1.5 1.5 0 0014.5 2h-13z",clipRule:"evenodd"}},{tag:"path",attr:{fillRule:"evenodd",d:"M3 5.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zM3 8a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9A.5.5 0 013 8zm0 2.5a.5.5 0 01.5-.5h6a.5.5 0 010 1h-6a.5.5 0 01-.5-.5z",clipRule:"evenodd"}}]})(e)}function Hg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M4.854 4.146a.5.5 0 010 .708L1.707 8l3.147 3.146a.5.5 0 01-.708.708l-3.5-3.5a.5.5 0 010-.708l3.5-3.5a.5.5 0 01.708 0zm6.292 0a.5.5 0 000 .708L14.293 8l-3.147 3.146a.5.5 0 00.708.708l3.5-3.5a.5.5 0 000-.708l-3.5-3.5a.5.5 0 00-.708 0zm-.999-3.124a.5.5 0 01.33.625l-4 13a.5.5 0 01-.955-.294l4-13a.5.5 0 01.625-.33z",clipRule:"evenodd"}}]})(e)}function qg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 11.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5z",clipRule:"evenodd"}},{tag:"path",attr:{d:"M1.713 11.865v-.474H2c.217 0 .363-.137.363-.317 0-.185-.158-.31-.361-.31-.223 0-.367.152-.373.31h-.59c.016-.467.373-.787.986-.787.588-.002.954.291.957.703a.595.595 0 01-.492.594v.033a.615.615 0 01.569.631c.003.533-.502.8-1.051.8-.656 0-1-.37-1.008-.794h.582c.008.178.186.306.422.309.254 0 .424-.145.422-.35-.002-.195-.155-.348-.414-.348h-.3zm-.004-4.699h-.604v-.035c0-.408.295-.844.958-.844.583 0 .96.326.96.756 0 .389-.257.617-.476.848l-.537.572v.03h1.054V9H1.143v-.395l.957-.99c.138-.142.293-.304.293-.508 0-.18-.147-.32-.342-.32a.33.33 0 00-.342.338v.041zM2.564 5h-.635V2.924h-.031l-.598.42v-.567l.629-.443h.635V5z"}}]})(e)}function $g(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 11.5a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5zm-3 1a1 1 0 100-2 1 1 0 000 2zm0 4a1 1 0 100-2 1 1 0 000 2zm0 4a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}}]})(e)}function Wg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.637 13V3.669H7.379V7.62H2.758V3.67H1.5V13h1.258V8.728h4.62V13h1.259zm5.329 0V3.669h-1.244L10.5 5.316v1.265l2.16-1.565h.062V13h1.244z"}}]})(e)}function Qg(e){return Fg({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.638 13V3.669H6.38V7.62H1.759V3.67H.5V13h1.258V8.728h4.62V13h1.259zm3.022-6.733v-.048c0-.889.63-1.668 1.716-1.668.957 0 1.675.608 1.675 1.572 0 .855-.554 1.504-1.067 2.085l-3.513 3.999V13H15.5v-1.094h-4.245v-.075l2.481-2.844c.875-.998 1.586-1.784 1.586-2.953 0-1.463-1.155-2.556-2.919-2.556-1.941 0-2.966 1.326-2.966 2.74v.049h1.223z"}}]})(e)}var Kg=Eg.configure({HTMLAttributes:{class:"commands"},suggestion:{items:function(e){return[{title:"Paragraph",description:"Add a plain text block",Icon:Vg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("paragraph").run()}},{title:"H1",description:"Add a big heading",Icon:Wg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("heading",{level:1}).run()}},{title:"H2",description:"Add a sub-heading",Icon:Qg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).setNode("heading",{level:2}).run()}},{title:"Numbered list",description:"Add a list with numbering",Icon:qg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleOrderedList().run()}},{title:"Bulleted list",description:"Add an list bullets",Icon:$g,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleBulletList().run()}},{title:"Blockquote",description:"Add a quote",Icon:Gg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleBlockquote().run()}},{title:"Image",description:"Add an image",Icon:Yg,command:function(e){var t=e.editor,n=e.range;Af.showImageUpload=!0,Af.range=n,t.chain().focus().deleteRange(n).run()}},{title:"Youtube/Vimeo",description:"Embed a video from major services",Icon:jg,command:function(e){var t=e.editor,n=e.range,r=prompt("Please enter Youtube/Vimeo embed URL");t.chain().focus().deleteRange(n).setExternalVideo({src:r}).run()}},{title:"Code block",description:"Add a code block with syntax highlighting",Icon:Hg,command:function(e){var t=e.editor,n=e.range;t.chain().focus().deleteRange(n).toggleCodeBlock().run()}}].filter((function(t){return t.title.toLowerCase().startsWith(e.toLowerCase())})).slice(0,10)},render:function(){var e,t;return{onStart:function(n){e=new ec(kg,{props:n,editor:n.editor}),t=Gl("body",{getReferenceClientRect:n.clientRect,appendTo:function(){return document.body},content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:function(n){e.updateProps(n),t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:function(t){var n;return null===(n=e.ref)||void 0===n?void 0:n.onKeyDown(t)},onExit:function(){t[0].destroy(),e.destroy()}}}}});const Xg=/^```(?<language>[a-z]*)? $/,Zg=/^~~~(?<language>[a-z]*)? $/;var Jg=ja.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{var t;const n=null===(t=e.firstElementChild)||void 0===t?void 0:t.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:e}){return["pre",this.options.HTMLAttributes,["code",e,0]]},addCommands:()=>({setCodeBlock:e=>({commands:t})=>t.setNode("codeBlock",e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode("codeBlock","paragraph",e)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[xi(Xg,this.type,({groups:e})=>e),xi(Zg,this.type,({groups:e})=>e)]}}),e_={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var t_=/Edge\/(\d+)/.exec(navigator.userAgent),n_=/MSIE \d/.test(navigator.userAgent),r_=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);e_.mac=/Mac/.test(navigator.platform);var i_=e_.ie=!!(n_||r_||t_);e_.ie_version=n_?document.documentMode||6:r_?+r_[1]:t_?+t_[1]:null,e_.gecko=!i_&&/gecko\/(\d+)/i.test(navigator.userAgent),e_.gecko_version=e_.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var o_=!i_&&/Chrome\/(\d+)/.exec(navigator.userAgent);e_.chrome=!!o_,e_.chrome_version=o_&&+o_[1],e_.safari=!i_&&/Apple Computer/.test(navigator.vendor),e_.ios=e_.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),e_.android=/Android \d/.test(navigator.userAgent),e_.webkit="webkitFontSmoothing"in document.documentElement.style,e_.webkit_version=e_.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var a_=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},s_=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},l_=null,c_=function(e,t,n){var r=l_||(l_=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},d_=function(e,t,n,r){return n&&(p_(e,t,n,r,-1)||p_(e,t,n,r,1))},u_=/^(img|br|input|textarea|hr)$/i;function p_(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:f_(e))){var o=e.parentNode;if(1!=o.nodeType||m_(e)||u_.test(e.nodeName)||"false"==e.contentEditable)return!1;t=a_(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?f_(e):0}}}function f_(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function m_(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var h_=function(e){var t=e.isCollapsed;return t&&e_.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function g_(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function __(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function v_(e,t){return"number"==typeof e?e:e[t]}function E_(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function b_(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;a=s_(a))if(1==a.nodeType){var s=a==o.body||1!=a.nodeType,l=s?__(o):E_(a),c=0,d=0;if(t.top<l.top+v_(r,"top")?d=-(l.top-t.top+v_(i,"top")):t.bottom>l.bottom-v_(r,"bottom")&&(d=t.bottom-l.bottom+v_(i,"bottom")),t.left<l.left+v_(r,"left")?c=-(l.left-t.left+v_(i,"left")):t.right>l.right-v_(r,"right")&&(c=t.right-l.right+v_(i,"right")),c||d)if(s)o.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(s)break}}function y_(e){for(var t=[],n=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=n);e=s_(e));return t}function S_(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var T_=null;function N_(e,t){for(var n,r,i=2e8,o=0,a=t.top,s=t.top,l=e.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=c_(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(f<i){n=l,i=f,r=f&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==l.nodeType&&f&&(o=c+(t.left>=(p.left+p.right)/2?1:0));continue}}!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(o=c+1)}}return n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var o=A_(r,1);if(o.top!=o.bottom&&O_(t,o))return{node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||i&&1==n.nodeType?{node:e,offset:o}:N_(n,r)}function O_(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function C_(e,t){var n,r,i,o,a=e.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(t.left,t.top);s&&(i=(n=s).offsetNode,o=n.offset)}catch(e){}if(!i&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(t.left,t.top);l&&(i=(r=l).startContainer,o=r.startOffset)}var c,d=a.elementFromPoint(t.left,t.top+1);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=e.dom.getBoundingClientRect();if(!O_(t,u))return null;if(!(d=function e(t,n,r){var i=t.childNodes.length;if(i&&r.top<r.bottom)for(var o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){var s=t.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(O_(n,d))return e(s,n,d)}if((a=(a+1)%i)==o)break}return t}(e.dom,t,u)))return null}if(e_.safari&&d.draggable&&(i=o=null),d=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(d,t),i){if(e_.gecko&&1==i.nodeType&&(o=Math.min(o,i.childNodes.length))<i.childNodes.length){var p,f=i.childNodes[o];"IMG"==f.nodeName&&(p=f.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&o++}i==e.dom&&o==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:0!=o&&1==i.nodeType&&"BR"==i.childNodes[o-1].nodeName||(c=function(e,t,n,r){for(var i=-1,o=t;o!=e.dom;){var a=e.docView.nearestDesc(o,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)i=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;i=a.posAfter}}o=a.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n)}(e,i,o,t))}null==c&&(c=function(e,t,n){var r=N_(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,d,t));var m=e.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function A_(e,t){var n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}var D_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function R_(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=e_.webkit||e_.gecko;if(3==i.nodeType){if(!a||!D_.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var s=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==i.nodeValue.length?(s--,c=1):n<0?s--:l++,w_(A_(c_(i,s,l),c),c<0)}var d=A_(c_(i,o,o),n);if(e_.gecko&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var u=A_(c_(i,o-1,o-1),-1);if(u.top==d.top){var p=A_(c_(i,o,o+1),-1);if(p.top!=d.top)return w_(p,p.left<u.left)}}return d}if(!e.state.doc.resolve(t).parent.inlineContent){if(o&&(n<0||o==f_(i))){var f=i.childNodes[o-1];if(1==f.nodeType)return I_(f.getBoundingClientRect(),!1)}if(o<f_(i)){var m=i.childNodes[o];if(1==m.nodeType)return I_(m.getBoundingClientRect(),!0)}return I_(i.getBoundingClientRect(),n>=0)}if(o&&(n<0||o==f_(i))){var h=i.childNodes[o-1],g=3==h.nodeType?c_(h,f_(h)-(a?0:1)):1!=h.nodeType||"BR"==h.nodeName&&h.nextSibling?null:h;if(g)return w_(A_(g,1),!1)}if(o<f_(i)){var _=i.childNodes[o],v=3==_.nodeType?c_(_,0,a?0:1):1==_.nodeType?_:null;if(v)return w_(A_(v,-1),!0)}return w_(A_(3==i.nodeType?c_(i):i,-n),n>=0)}function w_(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function I_(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function M_(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var x_=/[\u0590-\u08ac]/;var k_=null,L_=null,P_=!1;function B_(e,t,n){return k_==t&&L_==n?P_:(k_=t,L_=n,P_="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return M_(e,t,(function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.dom;break}t=r.dom.parentNode}for(var o=R_(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=c_(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<o.top+1:c.top>o.bottom-1))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=getSelection();return x_.test(r.parent.textContent)&&s.modify?M_(e,t,(function(){var t=s.getRangeAt(0),i=s.focusNode,o=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?e.docView.domAfterPos(r.before()):e.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||i==s.focusNode&&o==s.focusOffset;return s.removeAllRanges(),s.addRange(t),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?o:a}(e,t,n))}var U_=function(e,t,n,r){this.parent=e,this.children=t,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},F_={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};U_.prototype.matchesWidget=function(){return!1},U_.prototype.matchesMark=function(){return!1},U_.prototype.matchesNode=function(){return!1},U_.prototype.matchesHack=function(){return!1},F_.beforePosition.get=function(){return!1},U_.prototype.parseRule=function(){return null},U_.prototype.stopEvent=function(){return!1},F_.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e},F_.border.get=function(){return 0},U_.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var e=0;e<this.children.length;e++)this.children[e].destroy()},U_.prototype.posBeforeChild=function(e){for(var t=0,n=this.posAtStart;t<this.children.length;t++){var r=this.children[t];if(r==e)return n;n+=r.size}},F_.posBefore.get=function(){return this.parent.posBeforeChild(this)},F_.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},F_.posAfter.get=function(){return this.posBefore+this.size},F_.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},U_.prototype.localPosFromDOM=function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>a_(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},U_.prototype.nearestDesc=function(e,t){for(var n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!i.nodeDOM||(1==i.nodeDOM.nodeType?i.nodeDOM.contains(1==e.nodeType?e:e.parentNode):i.nodeDOM==e))return i;n=!1}}},U_.prototype.getDesc=function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t},U_.prototype.posFromDOM=function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1},U_.prototype.descAt=function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}},U_.prototype.domFromPos=function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,i=!0;;r++,i=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var o=r==this.children.length?null:this.children[r];if(n==e&&(0==t||!o||!o.size||o.border||t<0&&i)||o&&o.domAtom&&e<n+o.size)return{node:this.contentDOM,offset:o?a_(o.dom):this.contentDOM.childNodes.length};if(!o)throw new Error("Invalid position "+e);var a=n+o.size;if(!o.domAtom&&(t<0&&!o.border?a>=e:a>e)&&(a>e||r+1>=this.children.length||!this.children[r+1].beforePosition))return o.domFromPos(e-n-o.border,t);n=a}},U_.prototype.parseRange=function(e,t,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],l=o+s.size;if(-1==r&&e<=l){var c=o+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=o;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=a_(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=a_(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}},U_.prototype.emptyChildAt=function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)},U_.prototype.domAfterPos=function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]},U_.prototype.setSelection=function(e,t,n,r){for(var i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(i>s&&o<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),p=n.getSelection(),f=!1;if((e_.gecko||e_.safari)&&e==t){var m=d.node,h=d.offset;if(3==m.nodeType)(f=h&&"\n"==m.nodeValue[h-1])&&h==m.nodeValue.length&&m.nextSibling&&"BR"==m.nextSibling.nodeName&&(d=u={node:m.parentNode,offset:a_(m)+1});else{var g=m.childNodes[h-1];f=g&&("BR"==g.nodeName||"false"==g.contentEditable)}}if(e_.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var _=p.focusNode.childNodes[p.focusOffset];_&&"false"==_.contentEditable&&(r=!0)}if(r||f&&e_.safari||!d_(d.node,d.offset,p.anchorNode,p.anchorOffset)||!d_(u.node,u.offset,p.focusNode,p.focusOffset)){var v=!1;if((p.extend||e==t)&&!f){p.collapse(d.node,d.offset);try{e!=t&&p.extend(u.node,u.offset),v=!0}catch(e){if(!(e instanceof DOMException))throw e}}if(!v){if(e>t){var E=d;d=u,u=E}var b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(b)}}},U_.prototype.ignoreMutation=function(e){return!this.contentDOM&&"selection"!=e.type},F_.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},U_.prototype.markDirty=function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=3}n=o}this.dirty=2},U_.prototype.markParentsDirty=function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}},F_.domAtom.get=function(){return!1},Object.defineProperties(U_.prototype,F_);var z_=[],j_=function(e){function t(t,n,r,i){var o,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,(function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:i}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}e.call(this,t,z_,a,null),this.widget=n,o=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(e){return 0==this.dirty&&e.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)},t.prototype.ignoreMutation=function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(U_),G_=function(e){function t(t,n,r,i){e.call(this,t,z_,n,null),this.textDOM=r,this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t},t.prototype.domFromPos=function(e){return{node:this.textDOM,offset:e}},t.prototype.ignoreMutation=function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue},Object.defineProperties(t.prototype,n),t}(U_),Y_=function(e){function t(t,n,r,i){e.call(this,t,[],r,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(e,n,r,i){var o=i.nodeViews[n.type.name],a=o&&o(n,i,r);return a&&a.dom||(a=fe.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,a.dom,a.contentDOM||a.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(e){return 3!=this.dirty&&this.mark.eq(e)},t.prototype.markDirty=function(t,n){if(e.prototype.markDirty.call(this,t,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},t.prototype.slice=function(e,n,r){var i=t.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;n<a&&(o=ov(o,n,a,r)),e>0&&(o=ov(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i},t}(U_),V_=function(e){function t(t,n,r,i,o,a,s,l,c){e.call(this,t,n.isLeaf?z_:[],o,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=i,a&&this.updateChildren(l,c)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(e,n,r,i,o,a){var s,l,c=o.nodeViews[n.type.name],d=c&&c(n,o,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),r,i),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=fe.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=ev(u,r,n),d?l=new W_(e,n,r,i,u,p,f,d,o,a+1):n.isText?new q_(e,n,r,i,u,f,o):new t(e,n,r,i,u,p,f,o,a+1)},t.prototype.parseRule=function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(t.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?t.contentElement=this.contentDOM:t.getContent=function(){return e.contentDOM?s.empty:e.node.content},t},t.prototype.matchesNode=function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&tv(t,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(e,t){var n=this,r=this.node.inlineContent,i=t,o=r&&e.composing&&this.localCompositionNode(e,t),a=new rv(this,o&&o.node);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<i.length&&i[l].to==o){for(var p=i[l++],f=void 0;l<i.length&&i[l].to==o;)(f||(f=[p])).push(i[l++]);if(f){f.sort(iv);for(var m=0;m<f.length;m++)n(f[m],u,!!d)}else n(p,u,!!d)}var h=void 0,g=void 0;if(d)g=-1,h=d,d=null;else{if(!(u<e.childCount))break;g=u,h=e.child(u++)}for(var _=0;_<c.length;_++)c[_].to<=o&&c.splice(_--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);var v=o+h.nodeSize;if(h.isText){var E=v;l<i.length&&i[l].from<E&&(E=i[l].from);for(var b=0;b<c.length;b++)c[b].to<E&&(E=c[b].to);E<v&&(d=h.cut(E-o),h=h.cut(0,E-o),v=E,g=-1)}var y=c.length?h.isInline&&!h.isLeaf?c.filter((function(e){return!e.inline})):c.slice():z_;r(h,y,t.forChild(o,h),g),o=v}}(this.node,this.innerDeco,(function(t,o,s){t.spec.marks?a.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!s&&a.syncToMarks(o==n.node.childCount?p.none:n.node.child(o).marks,r,e),a.placeWidget(t,e,i)}),(function(t,n,o,s){a.syncToMarks(t.marks,r,e),a.findNodeMatch(t,n,o,s)||a.updateNextNode(t,n,o,e,s)||a.addNode(t,n,o,e,i),i+=t.nodeSize})),a.syncToMarks(z_,r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){for(var i=t.firstChild,o=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==t){for(;l!=i;)i=nv(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(s instanceof Y_){var c=i?i.previousSibling:t.lastChild;e(s.contentDOM,s.children,r),i=c?c.nextSibling:t.firstChild}}for(;i;)i=nv(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),e_.ios&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))},t.prototype.localCompositionNode=function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(!(e.state.selection instanceof nt)||r<t||i>t+this.node.content.size)){var o=e.root.getSelection(),a=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];e=e.childNodes[t-1],t=f_(e)}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(o.focusNode,o.focusOffset);if(a&&this.dom.contains(a.parentNode)){var s=a.nodeValue,l=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var l=a.text;i<e.childCount;){var c=e.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){var d=l.lastIndexOf(t,r-s);if(d>=0&&d+t.length+s>=n)return s+d}}}return-1}(this.node.content,s,r-t,i-t);return l<0?null:{node:a,pos:l,text:s}}}},t.prototype.protectLocalComposition=function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=null)}var a=new G_(this,o,n,i);e.compositionNodes.push(a),this.children=ov(this.children,r,r+i.length,e,a)}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)},t.prototype.updateInner=function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},t.prototype.updateOuterDeco=function(e){if(!tv(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Z_(this.dom,this.nodeDOM,X_(this.outerDeco,this.node,t),X_(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=e}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,n),t}(U_);function H_(e,t,n,r,i){return ev(r,t,e),new V_(null,e,t,n,r,r,r,i,0)}var q_=function(e){function t(t,n,r,i,o,a,s){e.call(this,t,n,r,i,o,null,a,s)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}},t.prototype.update=function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)},t.prototype.inParent=function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1},t.prototype.domFromPos=function(e){return{node:this.nodeDOM,offset:e}},t.prototype.localPosFromDOM=function(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):e.prototype.localPosFromDOM.call(this,t,n,r)},t.prototype.ignoreMutation=function(e){return"characterData"!=e.type&&"selection"!=e.type},t.prototype.slice=function(e,n,r){var i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)},n.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,n),t}(V_),$_=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,n),t}(U_),W_=function(e){function t(t,n,r,i,o,a,s,l,c,d){e.call(this,t,n,r,i,o,a,s,c,d),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(t,n,r,i){if(3==this.dirty)return!1;if(this.spec.update){var o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&e.prototype.update.call(this,t,n,r,i)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r):e.prototype.setSelection.call(this,t,n,r,i)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)},t.prototype.ignoreMutation=function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e.prototype.ignoreMutation.call(this,t)},t}(V_);function Q_(e){e&&(this.nodeName=e)}Q_.prototype=Object.create(null);var K_=[new Q_];function X_(e,t,n){if(0==e.length)return K_;for(var r=n?K_[0]:new Q_,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new Q_(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==i.length&&i.push(r=new Q_(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return i}function Z_(e,t,n,r){if(n==K_&&r==K_)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var l=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(l=i.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(i),s=K_[0]),i=l}J_(i,s||K_[0],a)}return i}function J_(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):z_,a=n.class?n.class.split(" ").filter(Boolean):z_,s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var l=0;l<a.length;l++)-1==o.indexOf(a[l])&&e.classList.add(a[l])}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function ev(e,t,n){return Z_(e,e,K_,X_(t,n,1!=e.nodeType))}function tv(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function nv(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var rv=function(e,t){this.top=e,this.lock=t,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(e,t){for(var n=e.childCount,r=t.length,i=new Map;n>0&&r>0;r--){var o=t[r-1],a=o.node;if(a){if(a!=e.child(n-1))break;--n,i.set(o,n)}}return{index:n,matched:i}}(e.node.content,e.children)};function iv(e,t){return e.type.side-t.type.side}function ov(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,d=s+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=null),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function av(e,t){var n=e.root.getSelection(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(h_(n)){for(s=c;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&it.isSelectable(i.node)&&i.parent&&(!i.node.isInline||!function(e,t,n){for(var r=0==t,i=t==f_(e);r||i;){if(e==n)return!0;var o=a_(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==f_(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;l=new it(a==d?c:r.resolve(d))}}else{var u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=r.resolve(u)}l||(l=hv(e,s,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1));return l}function sv(e){return e.editable?e.hasFocus():gv(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function lv(e,t){var n=e.state.selection;if(fv(e,n),sv(e)){if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.root.getSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,a_(r)+1):n.setEnd(r,0);n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&e_.ie&&e_.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{var r,i,o=n.anchor,a=n.head;!cv||n instanceof nt||(n.$from.parent.inlineContent||(r=dv(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=dv(e,n.to))),e.docView.setSelection(o,a,e.root,t),cv&&(r&&pv(r),i&&pv(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var n=e.root.getSelection(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout((function(){sv(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}rv.prototype.destroyBetween=function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}},rv.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},rv.prototype.syncToMarks=function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(e[i])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=Y_.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}},rv.prototype.findNodeMatch=function(e,t,n,r){var i=this.top.children,o=-1;if(r>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(e,t,n)){o=a;break}}else for(var s=this.index,l=Math.min(i.length,s+1);s<l;s++){var c=i[s];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},rv.prototype.updateNextNode=function(e,t,n,r,i){for(var o=this.index;o<this.top.children.length;o++){var a=this.top.children[o];if(a instanceof V_){var s=this.preMatch.matched.get(a);if(null!=s&&s!=i)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&tv(t,a.outerDeco)))&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},rv.prototype.addNode=function(e,t,n,r,i){this.top.children.splice(this.index++,0,V_.create(this.top,e,t,n,r,i)),this.changed=!0},rv.prototype.placeWidget=function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new j_(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++},rv.prototype.addTextblockHacks=function(){for(var e=this.top.children[this.index-1];e instanceof Y_;)e=e.children[e.children.length-1];if(!e||!(e instanceof q_)||/\n$/.test(e.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var t=document.createElement("br");this.top.children.splice(this.index++,0,new $_(this.top,z_,t,null)),this.changed=!0}};var cv=e_.safari||e_.chrome&&e_.chrome_version<63;function dv(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(e_.safari&&o&&"false"==o.contentEditable)return uv(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return uv(o);if(a)return uv(a)}}function uv(e){return e.contentEditable="true",e_.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function pv(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function fv(e,t){if(t instanceof it){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(mv(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else mv(e)}function mv(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function hv(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||nt.between(t,n,r)}function gv(e){var t=e.root.getSelection();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function _v(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Je.findFrom(a,t)}function vv(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ev(e,t,n){var r=e.state.selection;if(!(r instanceof nt)){if(r instanceof it&&r.node.isInline)return vv(e,new nt(t>0?r.$to:r.$from));var i=_v(e.state,t);return!!i&&vv(e,i)}if(!r.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=_v(e.state,t);return!!(o&&o instanceof it)&&vv(e,o)}if(!(e_.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=t<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM)&&(it.isSelectable(l)?vv(e,new it(t<0?e.state.doc.resolve(s.pos-l.nodeSize):s)):!!e_.webkit&&vv(e,new nt(e.state.doc.resolve(t<0?c:c+l.nodeSize))))}}function bv(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function yv(e){var t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Sv(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){var i,o,a=!1;for(e_.gecko&&1==n.nodeType&&r<bv(n)&&yv(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(yv(s))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(Nv(n))break;for(var l=n.previousSibling;l&&yv(l);)i=n.parentNode,o=a_(l),l=l.previousSibling;if(l)r=bv(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?Ov(e,t,n,r):i&&Ov(e,t,i,o)}}function Tv(e){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n){for(var i,o,a=bv(n);;)if(r<a){if(1!=n.nodeType)break;if(!yv(n.childNodes[r]))break;i=n,o=++r}else{if(Nv(n))break;for(var s=n.nextSibling;s&&yv(s);)i=s.parentNode,o=a_(s)+1,s=s.nextSibling;if(s)r=0,a=bv(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&Ov(e,t,i,o)}}function Nv(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ov(e,t,n,r){if(h_(t)){var i=document.createRange();i.setEnd(n,r),i.setStart(n,r),t.removeAllRanges(),t.addRange(i)}else t.extend&&t.extend(n,r);e.domObserver.setCurSelection();var o=e.state;setTimeout((function(){e.state==o&&lv(e)}),50)}function Cv(e,t,n){var r=e.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1)return!1;if(e_.mac&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=_v(e.state,t);if(a&&a instanceof it)return vv(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,l=r instanceof at?Je.near(s,t):Je.findFrom(s,t);return!!l&&vv(e,l)}return!1}function Av(e,t){if(!(e.state.selection instanceof nt))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Dv(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Rv(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||e_.mac&&72==n&&"c"==r?Av(e,-1)||Sv(e):46==n||e_.mac&&68==n&&"c"==r?Av(e,1)||Tv(e):13==n||27==n||(37==n?Ev(e,-1,r)||Sv(e):39==n?Ev(e,1,r)||Tv(e):38==n?Cv(e,-1,r)||Sv(e):40==n?function(e){if(e_.safari&&!(e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;Dv(e,i,!0),setTimeout((function(){return Dv(e,i,!1)}),20)}}}(e)||Cv(e,1,r)||Tv(e):r==(e_.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function wv(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(e_.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||e_.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function Iv(e,t,n,r,i){if(t<0){var o=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,a=av(e,o);if(a&&!e.state.selection.eq(a)){var l=e.state.tr.setSelection(a);"pointer"==o?l.setMeta("pointer",!0):"key"==o&&l.scrollIntoView(),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u=e.state.selection,p=function(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,o=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=e.root.getSelection(),d=null,u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],h_(c)||d.push({node:c.focusNode,offset:c.focusOffset})),e_.chrome&&8===e.lastKeyCode)for(var p=a;p>o;p--){var f=i.childNodes[p-1],m=f.pmViewDesc;if("BR"==f.nodeName&&!m){a=p;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp("domParser")||ne.fromSchema(e.state.schema),_=h.resolve(s),v=null,E=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:o,to:a,preserveWhitespace:!_.parent.type.spec.code||"full",editableContent:!0,findPositions:d,ruleFromNode:wv,context:_});if(d&&null!=d[0].pos){var b=d[0].pos,y=d[1]&&d[1].pos;null==y&&(y=b),v={anchor:b+s,head:y+s}}return{doc:E,sel:v,from:s,to:l}}(e,t,n);if(e_.chrome&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from){var f=e.cursorWrapper.deco.type.toDOM.nextSibling,m=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+m,head:p.sel.anchor+m}}var h,g,_=e.state.doc,v=_.slice(p.from,p.to);8===e.lastKeyCode&&Date.now()-100<e.lastKeyCodeTime?(h=e.state.selection.to,g="end"):(h=e.state.selection.from,g="start"),e.lastKeyCode=null;var E=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==i){var c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&e.size<t.size){l=(o-=r<=o&&r>=s?o-r:0)+(l-s),s=o}else if(l<o){s=(o-=r<=o&&r>=l?o-r:0)+(s-l),l=o}return{start:o,endA:s,endB:l}}(v.content,p.doc.content,p.from,h,g);if(!E){if(!(r&&u instanceof nt&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if((e_.ios&&e.lastIOSEnter>Date.now()-225||e_.android)&&i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))&&e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})))return void(e.lastIOSEnter=0);if(p.sel){var b=Mv(e,e.state.doc,p.sel);b&&!b.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(b))}return}E={start:u.from,endA:u.to,endB:u.to}}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&E.start==E.endB&&e.state.selection instanceof nt&&(E.start>e.state.selection.from&&E.start<=e.state.selection.from+2?E.start=e.state.selection.from:E.endA<e.state.selection.to&&E.endA>=e.state.selection.to-2&&(E.endB+=e.state.selection.to-E.endA,E.endA=e.state.selection.to)),e_.ie&&e_.ie_version<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>p.from&&" "==p.doc.textBetween(E.start-p.from-1,E.start-p.from+1)&&(E.start--,E.endA--,E.endB--);var y,S=p.doc.resolveNoCache(E.start-p.from),T=p.doc.resolveNoCache(E.endB-p.from),N=S.sameParent(T)&&S.parent.inlineContent;if((e_.ios&&e.lastIOSEnter>Date.now()-225&&(!N||i.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!N&&S.pos<p.doc.content.size&&(y=Je.findFrom(p.doc.resolve(S.pos+1),1,!0))&&y.head==T.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})))e.lastIOSEnter=0;else if(e.state.selection.anchor>E.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||xv(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var a=e.resolve(xv(o,!0,!0));if(!a.parent.isTextblock||a.pos>n||xv(a,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(_,E.start,E.endA,S,T)&&e.someProp("handleKeyDown",(function(t){return t(e,g_(8,"Backspace"))})))e_.android&&e_.chrome&&e.domObserver.suppressSelectionUpdates();else{e_.chrome&&e_.android&&E.toB==E.from&&(e.lastAndroidDelete=Date.now()),e_.android&&!N&&S.start()!=T.start()&&0==T.parentOffset&&S.depth==T.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==E.endA&&(E.endB-=2,T=p.doc.resolveNoCache(E.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))}))}),20));var O,C,A,D,R=E.start,w=E.endA;if(N)if(S.pos==T.pos)e_.ie&&e_.ie_version<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return lv(e)}),20)),O=e.state.tr.delete(R,w),C=_.resolve(E.start).marksAcross(_.resolve(E.endA));else if(E.endA==E.endB&&(D=_.resolve(E.start))&&(A=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,l=o,c=a,d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var p=[],f=0;f<t.childCount;f++)p.push(i(t.child(f)));if(s.from(p).eq(e))return{mark:r,type:n}}(S.parent.content.cut(S.parentOffset,T.parentOffset),D.parent.content.cut(D.parentOffset,E.endA-D.start()))))O=e.state.tr,"add"==A.type?O.addMark(R,w,A.mark):O.removeMark(R,w,A.mark);else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){var I=S.parent.textBetween(S.parentOffset,T.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,R,w,I)})))return;O=e.state.tr.insertText(I,R,w)}if(O||(O=e.state.tr.replace(R,w,p.doc.slice(E.start-p.from,E.endB-p.from))),p.sel){var M=Mv(e,O.doc,p.sel);M&&!(e_.chrome&&e_.android&&e.composing&&M.empty&&(E.from!=E.toB||e.lastAndroidDelete<Date.now()-100)&&(M.head==R||M.head==O.mapping.map(w)-1)||e_.ie&&M.empty&&M.head==R)&&O.setSelection(M)}C&&O.ensureMarks(C),e.dispatch(O.scrollIntoView())}}}function Mv(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:hv(e,t.resolve(n.anchor),t.resolve(n.head))}function xv(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function kv(e,t){for(var n=[],r=t.content,i=t.openStart,o=t.openEnd;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;var a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=e.someProp("clipboardSerializer")||fe.fromSchema(e.state.schema),l=zv(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=Uv[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",i+" "+o+" "+JSON.stringify(n)),{dom:c,text:e.someProp("clipboardTextSerializer",(function(e){return e(t)}))||t.content.textBetween(0,t.content.size,"\n\n")}}function Lv(e,t,n,r,i){var o,a,l=i.parent.type.spec.code;if(!n&&!t)return null;var c=t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",(function(e){t=e(t,l||r)})),l)return new m(s.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0);var d=e.someProp("clipboardTextParser",(function(e){return e(t,i,r)}));d?a=d:(o=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach((function(e){o.appendChild(document.createElement("p")).textContent=e})))}else e.someProp("transformPastedHTML",(function(e){n=e(n)})),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=zv().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&Uv[i[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join(""));if(r.innerHTML=e,n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n);var u=o&&o.querySelector("[data-pm-slice]"),p=u&&/^(\d+) (\d+) (.*)/.exec(u.getAttribute("data-pm-slice"));if(!a){var f=e.someProp("clipboardParser")||e.someProp("domParser")||ne.fromSchema(e.state.schema);a=f.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i})}return a=p?function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,l=n.length-2;l>=0;l-=2){var c=r.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;i=s.from(c.create(n[l+1],i)),o++,a++}return new m(i,o,a)}(function(e,t,n){t<e.openStart&&(e=new m(Bv(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd));n<e.openEnd&&(e=new m(Bv(e.content,1,n,e.openEnd,0,0),e.openStart,n));return e}(a,+p[1],+p[2]),p[3]):m.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n=function(n){var r=t.node(n).contentMatchAt(t.index(n)),i=void 0,o=[];if(e.forEach((function(e){if(o){var t,n=r.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){var a=e(t,n,r,i.lastChild,o+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(s.from(Pv(r,t,o+1))))}}(n,i,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;var r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(s.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));var a=Pv(e,n);o.push(a),r=r.matchType(a.type,a.attrs),i=n}}})),o)return{v:s.from(o)}},r=t.depth;r>=0;r--){var i=n(r);if(i)return i.v}return e}(a.content,i),!1),e.someProp("transformPasted",(function(e){a=e(a)})),a}function Pv(e,t,n){void 0===n&&(n=0);for(var r=t.length-1;r>=n;r--)e=t[r].create(null,s.from(e));return e}function Bv(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,l=a.content;return i<r-1&&(l=Bv(l,t,n,r,i+1,o)),i>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,e.childCount>1||o<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}var Uv={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Fv=null;function zv(){return Fv||(Fv=document.implementation.createHTMLDocument("title"))}var jv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gv=e_.ie&&e_.ie_version<=11,Yv=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Yv.prototype.set=function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset},Yv.prototype.eq=function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset};var Vv=function(e,t){var n=this;this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)n.queue.push(e[t]);e_.ie&&e_.ie_version<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new Yv,Gv&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};Vv.prototype.flushSoon=function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))},Vv.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},Vv.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,jv),Gv&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},Vv.prototype.stop=function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}Gv&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},Vv.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},Vv.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},Vv.prototype.suppressSelectionUpdates=function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)},Vv.prototype.onSelectionChange=function(){if((!(e=this.view).editable||e.root.activeElement==e.dom)&&gv(e)){var e;if(this.suppressingSelectionUpdates)return lv(this.view);if(e_.ie&&e_.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&d_(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}},Vv.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},Vv.prototype.ignoreSelectionChange=function(e){if(0==e.rangeCount)return!0;var t=e.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(t);return n&&n.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0},Vv.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);var t=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&gv(this.view)&&!this.ignoreSelectionChange(t),r=-1,i=-1,o=!1,a=[];if(this.view.editable)for(var s=0;s<e.length;s++){var l=this.registerMutation(e[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(o=!0))}if(e_.gecko&&a.length>1){var c=a.filter((function(e){return"BR"==e.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,i),function(e){if(Hv)return;Hv=!0,"normal"==getComputedStyle(e.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,i,o,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(t)||lv(this.view),this.currentSelection.set(t))}},Vv.prototype.registerMutation=function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++)t.push(e.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,o=e.nextSibling;if(e_.ie&&e_.ie_version<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var s=e.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(i=l),(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(o=c)}var d=i&&i.parentNode==e.target?a_(i)+1:0,u=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?a_(o):e.target.childNodes.length;return{from:u,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}};var Hv=!1;var qv={},$v={};function Wv(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function Qv(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.eventHandlers[n]||e.dom.addEventListener(n,e.eventHandlers[n]=function(t){return Kv(e,t)})}))}function Kv(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Xv(e){return{left:e.clientX,top:e.clientY}}function Zv(e,t,n,r,i){if(-1==r)return!1;for(var o=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,(function(t){return r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)})))return{v:!0}},s=o.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Jv(e,t,n){e.focused||e.focus();var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function eE(e,t,n,r,i){return Zv(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof it&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(it.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Jv(e,it.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&it.isSelectable(r))&&(Jv(e,new it(n),"pointer"),!0)}(e,n))}function tE(e,t,n,r){return Zv(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function nE(e,t,n,r){return Zv(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t){var n=e.state.doc;if(-1==t)return!!n.inlineContent&&(Jv(e,nt.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(t),i=r.depth+1;i>0;i--){var o=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(o.inlineContent)Jv(e,nt.create(n,a+1,a+1+o.content.size),"pointer");else{if(!it.isSelectable(o))continue;Jv(e,it.create(n,a),"pointer")}return!0}}(e,n)}function rE(e){return dE(e)}$v.keydown=function(e,t){if(e.shiftKey=16==t.keyCode||t.shiftKey,!aE(e,t))if(e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),!e_.ios||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",(function(n){return n(e,t)}))||Rv(e,t)?t.preventDefault():Wv(e,"key");else{var n=Date.now();e.lastIOSEnter=n,e.lastIOSEnterFallbackTimeout=setTimeout((function(){e.lastIOSEnter==n&&(e.someProp("handleKeyDown",(function(t){return t(e,g_(13,"Enter"))})),e.lastIOSEnter=0)}),200)}},$v.keyup=function(e,t){16==t.keyCode&&(e.shiftKey=!1)},$v.keypress=function(e,t){if(!(aE(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||e_.mac&&t.metaKey))if(e.someProp("handleKeyPress",(function(n){return n(e,t)})))t.preventDefault();else{var n=e.state.selection;if(!(n instanceof nt&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(t.charCode);e.someProp("handleTextInput",(function(t){return t(e,n.$from.pos,n.$to.pos,r)}))||e.dispatch(e.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}}};var iE=e_.mac?"metaKey":"ctrlKey";qv.mousedown=function(e,t){e.shiftKey=t.shiftKey;var n=rE(e),r=Date.now(),i="singleClick";r-e.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(t,e.lastClick)&&!t[iE]&&("singleClick"==e.lastClick.type?i="doubleClick":"doubleClick"==e.lastClick.type&&(i="tripleClick")),e.lastClick={time:r,x:t.clientX,y:t.clientY,type:i};var o=e.posAtCoords(Xv(t));o&&("singleClick"==i?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new oE(e,o,t,n)):("doubleClick"==i?tE:nE)(e,o.pos,o.inside,t)?t.preventDefault():Wv(e,"pointer"))};var oE=function(e,t,n,r){var i,o,a=this;if(this.view=e,this.startDoc=e.state.doc,this.pos=t,this.event=n,this.flushed=r,this.selectNode=n[iE],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{var s=e.state.doc.resolve(t.pos);i=s.parent,o=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null,(i.type.spec.draggable&&!1!==i.type.spec.selectable||e.state.selection instanceof it&&o==e.state.selection.from)&&(this.mightDrag={node:i,pos:o,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&e_.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wv(e,"pointer")};function aE(e,t){return!!e.composing||!!(e_.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500)&&(e.compositionEndedAt=-2e8,!0)}oE.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},oE.prototype.up=function(e){if(this.done(),this.view.dom.contains(3==e.target.nodeType?e.target.parentNode:e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Xv(e))),this.allowDefault||!t?Wv(this.view,"pointer"):eE(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():this.flushed||e_.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||e_.chrome&&!(this.view.state.selection instanceof nt)&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2?(Jv(this.view,Je.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Wv(this.view,"pointer")}},oE.prototype.move=function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0),Wv(this.view,"pointer"),0==e.buttons&&this.done()},qv.touchdown=function(e){rE(e),Wv(e,"pointer")},qv.contextmenu=function(e){return rE(e)};var sE=e_.android?5e3:-1;function lE(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout((function(){return dE(e)}),t))}function cE(e){for(e.composing=!1;e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function dE(e,t){if(e.domObserver.forceFlush(),cE(e),t||e.docView.dirty){var n=av(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):e.updateState(e.state),!0}return!1}$v.compositionstart=$v.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),dE(e,!0),e.markCursor=null;else if(dE(e),e_.gecko&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.root.getSelection(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.composing=!0}lE(e,sE)},$v.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,lE(e,20))};var uE=e_.ie&&e_.ie_version<15||e_.ios&&e_.webkit_version<604;function pE(e,t,n,r){var i=Lv(e,t,n,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,r,i||m.empty)})))return!0;if(!i)return!1;var o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=o?e.state.tr.replaceSelectionWith(o,e.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}qv.copy=$v.cut=function(e,t){var n=e.state.selection,r="cut"==t.type;if(!n.empty){var i=uE?null:t.clipboardData,o=kv(e,n.content()),a=o.dom,s=o.text;i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},$v.paste=function(e,t){var n=uE?null:t.clipboardData;n&&pE(e,n.getData("text/plain"),n.getData("text/html"),t)?t.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?pE(e,r.value,null,t):pE(e,r.textContent,r.innerHTML,t)}),50)}}(e,t)};var fE=function(e,t){this.slice=e,this.move=t},mE=e_.mac?"altKey":"ctrlKey";for(var hE in qv.dragstart=function(e,t){var n=e.mouseDown;if(n&&n.done(),t.dataTransfer){var r=e.state.selection,i=r.empty?null:e.posAtCoords(Xv(t));if(i&&i.pos>=r.from&&i.pos<=(r instanceof it?r.to-1:r.to));else if(n&&n.mightDrag)e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,n.mightDrag.pos)));else if(t.target&&1==t.target.nodeType){var o=e.docView.nearestDesc(t.target,!0);if(!o||!o.node.type.spec.draggable||o==e.docView)return;e.dispatch(e.state.tr.setSelection(it.create(e.state.doc,o.posBefore)))}var a=e.state.selection.content(),s=kv(e,a),l=s.dom,c=s.text;t.dataTransfer.clearData(),t.dataTransfer.setData(uE?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",uE||t.dataTransfer.setData("text/plain",c),e.dragging=new fE(a,!t[mE])}},qv.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},$v.dragover=$v.dragenter=function(e,t){return t.preventDefault()},$v.drop=function(e,t){var n=e.dragging;if(e.dragging=null,t.dataTransfer){var r=e.posAtCoords(Xv(t));if(r){var i=e.state.doc.resolve(r.pos);if(i){var o=n&&n.slice;o?e.someProp("transformPasted",(function(e){o=e(o)})):o=Lv(e,t.dataTransfer.getData(uE?"Text":"text/plain"),uE?null:t.dataTransfer.getData("text/html"),!1,i);var a=n&&!t[mE];if(e.someProp("handleDrop",(function(n){return n(e,t,o||m.empty,a)})))t.preventDefault();else if(o){t.preventDefault();var s=o?Ue(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var l=e.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),!l.doc.eq(u)){var p=l.doc.resolve(c);if(d&&it.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new it(p));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(e,t,n,r){return f=r})),l.setSelection(hv(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}},qv.focus=function(e){e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.root.getSelection())&&lv(e)}),20))},qv.blur=function(e){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),e.domObserver.currentSelection.set({}),e.focused=!1)},qv.beforeinput=function(e,t){if(e_.chrome&&e_.android&&"deleteContentBackward"==t.inputType){var n=e.domChangeCount;setTimeout((function(){if(e.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,g_(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},$v)qv[hE]=$v[hE];function gE(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var _E=function(e,t){this.spec=t||TE,this.side=this.spec.side||0,this.toDOM=e};_E.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new bE(o-n,o-n,this)},_E.prototype.valid=function(){return!0},_E.prototype.eq=function(e){return this==e||e instanceof _E&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gE(this.spec,e.spec))};var vE=function(e,t){this.spec=t||TE,this.attrs=e};vE.prototype.map=function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new bE(i,o,this)},vE.prototype.valid=function(e,t){return t.from<t.to},vE.prototype.eq=function(e){return this==e||e instanceof vE&&gE(this.attrs,e.attrs)&&gE(this.spec,e.spec)},vE.is=function(e){return e.type instanceof vE};var EE=function(e,t){this.spec=t||TE,this.attrs=e};EE.prototype.map=function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new bE(i.pos-n,o.pos-n,this)},EE.prototype.valid=function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset;return i==t.from&&i+e.child(r).nodeSize==t.to},EE.prototype.eq=function(e){return this==e||e instanceof EE&&gE(this.attrs,e.attrs)&&gE(this.spec,e.spec)};var bE=function(e,t,n){this.from=e,this.to=t,this.type=n},yE={spec:{configurable:!0},inline:{configurable:!0}};bE.prototype.copy=function(e,t){return new bE(e,t,this.type)},bE.prototype.eq=function(e,t){return void 0===t&&(t=0),this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to},bE.prototype.map=function(e,t,n){return this.type.map(e,this,t,n)},bE.widget=function(e,t,n){return new bE(e,e,new _E(t,n))},bE.inline=function(e,t,n,r){return new bE(e,t,new vE(n,r))},bE.node=function(e,t,n,r){return new bE(e,t,new EE(n,r))},yE.spec.get=function(){return this.type.spec},yE.inline.get=function(){return this.type instanceof vE},Object.defineProperties(bE.prototype,yE);var SE=[],TE={},NE=function(e,t){this.local=e&&e.length?e:SE,this.children=t&&t.length?t:SE};NE.create=function(e,t){return t.length?wE(t,e,0,TE):OE},NE.prototype.find=function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r},NE.prototype.findInner=function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,i)}},NE.prototype.map=function(e,t,n){return this==OE||0==e.maps.length?this:this.mapInner(e,t,0,0,n||TE)},NE.prototype.mapInner=function(e,t,n,r,i){for(var o,a=0;a<this.local.length;a++){var s=this.local[a].map(e,n,r);s&&s.type.valid(t,s)?(o||(o=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?function(e,t,n,r,i,o,a){for(var s=e.slice(),l=function(e,t,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||e>l+o||(t>=s[a]+o?s[a+1]=-1:n>=i&&(c=r-n-(t-e))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(e[u]+o),f=p-i;if(f<0||f>=r.content.size){d=!0;continue}var m=n.map(e[u+1]+o,-1)-i,h=r.content.findIndex(f),g=h.index,_=h.offset,v=r.maybeChild(g);if(v&&_==f&&_+v.nodeSize==m){var E=s[u+2].mapInner(n,v,p+1,e[u]+o+1,a);E!=OE?(s[u]=f,s[u+1]=m,s[u+2]=E):(s[u+1]=-2,d=!0)}else d=!0}if(d){var b=wE(function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var l=e.local[o].map(r,i,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[o].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+o+1);return n}(s,e,t||[],n,i,o,a),r,0,a);t=b.local;for(var y=0;y<s.length;y+=3)s[y+1]<0&&(s.splice(y,3),y-=3);for(var S=0,T=0;S<b.children.length;S+=3){for(var N=b.children[S];T<s.length&&s[T]<N;)T+=3;s.splice(T,0,b.children[S],b.children[S+1],b.children[S+2])}}return new NE(t&&t.sort(IE),s)}(this.children,o,e,t,n,r,i):o?new NE(o.sort(IE)):OE},NE.prototype.add=function(e,t){return t.length?this==OE?NE.create(e,t):this.addInner(e,t,0):this},NE.prototype.addInner=function(e,t,n){var r,i=this,o=0;e.forEach((function(e,a){var s,l=a+n;if(s=DE(t,e,l)){for(r||(r=i.children.slice());o<r.length&&r[o]<a;)o+=3;r[o]==a?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,a,a+e.nodeSize,wE(s,e,l+1,TE)),o+=3}}));for(var a=AE(o?RE(t):t,-n),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||a.splice(s--,1);return new NE(a.length?this.local.concat(a).sort(IE):this.local,r||this.children)},NE.prototype.remove=function(e){return 0==e.length||this==OE?this:this.removeInner(e,0)},NE.prototype.removeInner=function(e,t){for(var n=this.children,r=this.local,i=0;i<n.length;i+=3){for(var o=void 0,a=n[i]+t,s=n[i+1]+t,l=0,c=void 0;l<e.length;l++)(c=e[l])&&c.from>a&&c.to<s&&(e[l]=null,(o||(o=[])).push(c));if(o){n==this.children&&(n=this.children.slice());var d=n[i+2].removeInner(o,a+1);d!=OE?n[i+2]=d:(n.splice(i,3),i-=3)}}if(r.length)for(var u=0,p=void 0;u<e.length;u++)if(p=e[u])for(var f=0;f<r.length;f++)r[f].eq(p,t)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new NE(r,n):OE},NE.prototype.forChild=function(e,t){if(this==OE)return this;if(t.isLeaf)return NE.empty;for(var n,r,i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}for(var o=e+1,a=o+t.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>o&&l.type instanceof vE){var c=Math.max(o,l.from)-o,d=Math.min(a,l.to)-o;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){var u=new NE(r.sort(IE));return n?new CE([u,n]):u}return n||OE},NE.prototype.eq=function(e){if(this==e)return!0;if(!(e instanceof NE)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(var t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0},NE.prototype.locals=function(e){return ME(this.localsInner(e))},NE.prototype.localsInner=function(e){if(this==OE)return SE;if(e.inlineContent||!this.local.some(vE.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof vE||t.push(this.local[n]);return t};var OE=new NE;NE.empty=OE,NE.removeOverlap=ME;var CE=function(e){this.members=e};function AE(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new bE(i.from+t,i.to+t,i.type))}return n}function DE(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,o=0,a=void 0;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function RE(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function wE(e,t,n,r){var i=[],o=!1;t.forEach((function(t,a){var s=DE(e,t,a+n);if(s){o=!0;var l=wE(s,t,n+a+1,r);l!=OE&&i.push(a,a+t.nodeSize,l)}}));for(var a=AE(o?RE(e):e,-n).sort(IE),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new NE(a,i):OE}function IE(e,t){return e.from-t.from||e.to-t.to}function ME(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),xE(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),xE(t,i+1,o.copy(r.to,o.to)))}}return t}function xE(e,t,n){for(;t<e.length&&IE(n,e[t])>0;)t++;e.splice(t,0,n)}function kE(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=OE&&t.push(r)})),e.cursorWrapper&&t.push(NE.create(e.state.doc,[e.cursorWrapper.deco])),CE.from(t)}CE.prototype.forChild=function(e,t){if(t.isLeaf)return NE.empty;for(var n=[],r=0;r<this.members.length;r++){var i=this.members[r].forChild(e,t);i!=OE&&(i instanceof CE?n=n.concat(i.members):n.push(i))}return CE.from(n)},CE.prototype.eq=function(e){if(!(e instanceof CE)||e.members.length!=this.members.length)return!1;for(var t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0},CE.prototype.locals=function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?ME(n?t:t.sort(IE)):SE},CE.from=function(e){switch(e.length){case 0:return OE;case 1:return e[0];default:return new CE(e)}};var LE=function(e,t){this._props=t,this.state=t.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):e.apply?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=FE(this),this.markCursor=null,this.cursorWrapper=null,UE(this),this.nodeViews=zE(this),this.docView=H_(this.state.doc,BE(this),kE(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new Vv(e,(function(t,n,r,i){return Iv(e,t,n,r,i)})),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(t){var n=qv[t];e.dom.addEventListener(t,e.eventHandlers[t]=function(t){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||Kv(e,t)||!e.editable&&t.type in $v||n(e,t)})};for(var n in qv)t(n);e_.safari&&e.dom.addEventListener("input",(function(){return null})),Qv(e)}(this),this.pluginViews=[],this.updatePluginViews()},PE={props:{configurable:!0},root:{configurable:!0}};function BE(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),[bE.node(0,e.state.doc.content.size,t)]}function UE(e){if(e.markCursor){var t=document.createElement("img");t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:bE.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function FE(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function zE(e){var t={};return e.someProp("nodeViews",(function(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])})),t}function jE(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];"object"!=typeof n||Object.isFrozen(n)||jE(n)})),e}PE.props.get=function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props},LE.prototype.update=function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Qv(this),this._props=e,this.updateStateInner(e.state,!0)},LE.prototype.setProps=function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)},LE.prototype.updateState=function(e){this.updateStateInner(e,this.state.plugins!=e.plugins)},LE.prototype.updateStateInner=function(e,t){var n=this,r=this.state,i=!1,o=!1;if(e.storedMarks&&this.composing&&(cE(this),o=!0),this.state=e,t){var a=zE(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Qv(this)}this.editable=FE(this),UE(this);var s=kE(this),l=BE(this),c=t?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(r.selection)||(o=!0);var u,p,f,m,h,g,_,v,E,b,y,S="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=i-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:y_(e.dom)}}(this);if(o){this.domObserver.stop();var T=d&&(e_.ie||e_.chrome)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,h=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),h.$anchor.sharedDepth(h.head)),m.$anchor.start(g)!=h.$anchor.start(g));if(d){var N=e_.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=H_(e.doc,l,s,this.dom,this)),N&&!this.trackWrites&&(T=!0)}T||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),d_(p.node,p.offset,f.anchorNode,f.anchorOffset)))?lv(this,T):(fv(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(e){return e(n)}))||(e.selection instanceof it?b_(this,this.docView.domAfterPos(e.selection.from).getBoundingClientRect(),O):b_(this,this.coordsAtPos(e.selection.head,1),O))}else S&&(v=(_=S).refDOM,E=_.refTop,b=_.stack,y=v?v.getBoundingClientRect().top:0,S_(b,0==y?0:y-E))},LE.prototype.destroyPluginViews=function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()},LE.prototype.updatePluginViews=function(e){if(e&&e.plugins==this.state.plugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}},LE.prototype.someProp=function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;var i=this.state.plugins;if(i)for(var o=0;o<i.length;o++){var a=i[o].props[e];if(null!=a&&(n=t?t(a):a))return n}},LE.prototype.hasFocus=function(){return this.root.activeElement==this.dom},LE.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(T_)return e.focus(T_);var t=y_(e);e.focus(null==T_?{get preventScroll(){return T_={preventScroll:!0},!0}}:void 0),T_||(T_=!1,S_(t,0))}(this.dom),lv(this),this.domObserver.start()},PE.root.get=function(){var e=this._root;if(null==e)for(var t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t;return e||document},LE.prototype.posAtCoords=function(e){return C_(this,e)},LE.prototype.coordsAtPos=function(e,t){return void 0===t&&(t=1),R_(this,e,t)},LE.prototype.domAtPos=function(e,t){return void 0===t&&(t=0),this.docView.domFromPos(e,t)},LE.prototype.nodeDOM=function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null},LE.prototype.posAtDOM=function(e,t,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},LE.prototype.endOfTextblock=function(e,t){return B_(this,t||this.state,e)},LE.prototype.destroy=function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},LE.prototype.dispatchEvent=function(e){return function(e,t){Kv(e,t)||!qv[t.type]||!e.editable&&t.type in $v||qv[t.type](e,t)}(this,e)},LE.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},Object.defineProperties(LE.prototype,PE);var GE=jE,YE=jE;GE.default=YE;class VE{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function HE(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qE(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const $E=e=>!!e.kind;class WE{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=HE(e)}openNode(e){if(!$E(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){$E(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class QE{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{QE._collapse(e)}))}}class KE extends QE{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){return new WE(this,this.options).value()}finalize(){return!0}}function XE(e){return e?"string"==typeof e?e:e.source:null}const ZE=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;const JE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",eb={begin:"\\\\[\\s\\S]",relevance:0},tb={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[eb]},nb={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[eb]},rb={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ib=function(e,t,n={}){const r=qE({className:"comment",begin:e,end:t,contains:[]},n);return r.contains.push(rb),r.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),r},ob=ib("//","$"),ab=ib("/\\*","\\*/"),sb=ib("#","$"),lb={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},cb={className:"number",begin:JE,relevance:0},db={className:"number",begin:"\\b(0b[01]+)",relevance:0},ub={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},pb={begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[eb,{begin:/\[/,end:/\]/,relevance:0,contains:[eb]}]}]},fb={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},mb={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},hb={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var gb=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:JE,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=function(...e){return e.map(e=>XE(e)).join("")}(t,/.*\b/,e.binary,/\b.*/)),qE({className:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:eb,APOS_STRING_MODE:tb,QUOTE_STRING_MODE:nb,PHRASAL_WORDS_MODE:rb,COMMENT:ib,C_LINE_COMMENT_MODE:ob,C_BLOCK_COMMENT_MODE:ab,HASH_COMMENT_MODE:sb,NUMBER_MODE:lb,C_NUMBER_MODE:cb,BINARY_NUMBER_MODE:db,CSS_NUMBER_MODE:ub,REGEXP_MODE:pb,TITLE_MODE:fb,UNDERSCORE_TITLE_MODE:mb,METHOD_GUARD:hb,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})}});function _b(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function vb(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=_b,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function Eb(e,t){Array.isArray(e.illegal)&&(e.illegal=function(...e){return"("+e.map(e=>XE(e)).join("|")+")"}(...e.illegal))}function bb(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function yb(e,t){void 0===e.relevance&&(e.relevance=1)}const Sb=["of","and","for","in","not","or","if","then","parent","list","value"];function Tb(e,t){return t?Number(t):function(e){return Sb.includes(e.toLowerCase())}(e)?0:1}function Nb(e,{plugins:t}){function n(t,n){return new RegExp(XE(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class r{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=function(e){return new RegExp(e.toString()+"|").exec("").length-1}(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=n(function(e,t="|"){let n=0;return e.map(e=>{n+=1;const t=n;let r=XE(e),i="";for(;r.length>0;){const e=ZE.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}(e),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new r;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=qE(e.classNameAliases||{}),function t(r,o){const a=r;if(r.isCompiled)return a;[bb].forEach(e=>e(r,o)),e.compilerExtensions.forEach(e=>e(r,o)),r.__beforeBegin=null,[vb,Eb,yb].forEach(e=>e(r,o)),r.isCompiled=!0;let s=null;if("object"==typeof r.keywords&&(s=r.keywords.$pattern,delete r.keywords.$pattern),r.keywords&&(r.keywords=function e(t,n,r="keyword"){const i={};return"string"==typeof t?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach((function(r){Object.assign(i,e(t[r],n,r))})),i;function o(e,t){n&&(t=t.map(e=>e.toLowerCase())),t.forEach((function(t){const n=t.split("|");i[n[0]]=[e,Tb(n[0],n[1])]}))}}(r.keywords,e.case_insensitive)),r.lexemes&&s)throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return s=s||r.lexemes||/\w+/,a.keywordPatternRe=n(s,!0),o&&(r.begin||(r.begin=/\B|\b/),a.beginRe=n(r.begin),r.endSameAsBegin&&(r.end=r.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),r.end&&(a.endRe=n(r.end)),a.terminatorEnd=XE(r.end)||"",r.endsWithParent&&o.terminatorEnd&&(a.terminatorEnd+=(r.end?"|":"")+o.terminatorEnd)),r.illegal&&(a.illegalRe=n(r.illegal)),r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return qE(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(e))return qE(e,{starts:e.starts?qE(e.starts):null});if(Object.isFrozen(e))return qE(e);return e}("self"===e?r:e)}))),r.contains.forEach((function(e){t(e,a)})),r.starts&&t(r.starts,o),a.matcher=function(e){const t=new i;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(a),a}(e)}function Ob(e){const t={props:["language","code","autodetect"],data:function(){return{detectedLanguage:"",unknownLanguage:!1}},computed:{className(){return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){if(!this.autoDetect&&!e.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`),this.unknownLanguage=!0,HE(this.code);let t={};return this.autoDetect?(t=e.highlightAuto(this.code),this.detectedLanguage=t.language):(t=e.highlight(this.language,this.code,this.ignoreIllegals),this.detectedLanguage=this.language),t.value},autoDetect(){return!this.language||(e=this.autodetect,Boolean(e||""===e));var e},ignoreIllegals:()=>!0},render(e){return e("pre",{},[e("code",{class:this.className,domProps:{innerHTML:this.highlighted}})])}};return{Component:t,VuePlugin:{install(e){e.component("highlightjs",t)}}}}const Cb={"after:highlightElement":({el:e,result:t,text:n})=>{const r=Db(e);if(!r.length)return;const i=document.createElement("div");i.innerHTML=t.value,t.value=function(e,t,n){let r=0,i="";const o=[];function a(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function s(e){i+="<"+Ab(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+HE(e.value)+'"'})).join("")+">"}function l(e){i+="</"+Ab(e)+">"}function c(e){("start"===e.event?s:l)(e.node)}for(;e.length||t.length;){let t=a();if(i+=HE(n.substring(r,t[0].offset)),r=t[0].offset,t===e){o.reverse().forEach(l);do{c(t.splice(0,1)[0]),t=a()}while(t===e&&t.length&&t[0].offset===r);o.reverse().forEach(s)}else"start"===t[0].event?o.push(t[0].node):o.pop(),c(t.splice(0,1)[0])}return i+HE(n.substr(r))}(r,Db(i),n)}};function Ab(e){return e.nodeName.toLowerCase()}function Db(e){const t=[];return function e(n,r){for(let i=n.firstChild;i;i=i.nextSibling)3===i.nodeType?r+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:r,node:i}),r=e(i,r),Ab(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:r,node:i}));return r}(e,0),t}const Rb={},wb=e=>{console.error(e)},Ib=(e,...t)=>{console.log("WARN: "+e,...t)},Mb=(e,t)=>{Rb[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Rb[`${e}/${t}`]=!0)},xb=HE,kb=qE,Lb=Symbol("nomatch");var Pb=function(e){const t=Object.create(null),n=Object.create(null),r=[];let i=!0;const o=/(^(<[^>]+>|\t|)+|\n)/gm,a="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let l={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:KE};function c(e){return l.noHighlightRe.test(e)}function d(e,t,n,r){let i="",o="";"object"==typeof t?(i=e,n=t.ignoreIllegals,o=t.language,r=void 0):(Mb("10.7.0","highlight(lang, code, ...args) has been deprecated."),Mb("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=t);const a={code:i,language:o};T("before:highlight",a);const s=a.result?a.result:u(a.language,a.code,n,r);return s.code=a.code,T("after:highlight",s),s}function u(e,n,o,s){function c(e,t){const n=E.case_insensitive?t[0].toLowerCase():t[0];return Object.prototype.hasOwnProperty.call(e.keywords,n)&&e.keywords[n]}function d(){null!=T.subLanguage?function(){if(""===C)return;let e=null;if("string"==typeof T.subLanguage){if(!t[T.subLanguage])return void O.addText(C);e=u(T.subLanguage,C,!0,N[T.subLanguage]),N[T.subLanguage]=e.top}else e=p(C,T.subLanguage.length?T.subLanguage:null);T.relevance>0&&(A+=e.relevance),O.addSublanguage(e.emitter,e.language)}():function(){if(!T.keywords)return void O.addText(C);let e=0;T.keywordPatternRe.lastIndex=0;let t=T.keywordPatternRe.exec(C),n="";for(;t;){n+=C.substring(e,t.index);const r=c(T,t);if(r){const[e,i]=r;if(O.addText(n),n="",A+=i,e.startsWith("_"))n+=t[0];else{const n=E.classNameAliases[e]||e;O.addKeyword(t[0],n)}}else n+=t[0];e=T.keywordPatternRe.lastIndex,t=T.keywordPatternRe.exec(C)}n+=C.substr(e),O.addText(n)}(),C=""}function f(e){return e.className&&O.openNode(E.classNameAliases[e.className]||e.className),T=Object.create(e,{parent:{value:T}}),T}function m(e){return 0===T.matcher.regexIndex?(C+=e[0],1):(w=!0,0)}function h(e){const t=e[0],n=e.rule,r=new VE(n),i=[n.__beforeBegin,n["on:begin"]];for(const n of i)if(n&&(n(e,r),r.isMatchIgnored))return m(t);return n&&n.endSameAsBegin&&(n.endRe=new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")),n.skip?C+=t:(n.excludeBegin&&(C+=t),d(),n.returnBegin||n.excludeBegin||(C=t)),f(n),n.returnBegin?0:t.length}function g(e){const t=e[0],r=n.substr(e.index),i=function e(t,n,r){let i=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(t.endRe,r);if(i){if(t["on:end"]){const e=new VE(t);t["on:end"](n,e),e.isMatchIgnored&&(i=!1)}if(i){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,n,r)}(T,e,r);if(!i)return Lb;const o=T;o.skip?C+=t:(o.returnEnd||o.excludeEnd||(C+=t),d(),o.excludeEnd&&(C=t));do{T.className&&O.closeNode(),T.skip||T.subLanguage||(A+=T.relevance),T=T.parent}while(T!==i.parent);return i.starts&&(i.endSameAsBegin&&(i.starts.endRe=i.endRe),f(i.starts)),o.returnEnd?0:t.length}let _={};function v(t,r){const a=r&&r[0];if(C+=t,null==a)return d(),0;if("begin"===_.type&&"end"===r.type&&_.index===r.index&&""===a){if(C+=n.slice(r.index,r.index+1),!i){const t=new Error("0 width match regex");throw t.languageName=e,t.badRule=_.rule,t}return 1}if(_=r,"begin"===r.type)return h(r);if("illegal"===r.type&&!o){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(T.className||"<unnamed>")+'"');throw e.mode=T,e}if("end"===r.type){const e=g(r);if(e!==Lb)return e}if("illegal"===r.type&&""===a)return 1;if(R>1e5&&R>3*r.index){throw new Error("potential infinite loop, way more iterations than matches")}return C+=a,a.length}const E=b(e);if(!E)throw wb(a.replace("{}",e)),new Error('Unknown language: "'+e+'"');const y=Nb(E,{plugins:r});let S="",T=s||y;const N={},O=new l.__emitter(l);!function(){const e=[];for(let t=T;t!==E;t=t.parent)t.className&&e.unshift(t.className);e.forEach(e=>O.openNode(e))}();let C="",A=0,D=0,R=0,w=!1;try{for(T.matcher.considerAll();;){R++,w?w=!1:T.matcher.considerAll(),T.matcher.lastIndex=D;const e=T.matcher.exec(n);if(!e)break;const t=v(n.substring(D,e.index),e);D=e.index+t}return v(n.substr(D)),O.closeAllNodes(),O.finalize(),S=O.toHTML(),{relevance:Math.floor(A),value:S,language:e,illegal:!1,emitter:O,top:T}}catch(t){if(t.message&&t.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:t.message,context:n.slice(D-100,D+100),mode:t.mode},sofar:S,relevance:0,value:xb(n),emitter:O};if(i)return{illegal:!1,relevance:0,value:xb(n),emitter:O,language:e,top:T,errorRaised:t};throw t}}function p(e,n){n=n||l.languages||Object.keys(t);const r=function(e){const t={relevance:0,emitter:new l.__emitter(l),value:xb(e),illegal:!1,top:s};return t.emitter.addText(e),t}(e),i=n.filter(b).filter(S).map(t=>u(t,e,!1));i.unshift(r);const o=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(b(e.language).supersetOf===t.language)return 1;if(b(t.language).supersetOf===e.language)return-1}return 0}),[a,c]=o,d=a;return d.second_best=c,d}const f={"before:highlightElement":({el:e})=>{l.useBR&&(e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,"\n"))},"after:highlightElement":({result:e})=>{l.useBR&&(e.value=e.value.replace(/\n/g,"<br>"))}},m=/^(<[^>]+>|\t)+/gm,h={"after:highlightElement":({result:e})=>{l.tabReplace&&(e.value=e.value.replace(m,e=>e.replace(/\t/g,l.tabReplace)))}};function g(e){let t=null;const r=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=l.languageDetectRe.exec(t);if(n){const t=b(n[1]);return t||(Ib(a.replace("{}",n[1])),Ib("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>c(e)||b(e))}(e);if(c(r))return;T("before:highlightElement",{el:e,language:r}),t=e;const i=t.textContent,o=r?d(i,{language:r,ignoreIllegals:!0}):p(i);T("after:highlightElement",{el:e,result:o,text:i}),e.innerHTML=o.value,function(e,t,r){const i=t?n[t]:r;e.classList.add("hljs"),i&&e.classList.add(i)}(e,r,o.language),e.result={language:o.language,re:o.relevance,relavance:o.relevance},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.relevance,relavance:o.second_best.relevance})}const _=()=>{if(_.called)return;_.called=!0,Mb("10.6.0","initHighlighting() is deprecated. Use highlightAll() instead.");document.querySelectorAll("pre code").forEach(g)};let v=!1;function E(){if("loading"===document.readyState)return void(v=!0);document.querySelectorAll("pre code").forEach(g)}function b(e){return e=(e||"").toLowerCase(),t[e]||t[n[e]]}function y(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function S(e){const t=b(e);return t&&!t.disableAutodetect}function T(e,t){const n=e;r.forEach((function(e){e[n]&&e[n](t)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){v&&E()}),!1),Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:E,fixMarkup:function(e){return Mb("10.2.0","fixMarkup will be removed entirely in v11.0"),Mb("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"),t=e,l.tabReplace||l.useBR?t.replace(o,e=>"\n"===e?l.useBR?"<br>":e:l.tabReplace?e.replace(/\t/g,l.tabReplace):e):t;var t},highlightElement:g,highlightBlock:function(e){return Mb("10.7.0","highlightBlock will be removed entirely in v12.0"),Mb("10.7.0","Please use highlightElement now."),g(e)},configure:function(e){e.useBR&&(Mb("10.3.0","'useBR' will be removed entirely in v11.0"),Mb("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")),l=kb(l,e)},initHighlighting:_,initHighlightingOnLoad:function(){Mb("10.6.0","initHighlightingOnLoad() is deprecated. Use highlightAll() instead."),v=!0},registerLanguage:function(n,r){let o=null;try{o=r(e)}catch(e){if(wb("Language definition for '{}' could not be registered.".replace("{}",n)),!i)throw e;wb(e),o=s}o.name||(o.name=n),t[n]=o,o.rawDefinition=r.bind(null,e),o.aliases&&y(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:function(){return Object.keys(t)},getLanguage:b,registerAliases:y,requireLanguage:function(e){Mb("10.4.0","requireLanguage will be removed entirely in v11."),Mb("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844");const t=b(e);if(t)return t;throw new Error("The '{}' language is required, but not loaded.".replace("{}",e))},autoDetection:S,inherit:kb,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},vuePlugin:Ob(e).VuePlugin}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString="10.7.2";for(const e in gb)"object"==typeof gb[e]&&GE(gb[e]);return Object.assign(e,gb),e.addPlugin(f),e.addPlugin(Cb),e.addPlugin(h),e}({});var Bb=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){!function(){var t;function n(e){for(var t,n,r,i,o=1,a=[].slice.call(arguments),s=0,l=e.length,c="",d=!1,u=!1,p=function(){return a[o++]},f=function(){for(var n="";/\d/.test(e[s]);)n+=e[s++],t=e[s];return n.length>0?parseInt(n):null};s<l;++s)if(t=e[s],d)switch(d=!1,"."==t?(u=!1,t=e[++s]):"0"==t&&"."==e[s+1]?(u=!0,t=e[s+=2]):u=!0,i=f(),t){case"b":c+=parseInt(p(),10).toString(2);break;case"c":c+="string"==typeof(n=p())||n instanceof String?n:String.fromCharCode(parseInt(n,10));break;case"d":c+=parseInt(p(),10);break;case"f":r=String(parseFloat(p()).toFixed(i||6)),c+=u?r:r.replace(/^0/,"");break;case"j":c+=JSON.stringify(p());break;case"o":c+="0"+parseInt(p(),10).toString(8);break;case"s":c+=p();break;case"x":c+="0x"+parseInt(p(),10).toString(16);break;case"X":c+="0x"+parseInt(p(),10).toString(16).toUpperCase();break;default:c+=t}else"%"===t?d=!0:c+=t;return c}(t=e.exports=n).format=n,t.vsprintf=function(e,t){return n.apply(null,[e].concat(t))},"undefined"!=typeof console&&"function"==typeof console.log&&(t.printf=function(){console.log(n.apply(null,arguments))})}()})),Ub=zb(Error),Fb=Ub;function zb(e){return t.displayName=e.displayName||e.name,t;function t(t){return t&&(t=Bb.apply(null,arguments)),new e(t)}}Ub.eval=zb(EvalError),Ub.range=zb(RangeError),Ub.reference=zb(ReferenceError),Ub.syntax=zb(SyntaxError),Ub.type=zb(TypeError),Ub.uri=zb(URIError),Ub.create=zb;var jb=qb,Gb=function(e,t){var n=t||{},r=n.subset||Pb.listLanguages();n.prefix;var i,o,a,s,l=r.length,c=-1;if("string"!=typeof e)throw Fb("Expected `string` for value, got `%s`",e);o={relevance:0,language:null,value:[]},i={relevance:0,language:null,value:[]};for(;++c<l;)s=r[c],Pb.getLanguage(s)&&((a=qb(s,e,t)).language=s,a.relevance>o.relevance&&(o=a),a.relevance>i.relevance&&(o=i,i=a));o.language&&(i.secondBest=o);return i},Yb=function(e,t){Pb.registerLanguage(e,t)},Vb=function(){return Pb.listLanguages()},Hb=function(e,t){var n,r=e;t&&((r={})[e]=t);for(n in r)Pb.registerAliases(r[n],{languageName:n})};$b.prototype.addText=function(e){var t,n,r=this.stack;if(""===e)return;t=r[r.length-1],(n=t.children[t.children.length-1])&&"text"===n.type?n.value+=e:t.children.push({type:"text",value:e})},$b.prototype.addKeyword=function(e,t){this.openNode(t),this.addText(e),this.closeNode()},$b.prototype.addSublanguage=function(e,t){var n=this.stack,r=n[n.length-1],i=e.rootNode.children,o=t?{type:"element",tagName:"span",properties:{className:[t]},children:i}:i;r.children=r.children.concat(o)},$b.prototype.openNode=function(e){var t=this.stack,n=this.options.classPrefix+e,r=t[t.length-1],i={type:"element",tagName:"span",properties:{className:[n]},children:[]};r.children.push(i),t.push(i)},$b.prototype.closeNode=function(){this.stack.pop()},$b.prototype.closeAllNodes=Wb,$b.prototype.finalize=Wb,$b.prototype.toHTML=function(){return""};function qb(e,t,n){var r,i=Pb.configure({}),o=(n||{}).prefix;if("string"!=typeof e)throw Fb("Expected `string` for name, got `%s`",e);if(!Pb.getLanguage(e))throw Fb("Unknown language: `%s` is not registered",e);if("string"!=typeof t)throw Fb("Expected `string` for value, got `%s`",t);if(null==o&&(o="hljs-"),Pb.configure({__emitter:$b,classPrefix:o}),r=Pb.highlight(t,{language:e,ignoreIllegals:!0}),Pb.configure(i||{}),r.errorRaised)throw r.errorRaised;return{relevance:r.relevance,language:r.language,value:r.emitter.rootNode.children}}function $b(e){this.options=e,this.rootNode={children:[]},this.stack=[this.rootNode]}function Wb(){}var Qb={highlight:jb,highlightAuto:Gb,registerLanguage:Yb,listLanguages:Vb,registerAlias:Hb};function Kb({doc:e,name:t,lowlight:n}){const r=[];return Qa(e,e=>e.type.name===t).forEach(e=>{let t=e.pos+1;const{language:i}=e.node.attrs,o=n.listLanguages();(function e(t,n=[]){return t.map(t=>{const r=[...n,...t.properties?t.properties.className:[]];return t.children?e(t.children,r):{text:t.value,classes:r}}).flat()})(i&&o.includes(i)?n.highlight(i,e.node.textContent).value:n.highlightAuto(e.node.textContent).value).forEach(e=>{const n=t+e.text.length;if(e.classes.length){const i=bE.inline(t,n,{class:e.classes.join(" ")});r.push(i)}t=n})}),NE.create(e,r)}function Xb({name:e,lowlight:t}){return new vt({key:new yt("lowlight"),state:{init:(n,{doc:r})=>Kb({doc:r,name:e,lowlight:t}),apply:(n,r,i,o)=>{const a=i.selection.$head.parent.type.name,s=o.selection.$head.parent.type.name,l=Qa(i.doc,t=>t.type.name===e),c=Qa(o.doc,t=>t.type.name===e);return n.docChanged&&([a,s].includes(e)||c.length!==l.length||n.steps.some(e=>void 0!==e.from&&void 0!==e.to&&l.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?Kb({doc:n.doc,name:e,lowlight:t}):r.map(n.mapping,n.doc)}},props:{decorations(e){return this.getState(e)}}})}var Zb=Jg.extend({defaultOptions:{...Jg.options,lowlight:Qb},addProseMirrorPlugins(){var e;return[...(null===(e=this.parent)||void 0===e?void 0:e.call(this))||[],Xb({name:"codeBlock",lowlight:this.options.lowlight})]}});function Jb(){return i.a.createElement(sc,null,i.a.createElement("pre",null,i.a.createElement(lc,{as:"code"})))}var ey=n(50),ty=n.n(ey),ny=Zb.extend({addNodeView:function(){return new rc(Jb)}}).configure({lowlight:ty.a}),ry=n(4),iy=n.n(ry),oy=(n(30),n(43)),ay=n.n(oy),sy=(n(44),n(45),n(46),n(47),n(48),n(51)),ly=n.n(sy),cy=n(22),dy={insert:"head",singleton:!1},uy=(Tg()(cy.a,dy),cy.a.locals,n(23)),py={insert:"head",singleton:!1},fy=(Tg()(uy.a,py),uy.a.locals,Object(Cf.b)((function(e){var t=e.editor,n=e.imageUploadUrl,r=new iy.a({allowMultipleUploads:!1,autoProceed:!0,debug:!0});return r.use(ly.a,{endpoint:n||"/api/v1/direct_uploads",formData:!0,fieldName:"blob"}),r.on("upload-success",(function(e,n){var r=n.body.imageURL;t.chain().focus().setImage({src:r}).run()})),i.a.createElement("div",null,i.a.createElement(ay.a,{uppy:r,proudlyDisplayPoweredByUppy:!1,closeModalOnClickOutside:!0,open:Af.showImageUpload,onRequestClose:function(){return Af.showImageUpload=!1}}))})));function my(e){return Fg({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"}}]})(e)}function hy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function gy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"}}]})(e)}function _y(e){return Fg({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"}}]})(e)}function vy(e){return Fg({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"}}]})(e)}function Ey(e){return Fg({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z"}}]})(e)}function by(){return(by=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function yy(e){var t=e.editor,n=e.formatterOptions;if(!t)return null;var r=[{Icon:my,command:function(){return t.chain().focus().toggleBold().run()},active:t.isActive("bold"),optionName:"bold"},{Icon:_y,command:function(){return t.chain().focus().toggleItalic().run()},active:t.isActive("italic"),optionName:"italic"},{Icon:Ey,command:function(){return t.chain().focus().toggleStrike().run()},active:t.isActive("strike"),optionName:"strike"},{Icon:vy,command:function(){if(t.isActive("link"))t.chain().focus().unsetLink().run();else{var e=window.prompt("Please enter your URL");t.chain().focus().setLink({href:e}).run()}},active:t.isActive("link"),optionName:"link"},{Icon:hy,command:function(){return t.chain().focus().toggleCode().run()},active:t.isActive("code"),optionName:"code"},{Icon:gy,command:function(){return t.chain().focus().toggleHighlight().run()},active:t.isActive("highlight"),optionName:"highlight"}];return i.a.createElement(Xl,{editor:t},i.a.createElement("div",{className:"relative flex items-center overflow-hidden bg-gray-900 rounded shadow"},r.filter((function(e){var t=e.optionName;return n.includes(t)})).map((function(e){return i.a.createElement(Sy,by({},e,{key:e.optionName}))}))))}var Sy=function(e){var t=e.Icon,n=e.command,r=e.active,o=e.iconSize;return i.a.createElement("div",{className:yg()("p-3 cursor-pointer hover:bg-gray-800",{"text-gray-400":!r,"text-white":r}),onClick:n},i.a.createElement(t,{size:o||15}))},Ty=ja.create({name:"external-video",defaultOptions:{inline:!1,HTMLAttributes:{}},inline:function(){return this.options.inline},group:function(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:function(){return{src:{default:null},title:{default:null},frameborder:{default:"0"},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"},allowfullscreen:{default:"allowfullscreen"}}},parseHTML:function(){return[{tag:"iframe[src]"}]},renderHTML:function(e){var t=e.HTMLAttributes;return["div",{class:"video-wrapper"},["iframe",To(this.options.HTMLAttributes,t)]]},addCommands:function(){var e=this;return{setExternalVideo:function(t){return function(n){return n.commands.insertContent({type:e.name,attrs:t})}}}}}),Ny=n(24),Oy={insert:"head",singleton:!1},Cy=(Tg()(Ny.a,Oy),Ny.a.locals,["hideBlockSelector","hideBubbleMenu","formatterOptions","className","endpoint","initialValue","onChange"]);function Ay(e){return function(e){if(Array.isArray(e))return Dy(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dy(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ry(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var wy=function(e,t){var n,r=e.hideBlockSelector,o=void 0!==r&&r,a=e.hideBubbleMenu,s=void 0!==a&&a,l=e.formatterOptions,c=void 0===l?["bold","italic","code","highlight","strike","link"]:l,d=e.className,u=e.endpoint,p=e.initialValue,f=void 0===p?"":p,m=e.onChange,h=void 0===m?function(){}:m,g=Ry(e,Cy);n=g.extensions?g.extensions:[fd,Nd,hf,ff,ny,Of,gf,Ty,Ef],o||(n=[].concat(Ay(n),[Kg]));var _=Jl({extensions:n,content:f,injectCSS:!1,editorProps:{attributes:{class:d||"prose focus:outline-none whitespace-pre-wrap"}},onUpdate:function(e){var t=e.editor;return h(t.getHTML())}});return i.a.useImperativeHandle(t,(function(){return{editor:_}})),i.a.createElement(i.a.Fragment,null,!s&&i.a.createElement(yy,{editor:_,formatterOptions:c}),i.a.createElement(fy,{editor:_,imageUploadUrl:u}),i.a.createElement(ac,{editor:_}))};t.default=i.a.forwardRef(wy)}])}));
|