Page MenuHomeMusing Studio

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/prose/dist/prose.bundle.js b/prose/dist/prose.bundle.js
index 448defa..c6fe84f 100644
--- a/prose/dist/prose.bundle.js
+++ b/prose/dist/prose.bundle.js
@@ -1,2 +1,2 @@
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=70)}([function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=Object.prototype.hasOwnProperty;function i(t,e){return o.call(t,e)}function s(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(65535!=(65535&t)&&65534!=(65535&t)&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function a(t){if(t>65535){var e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}var c=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,l=new RegExp(c.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),u=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,p=n(4);var h=/[&<>"]/,f=/[&<>"]/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function m(t){return d[t]}var v=/[.?*+^$[\]\\(){}|-]/g;var g=n(1);e.lib={},e.lib.mdurl=n(5),e.lib.ucmicro=n(20),e.assign=function(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach((function(e){if(e){if("object"!==r(e))throw new TypeError(e+"must be object");Object.keys(e).forEach((function(n){t[n]=e[n]}))}})),t},e.isString=function(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)},e.has=i,e.unescapeMd=function(t){return t.indexOf("\\")<0?t:t.replace(c,"$1")},e.unescapeAll=function(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(l,(function(t,e,n){return e||function(t,e){var n=0;return i(p,e)?p[e]:35===e.charCodeAt(0)&&u.test(e)&&s(n="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10))?a(n):t}(t,n)}))},e.isValidEntityCode=s,e.fromCodePoint=a,e.escapeHtml=function(t){return h.test(t)?t.replace(f,m):t},e.arrayReplaceAt=function(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))},e.isSpace=function(t){switch(t){case 9:case 32:return!0}return!1},e.isWhiteSpace=function(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},e.isMdAsciiPunct=function(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},e.isPunctChar=function(t){return g.test(t)},e.escapeRE=function(t){return t.replace(v,"\\$&")},e.normalizeReference=function(t){return t=t.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}},function(t,e){t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(t,e,n){"use strict";function r(){this.__rules__=[],this.__cache__=null}r.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},r.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach((function(t){t.enabled&&t.alt.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))})),t.__cache__={},e.forEach((function(e){t.__cache__[e]=[],t.__rules__.forEach((function(n){n.enabled&&(e&&n.alt.indexOf(e)<0||t.__cache__[e].push(n.fn))}))}))},r.prototype.at=function(t,e,n){var r=this.__find__(t),o=n||{};if(-1===r)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=o.alt||[],this.__cache__=null},r.prototype.before=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},r.prototype.after=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o+1,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},r.prototype.push=function(t,e,n){var r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},r.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach((function(t){var r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!0,n.push(t)}),this),this.__cache__=null,n},r.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach((function(t){t.enabled=!1})),this.enable(t,e)},r.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach((function(t){var r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!1,n.push(t)}),this),this.__cache__=null,n},r.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},t.exports=r},function(t,e,n){"use strict";function r(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}r.prototype.attrIndex=function(t){var e,n,r;if(!this.attrs)return-1;for(n=0,r=(e=this.attrs).length;n<r;n++)if(e[n][0]===t)return n;return-1},r.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},r.prototype.attrSet=function(t,e){var n=this.attrIndex(t),r=[t,e];n<0?this.attrPush(r):this.attrs[n]=r},r.prototype.attrGet=function(t){var e=this.attrIndex(t),n=null;return e>=0&&(n=this.attrs[e][1]),n},r.prototype.attrJoin=function(t,e){var n=this.attrIndex(t);n<0?this.attrPush([t,e]):this.attrs[n][1]=this.attrs[n][1]+" "+e},t.exports=r},function(t,e,n){"use strict";t.exports=n(15)},function(t,e,n){"use strict";t.exports.encode=n(16),t.exports.decode=n(17),t.exports.format=n(18),t.exports.parse=n(19)},function(t,e){t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(t,e){t.exports=/[\0-\x1F\x7F-\x9F]/},function(t,e){t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},function(t,e,n){"use strict";var r="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",o="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",i=new RegExp("^(?:"+r+"|"+o+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),s=new RegExp("^(?:"+r+"|"+o+")");t.exports.HTML_TAG_RE=i,t.exports.HTML_OPEN_CLOSE_TAG_RE=s},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a=[],c=e.length;for(n=0;n<c;n++)126===(o=e[n]).marker&&-1!==o.end&&(i=e[o.end],(s=t.tokens[o.token]).type="s_open",s.tag="s",s.nesting=1,s.markup="~~",s.content="",(s=t.tokens[i.token]).type="s_close",s.tag="s",s.nesting=-1,s.markup="~~",s.content="","text"===t.tokens[i.token-1].type&&"~"===t.tokens[i.token-1].content&&a.push(i.token-1));for(;a.length;){for(r=(n=a.pop())+1;r<t.tokens.length&&"s_close"===t.tokens[r].type;)r++;n!==--r&&(s=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=s)}}t.exports.tokenize=function(t,e){var n,r,o,i,s=t.pos,a=t.src.charCodeAt(s);if(e)return!1;if(126!==a)return!1;if(o=(r=t.scanDelims(t.pos,!0)).length,i=String.fromCharCode(a),o<2)return!1;for(o%2&&(t.push("text","",0).content=i,o--),n=0;n<o;n+=2)t.push("text","",0).content=i+i,t.delimiters.push({marker:a,length:0,jump:n,token:t.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return t.pos+=r.length,!0},t.exports.postProcess=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(t,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(t,n[e].delimiters)}},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a;for(n=e.length-1;n>=0;n--)95!==(r=e[n]).marker&&42!==r.marker||-1!==r.end&&(o=e[r.end],a=n>0&&e[n-1].end===r.end+1&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1&&e[n-1].marker===r.marker,s=String.fromCharCode(r.marker),(i=t.tokens[r.token]).type=a?"strong_open":"em_open",i.tag=a?"strong":"em",i.nesting=1,i.markup=a?s+s:s,i.content="",(i=t.tokens[o.token]).type=a?"strong_close":"em_close",i.tag=a?"strong":"em",i.nesting=-1,i.markup=a?s+s:s,i.content="",a&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}t.exports.tokenize=function(t,e){var n,r,o=t.pos,i=t.src.charCodeAt(o);if(e)return!1;if(95!==i&&42!==i)return!1;for(r=t.scanDelims(t.pos,42===i),n=0;n<r.length;n++)t.push("text","",0).content=String.fromCharCode(i),t.delimiters.push({marker:i,length:r.length,jump:n,token:t.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return t.pos+=r.length,!0},t.exports.postProcess=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(t,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(t,n[e].delimiters)}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";t.exports=n(14)},function(t,e,n){"use strict";var r=n(0),o=n(22),i=n(26),s=n(27),a=n(35),c=n(49),l=n(62),u=n(5),p=n(64),h={default:n(67),zero:n(68),commonmark:n(69)},f=/^(vbscript|javascript|file|data):/,d=/^data:image\/(gif|png|jpeg|webp);/;function m(t){var e=t.trim().toLowerCase();return!f.test(e)||!!d.test(e)}var v=["http:","https:","mailto:"];function g(t){var e=u.parse(t,!0);if(e.hostname&&(!e.protocol||v.indexOf(e.protocol)>=0))try{e.hostname=p.toASCII(e.hostname)}catch(t){}return u.encode(u.format(e))}function y(t){var e=u.parse(t,!0);if(e.hostname&&(!e.protocol||v.indexOf(e.protocol)>=0))try{e.hostname=p.toUnicode(e.hostname)}catch(t){}return u.decode(u.format(e))}function b(t,e){if(!(this instanceof b))return new b(t,e);e||r.isString(t)||(e=t||{},t="default"),this.inline=new c,this.block=new a,this.core=new s,this.renderer=new i,this.linkify=new l,this.validateLink=m,this.normalizeLink=g,this.normalizeLinkText=y,this.utils=r,this.helpers=r.assign({},o),this.options={},this.configure(t),e&&this.set(e)}b.prototype.set=function(t){return r.assign(this.options,t),this},b.prototype.configure=function(t){var e,n=this;if(r.isString(t)&&!(t=h[e=t]))throw new Error('Wrong `markdown-it` preset "'+e+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&n.set(t.options),t.components&&Object.keys(t.components).forEach((function(e){t.components[e].rules&&n[e].ruler.enableOnly(t.components[e].rules),t.components[e].rules2&&n[e].ruler2.enableOnly(t.components[e].rules2)})),this},b.prototype.enable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.enable(t,!0))}),this),n=n.concat(this.inline.ruler2.enable(t,!0));var r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},b.prototype.disable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.disable(t,!0))}),this),n=n.concat(this.inline.ruler2.disable(t,!0));var r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},b.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},b.prototype.parse=function(t,e){if("string"!=typeof t)throw new Error("Input data should be a String");var n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},b.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},b.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},b.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)},t.exports=b},function(t){t.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}')},function(t,e,n){"use strict";var r={};function o(t,e,n){var i,s,a,c,l,u="";for("string"!=typeof e&&(n=e,e=o.defaultChars),void 0===n&&(n=!0),l=function(t){var e,n,o=r[t];if(o)return o;for(o=r[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?o.push(n):o.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)o[t.charCodeAt(e)]=t[e];return o}(e),i=0,s=t.length;i<s;i++)if(a=t.charCodeAt(i),n&&37===a&&i+2<s&&/^[0-9a-f]{2}$/i.test(t.slice(i+1,i+3)))u+=t.slice(i,i+3),i+=2;else if(a<128)u+=l[a];else if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&i+1<s&&(c=t.charCodeAt(i+1))>=56320&&c<=57343){u+=encodeURIComponent(t[i]+t[i+1]),i++;continue}u+="%EF%BF%BD"}else u+=encodeURIComponent(t[i]);return u}o.defaultChars=";/?:@&=+$,-_.!~*'()#",o.componentChars="-_.!~*'()",t.exports=o},function(t,e,n){"use strict";var r={};function o(t,e){var n;return"string"!=typeof e&&(e=o.defaultChars),n=function(t){var e,n,o=r[t];if(o)return o;for(o=r[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),o.push(n);for(e=0;e<t.length;e++)o[n=t.charCodeAt(e)]="%"+("0"+n.toString(16).toUpperCase()).slice(-2);return o}(e),t.replace(/(%[a-f0-9]{2})+/gi,(function(t){var e,r,o,i,s,a,c,l="";for(e=0,r=t.length;e<r;e+=3)(o=parseInt(t.slice(e+1,e+3),16))<128?l+=n[o]:192==(224&o)&&e+3<r&&128==(192&(i=parseInt(t.slice(e+4,e+6),16)))?(l+=(c=o<<6&1984|63&i)<128?"��":String.fromCharCode(c),e+=3):224==(240&o)&&e+6<r&&(i=parseInt(t.slice(e+4,e+6),16),s=parseInt(t.slice(e+7,e+9),16),128==(192&i)&&128==(192&s))?(l+=(c=o<<12&61440|i<<6&4032|63&s)<2048||c>=55296&&c<=57343?"���":String.fromCharCode(c),e+=6):240==(248&o)&&e+9<r&&(i=parseInt(t.slice(e+4,e+6),16),s=parseInt(t.slice(e+7,e+9),16),a=parseInt(t.slice(e+10,e+12),16),128==(192&i)&&128==(192&s)&&128==(192&a))?((c=o<<18&1835008|i<<12&258048|s<<6&4032|63&a)<65536||c>1114111?l+="����":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),e+=9):l+="�";return l}))}o.defaultChars=";/?:@&=+$,#",o.componentChars="",t.exports=o},function(t,e,n){"use strict";t.exports=function(t){var e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&-1!==t.hostname.indexOf(":")?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||""}},function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var o=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(a),l=["%","/","?",";","#"].concat(c),u=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},d={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};r.prototype.parse=function(t,e){var n,r,i,a,c,m=t;if(m=m.trim(),!e&&1===t.split("#").length){var v=s.exec(m);if(v)return this.pathname=v[1],v[2]&&(this.search=v[2]),this}var g=o.exec(m);if(g&&(i=(g=g[0]).toLowerCase(),this.protocol=g,m=m.substr(g.length)),(e||g||m.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(c="//"===m.substr(0,2))||g&&f[g]||(m=m.substr(2),this.slashes=!0)),!f[g]&&(c||g&&!d[g])){var y,b,k=-1;for(n=0;n<u.length;n++)-1!==(a=m.indexOf(u[n]))&&(-1===k||a<k)&&(k=a);for(-1!==(b=-1===k?m.lastIndexOf("@"):m.lastIndexOf("@",k))&&(y=m.slice(0,b),m=m.slice(b+1),this.auth=y),k=-1,n=0;n<l.length;n++)-1!==(a=m.indexOf(l[n]))&&(-1===k||a<k)&&(k=a);-1===k&&(k=m.length),":"===m[k-1]&&k--;var w=m.slice(0,k);m=m.slice(k),this.parseHost(w),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x){var C=this.hostname.split(/\./);for(n=0,r=C.length;n<r;n++){var _=C[n];if(_&&!_.match(p)){for(var S="",A=0,M=_.length;A<M;A++)_.charCodeAt(A)>127?S+="x":S+=_[A];if(!S.match(p)){var D=C.slice(0,n),E=C.slice(n+1),O=_.match(h);O&&(D.push(O[1]),E.unshift(O[2])),E.length&&(m=E.join(".")+m),this.hostname=D.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var T=m.indexOf("#");-1!==T&&(this.hash=m.substr(T),m=m.slice(0,T));var N=m.indexOf("?");return-1!==N&&(this.search=m.substr(N),m=m.slice(0,N)),m&&(this.pathname=m),d[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this},r.prototype.parseHost=function(t){var e=i.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},t.exports=function(t,e){if(t&&t instanceof r)return t;var n=new r;return n.parse(t,e),n}},function(t,e,n){"use strict";e.Any=n(6),e.Cc=n(7),e.Cf=n(21),e.P=n(1),e.Z=n(8)},function(t,e){t.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},function(t,e,n){"use strict";e.parseLinkLabel=n(23),e.parseLinkDestination=n(24),e.parseLinkTitle=n(25)},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i,s,a=-1,c=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<c;){if(93===(i=t.src.charCodeAt(t.pos))&&0===--r){o=!0;break}if(s=t.pos,t.md.inline.skipToken(t),91===i)if(s===t.pos-1)r++;else if(n)return t.pos=l,-1}return o&&(a=t.pos),t.pos=l,a}},function(t,e,n){"use strict";var r=n(0).unescapeAll;t.exports=function(t,e,n){var o,i,s=e,a={ok:!1,pos:0,lines:0,str:""};if(60===t.charCodeAt(e)){for(e++;e<n;){if(10===(o=t.charCodeAt(e)))return a;if(62===o)return a.pos=e+1,a.str=r(t.slice(s+1,e)),a.ok=!0,a;92===o&&e+1<n?e+=2:e++}return a}for(i=0;e<n&&32!==(o=t.charCodeAt(e))&&!(o<32||127===o);)if(92===o&&e+1<n)e+=2;else{if(40===o&&i++,41===o){if(0===i)break;i--}e++}return s===e||0!==i||(a.str=r(t.slice(s,e)),a.lines=0,a.pos=e,a.ok=!0),a}},function(t,e,n){"use strict";var r=n(0).unescapeAll;t.exports=function(t,e,n){var o,i,s=0,a=e,c={ok:!1,pos:0,lines:0,str:""};if(e>=n)return c;if(34!==(i=t.charCodeAt(e))&&39!==i&&40!==i)return c;for(e++,40===i&&(i=41);e<n;){if((o=t.charCodeAt(e))===i)return c.pos=e+1,c.lines=s,c.str=r(t.slice(a+1,e)),c.ok=!0,c;10===o?s++:92===o&&e+1<n&&(e++,10===t.charCodeAt(e)&&s++),e++}return c}},function(t,e,n){"use strict";var r=n(0).assign,o=n(0).unescapeAll,i=n(0).escapeHtml,s={};function a(){this.rules=r({},s)}s.code_inline=function(t,e,n,r,o){var s=t[e];return"<code"+o.renderAttrs(s)+">"+i(t[e].content)+"</code>"},s.code_block=function(t,e,n,r,o){var s=t[e];return"<pre"+o.renderAttrs(s)+"><code>"+i(t[e].content)+"</code></pre>\n"},s.fence=function(t,e,n,r,s){var a,c,l,u,p=t[e],h=p.info?o(p.info).trim():"",f="";return h&&(f=h.split(/\s+/g)[0]),0===(a=n.highlight&&n.highlight(p.content,f)||i(p.content)).indexOf("<pre")?a+"\n":h?(c=p.attrIndex("class"),l=p.attrs?p.attrs.slice():[],c<0?l.push(["class",n.langPrefix+f]):l[c][1]+=" "+n.langPrefix+f,u={attrs:l},"<pre><code"+s.renderAttrs(u)+">"+a+"</code></pre>\n"):"<pre><code"+s.renderAttrs(p)+">"+a+"</code></pre>\n"},s.image=function(t,e,n,r,o){var i=t[e];return i.attrs[i.attrIndex("alt")][1]=o.renderInlineAsText(i.children,n,r),o.renderToken(t,e,n)},s.hardbreak=function(t,e,n){return n.xhtmlOut?"<br />\n":"<br>\n"},s.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?"<br />\n":"<br>\n":"\n"},s.text=function(t,e){return i(t[e].content)},s.html_block=function(t,e){return t[e].content},s.html_inline=function(t,e){return t[e].content},a.prototype.renderAttrs=function(t){var e,n,r;if(!t.attrs)return"";for(r="",e=0,n=t.attrs.length;e<n;e++)r+=" "+i(t.attrs[e][0])+'="'+i(t.attrs[e][1])+'"';return r},a.prototype.renderToken=function(t,e,n){var r,o="",i=!1,s=t[e];return s.hidden?"":(s.block&&-1!==s.nesting&&e&&t[e-1].hidden&&(o+="\n"),o+=(-1===s.nesting?"</":"<")+s.tag,o+=this.renderAttrs(s),0===s.nesting&&n.xhtmlOut&&(o+=" /"),s.block&&(i=!0,1===s.nesting&&e+1<t.length&&("inline"===(r=t[e+1]).type||r.hidden||-1===r.nesting&&r.tag===s.tag)&&(i=!1)),o+=i?">\n":">")},a.prototype.renderInline=function(t,e,n){for(var r,o="",i=this.rules,s=0,a=t.length;s<a;s++)void 0!==i[r=t[s].type]?o+=i[r](t,s,e,n,this):o+=this.renderToken(t,s,e);return o},a.prototype.renderInlineAsText=function(t,e,n){for(var r="",o=0,i=t.length;o<i;o++)"text"===t[o].type?r+=t[o].content:"image"===t[o].type&&(r+=this.renderInlineAsText(t[o].children,e,n));return r},a.prototype.render=function(t,e,n){var r,o,i,s="",a=this.rules;for(r=0,o=t.length;r<o;r++)"inline"===(i=t[r].type)?s+=this.renderInline(t[r].children,e,n):void 0!==a[i]?s+=a[t[r].type](t,r,e,n,this):s+=this.renderToken(t,r,e,n);return s},t.exports=a},function(t,e,n){"use strict";var r=n(2),o=[["normalize",n(28)],["block",n(29)],["inline",n(30)],["linkify",n(31)],["replacements",n(32)],["smartquotes",n(33)]];function i(){this.ruler=new r;for(var t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1])}i.prototype.process=function(t){var e,n,r;for(e=0,n=(r=this.ruler.getRules("")).length;e<n;e++)r[e](t)},i.prototype.State=n(34),t.exports=i},function(t,e,n){"use strict";var r=/\r\n?|\n/g,o=/\0/g;t.exports=function(t){var e;e=(e=t.src.replace(r,"\n")).replace(o,"�"),t.src=e}},function(t,e,n){"use strict";t.exports=function(t){var e;t.inlineMode?((e=new t.Token("inline","",0)).content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r,o=t.tokens;for(n=0,r=o.length;n<r;n++)"inline"===(e=o[n]).type&&t.md.inline.parse(e.content,t.md,t.env,e.children)}},function(t,e,n){"use strict";var r=n(0).arrayReplaceAt;function o(t){return/^<\/a\s*>/i.test(t)}t.exports=function(t){var e,n,i,s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w=t.tokens;if(t.md.options.linkify)for(n=0,i=w.length;n<i;n++)if("inline"===w[n].type&&t.md.linkify.pretest(w[n].content))for(m=0,e=(s=w[n].children).length-1;e>=0;e--)if("link_close"!==(c=s[e]).type){if("html_inline"===c.type&&(k=c.content,/^<a[>\s]/i.test(k)&&m>0&&m--,o(c.content)&&m++),!(m>0)&&"text"===c.type&&t.md.linkify.test(c.content)){for(p=c.content,b=t.md.linkify.match(p),l=[],d=c.level,f=0,u=0;u<b.length;u++)v=b[u].url,g=t.md.normalizeLink(v),t.md.validateLink(g)&&(y=b[u].text,y=b[u].schema?"mailto:"!==b[u].schema||/^mailto:/i.test(y)?t.md.normalizeLinkText(y):t.md.normalizeLinkText("mailto:"+y).replace(/^mailto:/,""):t.md.normalizeLinkText("http://"+y).replace(/^http:\/\//,""),(h=b[u].index)>f&&((a=new t.Token("text","",0)).content=p.slice(f,h),a.level=d,l.push(a)),(a=new t.Token("link_open","a",1)).attrs=[["href",g]],a.level=d++,a.markup="linkify",a.info="auto",l.push(a),(a=new t.Token("text","",0)).content=y,a.level=d,l.push(a),(a=new t.Token("link_close","a",-1)).level=--d,a.markup="linkify",a.info="auto",l.push(a),f=b[u].lastIndex);f<p.length&&((a=new t.Token("text","",0)).content=p.slice(f),a.level=d,l.push(a)),w[n].children=s=r(s,e,l)}}else for(e--;s[e].level!==c.level&&"link_open"!==s[e].type;)e--}},function(t,e,n){"use strict";var r=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,o=/\((c|tm|r|p)\)/i,i=/\((c|tm|r|p)\)/gi,s={c:"©",r:"®",p:"§",tm:"™"};function a(t,e){return s[e.toLowerCase()]}function c(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)"text"!==(n=t[e]).type||r||(n.content=n.content.replace(i,a)),"link_open"===n.type&&"auto"===n.info&&r--,"link_close"===n.type&&"auto"===n.info&&r++}function l(t){var e,n,o=0;for(e=t.length-1;e>=0;e--)"text"!==(n=t[e]).type||o||r.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),"link_open"===n.type&&"auto"===n.info&&o--,"link_close"===n.type&&"auto"===n.info&&o++}t.exports=function(t){var e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&(o.test(t.tokens[e].content)&&c(t.tokens[e].children),r.test(t.tokens[e].content)&&l(t.tokens[e].children))}},function(t,e,n){"use strict";var r=n(0).isWhiteSpace,o=n(0).isPunctChar,i=n(0).isMdAsciiPunct,s=/['"]/,a=/['"]/g;function c(t,e,n){return t.substr(0,e)+n+t.substr(e+1)}function l(t,e){var n,s,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S,A,M;for(S=[],n=0;n<t.length;n++){for(s=t[n],f=t[n].level,C=S.length-1;C>=0&&!(S[C].level<=f);C--);if(S.length=C+1,"text"===s.type){p=0,h=(l=s.content).length;t:for(;p<h&&(a.lastIndex=p,u=a.exec(l));){if(w=x=!0,p=u.index+1,_="'"===u[0],m=32,u.index-1>=0)m=l.charCodeAt(u.index-1);else for(C=n-1;C>=0&&("softbreak"!==t[C].type&&"hardbreak"!==t[C].type);C--)if("text"===t[C].type){m=t[C].content.charCodeAt(t[C].content.length-1);break}if(v=32,p<h)v=l.charCodeAt(p);else for(C=n+1;C<t.length&&("softbreak"!==t[C].type&&"hardbreak"!==t[C].type);C++)if("text"===t[C].type){v=t[C].content.charCodeAt(0);break}if(g=i(m)||o(String.fromCharCode(m)),y=i(v)||o(String.fromCharCode(v)),b=r(m),(k=r(v))?w=!1:y&&(b||g||(w=!1)),b?x=!1:g&&(k||y||(x=!1)),34===v&&'"'===u[0]&&m>=48&&m<=57&&(x=w=!1),w&&x&&(w=!1,x=y),w||x){if(x)for(C=S.length-1;C>=0&&(d=S[C],!(S[C].level<f));C--)if(d.single===_&&S[C].level===f){d=S[C],_?(A=e.md.options.quotes[2],M=e.md.options.quotes[3]):(A=e.md.options.quotes[0],M=e.md.options.quotes[1]),s.content=c(s.content,u.index,M),t[d.token].content=c(t[d.token].content,d.pos,A),p+=M.length-1,d.token===n&&(p+=A.length-1),h=(l=s.content).length,S.length=C;continue t}w?S.push({token:n,pos:u.index,single:_,level:f}):x&&_&&(s.content=c(s.content,u.index,"’"))}else _&&(s.content=c(s.content,u.index,"’"))}}}}t.exports=function(t){var e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&s.test(t.tokens[e].content)&&l(t.tokens[e].children,t)}},function(t,e,n){"use strict";var r=n(3);function o(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}o.prototype.Token=r,t.exports=o},function(t,e,n){"use strict";var r=n(2),o=[["table",n(36),["paragraph","reference"]],["code",n(37)],["fence",n(38),["paragraph","reference","blockquote","list"]],["blockquote",n(39),["paragraph","reference","blockquote","list"]],["hr",n(40),["paragraph","reference","blockquote","list"]],["list",n(41),["paragraph","reference","blockquote"]],["reference",n(42)],["heading",n(43),["paragraph","reference","blockquote"]],["lheading",n(44)],["html_block",n(45),["paragraph","reference","blockquote"]],["paragraph",n(47)]];function i(){this.ruler=new r;for(var t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1],{alt:(o[t][2]||[]).slice()})}i.prototype.tokenize=function(t,e,n){for(var r,o=this.ruler.getRules(""),i=o.length,s=e,a=!1,c=t.md.options.maxNesting;s<n&&(t.line=s=t.skipEmptyLines(s),!(s>=n))&&!(t.sCount[s]<t.blkIndent);){if(t.level>=c){t.line=n;break}for(r=0;r<i&&!o[r](t,s,n,!1);r++);t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),(s=t.line)<n&&t.isEmpty(s)&&(a=!0,s++,t.line=s)}},i.prototype.parse=function(t,e,n,r){var o;t&&(o=new this.State(t,e,n,r),this.tokenize(o,o.line,o.lineMax))},i.prototype.State=n(48),t.exports=i},function(t,e,n){"use strict";var r=n(0).isSpace;function o(t,e){var n=t.bMarks[e]+t.blkIndent,r=t.eMarks[e];return t.src.substr(n,r-n)}function i(t){var e,n=[],r=0,o=t.length,i=0,s=0,a=!1,c=0;for(e=t.charCodeAt(r);r<o;)96===e?a?(a=!1,c=r):i%2==0&&(a=!0,c=r):124!==e||i%2!=0||a||(n.push(t.substring(s,r)),s=r+1),92===e?i++:i=0,++r===o&&a&&(a=!1,r=c+1),e=t.charCodeAt(r);return n.push(t.substring(s)),n}t.exports=function(t,e,n,s){var a,c,l,u,p,h,f,d,m,v,g,y;if(e+2>n)return!1;if(p=e+1,t.sCount[p]<t.blkIndent)return!1;if(t.sCount[p]-t.blkIndent>=4)return!1;if((l=t.bMarks[p]+t.tShift[p])>=t.eMarks[p])return!1;if(124!==(a=t.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l<t.eMarks[p];){if(124!==(a=t.src.charCodeAt(l))&&45!==a&&58!==a&&!r(a))return!1;l++}for(h=(c=o(t,e+1)).split("|"),m=[],u=0;u<h.length;u++){if(!(v=h[u].trim())){if(0===u||u===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(v))return!1;58===v.charCodeAt(v.length-1)?m.push(58===v.charCodeAt(0)?"center":"right"):58===v.charCodeAt(0)?m.push("left"):m.push("")}if(-1===(c=o(t,e).trim()).indexOf("|"))return!1;if(t.sCount[e]-t.blkIndent>=4)return!1;if((f=(h=i(c.replace(/^\||\|$/g,""))).length)>m.length)return!1;if(s)return!0;for((d=t.push("table_open","table",1)).map=g=[e,0],(d=t.push("thead_open","thead",1)).map=[e,e+1],(d=t.push("tr_open","tr",1)).map=[e,e+1],u=0;u<h.length;u++)(d=t.push("th_open","th",1)).map=[e,e+1],m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=t.push("inline","",0)).content=h[u].trim(),d.map=[e,e+1],d.children=[],d=t.push("th_close","th",-1);for(d=t.push("tr_close","tr",-1),d=t.push("thead_close","thead",-1),(d=t.push("tbody_open","tbody",1)).map=y=[e+2,0],p=e+2;p<n&&!(t.sCount[p]<t.blkIndent)&&-1!==(c=o(t,p).trim()).indexOf("|")&&!(t.sCount[p]-t.blkIndent>=4);p++){for(h=i(c.replace(/^\||\|$/g,"")),d=t.push("tr_open","tr",1),u=0;u<f;u++)d=t.push("td_open","td",1),m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=t.push("inline","",0)).content=h[u]?h[u].trim():"",d.children=[],d=t.push("td_close","td",-1);d=t.push("tr_close","tr",-1)}return d=t.push("tbody_close","tbody",-1),d=t.push("table_close","table",-1),g[1]=y[1]=p,t.line=p,!0}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i;if(t.sCount[e]-t.blkIndent<4)return!1;for(o=r=e+1;r<n;)if(t.isEmpty(r))r++;else{if(!(t.sCount[r]-t.blkIndent>=4))break;o=++r}return t.line=o,(i=t.push("code_block","code",0)).content=t.getLines(e,o,4+t.blkIndent,!0),i.map=[e,t.line],!0}},function(t,e,n){"use strict";t.exports=function(t,e,n,r){var o,i,s,a,c,l,u,p=!1,h=t.bMarks[e]+t.tShift[e],f=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(o=t.src.charCodeAt(h))&&96!==o)return!1;if(c=h,(i=(h=t.skipChars(h,o))-c)<3)return!1;if(u=t.src.slice(c,h),s=t.src.slice(h,f),96===o&&s.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;for(a=e;!(++a>=n)&&!((h=c=t.bMarks[a]+t.tShift[a])<(f=t.eMarks[a])&&t.sCount[a]<t.blkIndent);)if(t.src.charCodeAt(h)===o&&!(t.sCount[a]-t.blkIndent>=4||(h=t.skipChars(h,o))-c<i||(h=t.skipSpaces(h))<f)){p=!0;break}return i=t.sCount[e],t.line=a+(p?1:0),(l=t.push("fence","code",0)).info=s,l.content=t.getLines(e+1,a,i,!0),l.markup=u,l.map=[e,t.line],!0}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S=t.lineMax,A=t.bMarks[e]+t.tShift[e],M=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(62!==t.src.charCodeAt(A++))return!1;if(o)return!0;for(c=f=t.sCount[e]+A-(t.bMarks[e]+t.tShift[e]),32===t.src.charCodeAt(A)?(A++,c++,f++,i=!1,k=!0):9===t.src.charCodeAt(A)?(k=!0,(t.bsCount[e]+f)%4==3?(A++,c++,f++,i=!1):i=!0):k=!1,d=[t.bMarks[e]],t.bMarks[e]=A;A<M&&(s=t.src.charCodeAt(A),r(s));)9===s?f+=4-(f+t.bsCount[e]+(i?1:0))%4:f++,A++;for(m=[t.bsCount[e]],t.bsCount[e]=t.sCount[e]+1+(k?1:0),u=A>=M,y=[t.sCount[e]],t.sCount[e]=f-c,b=[t.tShift[e]],t.tShift[e]=A-t.bMarks[e],x=t.md.block.ruler.getRules("blockquote"),g=t.parentType,t.parentType="blockquote",_=!1,h=e+1;h<n&&(t.sCount[h]<t.blkIndent&&(_=!0),!((A=t.bMarks[h]+t.tShift[h])>=(M=t.eMarks[h])));h++)if(62!==t.src.charCodeAt(A++)||_){if(u)break;for(w=!1,a=0,l=x.length;a<l;a++)if(x[a](t,h,n,!0)){w=!0;break}if(w){t.lineMax=h,0!==t.blkIndent&&(d.push(t.bMarks[h]),m.push(t.bsCount[h]),b.push(t.tShift[h]),y.push(t.sCount[h]),t.sCount[h]-=t.blkIndent);break}d.push(t.bMarks[h]),m.push(t.bsCount[h]),b.push(t.tShift[h]),y.push(t.sCount[h]),t.sCount[h]=-1}else{for(c=f=t.sCount[h]+A-(t.bMarks[h]+t.tShift[h]),32===t.src.charCodeAt(A)?(A++,c++,f++,i=!1,k=!0):9===t.src.charCodeAt(A)?(k=!0,(t.bsCount[h]+f)%4==3?(A++,c++,f++,i=!1):i=!0):k=!1,d.push(t.bMarks[h]),t.bMarks[h]=A;A<M&&(s=t.src.charCodeAt(A),r(s));)9===s?f+=4-(f+t.bsCount[h]+(i?1:0))%4:f++,A++;u=A>=M,m.push(t.bsCount[h]),t.bsCount[h]=t.sCount[h]+1+(k?1:0),y.push(t.sCount[h]),t.sCount[h]=f-c,b.push(t.tShift[h]),t.tShift[h]=A-t.bMarks[h]}for(v=t.blkIndent,t.blkIndent=0,(C=t.push("blockquote_open","blockquote",1)).markup=">",C.map=p=[e,0],t.md.block.tokenize(t,e,h),(C=t.push("blockquote_close","blockquote",-1)).markup=">",t.lineMax=S,t.parentType=g,p[1]=t.line,a=0;a<b.length;a++)t.bMarks[a+e]=d[a],t.tShift[a+e]=b[a],t.sCount[a+e]=y[a],t.bsCount[a+e]=m[a];return t.blkIndent=v,!0}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(42!==(i=t.src.charCodeAt(l++))&&45!==i&&95!==i)return!1;for(s=1;l<u;){if((a=t.src.charCodeAt(l++))!==i&&!r(a))return!1;a===i&&s++}return!(s<3)&&(o||(t.line=e+1,(c=t.push("hr","hr",0)).map=[e,t.line],c.markup=Array(s+1).join(String.fromCharCode(i))),!0)}},function(t,e,n){"use strict";var r=n(0).isSpace;function o(t,e){var n,o,i,s;return o=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],42!==(n=t.src.charCodeAt(o++))&&45!==n&&43!==n||o<i&&(s=t.src.charCodeAt(o),!r(s))?-1:o}function i(t,e){var n,o=t.bMarks[e]+t.tShift[e],i=o,s=t.eMarks[e];if(i+1>=s)return-1;if((n=t.src.charCodeAt(i++))<48||n>57)return-1;for(;;){if(i>=s)return-1;if(!((n=t.src.charCodeAt(i++))>=48&&n<=57)){if(41===n||46===n)break;return-1}if(i-o>=10)return-1}return i<s&&(n=t.src.charCodeAt(i),!r(n))?-1:i}t.exports=function(t,e,n,r){var s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S,A,M,D,E,O,T,N,z,q=!1,I=!0;if(t.sCount[e]-t.blkIndent>=4)return!1;if(t.listIndent>=0&&t.sCount[e]-t.listIndent>=4&&t.sCount[e]<t.blkIndent)return!1;if(r&&"paragraph"===t.parentType&&t.tShift[e]>=t.blkIndent&&(q=!0),(D=i(t,e))>=0){if(h=!0,O=t.bMarks[e]+t.tShift[e],y=Number(t.src.substr(O,D-O-1)),q&&1!==y)return!1}else{if(!((D=o(t,e))>=0))return!1;h=!1}if(q&&t.skipSpaces(D)>=t.eMarks[e])return!1;if(g=t.src.charCodeAt(D-1),r)return!0;for(v=t.tokens.length,h?(z=t.push("ordered_list_open","ol",1),1!==y&&(z.attrs=[["start",y]])):z=t.push("bullet_list_open","ul",1),z.map=m=[e,0],z.markup=String.fromCharCode(g),k=e,E=!1,N=t.md.block.ruler.getRules("list"),C=t.parentType,t.parentType="list";k<n;){for(M=D,b=t.eMarks[k],p=w=t.sCount[k]+D-(t.bMarks[e]+t.tShift[e]);M<b;){if(9===(s=t.src.charCodeAt(M)))w+=4-(w+t.bsCount[k])%4;else{if(32!==s)break;w++}M++}if((u=(a=M)>=b?1:w-p)>4&&(u=1),l=p+u,(z=t.push("list_item_open","li",1)).markup=String.fromCharCode(g),z.map=f=[e,0],A=t.tight,S=t.tShift[e],_=t.sCount[e],x=t.listIndent,t.listIndent=t.blkIndent,t.blkIndent=l,t.tight=!0,t.tShift[e]=a-t.bMarks[e],t.sCount[e]=w,a>=b&&t.isEmpty(e+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,e,n,!0),t.tight&&!E||(I=!1),E=t.line-e>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=x,t.tShift[e]=S,t.sCount[e]=_,t.tight=A,(z=t.push("list_item_close","li",-1)).markup=String.fromCharCode(g),k=e=t.line,f[1]=k,a=t.bMarks[e],k>=n)break;if(t.sCount[k]<t.blkIndent)break;if(t.sCount[e]-t.blkIndent>=4)break;for(T=!1,c=0,d=N.length;c<d;c++)if(N[c](t,k,n,!0)){T=!0;break}if(T)break;if(h){if((D=i(t,k))<0)break}else if((D=o(t,k))<0)break;if(g!==t.src.charCodeAt(D-1))break}return(z=h?t.push("ordered_list_close","ol",-1):t.push("bullet_list_close","ul",-1)).markup=String.fromCharCode(g),m[1]=k,t.line=k,t.parentType=C,I&&function(t,e){var n,r,o=t.level+2;for(n=e+2,r=t.tokens.length-2;n<r;n++)t.tokens[n].level===o&&"paragraph_open"===t.tokens[n].type&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}(t,v),!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e,n,i){var s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x=0,C=t.bMarks[e]+t.tShift[e],_=t.eMarks[e],S=e+1;if(t.sCount[e]-t.blkIndent>=4)return!1;if(91!==t.src.charCodeAt(C))return!1;for(;++C<_;)if(93===t.src.charCodeAt(C)&&92!==t.src.charCodeAt(C-1)){if(C+1===_)return!1;if(58!==t.src.charCodeAt(C+1))return!1;break}for(l=t.lineMax,k=t.md.block.ruler.getRules("reference"),m=t.parentType,t.parentType="reference";S<l&&!t.isEmpty(S);S++)if(!(t.sCount[S]-t.blkIndent>3||t.sCount[S]<0)){for(b=!1,p=0,h=k.length;p<h;p++)if(k[p](t,S,l,!0)){b=!0;break}if(b)break}for(_=(y=t.getLines(e,S,t.blkIndent,!1).trim()).length,C=1;C<_;C++){if(91===(s=y.charCodeAt(C)))return!1;if(93===s){d=C;break}(10===s||92===s&&++C<_&&10===y.charCodeAt(C))&&x++}if(d<0||58!==y.charCodeAt(d+1))return!1;for(C=d+2;C<_;C++)if(10===(s=y.charCodeAt(C)))x++;else if(!o(s))break;if(!(v=t.md.helpers.parseLinkDestination(y,C,_)).ok)return!1;if(u=t.md.normalizeLink(v.str),!t.md.validateLink(u))return!1;for(a=C=v.pos,c=x+=v.lines,g=C;C<_;C++)if(10===(s=y.charCodeAt(C)))x++;else if(!o(s))break;for(v=t.md.helpers.parseLinkTitle(y,C,_),C<_&&g!==C&&v.ok?(w=v.str,C=v.pos,x+=v.lines):(w="",C=a,x=c);C<_&&(s=y.charCodeAt(C),o(s));)C++;if(C<_&&10!==y.charCodeAt(C)&&w)for(w="",C=a,x=c;C<_&&(s=y.charCodeAt(C),o(s));)C++;return!(C<_&&10!==y.charCodeAt(C))&&(!!(f=r(y.slice(1,d)))&&(i||(void 0===t.env.references&&(t.env.references={}),void 0===t.env.references[f]&&(t.env.references[f]={title:w,href:u}),t.parentType=m,t.line=e+x+1),!0))}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(35!==(i=t.src.charCodeAt(l))||l>=u)return!1;for(s=1,i=t.src.charCodeAt(++l);35===i&&l<u&&s<=6;)s++,i=t.src.charCodeAt(++l);return!(s>6||l<u&&!r(i))&&(o||(u=t.skipSpacesBack(u,l),(a=t.skipCharsBack(u,35,l))>l&&r(t.src.charCodeAt(a-1))&&(u=a),t.line=e+1,(c=t.push("heading_open","h"+String(s),1)).markup="########".slice(0,s),c.map=[e,t.line],(c=t.push("inline","",0)).content=t.src.slice(l,u).trim(),c.map=[e,t.line],c.children=[],(c=t.push("heading_close","h"+String(s),-1)).markup="########".slice(0,s)),!0)}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i,s,a,c,l,u,p,h,f=e+1,d=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;for(h=t.parentType,t.parentType="paragraph";f<n&&!t.isEmpty(f);f++)if(!(t.sCount[f]-t.blkIndent>3)){if(t.sCount[f]>=t.blkIndent&&(c=t.bMarks[f]+t.tShift[f])<(l=t.eMarks[f])&&(45===(p=t.src.charCodeAt(c))||61===p)&&(c=t.skipChars(c,p),(c=t.skipSpaces(c))>=l)){u=61===p?1:2;break}if(!(t.sCount[f]<0)){for(o=!1,i=0,s=d.length;i<s;i++)if(d[i](t,f,n,!0)){o=!0;break}if(o)break}}return!!u&&(r=t.getLines(e,f,t.blkIndent,!1).trim(),t.line=f+1,(a=t.push("heading_open","h"+String(u),1)).markup=String.fromCharCode(p),a.map=[e,t.line],(a=t.push("inline","",0)).content=r,a.map=[e,t.line-1],a.children=[],(a=t.push("heading_close","h"+String(u),-1)).markup=String.fromCharCode(p),t.parentType=h,!0)}},function(t,e,n){"use strict";var r=n(46),o=n(9).HTML_OPEN_CLOSE_TAG_RE,i=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+r.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(o.source+"\\s*$"),/^$/,!1]];t.exports=function(t,e,n,r){var o,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(!t.md.options.html)return!1;if(60!==t.src.charCodeAt(l))return!1;for(c=t.src.slice(l,u),o=0;o<i.length&&!i[o][0].test(c);o++);if(o===i.length)return!1;if(r)return i[o][2];if(s=e+1,!i[o][1].test(c))for(;s<n&&!(t.sCount[s]<t.blkIndent);s++)if(l=t.bMarks[s]+t.tShift[s],u=t.eMarks[s],c=t.src.slice(l,u),i[o][1].test(c)){0!==c.length&&s++;break}return t.line=s,(a=t.push("html_block","",0)).map=[e,s],a.content=t.getLines(e,s,t.blkIndent,!0),!0}},function(t,e,n){"use strict";t.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o,i,s,a,c=e+1,l=t.md.block.ruler.getRules("paragraph"),u=t.lineMax;for(a=t.parentType,t.parentType="paragraph";c<u&&!t.isEmpty(c);c++)if(!(t.sCount[c]-t.blkIndent>3||t.sCount[c]<0)){for(r=!1,o=0,i=l.length;o<i;o++)if(l[o](t,c,u,!0)){r=!0;break}if(r)break}return n=t.getLines(e,c,t.blkIndent,!1).trim(),t.line=c,(s=t.push("paragraph_open","p",1)).map=[e,t.line],(s=t.push("inline","",0)).content=n,s.map=[e,t.line],s.children=[],s=t.push("paragraph_close","p",-1),t.parentType=a,!0}},function(t,e,n){"use strict";var r=n(3),o=n(0).isSpace;function i(t,e,n,r){var i,s,a,c,l,u,p,h;for(this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",h=!1,a=c=u=p=0,l=(s=this.src).length;c<l;c++){if(i=s.charCodeAt(c),!h){if(o(i)){u++,9===i?p+=4-p%4:p++;continue}h=!0}10!==i&&c!==l-1||(10!==i&&c++,this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(u),this.sCount.push(p),this.bsCount.push(0),h=!1,u=0,p=0,a=c+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}i.prototype.push=function(t,e,n){var o=new r(t,e,n);return o.block=!0,n<0&&this.level--,o.level=this.level,n>0&&this.level++,this.tokens.push(o),o},i.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},i.prototype.skipEmptyLines=function(t){for(var e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},i.prototype.skipSpaces=function(t){for(var e,n=this.src.length;t<n&&(e=this.src.charCodeAt(t),o(e));t++);return t},i.prototype.skipSpacesBack=function(t,e){if(t<=e)return t;for(;t>e;)if(!o(this.src.charCodeAt(--t)))return t+1;return t},i.prototype.skipChars=function(t,e){for(var n=this.src.length;t<n&&this.src.charCodeAt(t)===e;t++);return t},i.prototype.skipCharsBack=function(t,e,n){if(t<=n)return t;for(;t>n;)if(e!==this.src.charCodeAt(--t))return t+1;return t},i.prototype.getLines=function(t,e,n,r){var i,s,a,c,l,u,p,h=t;if(t>=e)return"";for(u=new Array(e-t),i=0;h<e;h++,i++){for(s=0,p=c=this.bMarks[h],l=h+1<e||r?this.eMarks[h]+1:this.eMarks[h];c<l&&s<n;){if(a=this.src.charCodeAt(c),o(a))9===a?s+=4-(s+this.bsCount[h])%4:s++;else{if(!(c-p<this.tShift[h]))break;s++}c++}u[i]=s>n?new Array(s-n+1).join(" ")+this.src.slice(c,l):this.src.slice(c,l)}return u.join("")},i.prototype.Token=r,t.exports=i},function(t,e,n){"use strict";var r=n(2),o=[["text",n(50)],["newline",n(51)],["escape",n(52)],["backticks",n(53)],["strikethrough",n(10).tokenize],["emphasis",n(11).tokenize],["link",n(54)],["image",n(55)],["autolink",n(56)],["html_inline",n(57)],["entity",n(58)]],i=[["balance_pairs",n(59)],["strikethrough",n(10).postProcess],["emphasis",n(11).postProcess],["text_collapse",n(60)]];function s(){var t;for(this.ruler=new r,t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1]);for(this.ruler2=new r,t=0;t<i.length;t++)this.ruler2.push(i[t][0],i[t][1])}s.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,s=t.md.options.maxNesting,a=t.cache;if(void 0===a[r]){if(t.level<s)for(n=0;n<i&&(t.level++,e=o[n](t,!0),t.level--,!e);n++);else t.pos=t.posMax;e||t.pos++,a[r]=t.pos}else t.pos=a[r]},s.prototype.tokenize=function(t){for(var e,n,r=this.ruler.getRules(""),o=r.length,i=t.posMax,s=t.md.options.maxNesting;t.pos<i;){if(t.level<s)for(n=0;n<o&&!(e=r[n](t,!1));n++);if(e){if(t.pos>=i)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},s.prototype.parse=function(t,e,n,r){var o,i,s,a=new this.State(t,e,n,r);for(this.tokenize(a),s=(i=this.ruler2.getRules("")).length,o=0;o<s;o++)i[o](a)},s.prototype.State=n(61),t.exports=s},function(t,e,n){"use strict";function r(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}t.exports=function(t,e){for(var n=t.pos;n<t.posMax&&!r(t.src.charCodeAt(n));)n++;return n!==t.pos&&(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e){var n,o,i=t.pos;if(10!==t.src.charCodeAt(i))return!1;for(n=t.pending.length-1,o=t.posMax,e||(n>=0&&32===t.pending.charCodeAt(n)?n>=1&&32===t.pending.charCodeAt(n-1)?(t.pending=t.pending.replace(/ +$/,""),t.push("hardbreak","br",0)):(t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0)):t.push("softbreak","br",0)),i++;i<o&&r(t.src.charCodeAt(i));)i++;return t.pos=i,!0}},function(t,e,n){"use strict";for(var r=n(0).isSpace,o=[],i=0;i<256;i++)o.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(t){o[t.charCodeAt(0)]=1})),t.exports=function(t,e){var n,i=t.pos,s=t.posMax;if(92!==t.src.charCodeAt(i))return!1;if(++i<s){if((n=t.src.charCodeAt(i))<256&&0!==o[n])return e||(t.pending+=t.src[i]),t.pos+=2,!0;if(10===n){for(e||t.push("hardbreak","br",0),i++;i<s&&(n=t.src.charCodeAt(i),r(n));)i++;return t.pos=i,!0}}return e||(t.pending+="\\"),t.pos++,!0}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o,i,s,a,c=t.pos;if(96!==t.src.charCodeAt(c))return!1;for(n=c,c++,r=t.posMax;c<r&&96===t.src.charCodeAt(c);)c++;for(o=t.src.slice(n,c),i=s=c;-1!==(i=t.src.indexOf("`",s));){for(s=i+1;s<r&&96===t.src.charCodeAt(s);)s++;if(s-i===o.length)return e||((a=t.push("code_inline","code",0)).markup=o,a.content=t.src.slice(c,i).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),t.pos=s,!0}return e||(t.pending+=o),t.pos+=o.length,!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e){var n,i,s,a,c,l,u,p,h,f="",d=t.pos,m=t.posMax,v=t.pos,g=!0;if(91!==t.src.charCodeAt(t.pos))return!1;if(c=t.pos+1,(a=t.md.helpers.parseLinkLabel(t,t.pos,!0))<0)return!1;if((l=a+1)<m&&40===t.src.charCodeAt(l)){for(g=!1,l++;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);if(l>=m)return!1;for(v=l,(u=t.md.helpers.parseLinkDestination(t.src,l,t.posMax)).ok&&(f=t.md.normalizeLink(u.str),t.md.validateLink(f)?l=u.pos:f=""),v=l;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);if(u=t.md.helpers.parseLinkTitle(t.src,l,t.posMax),l<m&&v!==l&&u.ok)for(h=u.str,l=u.pos;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);else h="";(l>=m||41!==t.src.charCodeAt(l))&&(g=!0),l++}if(g){if(void 0===t.env.references)return!1;if(l<m&&91===t.src.charCodeAt(l)?(v=l+1,(l=t.md.helpers.parseLinkLabel(t,l))>=0?s=t.src.slice(v,l++):l=a+1):l=a+1,s||(s=t.src.slice(c,a)),!(p=t.env.references[r(s)]))return t.pos=d,!1;f=p.href,h=p.title}return e||(t.pos=c,t.posMax=a,t.push("link_open","a",1).attrs=n=[["href",f]],h&&n.push(["title",h]),t.md.inline.tokenize(t),t.push("link_close","a",-1)),t.pos=l,t.posMax=m,!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e){var n,i,s,a,c,l,u,p,h,f,d,m,v,g="",y=t.pos,b=t.posMax;if(33!==t.src.charCodeAt(t.pos))return!1;if(91!==t.src.charCodeAt(t.pos+1))return!1;if(l=t.pos+2,(c=t.md.helpers.parseLinkLabel(t,t.pos+1,!1))<0)return!1;if((u=c+1)<b&&40===t.src.charCodeAt(u)){for(u++;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);if(u>=b)return!1;for(v=u,(h=t.md.helpers.parseLinkDestination(t.src,u,t.posMax)).ok&&(g=t.md.normalizeLink(h.str),t.md.validateLink(g)?u=h.pos:g=""),v=u;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);if(h=t.md.helpers.parseLinkTitle(t.src,u,t.posMax),u<b&&v!==u&&h.ok)for(f=h.str,u=h.pos;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);else f="";if(u>=b||41!==t.src.charCodeAt(u))return t.pos=y,!1;u++}else{if(void 0===t.env.references)return!1;if(u<b&&91===t.src.charCodeAt(u)?(v=u+1,(u=t.md.helpers.parseLinkLabel(t,u))>=0?a=t.src.slice(v,u++):u=c+1):u=c+1,a||(a=t.src.slice(l,c)),!(p=t.env.references[r(a)]))return t.pos=y,!1;g=p.href,f=p.title}return e||(s=t.src.slice(l,c),t.md.inline.parse(s,t.md,t.env,m=[]),(d=t.push("image","img",0)).attrs=n=[["src",g],["alt",""]],d.children=m,d.content=s,f&&n.push(["title",f])),t.pos=u,t.posMax=b,!0}},function(t,e,n){"use strict";var r=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,o=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;t.exports=function(t,e){var n,i,s,a,c,l,u=t.pos;return 60===t.src.charCodeAt(u)&&(!((n=t.src.slice(u)).indexOf(">")<0)&&(o.test(n)?(a=(i=n.match(o))[0].slice(1,-1),c=t.md.normalizeLink(a),!!t.md.validateLink(c)&&(e||((l=t.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=t.push("text","",0)).content=t.md.normalizeLinkText(a),(l=t.push("link_close","a",-1)).markup="autolink",l.info="auto"),t.pos+=i[0].length,!0)):!!r.test(n)&&(a=(s=n.match(r))[0].slice(1,-1),c=t.md.normalizeLink("mailto:"+a),!!t.md.validateLink(c)&&(e||((l=t.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=t.push("text","",0)).content=t.md.normalizeLinkText(a),(l=t.push("link_close","a",-1)).markup="autolink",l.info="auto"),t.pos+=s[0].length,!0))))}},function(t,e,n){"use strict";var r=n(9).HTML_TAG_RE;t.exports=function(t,e){var n,o,i,s=t.pos;return!!t.md.options.html&&(i=t.posMax,!(60!==t.src.charCodeAt(s)||s+2>=i)&&(!(33!==(n=t.src.charCodeAt(s+1))&&63!==n&&47!==n&&!function(t){var e=32|t;return e>=97&&e<=122}(n))&&(!!(o=t.src.slice(s).match(r))&&(e||(t.push("html_inline","",0).content=t.src.slice(s,s+o[0].length)),t.pos+=o[0].length,!0))))}},function(t,e,n){"use strict";var r=n(4),o=n(0).has,i=n(0).isValidEntityCode,s=n(0).fromCodePoint,a=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,c=/^&([a-z][a-z0-9]{1,31});/i;t.exports=function(t,e){var n,l,u=t.pos,p=t.posMax;if(38!==t.src.charCodeAt(u))return!1;if(u+1<p)if(35===t.src.charCodeAt(u+1)){if(l=t.src.slice(u).match(a))return e||(n="x"===l[1][0].toLowerCase()?parseInt(l[1].slice(1),16):parseInt(l[1],10),t.pending+=i(n)?s(n):s(65533)),t.pos+=l[0].length,!0}else if((l=t.src.slice(u).match(c))&&o(r,l[1]))return e||(t.pending+=r[l[1]]),t.pos+=l[0].length,!0;return e||(t.pending+="&"),t.pos++,!0}},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a,c,l,u={},p=e.length;for(n=0;n<p;n++)if((o=e[n]).length=o.length||0,o.close){for(u.hasOwnProperty(o.marker)||(u[o.marker]=[-1,-1,-1]),s=u[o.marker][o.length%3],a=-1,r=n-o.jump-1;r>s;r-=i.jump+1)if((i=e[r]).marker===o.marker&&(-1===a&&(a=r),i.open&&i.end<0&&i.level===o.level&&(c=!1,(i.close||o.open)&&(i.length+o.length)%3==0&&(i.length%3==0&&o.length%3==0||(c=!0)),!c))){l=r>0&&!e[r-1].open?e[r-1].jump+1:0,o.jump=n-r+l,o.open=!1,i.end=n,i.jump=l,i.close=!1,a=-1;break}-1!==a&&(u[o.marker][(o.length||0)%3]=a)}}t.exports=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(0,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(0,n[e].delimiters)}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r=0,o=t.tokens,i=t.tokens.length;for(e=n=0;e<i;e++)o[e].nesting<0&&r--,o[e].level=r,o[e].nesting>0&&r++,"text"===o[e].type&&e+1<i&&"text"===o[e+1].type?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}},function(t,e,n){"use strict";var r=n(3),o=n(0).isWhiteSpace,i=n(0).isPunctChar,s=n(0).isMdAsciiPunct;function a(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[]}a.prototype.pushPending=function(){var t=new r("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},a.prototype.push=function(t,e,n){this.pending&&this.pushPending();var o=new r(t,e,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),o.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(o),this.tokens_meta.push(i),o},a.prototype.scanDelims=function(t,e){var n,r,a,c,l,u,p,h,f,d=t,m=!0,v=!0,g=this.posMax,y=this.src.charCodeAt(t);for(n=t>0?this.src.charCodeAt(t-1):32;d<g&&this.src.charCodeAt(d)===y;)d++;return a=d-t,r=d<g?this.src.charCodeAt(d):32,p=s(n)||i(String.fromCharCode(n)),f=s(r)||i(String.fromCharCode(r)),u=o(n),(h=o(r))?m=!1:f&&(u||p||(m=!1)),u?v=!1:p&&(h||f||(v=!1)),e?(c=m,l=v):(c=m&&(!v||p),l=v&&(!m||f)),{can_open:c,can_close:l,length:a}},a.prototype.Token=r,t.exports=a},function(t,e,n){"use strict";function r(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach((function(e){e&&Object.keys(e).forEach((function(n){t[n]=e[n]}))})),t}function o(t){return Object.prototype.toString.call(t)}function i(t){return"[object Function]"===o(t)}function s(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var a={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var c={"http:":{validate:function(t,e,n){var r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){var r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&":"===t[e-3]||e>=3&&"/"===t[e-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){var r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},l="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function u(t){var e=t.re=n(63)(t.__opts__),r=t.__tlds__.slice();function a(t){return t.replace("%TLDS%",e.src_tlds)}t.onCompile(),t.__tlds_replaced__||r.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),r.push(e.src_xn),e.src_tlds=r.join("|"),e.email_fuzzy=RegExp(a(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(a(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(a(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(a(e.tpl_host_fuzzy_test),"i");var c=[];function l(t,e){throw new Error('(LinkifyIt) Invalid schema "'+t+'": '+e)}t.__compiled__={},Object.keys(t.__schemas__).forEach((function(e){var n=t.__schemas__[e];if(null!==n){var r={validate:null,link:null};if(t.__compiled__[e]=r,"[object Object]"===o(n))return!function(t){return"[object RegExp]"===o(t)}(n.validate)?i(n.validate)?r.validate=n.validate:l(e,n):r.validate=function(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}(n.validate),void(i(n.normalize)?r.normalize=n.normalize:n.normalize?l(e,n):r.normalize=function(t,e){e.normalize(t)});!function(t){return"[object String]"===o(t)}(n)?l(e,n):c.push(e)}})),c.forEach((function(e){t.__compiled__[t.__schemas__[e]]&&(t.__compiled__[e].validate=t.__compiled__[t.__schemas__[e]].validate,t.__compiled__[e].normalize=t.__compiled__[t.__schemas__[e]].normalize)})),t.__compiled__[""]={validate:null,normalize:function(t,e){e.normalize(t)}};var u=Object.keys(t.__compiled__).filter((function(e){return e.length>0&&t.__compiled__[e]})).map(s).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+u+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+u+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),function(t){t.__index__=-1,t.__text_cache__=""}(t)}function p(t,e){var n=t.__index__,r=t.__last_index__,o=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=o,this.text=o,this.url=o}function h(t,e){var n=new p(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function f(t,e){if(!(this instanceof f))return new f(t,e);var n;e||(n=t,Object.keys(n||{}).reduce((function(t,e){return t||a.hasOwnProperty(e)}),!1)&&(e=t,t={})),this.__opts__=r({},a,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=r({},c,t),this.__compiled__={},this.__tlds__=l,this.__tlds_replaced__=!1,this.re={},u(this)}f.prototype.add=function(t,e){return this.__schemas__[t]=e,u(this),this},f.prototype.set=function(t){return this.__opts__=r(this.__opts__,t),this},f.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;var e,n,r,o,i,s,a,c;if(this.re.schema_test.test(t))for((a=this.re.schema_search).lastIndex=0;null!==(e=a.exec(t));)if(o=this.testSchemaAt(t,e[2],a.lastIndex)){this.__schema__=e[2],this.__index__=e.index+e[1].length,this.__last_index__=e.index+e[0].length+o;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=t.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c<this.__index__)&&null!==(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(i=n.index+n[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=n.index+n[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&t.indexOf("@")>=0&&null!==(r=t.match(this.re.email_fuzzy))&&(i=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=s)),this.__index__>=0},f.prototype.pretest=function(t){return this.re.pretest.test(t)},f.prototype.testSchemaAt=function(t,e,n){return this.__compiled__[e.toLowerCase()]?this.__compiled__[e.toLowerCase()].validate(t,n,this):0},f.prototype.match=function(t){var e=0,n=[];this.__index__>=0&&this.__text_cache__===t&&(n.push(h(this,e)),e=this.__last_index__);for(var r=e?t.slice(e):t;this.test(r);)n.push(h(this,e)),r=r.slice(this.__last_index__),e+=this.__last_index__;return n.length?n:null},f.prototype.tlds=function(t,e){return t=Array.isArray(t)?t:[t],e?(this.__tlds__=this.__tlds__.concat(t).sort().filter((function(t,e,n){return t!==n[e-1]})).reverse(),u(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,u(this),this)},f.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),"mailto:"!==t.schema||/^mailto:/i.test(t.url)||(t.url="mailto:"+t.url)},f.prototype.onCompile=function(){},t.exports=f},function(t,e,n){"use strict";t.exports=function(t){var e={};e.src_Any=n(6).source,e.src_Cc=n(7).source,e.src_Z=n(8).source,e.src_P=n(1).source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");return e.src_pseudo_letter="(?:(?![><|]|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|[><|]|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+e.src_ZCc+").|\\!(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy='(^|[><|]|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}},function(t,e,n){(function(t,r){var o;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
-/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){var a="object"==i(e)&&e&&!e.nodeType&&e,c="object"==i(t)&&t&&!t.nodeType&&t,l="object"==(void 0===r?"undefined":i(r))&&r;l.global!==l&&l.window!==l&&l.self!==l||(s=l);var u,p,h=2147483647,f=/^xn--/,d=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,y=String.fromCharCode;function b(t){throw new RangeError(v[t])}function k(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function w(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+k((t=t.replace(m,".")).split("."),e).join(".")}function x(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function C(t){return k(t,(function(t){var e="";return t>65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=y(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var r=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;r+=36)t=g(t/35);return g(r+36*t/(t+38))}function A(t){var e,n,r,o,i,s,a,c,l,u,p,f=[],d=t.length,m=0,v=128,y=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&b("not-basic"),f.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<d;){for(i=m,s=1,a=36;o>=d&&b("invalid-input"),((c=(p=t.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||c>g((h-m)/s))&&b("overflow"),m+=c*s,!(c<(l=a<=y?1:a>=y+26?26:a-y));a+=36)s>g(h/(u=36-l))&&b("overflow"),s*=u;y=S(m-i,e=f.length+1,0==i),g(m/e)>h-v&&b("overflow"),v+=g(m/e),m%=e,f.splice(m++,0,v)}return C(f)}function M(t){var e,n,r,o,i,s,a,c,l,u,p,f,d,m,v,k=[];for(f=(t=x(t)).length,e=128,n=0,i=72,s=0;s<f;++s)(p=t[s])<128&&k.push(y(p));for(r=o=k.length,o&&k.push("-");r<f;){for(a=h,s=0;s<f;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>g((h-n)/(d=r+1))&&b("overflow"),n+=(a-e)*d,e=a,s=0;s<f;++s)if((p=t[s])<e&&++n>h&&b("overflow"),p==e){for(c=n,l=36;!(c<(u=l<=i?1:l>=i+26?26:l-i));l+=36)v=c-u,m=36-u,k.push(y(_(u+v%m,0))),c=g(v/m);k.push(y(_(c,0))),i=S(n,d,r==o),n=0,++r}++n,++e}return k.join("")}if(u={version:"1.4.1",ucs2:{decode:x,encode:C},decode:A,encode:M,toASCII:function(t){return w(t,(function(t){return d.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return w(t,(function(t){return f.test(t)?A(t.slice(4).toLowerCase()):t}))}},"object"==i(n(12))&&n(12))void 0===(o=function(){return u}.call(e,n,e,t))||(t.exports=o);else if(a&&c)if(t.exports==a)c.exports=u;else for(p in u)u.hasOwnProperty(p)&&(a[p]=u[p]);else s.punycode=u}(this)}).call(this,n(65)(t),n(66))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},function(t,e,n){"use strict";t.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},a={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},s.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},s.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},s.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new s(r,this.size+t.size)},s.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,i=0;i<e;o++){var a=this.content[o],c=i+a.nodeSize;c>t&&((i<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-i),Math.min(a.text.length,e-i)):a.cut(Math.max(0,t-i-1),Math.min(a.content.size,e-i-1))),n.push(a),r+=a.nodeSize),i=c}return new s(n,r)},s.prototype.cutByIndex=function(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))},s.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new s(r,o)},s.prototype.addToStart=function(t){return new s([t].concat(this.content),this.size+t.nodeSize)},s.prototype.addToEnd=function(t){return new s(this.content.concat(t),this.size+t.nodeSize)},s.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},a.firstChild.get=function(){return this.content.length?this.content[0]:null},a.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},a.childCount.get=function(){return this.content.length},s.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},s.prototype.maybeChild=function(t){return this.content[t]},s.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},s.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},s.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),l=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var u=0,p=Math.min(a.text.length,c.text.length);u<p&&a.text[a.text.length-u-1]==c.text[c.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var h=t(a.content,c.content,r-1,o-1);if(h)return h}r-=l,o-=l}else r-=l,o-=l}}(this,t,e,n)},s.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?l(n+1,o):l(n,r);r=o}},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(t){return t.toJSON()})):null},s.fromJSON=function(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(e.map(t.nodeFromJSON))},s.fromArray=function(t){if(!t.length)return s.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new s(e||t,n)},s.from=function(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,a);var c={index:0,offset:0};function l(t,e){return c.index=t,c.offset=e,c}function u(t,e){if(t===e)return!0;if(!t||"object"!=i(t)||!e||"object"!=i(e))return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!u(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e&&u(t[o],e[o])))return!1;for(var s in e)if(!(s in t))return!1}return!0}s.empty=new s([],0);var p=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}p.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},p.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},p.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},p.prototype.eq=function(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)},p.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},p.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},p.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},p.setFrom=function(t){if(!t||0==t.length)return p.none;if(t instanceof p)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},p.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},d={size:{configurable:!0}};function m(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return function t(e,n,r,o){var i=e.index(o),a=e.node(o);if(i==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(i,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var l=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(s.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),u=l.start,p=l.end;return k(a,function t(e,n,r,o,i){var a=e.depth>i&&g(e,n,i+1),c=o.depth>i&&g(r,o,i+1),l=[];b(null,e,i,l),a&&c&&n.index(i)==r.index(i)?(v(a,c),y(k(a,t(e,n,r,o,i+1)),l)):(a&&y(k(a,w(e,n,i+1)),l),b(n,r,i,l),c&&y(k(c,w(r,o,i+1)),l));return b(o,null,i,l),new s(l)}(e,u,p,n,o))}var h=e.parent,f=h.content;return k(h,f.cut(0,e.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return k(a,w(e,n,o))}(t,e,n,0)}function v(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){var r=t.node(n);return v(r,e.node(n)),r}function y(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function b(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(y(t.nodeAfter,r),i++));for(var a=i;a<s;a++)y(o.child(a),r);e&&e.depth==n&&e.textOffset&&y(e.nodeBefore,r)}function k(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var r=[];(b(null,t,n,r),t.depth>n)&&y(k(g(t,e,n+1),w(t,e,n+1)),r);return b(e,null,n,r),new s(r)}d.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var l=t(c.content,n-a-1,r);return l&&e.replaceChild(s,c.copy(l))}(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),l=c.index,u=c.offset;if(s==n||a.isText){if(u!=r&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(s.fromJSON(t,e.content),e.openStart||0,e.openEnd||0)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,d),f.empty=new f(s.empty,0,0);var x=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};x.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},x.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},x.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},x.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},x.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},x.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},x.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},x.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},x.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},x.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},x.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},x.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new M(this,t,n)},x.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},x.prototype.max=function(t){return t.pos>this.pos?t:this},x.prototype.min=function(t){return t.pos<this.pos?t:this},x.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},x.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new x(e,n,o)},x.resolveCached=function(t,e){for(var n=0;n<_.length;n++){var r=_[n];if(r.pos==e&&r.doc==t)return r}var o=_[S]=x.resolve(t,e);return S=(S+1)%A,o},Object.defineProperties(x.prototype,C);var _=[],S=0,A=12,M=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},D={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};D.start.get=function(){return this.$from.before(this.depth+1)},D.end.get=function(){return this.$to.after(this.depth+1)},D.parent.get=function(){return this.$from.node(this.depth)},D.startIndex.get=function(){return this.$from.index(this.depth)},D.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(M.prototype,D);var E=Object.create(null),O=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||s.empty,this.marks=r||p.none},T={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}};T.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},T.childCount.get=function(){return this.content.childCount},O.prototype.child=function(t){return this.content.child(t)},O.prototype.maybeChild=function(t){return this.content.maybeChild(t)},O.prototype.forEach=function(t){this.content.forEach(t)},O.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},O.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},T.textContent.get=function(){return this.textBetween(0,this.content.size,"")},O.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},T.firstChild.get=function(){return this.content.firstChild},T.lastChild.get=function(){return this.content.lastChild},O.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},O.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},O.prototype.hasMarkup=function(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||E)&&p.sameSet(this.marks,n||p.none)},O.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},O.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},O.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},O.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},O.prototype.replace=function(t,e,n){return m(this.resolve(t),this.resolve(e),n)},O.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},O.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},O.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},O.prototype.resolve=function(t){return x.resolveCached(this,t)},O.prototype.resolveNoCache=function(t){return x.resolve(this,t)},O.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},T.isBlock.get=function(){return this.type.isBlock},T.isTextblock.get=function(){return this.type.isTextblock},T.inlineContent.get=function(){return this.type.inlineContent},T.isInline.get=function(){return this.type.isInline},T.isText.get=function(){return this.type.isText},T.isLeaf.get=function(){return this.type.isLeaf},T.isAtom.get=function(){return this.type.isAtom},O.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),z(this.marks,t)},O.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},O.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},O.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},O.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},O.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));this.content.forEach((function(t){return t.check()}))},O.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},O.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=s.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(O.prototype,T);var N=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):z(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(O);function z(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var q=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},I={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};q.parse=function(t,e){var n=new R(t,e);if(null==n.next)return q.empty;var r=L(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];J(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new q(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(J(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var l=n();return o(t(e.expr,i),l),o(t(e.expr,l),l),[r(l)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var u=i,p=0;p<e.min;p++){var h=n();o(t(e.expr,u),h),u=h}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var d=n();r(u,d),o(t(e.expr,u),d),u=d}return[r(u)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position")}}(o,n),o},q.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},q.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},I.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},I.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},q.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},q.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(i,a){var c=i.matchFragment(t,n);if(c&&(!e||c.validEnd))return s.from(a.map((function(t){return t.createAndFill()})));for(var l=0;l<i.next.length;l+=2){var u=i.next[l],p=i.next[l+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var h=o(p,a.concat(u));if(h)return h}}}(this,[])},q.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},q.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},I.edgeCount.get=function(){return this.next.length>>1},q.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},q.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(q.prototype,I),q.empty=new q(!0);var R=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.unshift()},F={next:{configurable:!0}};function L(t){var e=[];do{e.push(B(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function B(t){var e=[];do{e.push(P(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function P(t){for(var e=function(t){if(t.eat("(")){var e=L(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=$(t,e)}return e}function V(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function $(t,e){var n=V(t),r=n;return t.eat(",")&&(r="}"!=t.next?V(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j(t,e){return e-t}function J(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(j)}function H(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function W(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function U(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new Z(t[n]);return e}F.next.get=function(){return this.tokens[this.pos]},R.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},R.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(R.prototype,F);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=U(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},G={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};G.isInline.get=function(){return!this.isBlock},G.isTextblock.get=function(){return this.isBlock&&this.inlineContent},G.isLeaf.get=function(){return this.contentMatch==q.empty},G.isAtom.get=function(){return this.isLeaf||this.spec.atom},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new O(this,this.computeAttrs(t),s.from(e),p.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=s.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new O(this,this.computeAttrs(t),e,p.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=s.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(s.empty,!0);return o?new O(this,t,e.append(o),p.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.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 o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,G);var Z=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(Z.prototype,Y);var Q=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=U(r.attrs),this.rank=e,this.excluded=null;var o=H(this.attrs);this.instance=o&&new p(this,o)};Q.prototype.create=function(t){return!t&&this.instance?this.instance:new p(this,W(this.attrs,t))},Q.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Q(t,r++,e,o)})),n},Q.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t.slice(0,e).concat(t.slice(e+1));return t},Q.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Q.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var X=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=Q.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],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=q.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?tt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:tt(this,u.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 tt(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}X.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},X.prototype.text=function(t,e){var n=this.nodes.text;return new N(n,n.defaultAttrs,t,p.setFrom(e))},X.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},X.prototype.nodeFromJSON=function(t){return O.fromJSON(this,t)},X.prototype.markFromJSON=function(t){return p.fromJSON(this,t)},X.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var et=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)}))};et.prototype.parse=function(t,e){void 0===e&&(e={});var n=new at(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},et.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new at(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},et.prototype.matchTag=function(t,e){for(var n=0;n<this.tags.length;n++){var r=this.tags[n];if(lt(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){var o=r.getAttrs(t);if(!1===o)continue;r.attrs=o}return r}}},et.prototype.matchStyle=function(t,e,n){for(var r=0;r<this.styles.length;r++){var o=this.styles[r];if(!(0!=o.style.indexOf(t)||o.context&&!n.matchesContext(o.context)||o.style.length>t.length&&(61!=o.style.charCodeAt(t.length)||o.style.slice(t.length+1)!=e))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i}return o}}},et.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=ut(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=ut(t)),t.node=s}));return e},et.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new et(t,et.schemaRules(t)))};var nt={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},rt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0};function it(t){return(t?1:0)|("full"===t?2:0)}var st=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r};st.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(s.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},st.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=s.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},st.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):pt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var at=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=it(e.preserveWhitespace)|(n?4:0);r=o?new st(o.type,o.attrs,p.none,p.none,!0,e.topMatch||o.type.contentMatch,i):new st(n?null:t.schema.topNodeType,null,p.none,p.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ct={top:{configurable:!0},currentPos:{configurable:!0}};function lt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ut(t){var e={};for(var n in t)e[n]=t[n];return e}function pt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[];return function t(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var o=n.edge(r),s=o.type,a=o.next;if(s==e)return!0;if(i.indexOf(a)<0&&t(a))return!0}}(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ct.top.get=function(){return this.nodes[this.open]},at.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},at.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if((n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)2&n.options||(e=e.replace(/\r?\n|\r/g," "));else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},at.prototype.addElement=function(t){var e=t.nodeName.toLowerCase();ot.hasOwnProperty(e)&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ot.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var n=this.options.ruleFromNode&&this.options.ruleFromNode(t)||this.parser.matchTag(t,this);if(n?n.ignore:rt.hasOwnProperty(e))this.findInside(t);else if(!n||n.skip){n&&n.skip.nodeType&&(t=n.skip);var r,o=this.top,i=this.needsBlock;if(nt.hasOwnProperty(e))r=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),r&&this.sync(o),this.needsBlock=i}else this.addElementByRule(t,n)},at.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},at.prototype.readStyles=function(t){for(var e=p.none,n=0;n<t.length;n+=2){var r=this.parser.matchStyle(t[n],t[n+1],this);if(r){if(r.ignore)return null;e=this.parser.schema.marks[r.mark].create(r.attrs).addToSet(e)}}return e},at.prototype.addElementByRule=function(t,e){var n,r,o,i=this;e.node?(r=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(r.create(e.attrs))||this.leafFallback(t):n=this.enter(r,e.attrs,e.preserveWhitespace):(o=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(o));var s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return i.insertNode(t)}));else{var a=e.contentElement;"string"==typeof a?a=t.querySelector(a):"function"==typeof a&&(a=a(t)),a||(a=t),this.findAround(t,a,!0),this.addAll(a,n)}n&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},at.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&nt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},at.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},at.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},at.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},at.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:it(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new st(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},at.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},at.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},at.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ct.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},at.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},at.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},at.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},at.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},at.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function t(s,a){for(;s>=0;s--){var c=n[s];if(""==c){if(s==n.length-1||0==s)continue;for(;a>=i;a--)if(t(s-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0}(n.length-1,this.open)},at.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},at.prototype.addPendingMark=function(t){this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},at.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1?r.pendingMarks=t.removeFromSet(r.pendingMarks):r.activeMarks=t.removeFromSet(r.activeMarks),r==e)break}},Object.defineProperties(at.prototype,ct);var ht=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dt(t){return t.document||window.document}ht.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=dt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNode(t,e))})),n},ht.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=ht.renderSpec(dt(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},ht.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},ht.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&ht.renderSpec(dt(n),r(t,e))},ht.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var s=null,a=n?t.createElementNS(n,r):t.createElement(r),c=e[1],l=1;if(c&&"object"==i(c)&&null==c.nodeType&&!Array.isArray(c))for(var u in l=2,c)if(null!=c[u]){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):a.setAttribute(u,c[u])}for(var h=l;h<e.length;h++){var f=e[h];if(0===f){if(h<e.length-1||h>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var d=ht.renderSpec(t,f,n),m=d.dom,v=d.contentDOM;if(a.appendChild(m),v){if(s)throw new RangeError("Multiple content holes");s=v}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ht.marksFromSchema=function(t){return ft(t.marks)};var mt=Math.pow(2,16);function vt(t){return 65535&t}var gt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},yt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};yt.prototype.recover=function(t){var e=0,n=vt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/mt}(t)},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},yt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var h=s/3+(t-a)*mt;return new gt(p,e<0?t!=a:t!=u,h)}r+=l-c}return n?t+r:new gt(t+r)},yt.prototype.touches=function(t,e){for(var n=0,r=vt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},yt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},yt.prototype.invert=function(){return new yt(this.ranges,!this.inverted)},yt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},yt.offset=function(t){return 0==t?yt.empty:new yt(t<0?[0,-t,0]:[0,0,t])},yt.empty=new yt([]);var bt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function kt(t){var e=Error.call(this,t);return e.__proto__=kt.prototype,e}bt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new bt(this.maps,this.mirror,t,e)},bt.prototype.copy=function(){return new bt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},bt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},bt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},bt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},bt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},bt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},bt.prototype.invert=function(){var t=new bt;return t.appendMappingInverted(this),t},bt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},bt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},bt.prototype._map=function(t,e,n){for(var r=!1,o=null,i=this.from;i<this.to;i++){var s=this.maps[i],a=o&&o[i];if(null!=a&&s.touches(t,a))t=s.recover(a);else{var c=s.mapResult(t,e);if(null!=c.recover){var l=this.getMirror(i);if(null!=l&&l>i&&l<this.to){if(c.deleted){i=l,t=this.maps[l].recover(c.recover);continue}(o||(o=Object.create(null)))[l]=c.recover}}c.deleted&&(r=!0),t=c.pos}}return n?t:new gt(t,r)},kt.prototype=Object.create(Error.prototype),kt.prototype.constructor=kt,kt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bt},xt={before:{configurable:!0},docChanged:{configurable:!0}};function Ct(){throw new Error("Override me")}xt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new kt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},xt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,xt);var _t=Object.create(null),St=function(){};St.prototype.apply=function(t){return Ct()},St.prototype.getMap=function(){return yt.empty},St.prototype.invert=function(t){return Ct()},St.prototype.map=function(t){return Ct()},St.prototype.merge=function(t){return null},St.prototype.toJSON=function(){return Ct()},St.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=_t[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},St.jsonID=function(t,e){if(t in _t)throw new RangeError("Duplicate use of step JSON ID "+t);return _t[t]=e,e.prototype.jsonID=t,e};var At=function(t,e){this.doc=t,this.failed=e};At.ok=function(t){return new At(t,null)},At.fail=function(t){return new At(null,t)},At.fromReplace=function(t,e,n,r){try{return At.ok(t.replace(e,n,r))}catch(t){if(t instanceof h)return At.fail(t.message);throw t}};var Mt=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Et(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new yt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure!=this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?f.empty:new f(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?f.empty:new f(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,f.fromJSON(t,n.slice),!!n.structure)},e}(St);St.jsonID("replace",Mt);var Dt=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Et(t,this.from,this.gapFrom)||Et(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return At.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?At.fromReplace(t,this.from,this.to,n):At.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,f.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(St);function Et(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Ot(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Tt(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Ot(r,o,i))break}}function Nt(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(zt).concat({type:e,attrs:n}).concat(i.map(zt)):null}function zt(t){return{type:t,attrs:null}}function qt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),h=r&&r[c]||l;if(h!=l&&(p=p.replaceChild(0,h.type.create(h.attrs))),!l.canReplace(u+1,l.childCount)||!h.type.validContent(p))return!1}var f=o.indexAfter(i),d=r&&r[0];return o.node(i).canReplaceWith(f,f,d?d.type:o.node(i+1).type)}function It(t,e){var n=t.resolve(e),r=n.index();return Rt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Ft(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Rt(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function Lt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Bt(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Bt(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return s.fromArray(r)}St.jsonID("replaceAround",Dt),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,i=n.before(o+1),a=r.after(o+1),c=i,l=a,u=s.empty,p=0,h=o,d=!1;h>e;h--)d||n.index(h)>0?(d=!0,u=s.from(n.node(h).copy(u)),p++):c--;for(var m=s.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,m=s.from(r.node(g).copy(m)),v++):l++;return this.step(new Dt(c,l,i,a,new f(u.append(m),p,v),u.size-p,!0))},wt.prototype.wrap=function(t,e){for(var n=s.empty,r=e.length-1;r>=0;r--)n=s.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Dt(o,i,o,i,new f(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var a=o.mapping.slice(i),c=a.map(e,1),l=a.map(e+t.nodeSize,1);return o.step(new Dt(c,l,c+1,l-1,new f(s.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Dt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new f(s.from(i),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=s.empty,i=s.empty,a=r.depth,c=r.depth-e,l=e-1;a>c;a--,l--){o=s.from(r.node(a).copy(o));var u=n&&n[l];i=s.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Mt(t,t,new f(o.append(i),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Mt(t-e,t+e,f.empty,!0);return this.step(n)};var Pt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new f(Bt(n.content,(function(t,n){return n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);St.jsonID("addMark",Pt);var Vt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new f(Bt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Pt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);function $t(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=f.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);if(Ht(o,i,r))return new Mt(e,n,r);var a=function(t,e){var n=function t(e,n,r,o){var i=s.empty,a=0,c=r[n];if(e.depth>n){var l=t(e,n+1,r,o||c);a=l.openEnd+1,i=s.from(e.node(n+1).copy(l.content))}c&&(i=i.append(c.content),a=c.openEnd);o&&(i=i.append(e.node(n).contentMatchAt(e.indexAfter(n)).fillBefore(s.empty,!0)),a=0);return{content:i,openEnd:a}}(t,0,e,!1),r=n.content,o=n.openEnd;return new f(r,t.depth,o||0)}(o,function(t,e){for(var n=new Wt(t),r=1;e.size&&r<=3;r++){var o=n.placeSlice(e.content,e.openStart,e.openEnd,r);3==r&&o!=e&&o.size&&(r=0),e=o}for(;n.open.length;)n.closeNode();return n.placed}(o,r)),c=Jt(o,i,a);if(!c)return null;if(a.size!=c.size&&function(t,e,n){if(!e.parent.isTextblock)return!1;var r,o=n.openEnd?function(t,e){for(var n=1;n<e;n++)t=t.lastChild.content;return t.lastChild}(n.content,n.openEnd):t.node(t.depth-(n.openStart-n.openEnd));if(!o.isTextblock)return!1;for(var i=e.index();i<e.parent.childCount;i++)if(!o.type.allowsMarks(e.parent.child(i).marks))return!1;n.openEnd?r=o.contentMatchAt(o.childCount):(r=o.contentMatchAt(o.childCount),n.size&&(r=r.matchFragment(n.content,n.openStart?1:0)));return(r=r.matchFragment(e.parent.content,e.index()))&&r.validEnd}(o,i,a)){for(var l=i.depth,u=i.after(l);l>1&&u==i.end(--l);)++u;var p=Jt(o,t.resolve(u),a);if(p)return new Dt(e,u,n,i.end(),p,a.size)}return c.size||e!=n?new Mt(e,n,c):null}function jt(t,e,n,r,o,i,a){var c,l=t.childCount,u=l-(a>0?1:0),p=i<0?e:n.node(o);c=i<0?p.contentMatchAt(u):1==l&&a>0?p.contentMatchAt(i?n.index(o):n.indexAfter(o)):p.contentMatchAt(n.indexAfter(o)).matchFragment(t,l>0&&i?1:0,u);var h=r.node(o);if(a>0&&o<r.depth){var f=h.content.cutByIndex(r.indexAfter(o)).addToStart(t.lastChild),d=c.fillBefore(f,!0);if(d&&d.size&&i>0&&1==l&&(d=null),d){var m=jt(t.lastChild.content,t.lastChild,n,r,o+1,1==l?i-1:-1,a-1);if(m){var v=t.lastChild.copy(m);return d.size?t.cutByIndex(0,l-1).append(d).addToEnd(v):t.replaceChild(l-1,v)}}}a>0&&(c=c.matchType((1==l&&i>0?n.node(o+1):t.lastChild).type));var g=r.index(o);if(g==h.childCount&&!h.type.compatibleContent(e.type))return null;for(var y=c.fillBefore(h.content,!0,g),b=g;y&&b<h.content.childCount;b++)p.type.allowsMarks(h.content.child(b).marks)||(y=null);if(!y)return null;if(a>0){var k=function t(e,n,r,o,i){var a,c=e.content,l=c.childCount;a=i>=0?r.node(o).contentMatchAt(r.indexAfter(o)).matchFragment(c,i>0?1:0,l):e.contentMatchAt(l);if(n>0){var u=t(c.lastChild,n-1,r,o+1,1==l?i-1:-1);c=c.replaceChild(l-1,u)}return e.copy(c.append(a.fillBefore(s.empty,!0)))}(t.lastChild,a-1,n,o+1,1==l?i-1:-1);t=t.replaceChild(l-1,k)}return t=t.append(y),r.depth>o&&(t=t.addToEnd(function t(e,n){var r=e.node(n),o=r.contentMatchAt(0).fillBefore(r.content,!0,e.index(n));e.depth>n&&(o=o.addToEnd(t(e,n+1)));return r.copy(o)}(r,o+1))),t}function Jt(t,e,n){var r=jt(n.content,t.node(0),t,e,0,n.openStart,n.openEnd);return r?function(t,e,n){for(;e>0&&n>0&&1==t.childCount;)t=t.firstChild.content,e--,n--;return new f(t,e,n)}(r,n.openStart,e.depth):null}function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}St.jsonID("removeMark",Vt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),h=Math.min(c+r.nodeSize,e),f=n.addToSet(u),d=0;d<u.length;d++)u[d].isInSet(f)||(s&&s.to==p&&s.mark.eq(u[d])?s.to=h:o.push(s=new Vt(p,h,u[d])));a&&a.to==p?a.to=h:i.push(a=new Pt(p,h,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof Q){var c=n.isInSet(r.marks);c&&(a=[c])}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var l=Math.min(s+r.nodeSize,e),u=0;u<a.length;u++){for(var p=a[u],h=void 0,f=0;f<o.length;f++){var d=o[f];d.step==i-1&&p.eq(o[f].style)&&(h=d)}h?(h.to=l,h.step=i):o.push({style:p,from:Math.max(s,t),to:l,step:i})}}})),o.forEach((function(t){return r.step(new Vt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],i=t+1,a=0;a<r.childCount;a++){var c=r.child(a),l=i+c.nodeSize,u=n.matchType(c.type,c.attrs);if(u){n=u;for(var p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||this.step(new Vt(i,l,c.marks[p]))}else o.push(new Mt(i,l,f.empty));i=l}if(!n.validEnd){var h=n.fillBefore(s.empty,!0);this.replace(i,i,new f(h,0,0))}for(var d=o.length-1;d>=0;d--)this.step(o[d]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=f.empty);var r=$t(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new f(s.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,f.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Wt=function(t){this.open=[];for(var e=0;e<=t.depth;e++){var n=t.node(e),r=n.contentMatchAt(t.indexAfter(e));this.open.push({parent:n,match:r,content:s.empty,wrapper:!1,openEnd:0,depth:e})}this.placed=[]};function Ut(t,e,n){var r=t.content;if(e>1){var o=Ut(t.firstChild,e-1,1==t.childCount?n-1:0);r=t.content.replaceChild(0,o)}var i=t.type.contentMatch.fillBefore(r,0==n);return t.copy(i.append(r))}function Kt(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(Kt(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(s.empty,!0))}return t}function Gt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}function Zt(t){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Wt.prototype.placeSlice=function(t,e,n,r,o){if(e>0){var i=t.firstChild,a=this.placeSlice(i.content,Math.max(0,e-1),n&&1==t.childCount?n-1:0,r,i);a.content!=i.content&&(a.content.size?(t=t.replaceChild(0,i.copy(a.content)),e=a.openStart+1):(1==t.childCount&&(n=0),t=t.cutByIndex(1),e=0))}var c=this.placeContent(t,e,n,r,o);if(r>2&&c.size&&0==e){var l=c.content.firstChild,u=1==c.content.childCount;this.placeContent(l.content,0,n&&u?n-1:0,r,l),c=u?s.empty:new f(c.content.cutByIndex(1),0,n)}return c},Wt.prototype.placeContent=function(t,e,n,r,o){for(var i=0;i<t.childCount;i++){for(var a=t.child(i),c=!1,l=i==t.childCount-1,u=this.open.length-1;u>=0;u--){var p=this.open[u],h=void 0;if(r>1&&(h=p.match.findWrapping(a.type))&&(!o||!h.length||h[h.length-1]!=o.type)){for(;this.open.length-1>u;)this.closeNode();for(var d=0;d<h.length;d++)p.match=p.match.matchType(h[d]),u++,p={parent:h[d].create(),match:h[d].contentMatch,content:s.empty,wrapper:!0,openEnd:0,depth:u+d},this.open.push(p)}var m=p.match.matchType(a.type);if(!m){var v=p.match.fillBefore(s.from(a));if(!v){if(o&&p.match.matchType(o.type))break;continue}for(var g=0;g<v.childCount;g++){var y=v.child(g);this.addNode(p,y,0),m=p.match.matchFragment(y)}}for(;this.open.length-1>u;)this.closeNode();a=a.mark(p.parent.type.allowedMarks(a.marks)),e&&(a=Ut(a,e,l?n:0),e=0),this.addNode(p,a,l?n:0),p.match=m,l&&(n=0),c=!0;break}if(!c)break}return this.open.length>1&&(i>0&&i==t.childCount||o&&this.open[this.open.length-1].parent.type==o.type)&&this.closeNode(),new f(t.cutByIndex(i),e,n)},Wt.prototype.addNode=function(t,e,n){var r,o;t.content=(r=t.content,o=t.openEnd,o?r.replaceChild(r.childCount-1,function t(e,n){var r=e.content;if(n>1){var o=t(e.lastChild,n-1);r=e.content.replaceChild(e.childCount-1,o)}var i=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(i))}(r.lastChild,o)):r).addToEnd(e),t.openEnd=n},Wt.prototype.closeNode=function(){var t=this.open.pop();0==t.content.size||(t.wrapper?this.addNode(this.open[this.open.length-1],t.parent.copy(t.content),t.openEnd+1):this.placed[t.depth]={depth:t.depth,content:t.content,openEnd:t.openEnd})},wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new Mt(t,e,n));var i=Gt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],h=n.openStart,d=n.content,m=0;;m++){var v=d.firstChild;if(p.push(v),m==n.openStart)break;d=v.content}h>0&&p[h-1].type.spec.defining&&r.node(u).type!=p[h-1].type?h-=1:h>=2&&p[h-1].isTextblock&&p[h-2].type.spec.defining&&r.node(u).type!=p[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=p[y];if(b)for(var k=0;k<i.length;k++){var w=i[(k+u)%i.length],x=!0;w<0&&(x=!1,w=-w);var C=r.node(w-1),_=r.index(w-1);if(C.canReplaceWith(_,_,b.type,b.marks))return this.replace(r.before(w),x?o.after(w):e,new f(Kt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,A=i.length-1;A>=0&&(this.replace(t,e,n),!(this.steps.length>S));A--){var M=i[A];A<0||(t=r.before(M),e=o.after(M))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new f(s.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Gt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Yt=Object.create(null),Qt=function(t,e,n){this.ranges=n||[new te(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Xt={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Xt.anchor.get=function(){return this.$anchor.pos},Xt.head.get=function(){return this.$head.pos},Xt.from.get=function(){return this.$from.pos},Xt.to.get=function(){return this.$to.pos},Xt.$from.get=function(){return this.ranges[0].$from},Xt.$to.get=function(){return this.ranges[0].$to},Xt.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},Qt.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Qt.prototype.replace=function(t,e){void 0===e&&(e=f.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],l=c.$from,u=c.$to,p=t.mapping.slice(i);t.replaceRange(p.map(l.pos),p.map(u.pos),a?f.empty:e),0==a&&ce(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Qt.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),ce(t,n,e.isInline?-1:1))}},Qt.findFrom=function(t,e,n){var r=t.parent.inlineContent?new ee(t):ae(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?ae(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):ae(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Qt.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ie(t.node(0))},Qt.atStart=function(t){return ae(t,t,0,0,1)||new ie(t)},Qt.atEnd=function(t){return ae(t,t,t.content.size,t.childCount,-1)||new ie(t)},Qt.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Yt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Qt.jsonID=function(t,e){if(t in Yt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Yt[t]=e,e.prototype.jsonID=t,e},Qt.prototype.getBookmark=function(){return ee.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Qt.prototype,Xt),Qt.prototype.visible=!0;var te=function(t,e){this.$from=t,this.$to=e},ee=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),t.prototype.replace.call(this,e,n),n==f.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new ne(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(Qt);Qt.jsonID("text",ee);var ne=function(t,e){this.anchor=t,this.head=e};ne.prototype.map=function(t){return new ne(t.map(this.anchor),t.map(this.head))},ne.prototype.resolve=function(t){return ee.between(t.resolve(this.anchor),t.resolve(this.head))};var re=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new f(s.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new oe(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(Qt);re.prototype.visible=!1,Qt.jsonID("node",re);var oe=function(t){this.anchor=t};oe.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new ne(r,r):new oe(r)},oe.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&re.isSelectable(n)?new re(e):Qt.near(e)};var ie=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return se},e}(Qt);Qt.jsonID("all",ie);var se={map:function(){return this},resolve:function(t){return new ie(t)}};function ae(t,e,n,r,o,i){if(e.inlineContent)return ee.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&re.isSelectable(a))return re.create(t,n-(o<0?a.nodeSize:0))}else{var c=ae(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ce(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Mt||i instanceof Dt)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(Qt.near(t.doc.resolve(o),n))}}var le=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;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},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return p.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Qt.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function ue(t,e){return e&&t?t.bind(e):t}var pe=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},he=[new pe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new pe("selection",{init:function(t,e){return t.selection||Qt.atStart(e.doc)},apply:function(t){return t.selection}}),new pe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],fe=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new pe(t.key,t.spec.state,t))}))},de=function(t){this.config=t},me={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};me.schema.get=function(){return this.config.schema},me.plugins.get=function(){return this.config.plugins},de.prototype.apply=function(t){return this.applyTransaction(t).state},de.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},de.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},de.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new de(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<ve.length;i++)ve[i](this,t,e);return e},me.tr.get=function(){return new le(this)},de.create=function(t){for(var e=new fe(t.schema||t.doc.type.schema,t.plugins),n=new de(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},de.prototype.reconfigure=function(t){for(var e=new fe(t.schema||this.schema,t.plugins),n=e.fields,r=new de(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},de.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==Zt(t))for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},de.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new fe(t.schema,t.plugins),o=new de(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=O.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=Qt.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},de.addApplyListener=function(t){ve.push(t)},de.removeApplyListener=function(t){var e=ve.indexOf(t);e>-1&&ve.splice(e,1)},Object.defineProperties(de.prototype,me);var ve=[];var ge=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:be("plugin")};ge.prototype.getState=function(t){return t[this.key]};var ye=Object.create(null);function be(t){return t in ye?t+"$"+ ++ye[t]:(ye[t]=0,t+"$")}var ke=function(t){void 0===t&&(t="key"),this.key=be(t)};ke.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ke.prototype.getState=function(t){return t[this.key]};var we={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var xe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);we.mac=/Mac/.test(navigator.platform);var Se=we.ie=!!(Ce||_e||xe);we.ie_version=Ce?document.documentMode||6:_e?+_e[1]:xe?+xe[1]:null,we.gecko=!Se&&/gecko\/(\d+)/i.test(navigator.userAgent),we.gecko_version=we.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Ae=!Se&&/Chrome\/(\d+)/.exec(navigator.userAgent);we.chrome=!!Ae,we.chrome_version=Ae&&+Ae[1],we.ios=!Se&&/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),we.android=/Android \d/.test(navigator.userAgent),we.webkit=!Se&&"WebkitAppearance"in document.documentElement.style,we.safari=/Apple Computer/.test(navigator.vendor),we.webkit_version=we.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Me=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},De=function(t){var e=t.parentNode;return e&&11==e.nodeType?e.host:e},Ee=function(t,e,n){var r=document.createRange();return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Oe=function(t,e,n,r){return n&&(Ne(t,e,n,r,-1)||Ne(t,e,n,r,1))},Te=/^(img|br|input|textarea|hr)$/i;function Ne(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:ze(t))){var i=t.parentNode;if(1!=i.nodeType||qe(t)||Te.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Me(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?ze(t):0}}}function ze(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function qe(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Ie=function(t){var e=t.isCollapsed;return e&&we.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Re(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Le(t,e){return"number"==typeof t?t:t[e]}function Be(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=i.defaultView,a=n||t.dom;a;a=De(a))if(1==a.nodeType){var c=a==i.body||1!=a.nodeType,l=c?Fe(s):a.getBoundingClientRect(),u=0,p=0;if(e.top<l.top+Le(r,"top")?p=-(l.top-e.top+Le(o,"top")):e.bottom>l.bottom-Le(r,"bottom")&&(p=e.bottom-l.bottom+Le(o,"bottom")),e.left<l.left+Le(r,"left")?u=-(l.left-e.left+Le(o,"left")):e.right>l.right-Le(r,"right")&&(u=e.right-l.right+Le(o,"right")),(u||p)&&(c?s.scrollBy(u,p):(p&&(a.scrollTop+=p),u&&(a.scrollLeft+=u),e={left:e.left-u,top:e.top-p,right:e.right-u,bottom:e.bottom-p})),c)break}}function Pe(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=De(t));return e}function Ve(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var $e=null;function je(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=Ee(c).getClientRects()}for(var p=0;p<u.length;p++){var h=u[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);var f=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:h.right<e.left?h.right:h.left,top:e.top}:e,1==c.nodeType&&f&&(i=l+(e.left>=(h.left+h.right)/2?1:0));continue}}!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=We(r,1);if(i.top!=i.bottom&&Je(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:je(n,r)}function Je(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function He(t,e){var n,r,o,i,s=t.root;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var l,u=s.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!Je(e,p))return null;if(!(u=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),l=0;l<c.length;l++){var u=c[l];if(Je(n,u))return t(a,n,u)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,p)))return null}if(u=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(u,e),o){if(we.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var h,f=o.childNodes[i];"IMG"==f.nodeName&&(h=f.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=je(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var d=t.docView.nearestDesc(u,!0);return{pos:l,inside:d?d.posAtStart-d.border:-1}}function We(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function Ue(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset;if(3==r.nodeType&&(we.chrome||we.gecko)){var i=We(Ee(r,o,o),0);if(we.gecko&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){var s=We(Ee(r,o-1,o-1),-1);if(Math.abs(s.left-i.left)<1&&s.top==i.top){var a=We(Ee(r,o,o+1),-1);return Ke(a,a.left<s.left)}}return i}if(1==r.nodeType&&!t.state.doc.resolve(e).parent.inlineContent){var c,l=!0;if(o<r.childNodes.length){var u=r.childNodes[o];1==u.nodeType&&(c=u.getBoundingClientRect())}if(!c&&o){var p=r.childNodes[o-1];1==p.nodeType&&(c=p.getBoundingClientRect(),l=!1)}return function(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}(c||r.getBoundingClientRect(),l)}for(var h=-1;h<2;h+=2)if(h<0&&o){var f=void 0,d=3==r.nodeType?Ee(r,o-1,o):3==(f=r.childNodes[o-1]).nodeType?Ee(f):1==f.nodeType&&"BR"!=f.nodeName?f:null;if(d){var m=We(d,1);if(m.top<m.bottom)return Ke(m,!1)}}else if(h>0&&o<ze(r)){var v=void 0,g=3==r.nodeType?Ee(r,o,o+1):3==(v=r.childNodes[o]).nodeType?Ee(v):1==v.nodeType?v:null;if(g){var y=We(g,-1);if(y.top<y.bottom)return Ke(y,!0)}}return Ke(We(3==r.nodeType?Ee(r):r,0),!1)}function Ke(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ge(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o.focus()}}var Ze=/[\u0590-\u08ac]/;var Ye=null,Qe=null,Xe=!1;function tn(t,e,n){return Ye==e&&Qe==n?Xe:(Ye=e,Qe=n,Xe="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$anchor.min(r.$head):r.$anchor.max(r.$head);return Ge(t,e,(function(){for(var e=t.docView.domFromPos(o.pos).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Ue(t,o.pos),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=Ee(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top&&("up"==n?l.bottom<i.top+1:l.top>i.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return Ze.test(r.parent.textContent)&&a.modify?Ge(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var en=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},nn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0}};en.prototype.matchesWidget=function(){return!1},en.prototype.matchesMark=function(){return!1},en.prototype.matchesNode=function(){return!1},en.prototype.matchesHack=function(){return!1},nn.beforePosition.get=function(){return!1},en.prototype.parseRule=function(){return null},en.prototype.stopEvent=function(){return!1},nn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},nn.border.get=function(){return 0},en.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},en.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},nn.posBefore.get=function(){return this.parent.posBeforeChild(this)},nn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},nn.posAfter.get=function(){return this.posBefore+this.size},nn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},en.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},en.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(t):o.nodeDOM==t))return o;n=!1}}},en.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},en.prototype.posFromDOM=function(t,e,n){for(var r=t;;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}},en.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},en.prototype.domFromPos=function(t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var e=0,n=0;;n++){if(e==t){for(;n<this.children.length&&(this.children[n].beforePosition||this.children[n].dom.parentNode!=this.contentDOM);)n++;return{node:this.contentDOM,offset:n==this.children.length?this.contentDOM.childNodes.length:Me(this.children[n].dom)}}if(n==this.children.length)throw new Error("Invalid position "+t);var r=this.children[n],o=e+r.size;if(t<o)return r.domFromPos(t-e-r.border);e=o}},en.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Me(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&e<=c){e=c;for(var h=s+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Me(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},en.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},en.prototype.domAfterPos=function(t){var e=this.domFromPos(t),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},en.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],l=a+c.size;if(o>a&&i<l)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=l}var u=this.domFromPos(t),p=this.domFromPos(e),h=n.getSelection(),f=document.createRange();if(r||!Oe(u.node,u.offset,h.anchorNode,h.anchorOffset)||!Oe(p.node,p.offset,h.focusNode,h.focusOffset)){if(h.extend)f.setEnd(u.node,u.offset),f.collapse(!1);else{if(t>e){var d=u;u=p,p=d}f.setEnd(p.node,p.offset),f.setStart(u.node,u.offset)}h.removeAllRanges(),h.addRange(f),h.extend&&h.extend(p.node,p.offset)}},en.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},nn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},en.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},en.prototype.markParentsDirty=function(){for(var t=this.parent;t;t=t.parent){t.dirty<2&&(t.dirty=2)}},Object.defineProperties(en.prototype,nn);var rn=[],on=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,rn,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={beforePosition:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},Object.defineProperties(e.prototype,n),e}(en),sn=function(t){function e(e,n,r,o){t.call(this,e,rn,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(en),an=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=ht.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,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}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Cn(i,n,s,r)),t>0&&(i=Cn(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(en),cn=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?rn:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,l=i.nodeViews[n.type.name],u=l&&l(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r),p=u&&u.dom,h=u&&u.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(a=ht.renderSpec(document,n.type.spec.toDOM(n))).dom,h=a.contentDOM);h||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=yn(p,r,n),u?c=new hn(t,n,r,o,p,h,f,u,i,s+1):n.isText?new un(t,n,r,o,p,f,i):new e(t,n,r,o,p,h,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?s.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&bn(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=r&&t.composing&&this.localCompositionNode(t,e),s=new wn(this,i&&i.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var h=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[h])).push(o[c++]);if(f){f.sort(xn);for(var d=0;d<f.length;d++)n(f[d],p,!!u)}else n(h,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from==i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var k=0;k<l.length;k++)l[k].to<b&&(b=l[k].to);b<y&&(u=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}r(m,l.length?l.slice():rn,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?s.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&s.syncToMarks(i==n.node.childCount?p.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(rn,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),this.renderChildren())},e.prototype.renderChildren=function(){!function t(e,n){for(var r=e.firstChild,o=0;o<n.length;o++){var i=n[o],s=i.dom;if(s.parentNode==e){for(;s!=r;)r=kn(r);r=r.nextSibling}else e.insertBefore(s,r);if(i instanceof an){var a=r?r.previousSibling:e.lastChild;t(i.contentDOM,i.children),r=a?a.nextSibling:e.firstChild}}for(;r;)r=kn(r)}(this.contentDOM,this.children),we.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom)},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof ee)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=ze(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new sn(this,i,n,o);t.compositionNodes.push(s),this.children=Cn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!bn(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=vn(this.dom,this.nodeDOM,mn(this.outerDeco,this.node,e),mn(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!1)},Object.defineProperties(e.prototype,n),e}(en);function ln(t,e,n,r,o){return yn(r,e,t),new cn(null,t,e,n,r,r,r,o,0)}var un=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{skip:this.nodeDOM.parentNode||!0}},e.prototype.update=function(t,e){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e}(cn),pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},e}(en),hn=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(cn);function fn(t){t&&(this.nodeName=t)}fn.prototype=Object.create(null);var dn=[new fn];function mn(t,e,n){if(0==t.length)return dn;for(var r=n?dn[0]:new fn,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs,a=r;if(s)for(var c in s.nodeName&&o.push(a=new fn(s.nodeName)),s){var l=s[c];null!=l&&(n&&1==o.length&&o.push(a=r=new fn(e.isInline?"span":"div")),"class"==c?a.class=(a.class?a.class+" ":"")+l:"style"==c?a.style=(a.style?a.style+";":"")+l:"nodeName"!=c&&(a[c]=l))}}return o}function vn(t,e,n,r){if(n==dn&&r==dn)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).appendChild(o),a=dn[0]),o=c}gn(o,a||dn[0],s)}return o}function gn(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" "):rn,s=n.class?n.class.split(" "):rn,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c])}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function yn(t,e,n){return vn(t,t,dn,mn(e,n,1!=t.nodeType))}function bn(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function kn(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var wn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1;var n=function(t,e){for(var n=[],r=t.childCount,o=e.length-1;r>0&&o>=0;o--){var i=e[o],s=i.node;if(s){if(s!=t.child(r-1))break;n.push(i),--r}}return{nodes:n.reverse(),offset:r}}(t.node.content,t.children);this.preMatched=n.nodes,this.preMatchOffset=n.offset};function xn(t,e){return t.type.side-e.type.side}function Cn(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function _n(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Qt.findFrom(s,e)}function Sn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function An(t,e,n){var r=t.state.selection;if(r instanceof ee){if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var o=_n(t.state,e);return!!(o&&o instanceof re)&&Sn(t,o)}var i,s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText)return!1;var c=e<0?s.pos-a.nodeSize:s.pos;return!!(a.isAtom||(i=t.docView.descAt(c))&&!i.contentDOM)&&(re.isSelectable(a)?Sn(t,new re(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):!!we.webkit&&Sn(t,new ee(t.state.doc.resolve(e<0?c:c+a.nodeSize))))}if(r instanceof re&&r.node.isInline)return Sn(t,new ee(e>0?r.$to:r.$from));var l=_n(t.state,e);return!!l&&Sn(t,l)}function Mn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Dn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function En(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(we.gecko&&1==n.nodeType&&r<Mn(n)&&Dn(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Dn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Tn(n))break;for(var c=n.previousSibling;c&&Dn(c);)o=n.parentNode,i=Me(c),c=c.previousSibling;if(c)r=Mn(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Nn(t,e,n,r):o&&Nn(t,e,o,i)}}function On(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Mn(n);;)if(r<s){if(1!=n.nodeType)break;if(!Dn(n.childNodes[r]))break;o=n,i=++r}else{if(Tn(n))break;for(var a=n.nextSibling;a&&Dn(a);)o=a.parentNode,i=Me(a)+1,a=a.nextSibling;if(a)r=0,s=Mn(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Nn(t,e,o,i)}}function Tn(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Nn(t,e,n,r){if(Ie(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection()}function zn(t,e,n){var r=t.state.selection;if(r instanceof ee&&!r.empty||n.indexOf("s")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=_n(t.state,e);if(s&&s instanceof re)return Sn(t,s)}if(!o.parent.inlineContent){var a=Qt.findFrom(e<0?o:i,e);return!a||Sn(t,a)}return!1}function qn(t,e){if(!(t.state.selection instanceof ee))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function In(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Rn(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||we.mac&&72==n&&"c"==r?qn(t,-1)||En(t):46==n||we.mac&&68==n&&"c"==r?qn(t,1)||On(t):13==n&&!we.ios||27==n||(37==n?An(t,-1,r)||En(t):39==n?An(t,1,r)||On(t):38==n?zn(t,-1,r)||En(t):40==n?function(t){if(we.chrome&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;In(t,o,!0),setTimeout((function(){return In(t,o,!1)}),20)}}}(t)||zn(t,1,r)||On(t):r==(we.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Fn(t,e){var n,r,o=t.root.getSelection(),i=t.state.doc,s=t.docView.nearestDesc(o.focusNode),a=s&&0==s.size,c=t.docView.posFromDOM(o.focusNode,o.focusOffset),l=i.resolve(c);if(Ie(o)){for(n=l;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&re.isSelectable(s.node)&&s.parent&&(!s.node.isInline||!function(t,e,n){for(var r=0==e,o=e==ze(t);r||o;){if(t==n)return!0;var i=Me(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==ze(t)}}(o.focusNode,o.focusOffset,s.dom))){var u=s.posBefore;r=new re(c==u?l:i.resolve(u))}}else n=i.resolve(t.docView.posFromDOM(o.anchorNode,o.anchorOffset));r||(r=Hn(t,n,l,"pointer"==e||t.state.selection.head<l.pos&&!a?1:-1));return r}function Ln(t,e){var n=t.state.selection;if(jn(t,n),t.editable?t.hasFocus():Wn(t)&&document.activeElement.contains(t.dom)){if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,Me(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&we.ie&&we.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,s=n.head;!Bn||n instanceof ee||(n.$from.parent.inlineContent||(r=Pn(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Pn(t,n.to))),t.docView.setSelection(i,s,t.root,e),Bn&&(r&&$n(r),o&&$n(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):i!=s&&(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),t.dom.classList.remove("ProseMirror-hideselection"))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}wn.prototype.getPreMatch=function(t){return t>=this.preMatchOffset?this.preMatched[t-this.preMatchOffset]:null},wn.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},wn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},wn.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=an.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},wn.prototype.findNodeMatch=function(t,e,n,r){var o=-1,i=r<0?void 0:this.getPreMatch(r),s=this.top.children;if(i&&i.matchesNode(t,e,n))o=s.indexOf(i);else for(var a=this.index,c=Math.min(s.length,a+5);a<c;a++){var l=s[a];if(l.matchesNode(t,e,n)&&this.preMatched.indexOf(l)<0){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},wn.prototype.updateNextNode=function(t,e,n,r,o){if(this.index==this.top.children.length)return!1;var i=this.top.children[this.index];if(i instanceof cn){var s=this.preMatched.indexOf(i);if(s>-1&&s+this.preMatchOffset!=o)return!1;var a=i.dom;if(!(this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))&&!(t.isText&&i.node&&i.node.isText&&i.nodeDOM.nodeValue==t.text&&3!=i.dirty&&bn(e,i.outerDeco)))&&i.update(t,e,n,r))return i.dom!=a&&(this.changed=!0),this.index++,!0}return!1},wn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,cn.create(this.top,t,e,n,r,o)),this.changed=!0},wn.prototype.placeWidget=function(t,e,n){if(this.index<this.top.children.length&&this.top.children[this.index].matchesWidget(t))this.index++;else{var r=new on(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}},wn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof an;)t=t.children[t.children.length-1];if(!t||!(t instanceof un)||/\n$/.test(t.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var e=document.createElement("br");this.top.children.splice(this.index++,0,new pn(this.top,rn,e,null)),this.changed=!0}};var Bn=we.safari||we.chrome&&we.chrome_version<63;function Pn(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(we.safari&&i&&"false"==i.contentEditable)return Vn(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Vn(i);if(s)return Vn(s)}}function Vn(t){return t.contentEditable="true",we.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $n(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jn(t,e){if(e instanceof re){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Jn(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Jn(t)}function Jn(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Hn(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||ee.between(e,n,r)}function Wn(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Un(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(we.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||we.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Kn(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==i?c.setMeta("pointer",!0):"key"==i&&c.scrollIntoView(),t.dispatch(c)}}else{var l=t.state.doc.resolve(e),u=l.sharedDepth(n);e=l.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p,h,f=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Ie(l)||u.push({node:l.focusNode,offset:l.focusOffset})),we.chrome&&8===t.lastKeyCode)for(var h=s;h>i;h--){var f=o.childNodes[h-1],d=f.pmViewDesc;if("BR"==f.nodeType&&!d){s=h;break}if(!d||d.size)break}var m=t.state.doc,v=t.someProp("domParser")||et.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Un,context:g});if(u&&null!=u[0].pos){var k=u[0].pos,w=u[1]&&u[1].pos;null==w&&(w=k),y={anchor:k+a,head:w+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n),m=t.state.doc,v=m.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.lastKeyCode=null;var g=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var l=Math.max(0,i-Math.min(a,c));r-=a+l-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(v.content,d.doc.content,d.from,p,h);if(!g){if(!(r&&f instanceof ee&&!f.empty&&f.$head.sameParent(f.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){var y=Gn(t,t.state.doc,d.sel);y&&!y.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(y))}return}g={start:f.from,endA:f.to,endB:f.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof ee&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),we.ie&&we.ie_version<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>d.from&&"  "==d.doc.textBetween(g.start-d.from-1,g.start-d.from+1)&&(g.start--,g.endA--,g.endB--);var b,k=d.doc.resolveNoCache(g.start-d.from),w=d.doc.resolveNoCache(g.endB-d.from);if((we.ios&&t.lastIOSEnter>Date.now()-100&&(!k.sameParent(w)||o.some((function(t){return"DIV"==t.nodeName})))||!k.sameParent(w)&&k.pos<d.doc.content.size&&(b=Qt.findFrom(d.doc.resolve(k.pos+1),1,!0))&&b.head==w.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>g.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Zn(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Zn(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,g.start,g.endA,k,w)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))we.android&&we.chrome&&t.domObserver.suppressSelectionUpdates();else{var x,C,_,S,A=g.start,M=g.endA;if(k.sameParent(w)&&k.parent.inlineContent)if(k.pos==w.pos)we.ie&&we.ie_version<=11&&0==k.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Ln(t)}),20)),x=t.state.tr.delete(A,M),C=m.resolve(g.start).marksAcross(m.resolve(g.endA));else if(g.endA==g.endB&&(S=m.resolve(g.start))&&(_=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,c=i,l=a,u=0;u<a.length;u++)c=a[u].removeFromSet(c);for(var p=0;p<i.length;p++)l=i[p].removeFromSet(l);if(1==c.length&&0==l.length)r=c[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=l.length)return null;r=l[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var h=[],f=0;f<e.childCount;f++)h.push(o(e.child(f)));if(s.from(h).eq(t))return{mark:r,type:n}}(k.parent.content.cut(k.parentOffset,w.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start()))))x=t.state.tr,"add"==_.type?x.addMark(A,M,_.mark):x.removeMark(A,M,_.mark);else if(k.parent.child(k.index()).isText&&k.index()==w.index()-(w.textOffset?0:1)){var D=k.parent.textBetween(k.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,A,M,D)})))return;x=t.state.tr.insertText(D,A,M)}if(x||(x=t.state.tr.replace(A,M,d.doc.slice(g.start-d.from,g.endB-d.from))),d.sel){var E=Gn(t,x.doc,d.sel);E&&!(we.chrome&&we.android&&t.composing&&E.empty&&E.head==A||we.ie&&E.empty&&E.head==A)&&x.setSelection(E)}C&&x.ensureMarks(C),t.dispatch(x.scrollIntoView())}}}function Gn(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hn(t,e.resolve(n.anchor),e.resolve(n.head))}function Zn(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Yn(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.type.hasRequiredAttrs()?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||ht.fromSchema(t.state.schema),c=rr(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=er[p.nodeName.toLowerCase()]);){for(var h=u.length-1;h>=0;h--){for(var f=c.createElement(u[h]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Qn(t,e,n,r,o){var i,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var l=e&&(r||c||!n);if(l){if(t.someProp("transformPastedText",(function(t){e=t(e)})),c)return new f(s.from(t.state.schema.text(e)),0,0);var u=t.someProp("clipboardTextParser",(function(t){return t(e,o)}));u?a=u:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=rr().createElement("div"),o=/(?:<meta [^>]*>)*<([a-z][^>\s]+)/i.exec(t),i=0;(n=o&&er[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""),i=n.length);r.innerHTML=t;for(var s=0;s<i;s++)r=r.firstChild;return r}(n);var p=i&&i.querySelector("[data-pm-slice]"),h=p&&/^(\d+) (\d+) (.*)/.exec(p.getAttribute("data-pm-slice"));if(!a){var d=t.someProp("clipboardParser")||t.someProp("domParser")||et.fromSchema(t.state.schema);a=d.parseSlice(i,{preserveWhitespace:!(!l&&!h),context:o})}return a=h?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var l=r.nodes[n[c]];if(!l||l.hasRequiredAttrs())break;o=s.from(l.create(n[c+1],o)),i++,a++}return new f(o,i,a)}(function(t,e,n){e<t.openStart&&(t=new f(tr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd));n<t.openEnd&&(t=new f(tr(t.content,1,n,t.openEnd,0,0),t.openStart,n));return t}(a,+h[1],+h[2]),h[3]):f.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,i=[];if(t.forEach((function(t){if(i){var e,n=r.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&o.length&&function t(e,n,r,o,i){if(i<e.length&&i<n.length&&e[i]==n[i]){var a=t(e,n,r,o.lastChild,i+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(i==e.length-1?r.type:e[i+1]))return o.copy(o.content.append(s.from(Xn(r,e,i+1))))}}(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),o=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(o))}(i[i.length-1],o.length));var a=Xn(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}})),i)return{v:s.from(i)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(a.content,o),!1),t.someProp("transformPasted",(function(t){a=t(a)})),a}function Xn(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,s.from(t));return t}function tr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,c=a.content;return o<r-1&&(c=tr(c,e,n,r,o+1,i)),o>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||i<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var er={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nr=null;function rr(){return nr||(nr=document.implementation.createHTMLDocument("title"))}var or={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ir=we.ie&&we.ie_version<=11,sr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};sr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},sr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var ar=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=!1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);we.ie&&we.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new sr,ir&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};ar.prototype.flushSoon=function(){var t=this;this.flushingSoon||(this.flushingSoon=!0,window.setTimeout((function(){t.flushingSoon=!1,t.flush()}),20))},ar.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,or),ir&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},ar.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}ir&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},ar.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},ar.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},ar.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},ar.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Wn(t)){var t;if(this.suppressingSelectionUpdates)return Ln(this.view);if(we.ie&&we.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&Oe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},ar.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},ar.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},ar.prototype.flush=function(){if(this.view.docView&&!this.flushingSoon){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Wn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&!this.view.composing&&(i=!0))}if(we.gecko&&s.length>1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(cr)return;cr=!0,"normal"==getComputedStyle(t.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,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Ln(this.view))}},ar.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){var r=t.previousSibling,o=t.nextSibling;if(we.ie&&we.ie_version<=11&&t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){var s=t.addedNodes[i],a=s.previousSibling,c=s.nextSibling;(!a||Array.prototype.indexOf.call(t.addedNodes,a)<0)&&(r=a),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c)}for(var l=r&&r.parentNode==t.target?Me(r)+1:0,u=n.localPosFromDOM(t.target,l,-1),p=o&&o.parentNode==t.target?Me(o):t.target.childNodes.length,h=0;h<t.addedNodes.length;h++)e.push(t.addedNodes[h]);return{from:u,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var cr=!1;var lr={},ur={};function pr(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function hr(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return fr(t,e)})}))}function fr(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function dr(t){return{left:t.clientX,top:t.clientY}}function mr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function vr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function gr(t,e,n,r,o){return mr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof re&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(vr(t,re.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&re.isSelectable(r))&&(vr(t,new re(n),"pointer"),!0)}(t,n))}function yr(t,e,n,r){return mr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function br(t,e,n,r){return mr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(vr(t,ee.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)vr(t,ee.create(n,s+1,s+1+i.content.size),"pointer");else{if(!re.isSelectable(i))continue;vr(t,re.create(n,s),"pointer")}return!0}}(t,n)}function kr(t){return Ar(t)}ur.keydown=function(t,e){t.shiftKey=16==e.keyCode||e.shiftKey,Cr(t,e)||(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!we.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey?t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Rn(t,e)?e.preventDefault():pr(t,"key"):t.lastIOSEnter=Date.now())},ur.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},ur.keypress=function(t,e){if(!(Cr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||we.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof ee&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var wr=we.mac?"metaKey":"ctrlKey";lr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=kr(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[wr]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(dr(e));i&&("singleClick"==o?t.mouseDown=new xr(t,i,e,n):("doubleClick"==o?yr:br)(t,i.pos,i.inside,e)?e.preventDefault():pr(t,"pointer"))};var xr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[wr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof re&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&we.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(){return s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),pr(t,"pointer")};function Cr(t,e){return!!t.composing||!!(we.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}xr.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.draggable=!1),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xr.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(dr(t))),this.allowDefault||!e?pr(this.view,"pointer"):gr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():!this.flushed&&(!we.chrome||this.view.state.selection instanceof ee||e.pos!=this.view.state.selection.from&&e.pos!=this.view.state.selection.to)?pr(this.view,"pointer"):(vr(this.view,Qt.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault())}},xr.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),pr(this.view,"pointer")},lr.touchdown=function(t){kr(t),pr(t,"pointer")},lr.contextmenu=function(t){return kr(t)};var _r=we.android?5e3:-1;function Sr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Ar(t)}),e))}function Ar(t,e){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty();return!(!e&&!t.docView.dirty)&&(t.updateState(t.state),!0)}ur.compositionstart=ur.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Ar(t,!0),t.markCursor=null;else if(Ar(t),we.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Sr(t,_r)},ur.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Sr(t,20))};var Mr=we.ie&&we.ie_version<15||we.ios&&we.webkit_version<604;function Dr(t,e,n,r){var o=Qn(t,e,n,t.shiftKey,t.state.selection.$from);if(!t.someProp("handlePaste",(function(e){return e(t,r,o||f.empty)}))&&o){var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste"))}}lr.copy=ur.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Mr?null:e.clipboardData,i=Yn(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){var n=t.dom.ownerDocument,r=n.body.appendChild(n.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),i=n.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((function(){n.body.removeChild(r),t.focus()}),50)}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},ur.paste=function(t,e){var n=Mr?null:e.clipboardData,r=n&&n.getData("text/html"),o=n&&n.getData("text/plain");n&&(r||o||n.files.length)?(Dr(t,o,r,e),e.preventDefault()):function(t,e){var n=t.dom.ownerDocument,r=t.shiftKey||t.state.selection.$from.parent.type.spec.code,o=n.body.appendChild(n.createElement(r?"textarea":"div"));r||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((function(){t.focus(),n.body.removeChild(o),r?Dr(t,o.value,null,e):Dr(t,o.textContent,o.innerHTML,e)}),50)}(t,e)};var Er=function(t,e){this.slice=t,this.move=e},Or=we.mac?"altKey":"ctrlKey";for(var Tr in lr.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(dr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof re?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=Yn(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Mr?"Text":"text/html",c.innerHTML),Mr||e.dataTransfer.setData("text/plain",l),t.dragging=new Er(s,!e[Or])}},lr.dragend=function(t){window.setTimeout((function(){return t.dragging=null}),50)},ur.dragover=ur.dragenter=function(t,e){return e.preventDefault()},ur.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(dr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||Qn(t,e.dataTransfer.getData(Mr?"Text":"text/plain"),Mr?null:e.dataTransfer.getData("text/html"),!1,o);if(i&&(e.preventDefault(),!t.someProp("handleDrop",(function(r){return r(t,e,i,n&&n.move)})))){var s=i?Lt(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var a=t.state.tr;n&&n.move&&a.deleteSelection();var c=a.mapping.map(s),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=a.doc;if(l?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),!a.doc.eq(u)){var p=a.doc.resolve(c);l&&re.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild)?a.setSelection(new re(p)):a.setSelection(Hn(t,p,a.doc.resolve(a.mapping.map(s)))),t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}}}}}},lr.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Ln(t)}),20))},lr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},lr.beforeinput=function(t,e){if(we.chrome&&we.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},ur)lr[Tr]=ur[Tr];function Nr(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var zr=function(t,e){this.spec=e||Br,this.side=this.spec.side||0,this.toDOM=t};zr.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Rr(i-n,i-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(t){return this==t||t instanceof zr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Nr(this.spec,t.spec))};var qr=function(t,e){this.spec=e||Br,this.attrs=t};qr.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Rr(o,i,this)},qr.prototype.valid=function(t,e){return e.from<e.to},qr.prototype.eq=function(t){return this==t||t instanceof qr&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)},qr.is=function(t){return t.type instanceof qr};var Ir=function(t,e){this.spec=e||Br,this.attrs=t};Ir.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Rr(o.pos-n,i.pos-n,this)},Ir.prototype.valid=function(t,e){var n=t.content.findIndex(e.from),r=n.index,o=n.offset;return o==e.from&&o+t.child(r).nodeSize==e.to},Ir.prototype.eq=function(t){return this==t||t instanceof Ir&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)};var Rr=function(t,e,n){this.from=t,this.to=e,this.type=n},Fr={spec:{configurable:!0}};Rr.prototype.copy=function(t,e){return new Rr(t,e,this.type)},Rr.prototype.eq=function(t){return this.type.eq(t.type)&&this.from==t.from&&this.to==t.to},Rr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Rr.widget=function(t,e,n){return new Rr(t,t,new zr(e,n))},Rr.inline=function(t,e,n,r){return new Rr(t,e,new qr(n,r))},Rr.node=function(t,e,n,r){return new Rr(t,e,new Ir(n,r))},Fr.spec.get=function(){return this.type.spec},Object.defineProperties(Rr.prototype,Fr);var Lr=[],Br={},Pr=function(t,e){this.local=t&&t.length?t:Lr,this.children=e&&e.length?e:Lr};Pr.create=function(t,e){return e.length?Wr(e,t,0,Br):Vr},Pr.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Pr.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Pr.prototype.map=function(t,e,n){return this==Vr||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Br)},Pr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:(l=r-n-(e-t)+(i-o))&&(a[s]+=l,a[s+1]+=l))}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(-1==a[p+1]){var h=n.map(a[p]+i),f=h-o;if(f<0||f>=r.content.size){u=!0;continue}var d=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==d){var b=a[p+2].mapInner(n,y,h+1,a[p]+i+1,s);b!=Vr?(a[p]=f,a[p+1]=d,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var k=Wr(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=k.local;for(var w=0;w<a.length;w+=3)a[w+1]<0&&(a.splice(w,3),w-=3);for(var x=0,C=0;x<k.children.length;x+=3){for(var _=k.children[x];C<a.length&&a[C]<_;)C+=3;a.splice(C,0,k.children[x],k.children[x+1],k.children[x+2])}}return new Pr(e&&e.sort(Ur),a)}(this.children,i,t,e,n,r,o):i?new Pr(i.sort(Ur)):Vr},Pr.prototype.add=function(t,e){return e.length?this==Vr?Pr.create(t,e):this.addInner(t,e,0):this},Pr.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Jr(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Wr(a,t,c+1,Br)),i+=3}}));var s=jr(i?Hr(e):e,-n);return new Pr(s.length?this.local.concat(s).sort(Ur):this.local,r||this.children)},Pr.prototype.remove=function(t){return 0==t.length||this==Vr?this:this.removeInner(t,0)},Pr.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=Vr?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,h=void 0;p<t.length;p++)if(h=t[p])for(var f=0;f<r.length;f++)r[f].type.eq(h.type)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Pr(r,n):Vr},Pr.prototype.forChild=function(t,e){if(this==Vr)return this;if(e.isLeaf)return Pr.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof qr){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Pr(r.sort(Ur));return n?new $r([p,n]):p}return n||Vr},Pr.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Pr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Pr.prototype.locals=function(t){return Kr(this.localsInner(t))},Pr.prototype.localsInner=function(t){if(this==Vr)return Lr;if(t.inlineContent||!this.local.some(qr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qr||e.push(this.local[n]);return e};var Vr=new Pr;Pr.empty=Vr,Pr.removeOverlap=Kr;var $r=function(t){this.members=t};function jr(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Rr(o.from+e,o.to+e,o.type))}return n}function Jr(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Hr(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Wr(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Jr(t,e,s+n);if(a){i=!0;var c=Wr(a,e,n+s+1,r);c!=Vr&&o.push(s,s+e.nodeSize,c)}}));for(var s=jr(i?Hr(t):t,-n).sort(Ur),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Pr(s,o):Vr}function Ur(t,e){return t.from-e.from||t.to-e.to}function Kr(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gr(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Gr(e,o+1,i.copy(r.to,i.to)))}}return e}function Gr(t,e,n){for(;e<t.length&&Ur(n,t[e])>0;)e++;t.splice(e,0,n)}function Zr(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Vr&&e.push(r)})),t.cursorWrapper&&e.push(Pr.create(t.state.doc,[t.cursorWrapper.deco])),$r.from(e)}$r.prototype.forChild=function(t,e){if(e.isLeaf)return Pr.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Vr&&(o instanceof $r?n=n.concat(o.members):n.push(o))}return $r.from(n)},$r.prototype.eq=function(t){if(!(t instanceof $r)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},$r.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Kr(n?e:e.sort(Ur)):Lr},$r.from=function(t){switch(t.length){case 0:return Vr;case 1:return t[0];default:return new $r(t)}};var Yr=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=eo(this),this.markCursor=null,this.cursorWrapper=null,to(this),this.nodeViews=no(this),this.docView=ln(this.state.doc,Xr(this),Zr(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new ar(t,(function(e,n,r,o){return Kn(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=lr[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||fr(t,e)||!t.editable&&e.type in ur||n(t,e)})};for(var n in lr)e(n);we.safari&&t.dom.addEventListener("input",(function(){return null})),hr(t)}(this),this.pluginViews=[],this.updatePluginViews()},Qr={props:{configurable:!0},root:{configurable:!0}};function Xr(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r?e.class+=" "+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Rr.node(0,t.state.doc.content.size,e)]}function to(t){var e=t.state.selection,n=e.$head,r=e.$anchor,o=e.visible;if(t.markCursor){var i=document.createElement("img");i.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:i,deco:Rr.widget(n.pos,i,{raw:!0,marks:t.markCursor})}}else if(o||n.pos!=r.pos)t.cursorWrapper=null;else{var s;!t.cursorWrapper||t.cursorWrapper.dom.childNodes.length?((s=document.createElement("div")).style.position="absolute",s.style.left="-100000px"):t.cursorWrapper.deco.pos!=n.pos&&(s=t.cursorWrapper.dom),s&&(t.cursorWrapper={dom:s,deco:Rr.widget(n.pos,s,{raw:!0})})}}function eo(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function no(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}Qr.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Yr.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&hr(this),this._props=t,this.updateStateInner(t.state,!0)},Yr.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},Yr.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Yr.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1;if(this.state=t,e){var i=no(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(i,this.nodeViews)&&(this.nodeViews=i,o=!0),hr(this)}this.editable=eo(this),to(this);var s,a,c,l,u,p,h,f,d,m,v,g=Zr(this),y=Xr(this),b=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",k=o||!this.docView.matchesNode(t.doc,y,g),w=k||!t.selection.eq(r.selection),x="preserve"==b&&w&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Pe(t.dom)}}(this);if(w){this.domObserver.stop();var C=k&&(we.ie||we.chrome)&&!r.selection.empty&&!t.selection.empty&&(l=r.selection,u=t.selection,p=Math.min(l.$anchor.sharedDepth(l.head),u.$anchor.sharedDepth(u.head)),l.$anchor.node(p)!=u.$anchor.node(p));k&&(!o&&this.docView.update(t.doc,y,g,this)||(this.docView.destroy(),this.docView=ln(t.doc,y,g,this.dom,this))),C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(s=this,a=s.docView.domFromPos(s.state.selection.anchor),c=s.root.getSelection(),Oe(a.node,a.offset,c.anchorNode,c.anchorOffset)))?Ln(this,C):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==b)this.dom.scrollTop=0;else if("to selection"==b){var _=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof re?Be(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),_):Be(this,this.coordsAtPos(t.selection.head),_))}else x&&(f=(h=x).refDOM,d=h.refTop,m=h.stack,v=f?f.getBoundingClientRect().top:0,Ve(m,0==v?0:v-d))},Yr.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Yr.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var o=this.state.plugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}},Yr.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;var o=this.state.plugins;if(o)for(var i=0;i<o.length;i++){var s=o[i].props[t];if(null!=s&&(n=e?e(s):s))return n}},Yr.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Yr.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if($e)return t.focus($e);var e=Pe(t);t.focus(null==$e?{get preventScroll(){return $e={preventScroll:!0},!0}}:void 0),$e||($e=!1,Ve(e,0))}(this.dom),Ln(this),this.domObserver.start()},Qr.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Yr.prototype.posAtCoords=function(t){return He(this,t)},Yr.prototype.coordsAtPos=function(t){return Ue(this,t)},Yr.prototype.domAtPos=function(t){return this.docView.domFromPos(t)},Yr.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Yr.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Yr.prototype.endOfTextblock=function(t,e){return tn(this,e||this.state,t)},Yr.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Yr.prototype.dispatchEvent=function(t){return function(t,e){fr(t,e)||!lr[e.type]||!t.editable&&e.type in ur||lr[e.type](t,e)}(this,t)},Yr.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Yr.prototype,Qr);var ro=n(13),oo=n.n(ro),io=new X({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:function(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:function(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:function(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){return{params:t.getAttribute("data-params")||""}}}],toDOM:function(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:function(t){return{tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:function(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:function(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM:function(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:function(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:function(t){return"italic"==t&&null}}],toDOM:function(){return["em"]}},strong:{parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-weight",getAttrs:function(t){return/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}}],toDOM:function(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:function(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM:function(){return["code"]}}}});var so=function(t,e){this.schema=t,this.stack=[{type:t.topNodeType,content:[]}],this.marks=p.none,this.tokenHandlers=e};function ao(t,e){return t.getAttrs?t.getAttrs(e):t.attrs instanceof Function?t.attrs(e):t.attrs}function co(t){return"code_inline"==t||"code_block"==t||"fence"==t}function lo(t){return"\n"==t[t.length-1]?t.slice(0,t.length-1):t}function uo(){}so.prototype.top=function(){return this.stack[this.stack.length-1]},so.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},so.prototype.addText=function(t){if(t){var e,n=this.top().content,r=n[n.length-1],o=this.schema.text(t,this.marks);r&&(e=function(t,e){if(t.isText&&e.isText&&p.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(r,o))?n[n.length-1]=e:n.push(o)}},so.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},so.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},so.prototype.parseTokens=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=this.tokenHandlers[n.type];if(!r)throw new Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n)}},so.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},so.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},so.prototype.closeNode=function(){this.marks.length&&(this.marks=p.none);var t=this.stack.pop();return this.addNode(t.type,t.attrs,t.content)};var po=function(t,e,n){this.tokens=n,this.schema=t,this.tokenizer=e,this.tokenHandlers=function(t,e){var n=Object.create(null),r=function(r){var o=e[r];if(o.block){var i=t.nodeType(o.block);co(r)?n[r]=function(t,e){t.openNode(i,ao(o,e)),t.addText(lo(e.content)),t.closeNode()}:(n[r+"_open"]=function(t,e){return t.openNode(i,ao(o,e))},n[r+"_close"]=function(t){return t.closeNode()})}else if(o.node){var s=t.nodeType(o.node);n[r]=function(t,e){return t.addNode(s,ao(o,e))}}else if(o.mark){var a=t.marks[o.mark];co(r)?n[r]=function(t,e){t.openMark(a.create(ao(o,e))),t.addText(lo(e.content)),t.closeMark(a)}:(n[r+"_open"]=function(t,e){return t.openMark(a.create(ao(o,e)))},n[r+"_close"]=function(t){return t.closeMark(a)})}else{if(!o.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(o));co(r)?n[r]=uo:(n[r+"_open"]=uo,n[r+"_close"]=uo)}};for(var o in e)r(o);return n.text=function(t,e){return t.addText(e.content)},n.inline=function(t,e){return t.parseTokens(e.children)},n.softbreak=n.softbreak||function(t){return t.addText("\n")},n}(t,n)};po.prototype.parse=function(t){var e,n=new so(this.schema,this.tokenHandlers);n.parseTokens(this.tokenizer.parse(t,{}));do{e=n.closeNode()}while(n.stack.length);return e};var ho=new po(io,oo()("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list"},ordered_list:{block:"ordered_list",getAttrs:function(t){return{order:+t.attrGet("start")||1}}},heading:{block:"heading",getAttrs:function(t){return{level:+t.tag.slice(1)}}},code_block:{block:"code_block"},fence:{block:"code_block",getAttrs:function(t){return{params:t.info||""}}},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:function(t){return{src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null}}},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:function(t){return{href:t.attrGet("href"),title:t.attrGet("title")||null}}},code_inline:{mark:"code"}}),fo=function(t,e){this.nodes=t,this.marks=e};fo.prototype.serialize=function(t,e){var n=new yo(this.nodes,this.marks,e);return n.renderContent(t),n.out};var mo=new fo({blockquote:function(t,e){t.wrapBlock("> ",null,e,(function(){return t.renderContent(e)}))},code_block:function(t,e){t.write("```"+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},heading:function(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e),t.closeBlock(e)},horizontal_rule:function(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list:function(t,e){t.renderList(e," ",(function(){return(e.attrs.bullet||"*")+" "}))},ordered_list:function(t,e){var n=e.attrs.order||1,r=String(n+e.childCount-1).length,o=t.repeat(" ",r+2);t.renderList(e,o,(function(e){var o=String(n+e);return t.repeat(" ",r-o.length)+o+". "}))},list_item:function(t,e){t.renderContent(e)},paragraph:function(t,e){t.renderInline(e),t.closeBlock(e)},image:function(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+t.esc(e.attrs.src)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")")},hard_break:function(t,e,n,r){for(var o=r+1;o<n.childCount;o++)if(n.child(o).type!=e.type)return void t.write("\\\n")},text:function(t,e){t.text(e.text)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open:function(t,e,n,r){return go(e,n,r,1)?"<":"["},close:function(t,e,n,r){return go(e,n,r,-1)?">":"]("+t.esc(e.attrs.href)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")"}},code:{open:function(t,e,n,r){return vo(n.child(r),-1)},close:function(t,e,n,r){return vo(n.child(r-1),1)},escape:!1}});function vo(t,e){var n,r=/`+/g,o=0;if(t.isText)for(;n=r.exec(t.text);)o=Math.max(o,n[0].length);for(var i=o>0&&e>0?" `":"`",s=0;s<o;s++)i+="`";return o>0&&e<0&&(i+=" "),i}function go(t,e,n,r){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;var o=e.child(n+(r<0?-1:0));if(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t)return!1;if(n==(r<0?1:e.childCount-1))return!0;var i=e.child(n+(r<0?-2:1));return!t.isInSet(i.marks)}var yo=function(t,e,n){this.nodes=t,this.marks=e,this.delim=this.out="",this.closed=!1,this.inTightList=!1,this.options=n||{},void 0===this.options.tightLists&&(this.options.tightLists=!1)};yo.prototype.flushClose=function(t){if(this.closed){if(this.atBlank()||(this.out+="\n"),null==t&&(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;r<t;r++)this.out+=e+"\n"}this.closed=!1}},yo.prototype.wrapBlock=function(t,e,n,r){var o=this.delim;this.write(e||t),this.delim+=t,r(),this.delim=o,this.closeBlock(n)},yo.prototype.atBlank=function(){return/(^|\n)$/.test(this.out)},yo.prototype.ensureNewLine=function(){this.atBlank()||(this.out+="\n")},yo.prototype.write=function(t){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),t&&(this.out+=t)},yo.prototype.closeBlock=function(t){this.closed=t},yo.prototype.text=function(t,e){for(var n=t.split("\n"),r=0;r<n.length;r++){var o=this.atBlank()||this.closed;this.write(),this.out+=!1!==e?this.esc(n[r],o):n[r],r!=n.length-1&&(this.out+="\n")}},yo.prototype.render=function(t,e,n){if("number"==typeof e)throw new Error("!");this.nodes[t.type.name](this,t,e,n)},yo.prototype.renderContent=function(t){var e=this;t.forEach((function(n,r,o){return e.render(n,t,o)}))},yo.prototype.renderInline=function(t){var e=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[];o&&"hard_break"===o.type.name&&(a=a.filter((function(e){if(s+1==t.childCount)return!1;var n=t.child(s+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));var c=r;if(r="",o&&o.isText&&a.some((function(t){var n=e.marks[t.type.name];return n&&n.expelEnclosingWhitespace}))){var l=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=(l[0],l[1]),p=l[2],h=l[3];c+=u,r=h,(u||h)&&((o=p?o.withText(p):null)||(a=n))}var f=a.length&&a[a.length-1],d=f&&!1===e.marks[f.type.name].escape,m=a.length-(d?1:0);t:for(var v=0;v<m;v++){var g=a[v];if(!e.marks[g.type.name].mixable)break;for(var y=0;y<n.length;y++){var b=n[y];if(!e.marks[b.type.name].mixable)break;if(g.eq(b)){v>y?a=a.slice(0,y).concat(g).concat(a.slice(y,v)).concat(a.slice(v+1,m)):y>v&&(a=a.slice(0,v).concat(a.slice(v+1,y)).concat(g).concat(a.slice(y,m)));continue t}}}for(var k=0;k<Math.min(n.length,m)&&a[k].eq(n[k]);)++k;for(;k<n.length;)e.text(e.markString(n.pop(),!1,t,s),!1);if(c&&e.text(c),o){for(;n.length<m;){var w=a[n.length];n.push(w),e.text(e.markString(w,!0,t,s),!1)}d&&o.isText?e.text(e.markString(f,!0,t,s)+o.text+e.markString(f,!1,t,s+1),!1):e.render(o,t,s)}};t.forEach(o),o(null,0,t.childCount)},yo.prototype.renderList=function(t,e,n){var r=this;this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);var o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach((function(i,s,a){a&&o&&r.flushClose(1),r.wrapBlock(e,n(a),t,(function(){return r.render(i,t,a)}))})),this.inTightList=i},yo.prototype.esc=function(t,e){return t=t.replace(/[`*\\~\[\]]/g,"\\$&"),e&&(t=t.replace(/^[:#\-*+]/,"\\$&").replace(/^(\d+)\./,"$1\\.")),t},yo.prototype.quote=function(t){var e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]},yo.prototype.repeat=function(t,e){for(var n="",r=0;r<e;r++)n+=t;return n},yo.prototype.markString=function(t,e,n,r){var o=this.marks[t.type.name],i=e?o.open:o.close;return"string"==typeof i?i:i(this,t,n,r)},yo.prototype.getEnclosingWhitespace=function(t){return{leading:(t.match(/^(\s+)/)||[])[0],trailing:(t.match(/(\s+)$/)||[])[0]}};for(var bo={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"},ko=bo,wo={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"},xo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Co="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),_o="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ao="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mo=xo&&(So||+xo[1]<57)||_o&&So,Do=0;Do<10;Do++)bo[48+Do]=bo[96+Do]=String(Do);for(Do=1;Do<=24;Do++)bo[Do+111]="F"+Do;for(Do=65;Do<=90;Do++)bo[Do]=String.fromCharCode(Do+32),wo[Do]=String.fromCharCode(Do);for(var Eo in bo)wo.hasOwnProperty(Eo)||(wo[Eo]=bo[Eo]);var Oo=function(t){var e=!(Mo&&(t.ctrlKey||t.altKey||t.metaKey)||(Co||Ao)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?wo:bo)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e},To="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function No(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);To?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function zo(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function qo(t){return new ge({props:{handleKeyDown:Io(t)}})}function Io(t){var e=function(t){var e=Object.create(null);for(var n in t)e[No(n)]=t[n];return e}(t);return function(t,n){var r,o=Oo(n),i=1==o.length&&" "!=o,s=e[zo(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey)&&(r=ko[n.keyCode])&&r!=o){var a=e[zo(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[zo(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Ro=function(){};Ro.prototype.append=function(t){return t.length?(t=Ro.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Ro.prototype.prepend=function(t){return t.length?Ro.from(t).append(this):this},Ro.prototype.appendInner=function(t){return new Lo(this,t)},Ro.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Ro.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Ro.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ro.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Ro.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Ro.from=function(t){return t instanceof Ro?t:t&&t.length?new Fo(t):Ro.empty};var Fo=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ro);Ro.empty=new Fo([]);var Lo=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Ro),Bo=Ro,Po=function(t,e){this.items=t,this.eventCount=e};Po.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new Vo(t.map));var p,h=t.step.map(r.slice(o));h&&c.maybeStep(h).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new Vo(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Po(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Po.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var l,u=t.steps[c].invert(t.docs[c]),p=new Vo(t.mapping.maps[c],u,e);(l=a&&a.merge(p))&&(p=l,c?o.pop():s=s.slice(0,s.length-1)),o.push(p),e&&(i++,e=null),r||(a=p)}var h,f,d,m=i-n.depth;return m>jo&&(f=m,(h=s).forEach((function(t,e){if(t.selection&&0==f--)return d=e,!1})),s=h.slice(d),i-=m),new Po(s.append(o),i)},Po.prototype.remapping=function(t,e){var n=new bt;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Po.prototype.addMaps=function(t){return 0==this.eventCount?this:new Po(this.items.append(t.map((function(t){return new Vo(t)}))),this.eventCount)},Po.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new Vo(c,l,u))}else n.push(new Vo(c))}}),r);for(var c=[],l=e;l<i;l++)c.push(new Vo(o.maps[l]));var u=this.items.slice(0,r).append(c).append(n),p=new Po(u,s);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},Po.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Po.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new Vo(c.invert(),a,l),h=r.length-1;(u=r.length&&r[h].merge(p))?r[h]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new Po(Bo.from(r.reverse()),o)},Po.empty=new Po(Bo.empty,0);var Vo=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Vo.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Vo(e.getMap().invert(),e,this.selection)}};var $o=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},jo=20;function Jo(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ho(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Wo(t,e,n,r){var o=Go(e),i=Zo.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new $o(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(Zo,{redo:r,historyState:l}).scrollIntoView())}}var Uo=!1,Ko=null;function Go(t){var e=t.plugins;if(Ko!=e){Uo=!1,Ko=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Uo=!0;break}}return Uo}var Zo=new ke("history"),Yo=new ke("closeHistory");function Qo(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new ge({key:Zo,state:{init:function(){return new $o(Po.empty,Po.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(Zo);if(i)return i.historyState;n.getMeta(Yo)&&(t=new $o(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Zo))return s.getMeta(Zo).redo?new $o(t.done.addTransform(n,null,r,Go(e)),t.undone,Jo(n.mapping.maps[n.steps.length-1]),t.prevTime):new $o(t.done,t.undone.addTransform(n,null,r,Go(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new $o(t.done.rebased(n,o),t.undone.rebased(n,o),Ho(t.prevRanges,n.mapping),t.prevTime):new $o(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ho(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ho(t.prevRanges,n.mapping):Jo(n.mapping.maps[n.steps.length-1]);return new $o(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Go(e)),Po.empty,c,n.time)}(n,r,e,t)}},config:t})}function Xo(t,e){var n=Zo.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Wo(n,t,e,!1),!0)}function ti(t,e){var n=Zo.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Wo(n,t,e,!0),!0)}function ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function ri(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function ii(t,e){var n,r=t.selection,o=r instanceof re;if(o){if(r.node.isTextblock||!It(t.doc,r.from))return!1;n=r.from}else if(null==(n=Ft(t.doc,r.from,-1)))return!1;if(e){var i=t.tr.join(n);o&&i.setSelection(re.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function si(t,e){var n,r=t.selection;if(r instanceof re){if(r.node.isTextblock||!It(t.doc,r.to))return!1;n=r.to}else if(null==(n=Ft(t.doc,r.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function ai(t,e){var n=t.selection,r=n.$from,o=n.$to,i=r.blockRange(o),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function ci(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function li(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=ci(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),l=t.tr.replaceWith(c,c,a.createAndFill());l.setSelection(Qt.near(l.doc.resolve(c),1)),e(l.scrollIntoView())}return!0}function ui(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof re&&t.selection.node.isBlock)return!(!r.parentOffset||!qt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,a=t.tr;t.selection instanceof ee&&a.deleteSelection();var c=0==r.depth?null:ci(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&c?[{type:c}]:null,u=qt(a.doc,a.mapping.map(r.pos),1,l);l||u||!qt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(l=[{type:c}],u=!0),u&&(a.split(a.mapping.map(r.pos),1,l),i||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from(c.create(),r.parent))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0}function pi(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(re.create(t.doc,n))),!0)}function hi(t,e,n){var r,o,i=e.nodeBefore,a=e.nodeAfter;if(i.type.spec.isolating||a.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!It(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;if(e.parent.canReplace(e.index(),e.index()+1)&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var c=e.pos+a.nodeSize,l=s.empty,u=r.length-1;u>=0;u--)l=s.from(r[u].create(null,l));l=s.from(i.copy(l));var p=t.tr.step(new Dt(e.pos-1,c,e.pos,c,new f(l,1,0),r.length,!0)),h=c+2*r.length;It(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}var d=Qt.findFrom(e,1),m=d&&d.$from.blockRange(d.$to),v=m&&Tt(m);return null!=v&&v>=e.depth&&(n&&n(t.tr.lift(m,v).scrollIntoView()),!0)}function fi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Nt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function di(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function mi(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],h=p.$from,f=p.$to;c=n.doc.rangeHasMark(h.pos,f.pos,t)}for(var d=0;d<a.length;d++){var m=a[d],v=m.$from,g=m.$to;c?l.removeMark(v.pos,g.pos,t):l.addMark(v.pos,g.pos,t.create(e))}r(l.scrollIntoView())}return!0}}function vi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var gi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r);if(!o){var i=r.blockRange(),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(a,"end")||re.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(ni(a,"end")?Qt.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):re.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r),i=o&&o.nodeBefore;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)})),yi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r);if(!o)return!1;var i=o.nodeAfter;if(hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(i,"start")||re.isSelectable(i))){if(e){var s=t.tr.deleteRange(r.before(),r.after());s.setSelection(ni(i,"start")?Qt.findFrom(s.doc.resolve(s.mapping.map(o.pos)),1):re.create(s.doc,s.mapping.map(o.pos))),e(s.scrollIntoView())}return!0}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r),i=o&&o.nodeAfter;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos)).scrollIntoView()),!0)})),bi={Enter:vi((function(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(r.parent.inlineContent||o.parent.inlineContent)return!1;var i=ci(r.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}),(function(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(qt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Tt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),ui),"Mod-Enter":li,Backspace:gi,"Mod-Backspace":gi,Delete:yi,"Mod-Delete":yi,"Mod-a":function(t,e){return e&&e(t.tr.setSelection(new ie(t.doc))),!0}},ki={"Ctrl-h":bi.Backspace,"Alt-Backspace":bi["Mod-Backspace"],"Ctrl-d":bi.Delete,"Ctrl-Alt-Backspace":bi["Mod-Delete"],"Alt-Delete":bi["Mod-Delete"],"Alt-d":bi["Mod-Delete"]};for(var wi in bi)ki[wi]=bi[wi];var xi=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?ki:bi;function Ci(t){return void 0===t&&(t={}),new ge({view:function(e){return new _i(e,t)}})}var _i=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};_i.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},_i.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},_i.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},_i.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a=this.editorView.dom.offsetParent;this.element||(this.element=a.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);var c=!a||a==document.body&&"static"==getComputedStyle(a).position?{left:-pageXOffset,top:-pageYOffset}:a.getBoundingClientRect();this.element.style.left=t.left-c.left+"px",this.element.style.top=t.top-c.top+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},_i.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},_i.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Lt(this.editorView.state.doc,n,this.editorView.dragging.slice))&&(n=e.pos),this.setCursor(n),this.scheduleRemoval(5e3)}}},_i.prototype.dragend=function(){this.scheduleRemoval(20)},_i.prototype.drop=function(){this.scheduleRemoval(20)},_i.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Si=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return f.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new Ai(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).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}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.maybeChild(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;i=n>0?i.firstChild:i.lastChild;){o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null},e}(Qt);Si.prototype.visible=!1,Qt.jsonID("gapcursor",Si);var Ai=function(t){this.pos=t};Ai.prototype.map=function(t){return new Ai(t.map(this.pos))},Ai.prototype.resolve=function(t){var e=t.resolve(this.pos);return Si.valid(e)?new Si(e):Qt.near(e)};var Mi=Io({ArrowLeft:Di("horiz",-1),ArrowRight:Di("horiz",1),ArrowUp:Di("vert",-1),ArrowDown:Di("vert",1)});function Di(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof ee){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=Si.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new Si(c))),!0)}}function Ei(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!Si.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&re.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new Si(r))),!0)}function Oi(t){if(!(t.selection instanceof Si))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pr.create(t.doc,[Rr.widget(t.selection.head,e,{key:"gapcursor"})])}function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Ni=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){!function(e){var n,r="function",o=function(t,e){return Ti(t)===e},i=function t(e,n){null!==n&&(Array.isArray(n)?n.map((function(n){return t(e,n)})):(s.isNode(n)||(n=document.createTextNode(n)),e.appendChild(n)))};function s(t,e){var n,a,c=arguments,l=1;if(t=s.isElement(t)?t:document.createElement(t),o(e,"object")&&!s.isNode(e)&&!Array.isArray(e))for(n in l++,e)a=e[n],n=s.attrMap[n]||n,o(n,r)?n(t,a):o(a,r)?t[n]=a:t.setAttribute(n,a);for(;l<c.length;l++)i(t,c[l]);return t}s.attrMap={},s.isElement=function(t){return t instanceof Element},s.isNode=function(t){return t instanceof Node},s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}}),n=s,t.exports=n}()})),zi="http://www.w3.org/2000/svg",qi="ProseMirror-icon";function Ii(t){var e=document.createElement("div");if(e.className=qi,t.path){var n="pm-icon-"+function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e}(t.path).toString(16);document.getElementById(n)||function(t,e){var n=document.getElementById(qi+"-collection");n||((n=document.createElementNS(zi,"svg")).id=qi+"-collection",n.style.display="none",document.body.insertBefore(n,document.body.firstChild));var r=document.createElementNS(zi,"symbol");r.id=t,r.setAttribute("viewBox","0 0 "+e.width+" "+e.height),r.appendChild(document.createElementNS(zi,"path")).setAttribute("d",e.path),n.appendChild(r)}(n,t);var r=e.appendChild(document.createElementNS(zi,"svg"));r.style.width=t.width/t.height+"em",r.appendChild(document.createElementNS(zi,"use")).setAttributeNS("http://www.w3.org/1999/xlink","href",/([^#]*)/.exec(document.location)[1]+"#"+n)}else t.dom?e.appendChild(t.dom.cloneNode(!0)):(e.appendChild(document.createElement("span")).textContent=t.text||"",t.css&&(e.firstChild.style.cssText=t.css));return e}var Ri="ProseMirror-menu",Fi=function(t){this.spec=t};function Li(t,e){return t._props.translate?t._props.translate(e):e}Fi.prototype.render=function(t){var e=this.spec,n=e.render?e.render(t):e.icon?Ii(e.icon):e.label?Ni("div",null,Li(t,e.label)):null;if(!n)throw new RangeError("MenuItem without icon or label property");if(e.title){var r="function"==typeof e.title?e.title(t.state):e.title;n.setAttribute("title",Li(t,r))}return e.class&&n.classList.add(e.class),e.css&&(n.style.cssText+=e.css),n.addEventListener("mousedown",(function(r){r.preventDefault(),n.classList.contains(Ri+"-disabled")||e.run(t.state,t.dispatch,t,r)})),{dom:n,update:function(t){if(e.select){var r=e.select(t);if(n.style.display=r?"":"none",!r)return!1}var o=!0;if(e.enable&&(o=e.enable(t)||!1,Xi(n,Ri+"-disabled",!o)),e.active){var i=o&&e.active(t)||!1;Xi(n,Ri+"-active",i)}return!0}}};var Bi={time:0,node:null};function Pi(t){Bi.time=Date.now(),Bi.node=t.target}function Vi(t){return Date.now()-100<Bi.time&&Bi.node&&t.contains(Bi.node)}var $i=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};function ji(t,e){for(var n=[],r=[],o=0;o<t.length;o++){var i=t[o].render(e),s=i.dom,a=i.update;n.push(Ni("div",{class:Ri+"-dropdown-item"},s)),r.push(a)}return{dom:n,update:Ji(r,n)}}function Ji(t,e){return function(n){for(var r=!1,o=0;o<t.length;o++){var i=t[o](n);e[o].style.display=i?"":"none",i&&(r=!0)}return r}}$i.prototype.render=function(t){var e=this,n=ji(this.content,t),r=Ni("div",{class:Ri+"-dropdown "+(this.options.class||""),style:this.options.css},Li(t,this.options.label));this.options.title&&r.setAttribute("title",Li(t,this.options.title));var o=Ni("div",{class:Ri+"-dropdown-wrap"},r),i=null,s=null,a=function(){i&&i.close()&&(i=null,window.removeEventListener("mousedown",s))};return r.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),i?a():(i=e.expand(o,n.dom),window.addEventListener("mousedown",s=function(){Vi(o)||a()}))})),{dom:o,update:function(t){var e=n.update(t);return o.style.display=e?"":"none",e}}},$i.prototype.expand=function(t,e){var n=Ni("div",{class:Ri+"-dropdown-menu "+(this.options.class||"")},e),r=!1;return t.appendChild(n),{close:function(){if(!r)return r=!0,t.removeChild(n),!0},node:n}};var Hi=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};Hi.prototype.render=function(t){var e=ji(this.content,t),n=Ni("div",{class:Ri+"-submenu-label"},Li(t,this.options.label)),r=Ni("div",{class:Ri+"-submenu-wrap"},n,Ni("div",{class:Ri+"-submenu"},e.dom)),o=null;return n.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),Xi(r,Ri+"-submenu-wrap-active"),o||window.addEventListener("mousedown",o=function(){Vi(r)||(r.classList.remove(Ri+"-submenu-wrap-active"),window.removeEventListener("mousedown",o),o=null)})})),{dom:r,update:function(t){var n=e.update(t);return r.style.display=n?"":"none",n}}};var Wi={join:{width:800,height:900,path:"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z"},lift:{width:1024,height:1024,path:"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z"},selectParentNode:{text:"⬚",css:"font-weight: bold"},undo:{width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"},redo:{width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"},strong:{width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},em:{width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},code:{width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"},link:{width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"},bulletList:{width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"},orderedList:{width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"},blockquote:{width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},Ui=new Fi({title:"Join with above block",run:ii,select:function(t){return ii(t)},icon:Wi.join}),Ki=new Fi({title:"Lift out of enclosing block",run:ai,select:function(t){return ai(t)},icon:Wi.lift}),Gi=new Fi({title:"Select parent node",run:pi,select:function(t){return pi(t)},icon:Wi.selectParentNode}),Zi=new Fi({title:"Undo last change",run:Xo,enable:function(t){return Xo(t)},icon:Wi.undo}),Yi=new Fi({title:"Redo last undone change",run:ti,enable:function(t){return ti(t)},icon:Wi.redo});function Qi(t,e){var n=di(t,e.attrs),r={run:n,enable:function(t){return n(t)},active:function(n){var r=n.selection,o=r.$from,i=r.to,s=r.node;return s?s.hasMarkup(t,e.attrs):i<=o.end()&&o.parent.hasMarkup(t,e.attrs)}};for(var o in e)r[o]=e[o];return new Fi(r)}function Xi(t,e,n){n?t.classList.add(e):t.classList.remove(e)}var ts="ProseMirror-menubar";var es=function(t,e){var n=this;this.editorView=t,this.options=e,this.wrapper=Ni("div",{class:ts+"-wrapper"}),this.menu=this.wrapper.appendChild(Ni("div",{class:ts})),this.menu.className=ts,this.spacer=null,t.dom.parentNode.replaceChild(this.wrapper,t.dom),this.wrapper.appendChild(t.dom),this.maxHeight=0,this.widthForMaxHeight=0,this.floating=!1;var r=function(t,e){for(var n=document.createDocumentFragment(),r=[],o=[],i=0;i<e.length;i++){for(var s=e[i],a=[],c=[],l=0;l<s.length;l++){var u=s[l].render(t),p=u.dom,h=u.update,f=Ni("span",{class:Ri+"item"},p);n.appendChild(f),c.push(f),a.push(h)}a.length&&(r.push(Ji(a,c)),i<e.length-1&&o.push(n.appendChild(Ni("span",{class:Ri+"separator"}))))}return{dom:n,update:function(t){for(var e=!1,n=!1,i=0;i<r.length;i++){var s=r[i](t);i&&(o[i-1].style.display=n&&s?"":"none"),n=s,s&&(e=!0)}return e}}}(this.editorView,this.options.content),o=r.dom,i=r.update;if(this.contentUpdate=i,this.menu.appendChild(o),this.update(),e.floating&&!function(){if("undefined"==typeof navigator)return!1;var t=navigator.userAgent;return!/Edge\/\d/.test(t)&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t)}()){this.updateFloat();var s=function(t){for(var e=[window],n=t.parentNode;n;n=n.parentNode)e.push(n);return e}(this.wrapper);this.scrollFunc=function(t){var e=n.editorView.root;(e.body||e).contains(n.wrapper)?n.updateFloat(t.target.getBoundingClientRect&&t.target):s.forEach((function(t){return t.removeEventListener("scroll",n.scrollFunc)}))},s.forEach((function(t){return t.addEventListener("scroll",n.scrollFunc)}))}};es.prototype.update=function(){this.contentUpdate(this.editorView.state),this.floating?this.updateScrollCursor():(this.menu.offsetWidth!=this.widthForMaxHeight&&(this.widthForMaxHeight=this.menu.offsetWidth,this.maxHeight=0),this.menu.offsetHeight>this.maxHeight&&(this.maxHeight=this.menu.offsetHeight,this.menu.style.minHeight=this.maxHeight+"px"))},es.prototype.updateScrollCursor=function(){var t=this.editorView.root.getSelection();if(t.focusNode){var e=t.getRangeAt(0).getClientRects(),n=e[function(t){if(t.anchorNode==t.focusNode)return t.anchorOffset>t.focusOffset;return t.anchorNode.compareDocumentPosition(t.focusNode)==Node.DOCUMENT_POSITION_FOLLOWING}(t)?0:e.length-1];if(n){var r=this.menu.getBoundingClientRect();if(n.top<r.bottom&&n.bottom>r.top){var o=function(t){for(var e=t.parentNode;e;e=e.parentNode)if(e.scrollHeight>e.clientHeight)return e}(this.wrapper);o&&(o.scrollTop-=r.bottom-n.top)}}}},es.prototype.updateFloat=function(t){var e=this.wrapper,n=e.getBoundingClientRect(),r=t?Math.max(0,t.getBoundingClientRect().top):0;if(this.floating)if(n.top>=r||n.bottom<this.menu.offsetHeight+10)this.floating=!1,this.menu.style.position=this.menu.style.left=this.menu.style.top=this.menu.style.width="",this.menu.style.display="",this.spacer.parentNode.removeChild(this.spacer),this.spacer=null;else{var o=(e.offsetWidth-e.clientWidth)/2;this.menu.style.left=n.left+o+"px",this.menu.style.display=n.top>window.innerHeight?"none":"",t&&(this.menu.style.top=r+"px")}else if(n.top<r&&n.bottom>=this.menu.offsetHeight+10){this.floating=!0;var i=this.menu.getBoundingClientRect();this.menu.style.left=i.left+"px",this.menu.style.width=i.width+"px",t&&(this.menu.style.top=r+"px"),this.menu.style.position="fixed",this.spacer=Ni("div",{class:ts+"-spacer",style:"height: "+i.height+"px"}),e.insertBefore(this.spacer,this.menu)}},es.prototype.destroy=function(){this.wrapper.parentNode&&this.wrapper.parentNode.replaceChild(this.editorView.dom,this.wrapper)};function ns(t,e){return function(n,r){var o=n.selection,i=o.$from,a=o.$to,c=i.blockRange(a),l=!1,u=c;if(!c)return!1;if(c.depth>=2&&i.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==i.index(c.depth-1))return!1;var p=n.doc.resolve(c.start-2);u=new M(p,p,c.depth),c.endIndex<c.parent.childCount&&(c=new M(i,n.doc.resolve(a.end(c.depth)),c.depth)),l=!0}var h=Nt(u,t,e,c);return!!h&&(r&&r(function(t,e,n,r,o){for(var i=s.empty,a=n.length-1;a>=0;a--)i=s.from(n[a].type.create(n[a].attrs,i));t.step(new Dt(e.start-(r?2:0),e.end,e.start,e.end,new f(i,0,0),n.length,!0));for(var c=0,l=0;l<n.length;l++)n[l].type==o&&(c=l+1);for(var u=n.length-c,p=e.start+n.length-(r?2:0),h=e.parent,d=e.startIndex,m=e.endIndex,v=!0;d<m;d++,v=!1)!v&&qt(t.doc,p,u)&&(t.split(p,u),p+=2*u),p+=h.child(d).nodeSize;return t}(n.tr,c,h,l,t).scrollIntoView()),!0)}}function rs(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));return!!a&&(!n||(o.node(a.depth-1).type==t?function(t,e,n,r){var o=t.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new Dt(i-1,a,i,a,new f(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new M(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));return e(o.lift(r,Tt(r)).scrollIntoView()),!0}(e,n,t,a):function(t,e,n){for(var r=t.tr,o=n.parent,i=n.end,a=n.endIndex-1,c=n.startIndex;a>c;a--)i-=o.child(a).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(n.start),u=l.nodeAfter,p=0==n.startIndex,h=n.endIndex==o.childCount,d=l.node(-1),m=l.index(-1);if(!d.canReplace(m+(p?0:1),m+1,u.content.append(h?s.empty:s.from(o))))return!1;var v=l.pos,g=v+u.nodeSize;return r.step(new Dt(v-(p?1:0),g+(h?1:0),v+1,g-1,new f((p?s.empty:s.from(o.copy(s.empty))).append(h?s.empty:s.from(o.copy(s.empty))),p?0:1,h?0:1),p?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}var is=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function ss(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}function as(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));var l=s.doc.resolve(i.from).marks();e(s.replaceWith(i.from,i.to,t.schema.text(i.text,l)))}return!0}}return!1}var cs=new is(/--$/,"—"),ls=new is(/\.\.\.$/,"…"),us=[new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new is(/"$/,"”"),new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new is(/'$/,"’")];function ps(t,e,n,r){return new is(t,(function(t,o,i,s){var a=n instanceof Function?n(o):n,c=t.tr.delete(i,s),l=c.doc.resolve(i).blockRange(),u=l&&Nt(l,e,a);if(!u)return null;c.wrap(l,u);var p=c.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&It(c.doc,i-1)&&(!r||r(o,p))&&c.join(i-1),c}))}function hs(t,e,n){return new is(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}function fs(t){var e=document.body.appendChild(document.createElement("div"));e.className="ProseMirror-prompt";var n=function(t){e.contains(t.target)||r()};setTimeout((function(){return window.addEventListener("mousedown",n)}),50);var r=function(){window.removeEventListener("mousedown",n),e.parentNode&&e.parentNode.removeChild(e)},o=[];for(var i in t.fields)o.push(t.fields[i].render());var s=document.createElement("button");s.type="submit",s.className="ProseMirror-prompt-submit",s.textContent="OK";var a=document.createElement("button");a.type="button",a.className="ProseMirror-prompt-cancel",a.textContent="Cancel",a.addEventListener("click",r);var c=e.appendChild(document.createElement("form"));t.title&&(c.appendChild(document.createElement("h5")).textContent=t.title),o.forEach((function(t){c.appendChild(document.createElement("div")).appendChild(t)}));var l=c.appendChild(document.createElement("div"));l.className="ProseMirror-prompt-buttons",l.appendChild(s),l.appendChild(document.createTextNode(" ")),l.appendChild(a);var u=e.getBoundingClientRect();e.style.top=(window.innerHeight-u.height)/2+"px",e.style.left=(window.innerWidth-u.width)/2+"px";var p=function(){var e=function(t,e){var n=Object.create(null),r=0;for(var o in t){var i=t[o],s=e[r++],a=i.read(s),c=i.validate(a);if(c)return ds(s,c),null;n[o]=i.clean(a)}return n}(t.fields,o);e&&(r(),t.callback(e))};c.addEventListener("submit",(function(t){t.preventDefault(),p()})),c.addEventListener("keydown",(function(t){27==t.keyCode?(t.preventDefault(),r()):13!=t.keyCode||t.ctrlKey||t.metaKey||t.shiftKey?9==t.keyCode&&window.setTimeout((function(){e.contains(document.activeElement)||r()}),500):(t.preventDefault(),p())}));var h=c.elements[0];h&&h.focus()}function ds(t,e){var n=t.parentNode,r=n.appendChild(document.createElement("div"));r.style.left=t.offsetLeft+t.offsetWidth+2+"px",r.style.top=t.offsetTop-5+"px",r.className="ProseMirror-invalid",r.textContent=e,setTimeout((function(){return n.removeChild(r)}),1500)}var ms=function(t){this.options=t};ms.prototype.read=function(t){return t.value},ms.prototype.validateType=function(t){},ms.prototype.validate=function(t){return!t&&this.options.required?"Required field":this.validateType(t)||this.options.validate&&this.options.validate(t)},ms.prototype.clean=function(t){return this.options.clean?this.options.clean(t):t};var vs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=document.createElement("input");return t.type="text",t.placeholder=this.options.label,t.value=this.options.value||"",t.autocomplete="off",t},e}(ms);function gs(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1}function ys(t,e){var n={label:e.title,run:t};for(var r in e)n[r]=e[r];return e.enable&&!0!==e.enable||e.select||(n[e.enable?"enable":"select"]=function(e){return t(e)}),new Fi(n)}function bs(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to;return n.empty?e.isInSet(t.storedMarks||o.marks()):t.doc.rangeHasMark(r,i,e)}function ks(t,e){var n={active:function(e){return bs(e,t)},enable:!0};for(var r in e)n[r]=e[r];return ys(mi(t),n)}function ws(t,e){return ys(ns(t,e.attrs),e)}function xs(t){var e,n,r,o={};if((e=t.marks.strong)&&(o.toggleStrong=ks(e,{title:"Toggle strong style",icon:Wi.strong})),(e=t.marks.em)&&(o.toggleEm=ks(e,{title:"Toggle emphasis",icon:Wi.em})),(e=t.marks.code)&&(o.toggleCode=ks(e,{title:"Toggle code font",icon:Wi.code})),(e=t.marks.link)&&(o.toggleLink=(n=e,new Fi({title:"Add or remove link",icon:Wi.link,active:function(t){return bs(t,n)},enable:function(t){return!t.selection.empty},run:function(t,e,r){if(bs(t,n))return mi(n)(t,e),!0;fs({title:"Create a link",fields:{href:new vs({label:"Link target",required:!0}),title:new vs({label:"Title"})},callback:function(t){mi(n,t)(r.state,r.dispatch),r.focus()}})}}))),(e=t.nodes.image)&&(o.insertImage=(r=e,new Fi({title:"Insert image",label:"Image",enable:function(t){return gs(t,r)},run:function(t,e,n){var o=t.selection,i=o.from,s=o.to,a=null;t.selection instanceof re&&t.selection.node.type==r&&(a=t.selection.node.attrs),fs({title:"Insert image",fields:{src:new vs({label:"Location",required:!0,value:a&&a.src}),title:new vs({label:"Title",value:a&&a.title}),alt:new vs({label:"Description",value:a?a.alt:t.doc.textBetween(i,s," ")})},callback:function(t){n.dispatch(n.state.tr.replaceSelectionWith(r.createAndFill(t))),n.focus()}})}}))),(e=t.nodes.bullet_list)&&(o.wrapBulletList=ws(e,{title:"Wrap in bullet list",icon:Wi.bulletList})),(e=t.nodes.ordered_list)&&(o.wrapOrderedList=ws(e,{title:"Wrap in ordered list",icon:Wi.orderedList})),(e=t.nodes.blockquote)&&(o.wrapBlockQuote=function(t,e){var n={run:function(n,r){return fi(t,e.attrs)(n,r)},select:function(n){return fi(t,e.attrs instanceof Function?null:e.attrs)(n)}};for(var r in e)n[r]=e[r];return new Fi(n)}(e,{title:"Wrap in block quote",icon:Wi.blockquote})),(e=t.nodes.paragraph)&&(o.makeParagraph=Qi(e,{title:"Change to paragraph",label:"Plain"})),(e=t.nodes.code_block)&&(o.makeCodeBlock=Qi(e,{title:"Change to code block",label:"Code"})),e=t.nodes.heading)for(var i=1;i<=10;i++)o["makeHead"+i]=Qi(e,{title:"Change to heading "+i,label:"Level "+i,attrs:{level:i}});if(e=t.nodes.horizontal_rule){var s=e;o.insertHorizontalRule=new Fi({title:"Insert horizontal rule",label:"Horizontal rule",enable:function(t){return gs(t,s)},run:function(t,e){e(t.tr.replaceSelectionWith(s.create()))}})}var a=function(t){return t.filter((function(t){return t}))};return o.insertMenu=new $i(a([o.insertImage,o.insertHorizontalRule]),{label:"Insert"}),o.typeMenu=new $i(a([o.makeParagraph,o.makeCodeBlock,o.makeHead1&&new Hi(a([o.makeHead1,o.makeHead2,o.makeHead3,o.makeHead4,o.makeHead5,o.makeHead6]),{label:"Heading"})]),{label:"Type..."}),o.inlineMenu=[a([o.toggleStrong,o.toggleEm,o.toggleCode,o.toggleLink])],o.blockMenu=[a([o.wrapBulletList,o.wrapOrderedList,o.wrapBlockQuote,Ui,Ki,Gi])],o.fullMenu=o.inlineMenu.concat([[o.insertMenu,o.typeMenu]],[[Zi,Yi]],o.blockMenu),o}var Cs="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _s(t,e){var n,r,o={};function i(t,n){if(e){var r=e[t];if(!1===r)return;r&&(t=r)}o[t]=n}if(i("Mod-z",Xo),i("Shift-Mod-z",ti),i("Backspace",as),Cs||i("Mod-y",ti),i("Alt-ArrowUp",ii),i("Alt-ArrowDown",si),i("Mod-BracketLeft",ai),i("Escape",pi),(n=t.marks.strong)&&(i("Mod-b",mi(n)),i("Mod-B",mi(n))),(n=t.marks.em)&&(i("Mod-i",mi(n)),i("Mod-I",mi(n))),(n=t.marks.code)&&i("Mod-`",mi(n)),(n=t.nodes.bullet_list)&&i("Shift-Ctrl-8",ns(n)),(n=t.nodes.ordered_list)&&i("Shift-Ctrl-9",ns(n)),(n=t.nodes.blockquote)&&i("Ctrl->",fi(n)),n=t.nodes.hard_break){var a=n,c=vi(li,(function(t,e){return e(t.tr.replaceSelectionWith(a.create()).scrollIntoView()),!0}));i("Mod-Enter",c),i("Shift-Enter",c),Cs&&i("Ctrl-Enter",c)}if((n=t.nodes.list_item)&&(i("Enter",(r=n,function(t,e){var n=t.selection,o=n.$from,i=n.$to,a=n.node;if(a&&a.isBlock||o.depth<2||!o.sameParent(i))return!1;var c=o.node(-1);if(c.type!=r)return!1;if(0==o.parent.content.size){if(2==o.depth||o.node(-3).type!=r||o.index(-2)!=o.node(-2).childCount-1)return!1;if(e){for(var l=s.empty,u=o.index(-1)>0,p=o.depth-(u?1:2);p>=o.depth-3;p--)l=s.from(o.node(p).copy(l));l=l.append(s.from(r.createAndFill()));var h=t.tr.replace(o.before(u?null:-1),o.after(-3),new f(l,u?3:2,2));h.setSelection(t.selection.constructor.near(h.doc.resolve(o.pos+(u?3:2)))),e(h.scrollIntoView())}return!0}var d=i.pos==o.end()?c.contentMatchAt(0).defaultType:null,m=t.tr.delete(o.pos,i.pos),v=d&&[null,{type:d}];return!!qt(m.doc,o.pos,2,v)&&(e&&e(m.split(o.pos,2,v).scrollIntoView()),!0)})),i("Mod-[",rs(n)),i("Mod-]",function(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var l=a.parent,u=l.child(c-1);if(u.type!=t)return!1;if(n){var p=u.lastChild&&u.lastChild.type==l.type,h=s.from(p?t.create():null),d=new f(s.from(t.create(null,s.from(l.type.create(null,h)))),p?3:1,0),m=a.start,v=a.end;n(e.tr.step(new Dt(m-(p?3:1),v,m,v,d,1,!0)).scrollIntoView())}return!0}}(n))),(n=t.nodes.paragraph)&&i("Shift-Ctrl-0",di(n)),(n=t.nodes.code_block)&&i("Shift-Ctrl-\\",di(n)),n=t.nodes.heading)for(var l=1;l<=6;l++)i("Shift-Ctrl-"+l,di(n,{level:l}));if(n=t.nodes.horizontal_rule){var u=n;i("Mod-_",(function(t,e){return e(t.tr.replaceSelectionWith(u.create()).scrollIntoView()),!0}))}return o}function Ss(t){var e,n=us.concat(ls,cs);return(e=t.nodes.blockquote)&&n.push(ps(/^\s*>\s$/,e)),(e=t.nodes.ordered_list)&&n.push(function(t){return ps(/^(\d+)\.\s$/,t,(function(t){return{order:+t[1]}}),(function(t,e){return e.childCount+e.attrs.order==+t[1]}))}(e)),(e=t.nodes.bullet_list)&&n.push(function(t){return ps(/^\s*([-+*])\s$/,t)}(e)),(e=t.nodes.code_block)&&n.push(function(t){return hs(/^```$/,t)}(e)),(e=t.nodes.heading)&&n.push(function(t,e){return hs(new RegExp("^(#{1,"+e+"})\\s$"),t,(function(t){return{level:t[1].length}}))}(e,6)),function(t){var e=t.rules,n=new ge({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return ss(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&ss(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:n})}function As(t){var e=[Ss(t.schema),qo(_s(t.schema,t.mapKeys)),qo(xi),Ci(),new ge({props:{decorations:Oi,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Si.valid(n))return new Si(n)},handleClick:Ei,handleKeyDown:Mi}})];return!1!==t.menuBar&&e.push(function(t){return new ge({view:function(e){return new es(e,t)}})}({floating:!1!==t.floatingMenu,content:t.menuContent||xs(t.schema).fullMenu})),!1!==t.history&&e.push(Qo()),e.concat(new ge({props:{attributes:{class:"ProseMirror-example-setup-style"}}}))}function Ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}new(function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=new Yr(e,{state:de.create({doc:ho.parse(n),plugins:As({schema:io})}),dispatchTransaction:function(t){document.querySelector("#content").innerText=mo.serialize(t.doc);var e=this.state.apply(t);this.updateState(e)}})}var e,n,r;return e=t,(n=[{key:"focus",value:function(){this.view.focus()}},{key:"destroy",value:function(){this.view.destroy()}},{key:"content",get:function(){return mo.serialize(this.view.state.doc)}}])&&Ms(e.prototype,n),r&&Ms(e,r),t}())(document.querySelector("#editor"),document.querySelector("#content").value)}]);
\ No newline at end of file
+/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){var a="object"==i(e)&&e&&!e.nodeType&&e,c="object"==i(t)&&t&&!t.nodeType&&t,l="object"==(void 0===r?"undefined":i(r))&&r;l.global!==l&&l.window!==l&&l.self!==l||(s=l);var u,p,h=2147483647,f=/^xn--/,d=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,y=String.fromCharCode;function b(t){throw new RangeError(v[t])}function k(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function w(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+k((t=t.replace(m,".")).split("."),e).join(".")}function x(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function C(t){return k(t,(function(t){var e="";return t>65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=y(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var r=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;r+=36)t=g(t/35);return g(r+36*t/(t+38))}function A(t){var e,n,r,o,i,s,a,c,l,u,p,f=[],d=t.length,m=0,v=128,y=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&b("not-basic"),f.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<d;){for(i=m,s=1,a=36;o>=d&&b("invalid-input"),((c=(p=t.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||c>g((h-m)/s))&&b("overflow"),m+=c*s,!(c<(l=a<=y?1:a>=y+26?26:a-y));a+=36)s>g(h/(u=36-l))&&b("overflow"),s*=u;y=S(m-i,e=f.length+1,0==i),g(m/e)>h-v&&b("overflow"),v+=g(m/e),m%=e,f.splice(m++,0,v)}return C(f)}function M(t){var e,n,r,o,i,s,a,c,l,u,p,f,d,m,v,k=[];for(f=(t=x(t)).length,e=128,n=0,i=72,s=0;s<f;++s)(p=t[s])<128&&k.push(y(p));for(r=o=k.length,o&&k.push("-");r<f;){for(a=h,s=0;s<f;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>g((h-n)/(d=r+1))&&b("overflow"),n+=(a-e)*d,e=a,s=0;s<f;++s)if((p=t[s])<e&&++n>h&&b("overflow"),p==e){for(c=n,l=36;!(c<(u=l<=i?1:l>=i+26?26:l-i));l+=36)v=c-u,m=36-u,k.push(y(_(u+v%m,0))),c=g(v/m);k.push(y(_(c,0))),i=S(n,d,r==o),n=0,++r}++n,++e}return k.join("")}if(u={version:"1.4.1",ucs2:{decode:x,encode:C},decode:A,encode:M,toASCII:function(t){return w(t,(function(t){return d.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return w(t,(function(t){return f.test(t)?A(t.slice(4).toLowerCase()):t}))}},"object"==i(n(12))&&n(12))void 0===(o=function(){return u}.call(e,n,e,t))||(t.exports=o);else if(a&&c)if(t.exports==a)c.exports=u;else for(p in u)u.hasOwnProperty(p)&&(a[p]=u[p]);else s.punycode=u}(this)}).call(this,n(65)(t),n(66))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},function(t,e,n){"use strict";t.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},a={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},s.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},s.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},s.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new s(r,this.size+t.size)},s.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,i=0;i<e;o++){var a=this.content[o],c=i+a.nodeSize;c>t&&((i<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-i),Math.min(a.text.length,e-i)):a.cut(Math.max(0,t-i-1),Math.min(a.content.size,e-i-1))),n.push(a),r+=a.nodeSize),i=c}return new s(n,r)},s.prototype.cutByIndex=function(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))},s.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new s(r,o)},s.prototype.addToStart=function(t){return new s([t].concat(this.content),this.size+t.nodeSize)},s.prototype.addToEnd=function(t){return new s(this.content.concat(t),this.size+t.nodeSize)},s.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},a.firstChild.get=function(){return this.content.length?this.content[0]:null},a.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},a.childCount.get=function(){return this.content.length},s.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},s.prototype.maybeChild=function(t){return this.content[t]},s.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},s.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},s.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),l=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var u=0,p=Math.min(a.text.length,c.text.length);u<p&&a.text[a.text.length-u-1]==c.text[c.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var h=t(a.content,c.content,r-1,o-1);if(h)return h}r-=l,o-=l}else r-=l,o-=l}}(this,t,e,n)},s.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?l(n+1,o):l(n,r);r=o}},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(t){return t.toJSON()})):null},s.fromJSON=function(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(e.map(t.nodeFromJSON))},s.fromArray=function(t){if(!t.length)return s.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new s(e||t,n)},s.from=function(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,a);var c={index:0,offset:0};function l(t,e){return c.index=t,c.offset=e,c}function u(t,e){if(t===e)return!0;if(!t||"object"!=i(t)||!e||"object"!=i(e))return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!u(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e&&u(t[o],e[o])))return!1;for(var s in e)if(!(s in t))return!1}return!0}s.empty=new s([],0);var p=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}p.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},p.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},p.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},p.prototype.eq=function(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)},p.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},p.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},p.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},p.setFrom=function(t){if(!t||0==t.length)return p.none;if(t instanceof p)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},p.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},d={size:{configurable:!0}};function m(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return function t(e,n,r,o){var i=e.index(o),a=e.node(o);if(i==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(i,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var l=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(s.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),u=l.start,p=l.end;return k(a,function t(e,n,r,o,i){var a=e.depth>i&&g(e,n,i+1),c=o.depth>i&&g(r,o,i+1),l=[];b(null,e,i,l),a&&c&&n.index(i)==r.index(i)?(v(a,c),y(k(a,t(e,n,r,o,i+1)),l)):(a&&y(k(a,w(e,n,i+1)),l),b(n,r,i,l),c&&y(k(c,w(r,o,i+1)),l));return b(o,null,i,l),new s(l)}(e,u,p,n,o))}var h=e.parent,f=h.content;return k(h,f.cut(0,e.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return k(a,w(e,n,o))}(t,e,n,0)}function v(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){var r=t.node(n);return v(r,e.node(n)),r}function y(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function b(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(y(t.nodeAfter,r),i++));for(var a=i;a<s;a++)y(o.child(a),r);e&&e.depth==n&&e.textOffset&&y(e.nodeBefore,r)}function k(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var r=[];(b(null,t,n,r),t.depth>n)&&y(k(g(t,e,n+1),w(t,e,n+1)),r);return b(e,null,n,r),new s(r)}d.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var l=t(c.content,n-a-1,r);return l&&e.replaceChild(s,c.copy(l))}(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),l=c.index,u=c.offset;if(s==n||a.isText){if(u!=r&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(s.fromJSON(t,e.content),e.openStart||0,e.openEnd||0)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,d),f.empty=new f(s.empty,0,0);var x=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};x.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},x.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},x.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},x.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},x.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},x.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},x.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},x.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},x.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},x.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},x.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},x.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new M(this,t,n)},x.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},x.prototype.max=function(t){return t.pos>this.pos?t:this},x.prototype.min=function(t){return t.pos<this.pos?t:this},x.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},x.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new x(e,n,o)},x.resolveCached=function(t,e){for(var n=0;n<_.length;n++){var r=_[n];if(r.pos==e&&r.doc==t)return r}var o=_[S]=x.resolve(t,e);return S=(S+1)%A,o},Object.defineProperties(x.prototype,C);var _=[],S=0,A=12,M=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},D={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};D.start.get=function(){return this.$from.before(this.depth+1)},D.end.get=function(){return this.$to.after(this.depth+1)},D.parent.get=function(){return this.$from.node(this.depth)},D.startIndex.get=function(){return this.$from.index(this.depth)},D.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(M.prototype,D);var E=Object.create(null),O=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||s.empty,this.marks=r||p.none},T={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}};T.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},T.childCount.get=function(){return this.content.childCount},O.prototype.child=function(t){return this.content.child(t)},O.prototype.maybeChild=function(t){return this.content.maybeChild(t)},O.prototype.forEach=function(t){this.content.forEach(t)},O.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},O.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},T.textContent.get=function(){return this.textBetween(0,this.content.size,"")},O.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},T.firstChild.get=function(){return this.content.firstChild},T.lastChild.get=function(){return this.content.lastChild},O.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},O.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},O.prototype.hasMarkup=function(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||E)&&p.sameSet(this.marks,n||p.none)},O.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},O.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},O.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},O.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},O.prototype.replace=function(t,e,n){return m(this.resolve(t),this.resolve(e),n)},O.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},O.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},O.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},O.prototype.resolve=function(t){return x.resolveCached(this,t)},O.prototype.resolveNoCache=function(t){return x.resolve(this,t)},O.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},T.isBlock.get=function(){return this.type.isBlock},T.isTextblock.get=function(){return this.type.isTextblock},T.inlineContent.get=function(){return this.type.inlineContent},T.isInline.get=function(){return this.type.isInline},T.isText.get=function(){return this.type.isText},T.isLeaf.get=function(){return this.type.isLeaf},T.isAtom.get=function(){return this.type.isAtom},O.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),z(this.marks,t)},O.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},O.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},O.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},O.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},O.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));this.content.forEach((function(t){return t.check()}))},O.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},O.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=s.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(O.prototype,T);var N=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):z(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(O);function z(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var q=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},I={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};q.parse=function(t,e){var n=new R(t,e);if(null==n.next)return q.empty;var r=L(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];J(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new q(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(J(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var l=n();return o(t(e.expr,i),l),o(t(e.expr,l),l),[r(l)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var u=i,p=0;p<e.min;p++){var h=n();o(t(e.expr,u),h),u=h}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var d=n();r(u,d),o(t(e.expr,u),d),u=d}return[r(u)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position")}}(o,n),o},q.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},q.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},I.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},I.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},q.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},q.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(i,a){var c=i.matchFragment(t,n);if(c&&(!e||c.validEnd))return s.from(a.map((function(t){return t.createAndFill()})));for(var l=0;l<i.next.length;l+=2){var u=i.next[l],p=i.next[l+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var h=o(p,a.concat(u));if(h)return h}}}(this,[])},q.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},q.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},I.edgeCount.get=function(){return this.next.length>>1},q.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},q.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(q.prototype,I),q.empty=new q(!0);var R=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.unshift()},F={next:{configurable:!0}};function L(t){var e=[];do{e.push(B(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function B(t){var e=[];do{e.push(P(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function P(t){for(var e=function(t){if(t.eat("(")){var e=L(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=$(t,e)}return e}function V(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function $(t,e){var n=V(t),r=n;return t.eat(",")&&(r="}"!=t.next?V(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j(t,e){return e-t}function J(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(j)}function H(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function W(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function U(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new Z(t[n]);return e}F.next.get=function(){return this.tokens[this.pos]},R.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},R.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(R.prototype,F);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=U(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},G={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};G.isInline.get=function(){return!this.isBlock},G.isTextblock.get=function(){return this.isBlock&&this.inlineContent},G.isLeaf.get=function(){return this.contentMatch==q.empty},G.isAtom.get=function(){return this.isLeaf||this.spec.atom},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new O(this,this.computeAttrs(t),s.from(e),p.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=s.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new O(this,this.computeAttrs(t),e,p.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=s.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(s.empty,!0);return o?new O(this,t,e.append(o),p.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.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 o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,G);var Z=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(Z.prototype,Y);var Q=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=U(r.attrs),this.rank=e,this.excluded=null;var o=H(this.attrs);this.instance=o&&new p(this,o)};Q.prototype.create=function(t){return!t&&this.instance?this.instance:new p(this,W(this.attrs,t))},Q.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Q(t,r++,e,o)})),n},Q.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t.slice(0,e).concat(t.slice(e+1));return t},Q.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Q.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var X=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=Q.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],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=q.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?tt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:tt(this,u.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 tt(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}X.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},X.prototype.text=function(t,e){var n=this.nodes.text;return new N(n,n.defaultAttrs,t,p.setFrom(e))},X.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},X.prototype.nodeFromJSON=function(t){return O.fromJSON(this,t)},X.prototype.markFromJSON=function(t){return p.fromJSON(this,t)},X.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var et=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)}))};et.prototype.parse=function(t,e){void 0===e&&(e={});var n=new at(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},et.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new at(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},et.prototype.matchTag=function(t,e){for(var n=0;n<this.tags.length;n++){var r=this.tags[n];if(lt(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){var o=r.getAttrs(t);if(!1===o)continue;r.attrs=o}return r}}},et.prototype.matchStyle=function(t,e,n){for(var r=0;r<this.styles.length;r++){var o=this.styles[r];if(!(0!=o.style.indexOf(t)||o.context&&!n.matchesContext(o.context)||o.style.length>t.length&&(61!=o.style.charCodeAt(t.length)||o.style.slice(t.length+1)!=e))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i}return o}}},et.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=ut(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=ut(t)),t.node=s}));return e},et.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new et(t,et.schemaRules(t)))};var nt={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},rt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0};function it(t){return(t?1:0)|("full"===t?2:0)}var st=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r};st.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(s.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},st.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=s.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},st.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):pt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var at=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=it(e.preserveWhitespace)|(n?4:0);r=o?new st(o.type,o.attrs,p.none,p.none,!0,e.topMatch||o.type.contentMatch,i):new st(n?null:t.schema.topNodeType,null,p.none,p.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ct={top:{configurable:!0},currentPos:{configurable:!0}};function lt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ut(t){var e={};for(var n in t)e[n]=t[n];return e}function pt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[];return function t(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var o=n.edge(r),s=o.type,a=o.next;if(s==e)return!0;if(i.indexOf(a)<0&&t(a))return!0}}(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ct.top.get=function(){return this.nodes[this.open]},at.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},at.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if((n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)2&n.options||(e=e.replace(/\r?\n|\r/g," "));else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},at.prototype.addElement=function(t){var e=t.nodeName.toLowerCase();ot.hasOwnProperty(e)&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ot.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var n=this.options.ruleFromNode&&this.options.ruleFromNode(t)||this.parser.matchTag(t,this);if(n?n.ignore:rt.hasOwnProperty(e))this.findInside(t);else if(!n||n.skip){n&&n.skip.nodeType&&(t=n.skip);var r,o=this.top,i=this.needsBlock;if(nt.hasOwnProperty(e))r=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),r&&this.sync(o),this.needsBlock=i}else this.addElementByRule(t,n)},at.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},at.prototype.readStyles=function(t){for(var e=p.none,n=0;n<t.length;n+=2){var r=this.parser.matchStyle(t[n],t[n+1],this);if(r){if(r.ignore)return null;e=this.parser.schema.marks[r.mark].create(r.attrs).addToSet(e)}}return e},at.prototype.addElementByRule=function(t,e){var n,r,o,i=this;e.node?(r=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(r.create(e.attrs))||this.leafFallback(t):n=this.enter(r,e.attrs,e.preserveWhitespace):(o=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(o));var s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return i.insertNode(t)}));else{var a=e.contentElement;"string"==typeof a?a=t.querySelector(a):"function"==typeof a&&(a=a(t)),a||(a=t),this.findAround(t,a,!0),this.addAll(a,n)}n&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},at.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&nt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},at.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},at.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},at.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},at.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:it(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new st(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},at.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},at.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},at.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ct.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},at.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},at.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},at.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},at.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},at.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function t(s,a){for(;s>=0;s--){var c=n[s];if(""==c){if(s==n.length-1||0==s)continue;for(;a>=i;a--)if(t(s-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0}(n.length-1,this.open)},at.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},at.prototype.addPendingMark=function(t){this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},at.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1?r.pendingMarks=t.removeFromSet(r.pendingMarks):r.activeMarks=t.removeFromSet(r.activeMarks),r==e)break}},Object.defineProperties(at.prototype,ct);var ht=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dt(t){return t.document||window.document}ht.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=dt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNode(t,e))})),n},ht.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=ht.renderSpec(dt(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},ht.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},ht.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&ht.renderSpec(dt(n),r(t,e))},ht.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var s=null,a=n?t.createElementNS(n,r):t.createElement(r),c=e[1],l=1;if(c&&"object"==i(c)&&null==c.nodeType&&!Array.isArray(c))for(var u in l=2,c)if(null!=c[u]){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):a.setAttribute(u,c[u])}for(var h=l;h<e.length;h++){var f=e[h];if(0===f){if(h<e.length-1||h>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var d=ht.renderSpec(t,f,n),m=d.dom,v=d.contentDOM;if(a.appendChild(m),v){if(s)throw new RangeError("Multiple content holes");s=v}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ht.marksFromSchema=function(t){return ft(t.marks)};var mt=Math.pow(2,16);function vt(t){return 65535&t}var gt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},yt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};yt.prototype.recover=function(t){var e=0,n=vt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/mt}(t)},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},yt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var h=s/3+(t-a)*mt;return new gt(p,e<0?t!=a:t!=u,h)}r+=l-c}return n?t+r:new gt(t+r)},yt.prototype.touches=function(t,e){for(var n=0,r=vt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},yt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},yt.prototype.invert=function(){return new yt(this.ranges,!this.inverted)},yt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},yt.offset=function(t){return 0==t?yt.empty:new yt(t<0?[0,-t,0]:[0,0,t])},yt.empty=new yt([]);var bt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function kt(t){var e=Error.call(this,t);return e.__proto__=kt.prototype,e}bt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new bt(this.maps,this.mirror,t,e)},bt.prototype.copy=function(){return new bt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},bt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},bt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},bt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},bt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},bt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},bt.prototype.invert=function(){var t=new bt;return t.appendMappingInverted(this),t},bt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},bt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},bt.prototype._map=function(t,e,n){for(var r=!1,o=null,i=this.from;i<this.to;i++){var s=this.maps[i],a=o&&o[i];if(null!=a&&s.touches(t,a))t=s.recover(a);else{var c=s.mapResult(t,e);if(null!=c.recover){var l=this.getMirror(i);if(null!=l&&l>i&&l<this.to){if(c.deleted){i=l,t=this.maps[l].recover(c.recover);continue}(o||(o=Object.create(null)))[l]=c.recover}}c.deleted&&(r=!0),t=c.pos}}return n?t:new gt(t,r)},kt.prototype=Object.create(Error.prototype),kt.prototype.constructor=kt,kt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bt},xt={before:{configurable:!0},docChanged:{configurable:!0}};function Ct(){throw new Error("Override me")}xt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new kt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},xt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,xt);var _t=Object.create(null),St=function(){};St.prototype.apply=function(t){return Ct()},St.prototype.getMap=function(){return yt.empty},St.prototype.invert=function(t){return Ct()},St.prototype.map=function(t){return Ct()},St.prototype.merge=function(t){return null},St.prototype.toJSON=function(){return Ct()},St.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=_t[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},St.jsonID=function(t,e){if(t in _t)throw new RangeError("Duplicate use of step JSON ID "+t);return _t[t]=e,e.prototype.jsonID=t,e};var At=function(t,e){this.doc=t,this.failed=e};At.ok=function(t){return new At(t,null)},At.fail=function(t){return new At(null,t)},At.fromReplace=function(t,e,n,r){try{return At.ok(t.replace(e,n,r))}catch(t){if(t instanceof h)return At.fail(t.message);throw t}};var Mt=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Et(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new yt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure!=this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?f.empty:new f(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?f.empty:new f(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,f.fromJSON(t,n.slice),!!n.structure)},e}(St);St.jsonID("replace",Mt);var Dt=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Et(t,this.from,this.gapFrom)||Et(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return At.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?At.fromReplace(t,this.from,this.to,n):At.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,f.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(St);function Et(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Ot(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Tt(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Ot(r,o,i))break}}function Nt(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(zt).concat({type:e,attrs:n}).concat(i.map(zt)):null}function zt(t){return{type:t,attrs:null}}function qt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),h=r&&r[c]||l;if(h!=l&&(p=p.replaceChild(0,h.type.create(h.attrs))),!l.canReplace(u+1,l.childCount)||!h.type.validContent(p))return!1}var f=o.indexAfter(i),d=r&&r[0];return o.node(i).canReplaceWith(f,f,d?d.type:o.node(i+1).type)}function It(t,e){var n=t.resolve(e),r=n.index();return Rt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Ft(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Rt(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function Lt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Bt(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Bt(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return s.fromArray(r)}St.jsonID("replaceAround",Dt),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,i=n.before(o+1),a=r.after(o+1),c=i,l=a,u=s.empty,p=0,h=o,d=!1;h>e;h--)d||n.index(h)>0?(d=!0,u=s.from(n.node(h).copy(u)),p++):c--;for(var m=s.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,m=s.from(r.node(g).copy(m)),v++):l++;return this.step(new Dt(c,l,i,a,new f(u.append(m),p,v),u.size-p,!0))},wt.prototype.wrap=function(t,e){for(var n=s.empty,r=e.length-1;r>=0;r--)n=s.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Dt(o,i,o,i,new f(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var a=o.mapping.slice(i),c=a.map(e,1),l=a.map(e+t.nodeSize,1);return o.step(new Dt(c,l,c+1,l-1,new f(s.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Dt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new f(s.from(i),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=s.empty,i=s.empty,a=r.depth,c=r.depth-e,l=e-1;a>c;a--,l--){o=s.from(r.node(a).copy(o));var u=n&&n[l];i=s.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Mt(t,t,new f(o.append(i),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Mt(t-e,t+e,f.empty,!0);return this.step(n)};var Pt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new f(Bt(n.content,(function(t,n){return n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);St.jsonID("addMark",Pt);var Vt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new f(Bt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Pt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);function $t(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=f.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);if(Ht(o,i,r))return new Mt(e,n,r);var a=function(t,e){var n=function t(e,n,r,o){var i=s.empty,a=0,c=r[n];if(e.depth>n){var l=t(e,n+1,r,o||c);a=l.openEnd+1,i=s.from(e.node(n+1).copy(l.content))}c&&(i=i.append(c.content),a=c.openEnd);o&&(i=i.append(e.node(n).contentMatchAt(e.indexAfter(n)).fillBefore(s.empty,!0)),a=0);return{content:i,openEnd:a}}(t,0,e,!1),r=n.content,o=n.openEnd;return new f(r,t.depth,o||0)}(o,function(t,e){for(var n=new Wt(t),r=1;e.size&&r<=3;r++){var o=n.placeSlice(e.content,e.openStart,e.openEnd,r);3==r&&o!=e&&o.size&&(r=0),e=o}for(;n.open.length;)n.closeNode();return n.placed}(o,r)),c=Jt(o,i,a);if(!c)return null;if(a.size!=c.size&&function(t,e,n){if(!e.parent.isTextblock)return!1;var r,o=n.openEnd?function(t,e){for(var n=1;n<e;n++)t=t.lastChild.content;return t.lastChild}(n.content,n.openEnd):t.node(t.depth-(n.openStart-n.openEnd));if(!o.isTextblock)return!1;for(var i=e.index();i<e.parent.childCount;i++)if(!o.type.allowsMarks(e.parent.child(i).marks))return!1;n.openEnd?r=o.contentMatchAt(o.childCount):(r=o.contentMatchAt(o.childCount),n.size&&(r=r.matchFragment(n.content,n.openStart?1:0)));return(r=r.matchFragment(e.parent.content,e.index()))&&r.validEnd}(o,i,a)){for(var l=i.depth,u=i.after(l);l>1&&u==i.end(--l);)++u;var p=Jt(o,t.resolve(u),a);if(p)return new Dt(e,u,n,i.end(),p,a.size)}return c.size||e!=n?new Mt(e,n,c):null}function jt(t,e,n,r,o,i,a){var c,l=t.childCount,u=l-(a>0?1:0),p=i<0?e:n.node(o);c=i<0?p.contentMatchAt(u):1==l&&a>0?p.contentMatchAt(i?n.index(o):n.indexAfter(o)):p.contentMatchAt(n.indexAfter(o)).matchFragment(t,l>0&&i?1:0,u);var h=r.node(o);if(a>0&&o<r.depth){var f=h.content.cutByIndex(r.indexAfter(o)).addToStart(t.lastChild),d=c.fillBefore(f,!0);if(d&&d.size&&i>0&&1==l&&(d=null),d){var m=jt(t.lastChild.content,t.lastChild,n,r,o+1,1==l?i-1:-1,a-1);if(m){var v=t.lastChild.copy(m);return d.size?t.cutByIndex(0,l-1).append(d).addToEnd(v):t.replaceChild(l-1,v)}}}a>0&&(c=c.matchType((1==l&&i>0?n.node(o+1):t.lastChild).type));var g=r.index(o);if(g==h.childCount&&!h.type.compatibleContent(e.type))return null;for(var y=c.fillBefore(h.content,!0,g),b=g;y&&b<h.content.childCount;b++)p.type.allowsMarks(h.content.child(b).marks)||(y=null);if(!y)return null;if(a>0){var k=function t(e,n,r,o,i){var a,c=e.content,l=c.childCount;a=i>=0?r.node(o).contentMatchAt(r.indexAfter(o)).matchFragment(c,i>0?1:0,l):e.contentMatchAt(l);if(n>0){var u=t(c.lastChild,n-1,r,o+1,1==l?i-1:-1);c=c.replaceChild(l-1,u)}return e.copy(c.append(a.fillBefore(s.empty,!0)))}(t.lastChild,a-1,n,o+1,1==l?i-1:-1);t=t.replaceChild(l-1,k)}return t=t.append(y),r.depth>o&&(t=t.addToEnd(function t(e,n){var r=e.node(n),o=r.contentMatchAt(0).fillBefore(r.content,!0,e.index(n));e.depth>n&&(o=o.addToEnd(t(e,n+1)));return r.copy(o)}(r,o+1))),t}function Jt(t,e,n){var r=jt(n.content,t.node(0),t,e,0,n.openStart,n.openEnd);return r?function(t,e,n){for(;e>0&&n>0&&1==t.childCount;)t=t.firstChild.content,e--,n--;return new f(t,e,n)}(r,n.openStart,e.depth):null}function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}St.jsonID("removeMark",Vt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),h=Math.min(c+r.nodeSize,e),f=n.addToSet(u),d=0;d<u.length;d++)u[d].isInSet(f)||(s&&s.to==p&&s.mark.eq(u[d])?s.to=h:o.push(s=new Vt(p,h,u[d])));a&&a.to==p?a.to=h:i.push(a=new Pt(p,h,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof Q){var c=n.isInSet(r.marks);c&&(a=[c])}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var l=Math.min(s+r.nodeSize,e),u=0;u<a.length;u++){for(var p=a[u],h=void 0,f=0;f<o.length;f++){var d=o[f];d.step==i-1&&p.eq(o[f].style)&&(h=d)}h?(h.to=l,h.step=i):o.push({style:p,from:Math.max(s,t),to:l,step:i})}}})),o.forEach((function(t){return r.step(new Vt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],i=t+1,a=0;a<r.childCount;a++){var c=r.child(a),l=i+c.nodeSize,u=n.matchType(c.type,c.attrs);if(u){n=u;for(var p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||this.step(new Vt(i,l,c.marks[p]))}else o.push(new Mt(i,l,f.empty));i=l}if(!n.validEnd){var h=n.fillBefore(s.empty,!0);this.replace(i,i,new f(h,0,0))}for(var d=o.length-1;d>=0;d--)this.step(o[d]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=f.empty);var r=$t(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new f(s.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,f.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Wt=function(t){this.open=[];for(var e=0;e<=t.depth;e++){var n=t.node(e),r=n.contentMatchAt(t.indexAfter(e));this.open.push({parent:n,match:r,content:s.empty,wrapper:!1,openEnd:0,depth:e})}this.placed=[]};function Ut(t,e,n){var r=t.content;if(e>1){var o=Ut(t.firstChild,e-1,1==t.childCount?n-1:0);r=t.content.replaceChild(0,o)}var i=t.type.contentMatch.fillBefore(r,0==n);return t.copy(i.append(r))}function Kt(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(Kt(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(s.empty,!0))}return t}function Gt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}function Zt(t){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Wt.prototype.placeSlice=function(t,e,n,r,o){if(e>0){var i=t.firstChild,a=this.placeSlice(i.content,Math.max(0,e-1),n&&1==t.childCount?n-1:0,r,i);a.content!=i.content&&(a.content.size?(t=t.replaceChild(0,i.copy(a.content)),e=a.openStart+1):(1==t.childCount&&(n=0),t=t.cutByIndex(1),e=0))}var c=this.placeContent(t,e,n,r,o);if(r>2&&c.size&&0==e){var l=c.content.firstChild,u=1==c.content.childCount;this.placeContent(l.content,0,n&&u?n-1:0,r,l),c=u?s.empty:new f(c.content.cutByIndex(1),0,n)}return c},Wt.prototype.placeContent=function(t,e,n,r,o){for(var i=0;i<t.childCount;i++){for(var a=t.child(i),c=!1,l=i==t.childCount-1,u=this.open.length-1;u>=0;u--){var p=this.open[u],h=void 0;if(r>1&&(h=p.match.findWrapping(a.type))&&(!o||!h.length||h[h.length-1]!=o.type)){for(;this.open.length-1>u;)this.closeNode();for(var d=0;d<h.length;d++)p.match=p.match.matchType(h[d]),u++,p={parent:h[d].create(),match:h[d].contentMatch,content:s.empty,wrapper:!0,openEnd:0,depth:u+d},this.open.push(p)}var m=p.match.matchType(a.type);if(!m){var v=p.match.fillBefore(s.from(a));if(!v){if(o&&p.match.matchType(o.type))break;continue}for(var g=0;g<v.childCount;g++){var y=v.child(g);this.addNode(p,y,0),m=p.match.matchFragment(y)}}for(;this.open.length-1>u;)this.closeNode();a=a.mark(p.parent.type.allowedMarks(a.marks)),e&&(a=Ut(a,e,l?n:0),e=0),this.addNode(p,a,l?n:0),p.match=m,l&&(n=0),c=!0;break}if(!c)break}return this.open.length>1&&(i>0&&i==t.childCount||o&&this.open[this.open.length-1].parent.type==o.type)&&this.closeNode(),new f(t.cutByIndex(i),e,n)},Wt.prototype.addNode=function(t,e,n){var r,o;t.content=(r=t.content,o=t.openEnd,o?r.replaceChild(r.childCount-1,function t(e,n){var r=e.content;if(n>1){var o=t(e.lastChild,n-1);r=e.content.replaceChild(e.childCount-1,o)}var i=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(i))}(r.lastChild,o)):r).addToEnd(e),t.openEnd=n},Wt.prototype.closeNode=function(){var t=this.open.pop();0==t.content.size||(t.wrapper?this.addNode(this.open[this.open.length-1],t.parent.copy(t.content),t.openEnd+1):this.placed[t.depth]={depth:t.depth,content:t.content,openEnd:t.openEnd})},wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new Mt(t,e,n));var i=Gt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],h=n.openStart,d=n.content,m=0;;m++){var v=d.firstChild;if(p.push(v),m==n.openStart)break;d=v.content}h>0&&p[h-1].type.spec.defining&&r.node(u).type!=p[h-1].type?h-=1:h>=2&&p[h-1].isTextblock&&p[h-2].type.spec.defining&&r.node(u).type!=p[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=p[y];if(b)for(var k=0;k<i.length;k++){var w=i[(k+u)%i.length],x=!0;w<0&&(x=!1,w=-w);var C=r.node(w-1),_=r.index(w-1);if(C.canReplaceWith(_,_,b.type,b.marks))return this.replace(r.before(w),x?o.after(w):e,new f(Kt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,A=i.length-1;A>=0&&(this.replace(t,e,n),!(this.steps.length>S));A--){var M=i[A];A<0||(t=r.before(M),e=o.after(M))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new f(s.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Gt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Yt=Object.create(null),Qt=function(t,e,n){this.ranges=n||[new te(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Xt={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Xt.anchor.get=function(){return this.$anchor.pos},Xt.head.get=function(){return this.$head.pos},Xt.from.get=function(){return this.$from.pos},Xt.to.get=function(){return this.$to.pos},Xt.$from.get=function(){return this.ranges[0].$from},Xt.$to.get=function(){return this.ranges[0].$to},Xt.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},Qt.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Qt.prototype.replace=function(t,e){void 0===e&&(e=f.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],l=c.$from,u=c.$to,p=t.mapping.slice(i);t.replaceRange(p.map(l.pos),p.map(u.pos),a?f.empty:e),0==a&&ce(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Qt.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),ce(t,n,e.isInline?-1:1))}},Qt.findFrom=function(t,e,n){var r=t.parent.inlineContent?new ee(t):ae(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?ae(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):ae(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Qt.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ie(t.node(0))},Qt.atStart=function(t){return ae(t,t,0,0,1)||new ie(t)},Qt.atEnd=function(t){return ae(t,t,t.content.size,t.childCount,-1)||new ie(t)},Qt.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Yt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Qt.jsonID=function(t,e){if(t in Yt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Yt[t]=e,e.prototype.jsonID=t,e},Qt.prototype.getBookmark=function(){return ee.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Qt.prototype,Xt),Qt.prototype.visible=!0;var te=function(t,e){this.$from=t,this.$to=e},ee=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),t.prototype.replace.call(this,e,n),n==f.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new ne(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(Qt);Qt.jsonID("text",ee);var ne=function(t,e){this.anchor=t,this.head=e};ne.prototype.map=function(t){return new ne(t.map(this.anchor),t.map(this.head))},ne.prototype.resolve=function(t){return ee.between(t.resolve(this.anchor),t.resolve(this.head))};var re=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new f(s.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new oe(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(Qt);re.prototype.visible=!1,Qt.jsonID("node",re);var oe=function(t){this.anchor=t};oe.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new ne(r,r):new oe(r)},oe.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&re.isSelectable(n)?new re(e):Qt.near(e)};var ie=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return se},e}(Qt);Qt.jsonID("all",ie);var se={map:function(){return this},resolve:function(t){return new ie(t)}};function ae(t,e,n,r,o,i){if(e.inlineContent)return ee.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&re.isSelectable(a))return re.create(t,n-(o<0?a.nodeSize:0))}else{var c=ae(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ce(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Mt||i instanceof Dt)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(Qt.near(t.doc.resolve(o),n))}}var le=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;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},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return p.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Qt.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function ue(t,e){return e&&t?t.bind(e):t}var pe=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},he=[new pe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new pe("selection",{init:function(t,e){return t.selection||Qt.atStart(e.doc)},apply:function(t){return t.selection}}),new pe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],fe=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new pe(t.key,t.spec.state,t))}))},de=function(t){this.config=t},me={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};me.schema.get=function(){return this.config.schema},me.plugins.get=function(){return this.config.plugins},de.prototype.apply=function(t){return this.applyTransaction(t).state},de.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},de.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},de.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new de(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<ve.length;i++)ve[i](this,t,e);return e},me.tr.get=function(){return new le(this)},de.create=function(t){for(var e=new fe(t.schema||t.doc.type.schema,t.plugins),n=new de(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},de.prototype.reconfigure=function(t){for(var e=new fe(t.schema||this.schema,t.plugins),n=e.fields,r=new de(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},de.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==Zt(t))for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},de.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new fe(t.schema,t.plugins),o=new de(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=O.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=Qt.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},de.addApplyListener=function(t){ve.push(t)},de.removeApplyListener=function(t){var e=ve.indexOf(t);e>-1&&ve.splice(e,1)},Object.defineProperties(de.prototype,me);var ve=[];var ge=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:be("plugin")};ge.prototype.getState=function(t){return t[this.key]};var ye=Object.create(null);function be(t){return t in ye?t+"$"+ ++ye[t]:(ye[t]=0,t+"$")}var ke=function(t){void 0===t&&(t="key"),this.key=be(t)};ke.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ke.prototype.getState=function(t){return t[this.key]};var we={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var xe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);we.mac=/Mac/.test(navigator.platform);var Se=we.ie=!!(Ce||_e||xe);we.ie_version=Ce?document.documentMode||6:_e?+_e[1]:xe?+xe[1]:null,we.gecko=!Se&&/gecko\/(\d+)/i.test(navigator.userAgent),we.gecko_version=we.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Ae=!Se&&/Chrome\/(\d+)/.exec(navigator.userAgent);we.chrome=!!Ae,we.chrome_version=Ae&&+Ae[1],we.ios=!Se&&/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),we.android=/Android \d/.test(navigator.userAgent),we.webkit=!Se&&"WebkitAppearance"in document.documentElement.style,we.safari=/Apple Computer/.test(navigator.vendor),we.webkit_version=we.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Me=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},De=function(t){var e=t.parentNode;return e&&11==e.nodeType?e.host:e},Ee=function(t,e,n){var r=document.createRange();return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Oe=function(t,e,n,r){return n&&(Ne(t,e,n,r,-1)||Ne(t,e,n,r,1))},Te=/^(img|br|input|textarea|hr)$/i;function Ne(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:ze(t))){var i=t.parentNode;if(1!=i.nodeType||qe(t)||Te.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Me(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?ze(t):0}}}function ze(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function qe(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Ie=function(t){var e=t.isCollapsed;return e&&we.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Re(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Le(t,e){return"number"==typeof t?t:t[e]}function Be(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=i.defaultView,a=n||t.dom;a;a=De(a))if(1==a.nodeType){var c=a==i.body||1!=a.nodeType,l=c?Fe(s):a.getBoundingClientRect(),u=0,p=0;if(e.top<l.top+Le(r,"top")?p=-(l.top-e.top+Le(o,"top")):e.bottom>l.bottom-Le(r,"bottom")&&(p=e.bottom-l.bottom+Le(o,"bottom")),e.left<l.left+Le(r,"left")?u=-(l.left-e.left+Le(o,"left")):e.right>l.right-Le(r,"right")&&(u=e.right-l.right+Le(o,"right")),(u||p)&&(c?s.scrollBy(u,p):(p&&(a.scrollTop+=p),u&&(a.scrollLeft+=u),e={left:e.left-u,top:e.top-p,right:e.right-u,bottom:e.bottom-p})),c)break}}function Pe(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=De(t));return e}function Ve(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var $e=null;function je(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=Ee(c).getClientRects()}for(var p=0;p<u.length;p++){var h=u[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);var f=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:h.right<e.left?h.right:h.left,top:e.top}:e,1==c.nodeType&&f&&(i=l+(e.left>=(h.left+h.right)/2?1:0));continue}}!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=We(r,1);if(i.top!=i.bottom&&Je(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:je(n,r)}function Je(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function He(t,e){var n,r,o,i,s=t.root;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var l,u=s.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!Je(e,p))return null;if(!(u=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),l=0;l<c.length;l++){var u=c[l];if(Je(n,u))return t(a,n,u)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,p)))return null}if(u=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(u,e),o){if(we.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var h,f=o.childNodes[i];"IMG"==f.nodeName&&(h=f.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=je(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var d=t.docView.nearestDesc(u,!0);return{pos:l,inside:d?d.posAtStart-d.border:-1}}function We(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function Ue(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset;if(3==r.nodeType&&(we.chrome||we.gecko)){var i=We(Ee(r,o,o),0);if(we.gecko&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){var s=We(Ee(r,o-1,o-1),-1);if(Math.abs(s.left-i.left)<1&&s.top==i.top){var a=We(Ee(r,o,o+1),-1);return Ke(a,a.left<s.left)}}return i}if(1==r.nodeType&&!t.state.doc.resolve(e).parent.inlineContent){var c,l=!0;if(o<r.childNodes.length){var u=r.childNodes[o];1==u.nodeType&&(c=u.getBoundingClientRect())}if(!c&&o){var p=r.childNodes[o-1];1==p.nodeType&&(c=p.getBoundingClientRect(),l=!1)}return function(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}(c||r.getBoundingClientRect(),l)}for(var h=-1;h<2;h+=2)if(h<0&&o){var f=void 0,d=3==r.nodeType?Ee(r,o-1,o):3==(f=r.childNodes[o-1]).nodeType?Ee(f):1==f.nodeType&&"BR"!=f.nodeName?f:null;if(d){var m=We(d,1);if(m.top<m.bottom)return Ke(m,!1)}}else if(h>0&&o<ze(r)){var v=void 0,g=3==r.nodeType?Ee(r,o,o+1):3==(v=r.childNodes[o]).nodeType?Ee(v):1==v.nodeType?v:null;if(g){var y=We(g,-1);if(y.top<y.bottom)return Ke(y,!0)}}return Ke(We(3==r.nodeType?Ee(r):r,0),!1)}function Ke(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ge(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o.focus()}}var Ze=/[\u0590-\u08ac]/;var Ye=null,Qe=null,Xe=!1;function tn(t,e,n){return Ye==e&&Qe==n?Xe:(Ye=e,Qe=n,Xe="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$anchor.min(r.$head):r.$anchor.max(r.$head);return Ge(t,e,(function(){for(var e=t.docView.domFromPos(o.pos).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Ue(t,o.pos),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=Ee(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top&&("up"==n?l.bottom<i.top+1:l.top>i.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return Ze.test(r.parent.textContent)&&a.modify?Ge(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var en=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},nn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0}};en.prototype.matchesWidget=function(){return!1},en.prototype.matchesMark=function(){return!1},en.prototype.matchesNode=function(){return!1},en.prototype.matchesHack=function(){return!1},nn.beforePosition.get=function(){return!1},en.prototype.parseRule=function(){return null},en.prototype.stopEvent=function(){return!1},nn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},nn.border.get=function(){return 0},en.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},en.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},nn.posBefore.get=function(){return this.parent.posBeforeChild(this)},nn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},nn.posAfter.get=function(){return this.posBefore+this.size},nn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},en.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},en.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(t):o.nodeDOM==t))return o;n=!1}}},en.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},en.prototype.posFromDOM=function(t,e,n){for(var r=t;;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}},en.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},en.prototype.domFromPos=function(t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var e=0,n=0;;n++){if(e==t){for(;n<this.children.length&&(this.children[n].beforePosition||this.children[n].dom.parentNode!=this.contentDOM);)n++;return{node:this.contentDOM,offset:n==this.children.length?this.contentDOM.childNodes.length:Me(this.children[n].dom)}}if(n==this.children.length)throw new Error("Invalid position "+t);var r=this.children[n],o=e+r.size;if(t<o)return r.domFromPos(t-e-r.border);e=o}},en.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Me(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&e<=c){e=c;for(var h=s+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Me(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},en.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},en.prototype.domAfterPos=function(t){var e=this.domFromPos(t),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},en.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],l=a+c.size;if(o>a&&i<l)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=l}var u=this.domFromPos(t),p=this.domFromPos(e),h=n.getSelection(),f=document.createRange();if(r||!Oe(u.node,u.offset,h.anchorNode,h.anchorOffset)||!Oe(p.node,p.offset,h.focusNode,h.focusOffset)){if(h.extend)f.setEnd(u.node,u.offset),f.collapse(!1);else{if(t>e){var d=u;u=p,p=d}f.setEnd(p.node,p.offset),f.setStart(u.node,u.offset)}h.removeAllRanges(),h.addRange(f),h.extend&&h.extend(p.node,p.offset)}},en.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},nn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},en.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},en.prototype.markParentsDirty=function(){for(var t=this.parent;t;t=t.parent){t.dirty<2&&(t.dirty=2)}},Object.defineProperties(en.prototype,nn);var rn=[],on=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,rn,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={beforePosition:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},Object.defineProperties(e.prototype,n),e}(en),sn=function(t){function e(e,n,r,o){t.call(this,e,rn,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(en),an=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=ht.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,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}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Cn(i,n,s,r)),t>0&&(i=Cn(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(en),cn=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?rn:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,l=i.nodeViews[n.type.name],u=l&&l(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r),p=u&&u.dom,h=u&&u.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(a=ht.renderSpec(document,n.type.spec.toDOM(n))).dom,h=a.contentDOM);h||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=yn(p,r,n),u?c=new hn(t,n,r,o,p,h,f,u,i,s+1):n.isText?new un(t,n,r,o,p,f,i):new e(t,n,r,o,p,h,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?s.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&bn(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=r&&t.composing&&this.localCompositionNode(t,e),s=new wn(this,i&&i.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var h=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[h])).push(o[c++]);if(f){f.sort(xn);for(var d=0;d<f.length;d++)n(f[d],p,!!u)}else n(h,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from==i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var k=0;k<l.length;k++)l[k].to<b&&(b=l[k].to);b<y&&(u=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}r(m,l.length?l.slice():rn,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?s.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&s.syncToMarks(i==n.node.childCount?p.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(rn,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),this.renderChildren())},e.prototype.renderChildren=function(){!function t(e,n){for(var r=e.firstChild,o=0;o<n.length;o++){var i=n[o],s=i.dom;if(s.parentNode==e){for(;s!=r;)r=kn(r);r=r.nextSibling}else e.insertBefore(s,r);if(i instanceof an){var a=r?r.previousSibling:e.lastChild;t(i.contentDOM,i.children),r=a?a.nextSibling:e.firstChild}}for(;r;)r=kn(r)}(this.contentDOM,this.children),we.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom)},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof ee)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=ze(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new sn(this,i,n,o);t.compositionNodes.push(s),this.children=Cn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!bn(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=vn(this.dom,this.nodeDOM,mn(this.outerDeco,this.node,e),mn(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!1)},Object.defineProperties(e.prototype,n),e}(en);function ln(t,e,n,r,o){return yn(r,e,t),new cn(null,t,e,n,r,r,r,o,0)}var un=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{skip:this.nodeDOM.parentNode||!0}},e.prototype.update=function(t,e){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e}(cn),pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},e}(en),hn=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(cn);function fn(t){t&&(this.nodeName=t)}fn.prototype=Object.create(null);var dn=[new fn];function mn(t,e,n){if(0==t.length)return dn;for(var r=n?dn[0]:new fn,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs,a=r;if(s)for(var c in s.nodeName&&o.push(a=new fn(s.nodeName)),s){var l=s[c];null!=l&&(n&&1==o.length&&o.push(a=r=new fn(e.isInline?"span":"div")),"class"==c?a.class=(a.class?a.class+" ":"")+l:"style"==c?a.style=(a.style?a.style+";":"")+l:"nodeName"!=c&&(a[c]=l))}}return o}function vn(t,e,n,r){if(n==dn&&r==dn)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).appendChild(o),a=dn[0]),o=c}gn(o,a||dn[0],s)}return o}function gn(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" "):rn,s=n.class?n.class.split(" "):rn,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c])}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function yn(t,e,n){return vn(t,t,dn,mn(e,n,1!=t.nodeType))}function bn(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function kn(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var wn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1;var n=function(t,e){for(var n=[],r=t.childCount,o=e.length-1;r>0&&o>=0;o--){var i=e[o],s=i.node;if(s){if(s!=t.child(r-1))break;n.push(i),--r}}return{nodes:n.reverse(),offset:r}}(t.node.content,t.children);this.preMatched=n.nodes,this.preMatchOffset=n.offset};function xn(t,e){return t.type.side-e.type.side}function Cn(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function _n(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Qt.findFrom(s,e)}function Sn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function An(t,e,n){var r=t.state.selection;if(r instanceof ee){if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var o=_n(t.state,e);return!!(o&&o instanceof re)&&Sn(t,o)}var i,s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText)return!1;var c=e<0?s.pos-a.nodeSize:s.pos;return!!(a.isAtom||(i=t.docView.descAt(c))&&!i.contentDOM)&&(re.isSelectable(a)?Sn(t,new re(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):!!we.webkit&&Sn(t,new ee(t.state.doc.resolve(e<0?c:c+a.nodeSize))))}if(r instanceof re&&r.node.isInline)return Sn(t,new ee(e>0?r.$to:r.$from));var l=_n(t.state,e);return!!l&&Sn(t,l)}function Mn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Dn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function En(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(we.gecko&&1==n.nodeType&&r<Mn(n)&&Dn(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Dn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Tn(n))break;for(var c=n.previousSibling;c&&Dn(c);)o=n.parentNode,i=Me(c),c=c.previousSibling;if(c)r=Mn(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Nn(t,e,n,r):o&&Nn(t,e,o,i)}}function On(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Mn(n);;)if(r<s){if(1!=n.nodeType)break;if(!Dn(n.childNodes[r]))break;o=n,i=++r}else{if(Tn(n))break;for(var a=n.nextSibling;a&&Dn(a);)o=a.parentNode,i=Me(a)+1,a=a.nextSibling;if(a)r=0,s=Mn(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Nn(t,e,o,i)}}function Tn(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Nn(t,e,n,r){if(Ie(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection()}function zn(t,e,n){var r=t.state.selection;if(r instanceof ee&&!r.empty||n.indexOf("s")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=_n(t.state,e);if(s&&s instanceof re)return Sn(t,s)}if(!o.parent.inlineContent){var a=Qt.findFrom(e<0?o:i,e);return!a||Sn(t,a)}return!1}function qn(t,e){if(!(t.state.selection instanceof ee))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function In(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Rn(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||we.mac&&72==n&&"c"==r?qn(t,-1)||En(t):46==n||we.mac&&68==n&&"c"==r?qn(t,1)||On(t):13==n&&!we.ios||27==n||(37==n?An(t,-1,r)||En(t):39==n?An(t,1,r)||On(t):38==n?zn(t,-1,r)||En(t):40==n?function(t){if(we.chrome&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;In(t,o,!0),setTimeout((function(){return In(t,o,!1)}),20)}}}(t)||zn(t,1,r)||On(t):r==(we.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Fn(t,e){var n,r,o=t.root.getSelection(),i=t.state.doc,s=t.docView.nearestDesc(o.focusNode),a=s&&0==s.size,c=t.docView.posFromDOM(o.focusNode,o.focusOffset),l=i.resolve(c);if(Ie(o)){for(n=l;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&re.isSelectable(s.node)&&s.parent&&(!s.node.isInline||!function(t,e,n){for(var r=0==e,o=e==ze(t);r||o;){if(t==n)return!0;var i=Me(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==ze(t)}}(o.focusNode,o.focusOffset,s.dom))){var u=s.posBefore;r=new re(c==u?l:i.resolve(u))}}else n=i.resolve(t.docView.posFromDOM(o.anchorNode,o.anchorOffset));r||(r=Hn(t,n,l,"pointer"==e||t.state.selection.head<l.pos&&!a?1:-1));return r}function Ln(t,e){var n=t.state.selection;if(jn(t,n),t.editable?t.hasFocus():Wn(t)&&document.activeElement.contains(t.dom)){if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,Me(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&we.ie&&we.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,s=n.head;!Bn||n instanceof ee||(n.$from.parent.inlineContent||(r=Pn(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Pn(t,n.to))),t.docView.setSelection(i,s,t.root,e),Bn&&(r&&$n(r),o&&$n(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):i!=s&&(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),t.dom.classList.remove("ProseMirror-hideselection"))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}wn.prototype.getPreMatch=function(t){return t>=this.preMatchOffset?this.preMatched[t-this.preMatchOffset]:null},wn.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},wn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},wn.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=an.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},wn.prototype.findNodeMatch=function(t,e,n,r){var o=-1,i=r<0?void 0:this.getPreMatch(r),s=this.top.children;if(i&&i.matchesNode(t,e,n))o=s.indexOf(i);else for(var a=this.index,c=Math.min(s.length,a+5);a<c;a++){var l=s[a];if(l.matchesNode(t,e,n)&&this.preMatched.indexOf(l)<0){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},wn.prototype.updateNextNode=function(t,e,n,r,o){if(this.index==this.top.children.length)return!1;var i=this.top.children[this.index];if(i instanceof cn){var s=this.preMatched.indexOf(i);if(s>-1&&s+this.preMatchOffset!=o)return!1;var a=i.dom;if(!(this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))&&!(t.isText&&i.node&&i.node.isText&&i.nodeDOM.nodeValue==t.text&&3!=i.dirty&&bn(e,i.outerDeco)))&&i.update(t,e,n,r))return i.dom!=a&&(this.changed=!0),this.index++,!0}return!1},wn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,cn.create(this.top,t,e,n,r,o)),this.changed=!0},wn.prototype.placeWidget=function(t,e,n){if(this.index<this.top.children.length&&this.top.children[this.index].matchesWidget(t))this.index++;else{var r=new on(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}},wn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof an;)t=t.children[t.children.length-1];if(!t||!(t instanceof un)||/\n$/.test(t.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var e=document.createElement("br");this.top.children.splice(this.index++,0,new pn(this.top,rn,e,null)),this.changed=!0}};var Bn=we.safari||we.chrome&&we.chrome_version<63;function Pn(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(we.safari&&i&&"false"==i.contentEditable)return Vn(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Vn(i);if(s)return Vn(s)}}function Vn(t){return t.contentEditable="true",we.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $n(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jn(t,e){if(e instanceof re){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Jn(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Jn(t)}function Jn(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Hn(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||ee.between(e,n,r)}function Wn(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Un(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(we.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||we.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Kn(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==i?c.setMeta("pointer",!0):"key"==i&&c.scrollIntoView(),t.dispatch(c)}}else{var l=t.state.doc.resolve(e),u=l.sharedDepth(n);e=l.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p,h,f=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Ie(l)||u.push({node:l.focusNode,offset:l.focusOffset})),we.chrome&&8===t.lastKeyCode)for(var h=s;h>i;h--){var f=o.childNodes[h-1],d=f.pmViewDesc;if("BR"==f.nodeType&&!d){s=h;break}if(!d||d.size)break}var m=t.state.doc,v=t.someProp("domParser")||et.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Un,context:g});if(u&&null!=u[0].pos){var k=u[0].pos,w=u[1]&&u[1].pos;null==w&&(w=k),y={anchor:k+a,head:w+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n),m=t.state.doc,v=m.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.lastKeyCode=null;var g=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var l=Math.max(0,i-Math.min(a,c));r-=a+l-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(v.content,d.doc.content,d.from,p,h);if(!g){if(!(r&&f instanceof ee&&!f.empty&&f.$head.sameParent(f.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){var y=Gn(t,t.state.doc,d.sel);y&&!y.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(y))}return}g={start:f.from,endA:f.to,endB:f.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof ee&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),we.ie&&we.ie_version<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>d.from&&"  "==d.doc.textBetween(g.start-d.from-1,g.start-d.from+1)&&(g.start--,g.endA--,g.endB--);var b,k=d.doc.resolveNoCache(g.start-d.from),w=d.doc.resolveNoCache(g.endB-d.from);if((we.ios&&t.lastIOSEnter>Date.now()-100&&(!k.sameParent(w)||o.some((function(t){return"DIV"==t.nodeName})))||!k.sameParent(w)&&k.pos<d.doc.content.size&&(b=Qt.findFrom(d.doc.resolve(k.pos+1),1,!0))&&b.head==w.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>g.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Zn(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Zn(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,g.start,g.endA,k,w)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))we.android&&we.chrome&&t.domObserver.suppressSelectionUpdates();else{var x,C,_,S,A=g.start,M=g.endA;if(k.sameParent(w)&&k.parent.inlineContent)if(k.pos==w.pos)we.ie&&we.ie_version<=11&&0==k.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Ln(t)}),20)),x=t.state.tr.delete(A,M),C=m.resolve(g.start).marksAcross(m.resolve(g.endA));else if(g.endA==g.endB&&(S=m.resolve(g.start))&&(_=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,c=i,l=a,u=0;u<a.length;u++)c=a[u].removeFromSet(c);for(var p=0;p<i.length;p++)l=i[p].removeFromSet(l);if(1==c.length&&0==l.length)r=c[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=l.length)return null;r=l[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var h=[],f=0;f<e.childCount;f++)h.push(o(e.child(f)));if(s.from(h).eq(t))return{mark:r,type:n}}(k.parent.content.cut(k.parentOffset,w.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start()))))x=t.state.tr,"add"==_.type?x.addMark(A,M,_.mark):x.removeMark(A,M,_.mark);else if(k.parent.child(k.index()).isText&&k.index()==w.index()-(w.textOffset?0:1)){var D=k.parent.textBetween(k.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,A,M,D)})))return;x=t.state.tr.insertText(D,A,M)}if(x||(x=t.state.tr.replace(A,M,d.doc.slice(g.start-d.from,g.endB-d.from))),d.sel){var E=Gn(t,x.doc,d.sel);E&&!(we.chrome&&we.android&&t.composing&&E.empty&&E.head==A||we.ie&&E.empty&&E.head==A)&&x.setSelection(E)}C&&x.ensureMarks(C),t.dispatch(x.scrollIntoView())}}}function Gn(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hn(t,e.resolve(n.anchor),e.resolve(n.head))}function Zn(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Yn(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.type.hasRequiredAttrs()?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||ht.fromSchema(t.state.schema),c=rr(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=er[p.nodeName.toLowerCase()]);){for(var h=u.length-1;h>=0;h--){for(var f=c.createElement(u[h]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Qn(t,e,n,r,o){var i,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var l=e&&(r||c||!n);if(l){if(t.someProp("transformPastedText",(function(t){e=t(e)})),c)return new f(s.from(t.state.schema.text(e)),0,0);var u=t.someProp("clipboardTextParser",(function(t){return t(e,o)}));u?a=u:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=rr().createElement("div"),o=/(?:<meta [^>]*>)*<([a-z][^>\s]+)/i.exec(t),i=0;(n=o&&er[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""),i=n.length);r.innerHTML=t;for(var s=0;s<i;s++)r=r.firstChild;return r}(n);var p=i&&i.querySelector("[data-pm-slice]"),h=p&&/^(\d+) (\d+) (.*)/.exec(p.getAttribute("data-pm-slice"));if(!a){var d=t.someProp("clipboardParser")||t.someProp("domParser")||et.fromSchema(t.state.schema);a=d.parseSlice(i,{preserveWhitespace:!(!l&&!h),context:o})}return a=h?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var l=r.nodes[n[c]];if(!l||l.hasRequiredAttrs())break;o=s.from(l.create(n[c+1],o)),i++,a++}return new f(o,i,a)}(function(t,e,n){e<t.openStart&&(t=new f(tr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd));n<t.openEnd&&(t=new f(tr(t.content,1,n,t.openEnd,0,0),t.openStart,n));return t}(a,+h[1],+h[2]),h[3]):f.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,i=[];if(t.forEach((function(t){if(i){var e,n=r.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&o.length&&function t(e,n,r,o,i){if(i<e.length&&i<n.length&&e[i]==n[i]){var a=t(e,n,r,o.lastChild,i+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(i==e.length-1?r.type:e[i+1]))return o.copy(o.content.append(s.from(Xn(r,e,i+1))))}}(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),o=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(o))}(i[i.length-1],o.length));var a=Xn(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}})),i)return{v:s.from(i)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(a.content,o),!1),t.someProp("transformPasted",(function(t){a=t(a)})),a}function Xn(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,s.from(t));return t}function tr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,c=a.content;return o<r-1&&(c=tr(c,e,n,r,o+1,i)),o>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||i<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var er={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nr=null;function rr(){return nr||(nr=document.implementation.createHTMLDocument("title"))}var or={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ir=we.ie&&we.ie_version<=11,sr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};sr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},sr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var ar=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=!1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);we.ie&&we.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new sr,ir&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};ar.prototype.flushSoon=function(){var t=this;this.flushingSoon||(this.flushingSoon=!0,window.setTimeout((function(){t.flushingSoon=!1,t.flush()}),20))},ar.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,or),ir&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},ar.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}ir&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},ar.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},ar.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},ar.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},ar.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Wn(t)){var t;if(this.suppressingSelectionUpdates)return Ln(this.view);if(we.ie&&we.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&Oe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},ar.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},ar.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},ar.prototype.flush=function(){if(this.view.docView&&!this.flushingSoon){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Wn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&!this.view.composing&&(i=!0))}if(we.gecko&&s.length>1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(cr)return;cr=!0,"normal"==getComputedStyle(t.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,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Ln(this.view))}},ar.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){var r=t.previousSibling,o=t.nextSibling;if(we.ie&&we.ie_version<=11&&t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){var s=t.addedNodes[i],a=s.previousSibling,c=s.nextSibling;(!a||Array.prototype.indexOf.call(t.addedNodes,a)<0)&&(r=a),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c)}for(var l=r&&r.parentNode==t.target?Me(r)+1:0,u=n.localPosFromDOM(t.target,l,-1),p=o&&o.parentNode==t.target?Me(o):t.target.childNodes.length,h=0;h<t.addedNodes.length;h++)e.push(t.addedNodes[h]);return{from:u,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var cr=!1;var lr={},ur={};function pr(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function hr(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return fr(t,e)})}))}function fr(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function dr(t){return{left:t.clientX,top:t.clientY}}function mr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function vr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function gr(t,e,n,r,o){return mr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof re&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(vr(t,re.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&re.isSelectable(r))&&(vr(t,new re(n),"pointer"),!0)}(t,n))}function yr(t,e,n,r){return mr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function br(t,e,n,r){return mr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(vr(t,ee.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)vr(t,ee.create(n,s+1,s+1+i.content.size),"pointer");else{if(!re.isSelectable(i))continue;vr(t,re.create(n,s),"pointer")}return!0}}(t,n)}function kr(t){return Ar(t)}ur.keydown=function(t,e){t.shiftKey=16==e.keyCode||e.shiftKey,Cr(t,e)||(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!we.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey?t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Rn(t,e)?e.preventDefault():pr(t,"key"):t.lastIOSEnter=Date.now())},ur.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},ur.keypress=function(t,e){if(!(Cr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||we.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof ee&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var wr=we.mac?"metaKey":"ctrlKey";lr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=kr(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[wr]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(dr(e));i&&("singleClick"==o?t.mouseDown=new xr(t,i,e,n):("doubleClick"==o?yr:br)(t,i.pos,i.inside,e)?e.preventDefault():pr(t,"pointer"))};var xr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[wr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof re&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&we.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(){return s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),pr(t,"pointer")};function Cr(t,e){return!!t.composing||!!(we.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}xr.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.draggable=!1),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xr.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(dr(t))),this.allowDefault||!e?pr(this.view,"pointer"):gr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():!this.flushed&&(!we.chrome||this.view.state.selection instanceof ee||e.pos!=this.view.state.selection.from&&e.pos!=this.view.state.selection.to)?pr(this.view,"pointer"):(vr(this.view,Qt.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault())}},xr.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),pr(this.view,"pointer")},lr.touchdown=function(t){kr(t),pr(t,"pointer")},lr.contextmenu=function(t){return kr(t)};var _r=we.android?5e3:-1;function Sr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Ar(t)}),e))}function Ar(t,e){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty();return!(!e&&!t.docView.dirty)&&(t.updateState(t.state),!0)}ur.compositionstart=ur.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Ar(t,!0),t.markCursor=null;else if(Ar(t),we.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Sr(t,_r)},ur.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Sr(t,20))};var Mr=we.ie&&we.ie_version<15||we.ios&&we.webkit_version<604;function Dr(t,e,n,r){var o=Qn(t,e,n,t.shiftKey,t.state.selection.$from);if(!t.someProp("handlePaste",(function(e){return e(t,r,o||f.empty)}))&&o){var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste"))}}lr.copy=ur.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Mr?null:e.clipboardData,i=Yn(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){var n=t.dom.ownerDocument,r=n.body.appendChild(n.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),i=n.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((function(){n.body.removeChild(r),t.focus()}),50)}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},ur.paste=function(t,e){var n=Mr?null:e.clipboardData,r=n&&n.getData("text/html"),o=n&&n.getData("text/plain");n&&(r||o||n.files.length)?(Dr(t,o,r,e),e.preventDefault()):function(t,e){var n=t.dom.ownerDocument,r=t.shiftKey||t.state.selection.$from.parent.type.spec.code,o=n.body.appendChild(n.createElement(r?"textarea":"div"));r||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((function(){t.focus(),n.body.removeChild(o),r?Dr(t,o.value,null,e):Dr(t,o.textContent,o.innerHTML,e)}),50)}(t,e)};var Er=function(t,e){this.slice=t,this.move=e},Or=we.mac?"altKey":"ctrlKey";for(var Tr in lr.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(dr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof re?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=Yn(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Mr?"Text":"text/html",c.innerHTML),Mr||e.dataTransfer.setData("text/plain",l),t.dragging=new Er(s,!e[Or])}},lr.dragend=function(t){window.setTimeout((function(){return t.dragging=null}),50)},ur.dragover=ur.dragenter=function(t,e){return e.preventDefault()},ur.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(dr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||Qn(t,e.dataTransfer.getData(Mr?"Text":"text/plain"),Mr?null:e.dataTransfer.getData("text/html"),!1,o);if(i&&(e.preventDefault(),!t.someProp("handleDrop",(function(r){return r(t,e,i,n&&n.move)})))){var s=i?Lt(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var a=t.state.tr;n&&n.move&&a.deleteSelection();var c=a.mapping.map(s),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=a.doc;if(l?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),!a.doc.eq(u)){var p=a.doc.resolve(c);l&&re.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild)?a.setSelection(new re(p)):a.setSelection(Hn(t,p,a.doc.resolve(a.mapping.map(s)))),t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}}}}}},lr.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Ln(t)}),20))},lr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},lr.beforeinput=function(t,e){if(we.chrome&&we.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},ur)lr[Tr]=ur[Tr];function Nr(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var zr=function(t,e){this.spec=e||Br,this.side=this.spec.side||0,this.toDOM=t};zr.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Rr(i-n,i-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(t){return this==t||t instanceof zr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Nr(this.spec,t.spec))};var qr=function(t,e){this.spec=e||Br,this.attrs=t};qr.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Rr(o,i,this)},qr.prototype.valid=function(t,e){return e.from<e.to},qr.prototype.eq=function(t){return this==t||t instanceof qr&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)},qr.is=function(t){return t.type instanceof qr};var Ir=function(t,e){this.spec=e||Br,this.attrs=t};Ir.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Rr(o.pos-n,i.pos-n,this)},Ir.prototype.valid=function(t,e){var n=t.content.findIndex(e.from),r=n.index,o=n.offset;return o==e.from&&o+t.child(r).nodeSize==e.to},Ir.prototype.eq=function(t){return this==t||t instanceof Ir&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)};var Rr=function(t,e,n){this.from=t,this.to=e,this.type=n},Fr={spec:{configurable:!0}};Rr.prototype.copy=function(t,e){return new Rr(t,e,this.type)},Rr.prototype.eq=function(t){return this.type.eq(t.type)&&this.from==t.from&&this.to==t.to},Rr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Rr.widget=function(t,e,n){return new Rr(t,t,new zr(e,n))},Rr.inline=function(t,e,n,r){return new Rr(t,e,new qr(n,r))},Rr.node=function(t,e,n,r){return new Rr(t,e,new Ir(n,r))},Fr.spec.get=function(){return this.type.spec},Object.defineProperties(Rr.prototype,Fr);var Lr=[],Br={},Pr=function(t,e){this.local=t&&t.length?t:Lr,this.children=e&&e.length?e:Lr};Pr.create=function(t,e){return e.length?Wr(e,t,0,Br):Vr},Pr.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Pr.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Pr.prototype.map=function(t,e,n){return this==Vr||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Br)},Pr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:(l=r-n-(e-t)+(i-o))&&(a[s]+=l,a[s+1]+=l))}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(-1==a[p+1]){var h=n.map(a[p]+i),f=h-o;if(f<0||f>=r.content.size){u=!0;continue}var d=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==d){var b=a[p+2].mapInner(n,y,h+1,a[p]+i+1,s);b!=Vr?(a[p]=f,a[p+1]=d,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var k=Wr(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=k.local;for(var w=0;w<a.length;w+=3)a[w+1]<0&&(a.splice(w,3),w-=3);for(var x=0,C=0;x<k.children.length;x+=3){for(var _=k.children[x];C<a.length&&a[C]<_;)C+=3;a.splice(C,0,k.children[x],k.children[x+1],k.children[x+2])}}return new Pr(e&&e.sort(Ur),a)}(this.children,i,t,e,n,r,o):i?new Pr(i.sort(Ur)):Vr},Pr.prototype.add=function(t,e){return e.length?this==Vr?Pr.create(t,e):this.addInner(t,e,0):this},Pr.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Jr(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Wr(a,t,c+1,Br)),i+=3}}));var s=jr(i?Hr(e):e,-n);return new Pr(s.length?this.local.concat(s).sort(Ur):this.local,r||this.children)},Pr.prototype.remove=function(t){return 0==t.length||this==Vr?this:this.removeInner(t,0)},Pr.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=Vr?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,h=void 0;p<t.length;p++)if(h=t[p])for(var f=0;f<r.length;f++)r[f].type.eq(h.type)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Pr(r,n):Vr},Pr.prototype.forChild=function(t,e){if(this==Vr)return this;if(e.isLeaf)return Pr.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof qr){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Pr(r.sort(Ur));return n?new $r([p,n]):p}return n||Vr},Pr.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Pr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Pr.prototype.locals=function(t){return Kr(this.localsInner(t))},Pr.prototype.localsInner=function(t){if(this==Vr)return Lr;if(t.inlineContent||!this.local.some(qr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qr||e.push(this.local[n]);return e};var Vr=new Pr;Pr.empty=Vr,Pr.removeOverlap=Kr;var $r=function(t){this.members=t};function jr(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Rr(o.from+e,o.to+e,o.type))}return n}function Jr(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Hr(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Wr(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Jr(t,e,s+n);if(a){i=!0;var c=Wr(a,e,n+s+1,r);c!=Vr&&o.push(s,s+e.nodeSize,c)}}));for(var s=jr(i?Hr(t):t,-n).sort(Ur),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Pr(s,o):Vr}function Ur(t,e){return t.from-e.from||t.to-e.to}function Kr(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gr(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Gr(e,o+1,i.copy(r.to,i.to)))}}return e}function Gr(t,e,n){for(;e<t.length&&Ur(n,t[e])>0;)e++;t.splice(e,0,n)}function Zr(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Vr&&e.push(r)})),t.cursorWrapper&&e.push(Pr.create(t.state.doc,[t.cursorWrapper.deco])),$r.from(e)}$r.prototype.forChild=function(t,e){if(e.isLeaf)return Pr.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Vr&&(o instanceof $r?n=n.concat(o.members):n.push(o))}return $r.from(n)},$r.prototype.eq=function(t){if(!(t instanceof $r)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},$r.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Kr(n?e:e.sort(Ur)):Lr},$r.from=function(t){switch(t.length){case 0:return Vr;case 1:return t[0];default:return new $r(t)}};var Yr=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=eo(this),this.markCursor=null,this.cursorWrapper=null,to(this),this.nodeViews=no(this),this.docView=ln(this.state.doc,Xr(this),Zr(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new ar(t,(function(e,n,r,o){return Kn(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=lr[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||fr(t,e)||!t.editable&&e.type in ur||n(t,e)})};for(var n in lr)e(n);we.safari&&t.dom.addEventListener("input",(function(){return null})),hr(t)}(this),this.pluginViews=[],this.updatePluginViews()},Qr={props:{configurable:!0},root:{configurable:!0}};function Xr(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r?e.class+=" "+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Rr.node(0,t.state.doc.content.size,e)]}function to(t){var e=t.state.selection,n=e.$head,r=e.$anchor,o=e.visible;if(t.markCursor){var i=document.createElement("img");i.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:i,deco:Rr.widget(n.pos,i,{raw:!0,marks:t.markCursor})}}else if(o||n.pos!=r.pos)t.cursorWrapper=null;else{var s;!t.cursorWrapper||t.cursorWrapper.dom.childNodes.length?((s=document.createElement("div")).style.position="absolute",s.style.left="-100000px"):t.cursorWrapper.deco.pos!=n.pos&&(s=t.cursorWrapper.dom),s&&(t.cursorWrapper={dom:s,deco:Rr.widget(n.pos,s,{raw:!0})})}}function eo(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function no(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}Qr.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Yr.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&hr(this),this._props=t,this.updateStateInner(t.state,!0)},Yr.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},Yr.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Yr.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1;if(this.state=t,e){var i=no(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(i,this.nodeViews)&&(this.nodeViews=i,o=!0),hr(this)}this.editable=eo(this),to(this);var s,a,c,l,u,p,h,f,d,m,v,g=Zr(this),y=Xr(this),b=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",k=o||!this.docView.matchesNode(t.doc,y,g),w=k||!t.selection.eq(r.selection),x="preserve"==b&&w&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Pe(t.dom)}}(this);if(w){this.domObserver.stop();var C=k&&(we.ie||we.chrome)&&!r.selection.empty&&!t.selection.empty&&(l=r.selection,u=t.selection,p=Math.min(l.$anchor.sharedDepth(l.head),u.$anchor.sharedDepth(u.head)),l.$anchor.node(p)!=u.$anchor.node(p));k&&(!o&&this.docView.update(t.doc,y,g,this)||(this.docView.destroy(),this.docView=ln(t.doc,y,g,this.dom,this))),C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(s=this,a=s.docView.domFromPos(s.state.selection.anchor),c=s.root.getSelection(),Oe(a.node,a.offset,c.anchorNode,c.anchorOffset)))?Ln(this,C):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==b)this.dom.scrollTop=0;else if("to selection"==b){var _=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof re?Be(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),_):Be(this,this.coordsAtPos(t.selection.head),_))}else x&&(f=(h=x).refDOM,d=h.refTop,m=h.stack,v=f?f.getBoundingClientRect().top:0,Ve(m,0==v?0:v-d))},Yr.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Yr.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var o=this.state.plugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}},Yr.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;var o=this.state.plugins;if(o)for(var i=0;i<o.length;i++){var s=o[i].props[t];if(null!=s&&(n=e?e(s):s))return n}},Yr.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Yr.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if($e)return t.focus($e);var e=Pe(t);t.focus(null==$e?{get preventScroll(){return $e={preventScroll:!0},!0}}:void 0),$e||($e=!1,Ve(e,0))}(this.dom),Ln(this),this.domObserver.start()},Qr.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Yr.prototype.posAtCoords=function(t){return He(this,t)},Yr.prototype.coordsAtPos=function(t){return Ue(this,t)},Yr.prototype.domAtPos=function(t){return this.docView.domFromPos(t)},Yr.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Yr.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Yr.prototype.endOfTextblock=function(t,e){return tn(this,e||this.state,t)},Yr.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Yr.prototype.dispatchEvent=function(t){return function(t,e){fr(t,e)||!lr[e.type]||!t.editable&&e.type in ur||lr[e.type](t,e)}(this,t)},Yr.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Yr.prototype,Qr);var ro=n(13),oo=n.n(ro),io=new X({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:function(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:function(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:function(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){return{params:t.getAttribute("data-params")||""}}}],toDOM:function(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:function(t){return{tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:function(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:function(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM:function(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:function(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:function(t){return"italic"==t&&null}}],toDOM:function(){return["em"]}},strong:{parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-weight",getAttrs:function(t){return/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}}],toDOM:function(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:function(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM:function(){return["code"]}}}});var so=function(t,e){this.schema=t,this.stack=[{type:t.topNodeType,content:[]}],this.marks=p.none,this.tokenHandlers=e};function ao(t,e){return t.getAttrs?t.getAttrs(e):t.attrs instanceof Function?t.attrs(e):t.attrs}function co(t){return"code_inline"==t||"code_block"==t||"fence"==t}function lo(t){return"\n"==t[t.length-1]?t.slice(0,t.length-1):t}function uo(){}so.prototype.top=function(){return this.stack[this.stack.length-1]},so.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},so.prototype.addText=function(t){if(t){var e,n=this.top().content,r=n[n.length-1],o=this.schema.text(t,this.marks);r&&(e=function(t,e){if(t.isText&&e.isText&&p.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(r,o))?n[n.length-1]=e:n.push(o)}},so.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},so.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},so.prototype.parseTokens=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=this.tokenHandlers[n.type];if(!r)throw new Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n)}},so.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},so.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},so.prototype.closeNode=function(){this.marks.length&&(this.marks=p.none);var t=this.stack.pop();return this.addNode(t.type,t.attrs,t.content)};var po=function(t,e,n){this.tokens=n,this.schema=t,this.tokenizer=e,this.tokenHandlers=function(t,e){var n=Object.create(null),r=function(r){var o=e[r];if(o.block){var i=t.nodeType(o.block);co(r)?n[r]=function(t,e){t.openNode(i,ao(o,e)),t.addText(lo(e.content)),t.closeNode()}:(n[r+"_open"]=function(t,e){return t.openNode(i,ao(o,e))},n[r+"_close"]=function(t){return t.closeNode()})}else if(o.node){var s=t.nodeType(o.node);n[r]=function(t,e){return t.addNode(s,ao(o,e))}}else if(o.mark){var a=t.marks[o.mark];co(r)?n[r]=function(t,e){t.openMark(a.create(ao(o,e))),t.addText(lo(e.content)),t.closeMark(a)}:(n[r+"_open"]=function(t,e){return t.openMark(a.create(ao(o,e)))},n[r+"_close"]=function(t){return t.closeMark(a)})}else{if(!o.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(o));co(r)?n[r]=uo:(n[r+"_open"]=uo,n[r+"_close"]=uo)}};for(var o in e)r(o);return n.text=function(t,e){return t.addText(e.content)},n.inline=function(t,e){return t.parseTokens(e.children)},n.softbreak=n.softbreak||function(t){return t.addText("\n")},n}(t,n)};po.prototype.parse=function(t){var e,n=new so(this.schema,this.tokenHandlers);n.parseTokens(this.tokenizer.parse(t,{}));do{e=n.closeNode()}while(n.stack.length);return e};var ho=new po(io,oo()("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list"},ordered_list:{block:"ordered_list",getAttrs:function(t){return{order:+t.attrGet("start")||1}}},heading:{block:"heading",getAttrs:function(t){return{level:+t.tag.slice(1)}}},code_block:{block:"code_block"},fence:{block:"code_block",getAttrs:function(t){return{params:t.info||""}}},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:function(t){return{src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null}}},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:function(t){return{href:t.attrGet("href"),title:t.attrGet("title")||null}}},code_inline:{mark:"code"}}),fo=function(t,e){this.nodes=t,this.marks=e};fo.prototype.serialize=function(t,e){var n=new yo(this.nodes,this.marks,e);return n.renderContent(t),n.out};var mo=new fo({blockquote:function(t,e){t.wrapBlock("> ",null,e,(function(){return t.renderContent(e)}))},code_block:function(t,e){t.write("```"+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},heading:function(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e),t.closeBlock(e)},horizontal_rule:function(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list:function(t,e){t.renderList(e," ",(function(){return(e.attrs.bullet||"*")+" "}))},ordered_list:function(t,e){var n=e.attrs.order||1,r=String(n+e.childCount-1).length,o=t.repeat(" ",r+2);t.renderList(e,o,(function(e){var o=String(n+e);return t.repeat(" ",r-o.length)+o+". "}))},list_item:function(t,e){t.renderContent(e)},paragraph:function(t,e){t.renderInline(e),t.closeBlock(e)},image:function(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+t.esc(e.attrs.src)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")")},hard_break:function(t,e,n,r){for(var o=r+1;o<n.childCount;o++)if(n.child(o).type!=e.type)return void t.write("\\\n")},text:function(t,e){t.text(e.text)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open:function(t,e,n,r){return go(e,n,r,1)?"<":"["},close:function(t,e,n,r){return go(e,n,r,-1)?">":"]("+t.esc(e.attrs.href)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")"}},code:{open:function(t,e,n,r){return vo(n.child(r),-1)},close:function(t,e,n,r){return vo(n.child(r-1),1)},escape:!1}});function vo(t,e){var n,r=/`+/g,o=0;if(t.isText)for(;n=r.exec(t.text);)o=Math.max(o,n[0].length);for(var i=o>0&&e>0?" `":"`",s=0;s<o;s++)i+="`";return o>0&&e<0&&(i+=" "),i}function go(t,e,n,r){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;var o=e.child(n+(r<0?-1:0));if(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t)return!1;if(n==(r<0?1:e.childCount-1))return!0;var i=e.child(n+(r<0?-2:1));return!t.isInSet(i.marks)}var yo=function(t,e,n){this.nodes=t,this.marks=e,this.delim=this.out="",this.closed=!1,this.inTightList=!1,this.options=n||{},void 0===this.options.tightLists&&(this.options.tightLists=!1)};yo.prototype.flushClose=function(t){if(this.closed){if(this.atBlank()||(this.out+="\n"),null==t&&(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;r<t;r++)this.out+=e+"\n"}this.closed=!1}},yo.prototype.wrapBlock=function(t,e,n,r){var o=this.delim;this.write(e||t),this.delim+=t,r(),this.delim=o,this.closeBlock(n)},yo.prototype.atBlank=function(){return/(^|\n)$/.test(this.out)},yo.prototype.ensureNewLine=function(){this.atBlank()||(this.out+="\n")},yo.prototype.write=function(t){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),t&&(this.out+=t)},yo.prototype.closeBlock=function(t){this.closed=t},yo.prototype.text=function(t,e){for(var n=t.split("\n"),r=0;r<n.length;r++){var o=this.atBlank()||this.closed;this.write(),this.out+=!1!==e?this.esc(n[r],o):n[r],r!=n.length-1&&(this.out+="\n")}},yo.prototype.render=function(t,e,n){if("number"==typeof e)throw new Error("!");this.nodes[t.type.name](this,t,e,n)},yo.prototype.renderContent=function(t){var e=this;t.forEach((function(n,r,o){return e.render(n,t,o)}))},yo.prototype.renderInline=function(t){var e=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[];o&&"hard_break"===o.type.name&&(a=a.filter((function(e){if(s+1==t.childCount)return!1;var n=t.child(s+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));var c=r;if(r="",o&&o.isText&&a.some((function(t){var n=e.marks[t.type.name];return n&&n.expelEnclosingWhitespace}))){var l=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=(l[0],l[1]),p=l[2],h=l[3];c+=u,r=h,(u||h)&&((o=p?o.withText(p):null)||(a=n))}var f=a.length&&a[a.length-1],d=f&&!1===e.marks[f.type.name].escape,m=a.length-(d?1:0);t:for(var v=0;v<m;v++){var g=a[v];if(!e.marks[g.type.name].mixable)break;for(var y=0;y<n.length;y++){var b=n[y];if(!e.marks[b.type.name].mixable)break;if(g.eq(b)){v>y?a=a.slice(0,y).concat(g).concat(a.slice(y,v)).concat(a.slice(v+1,m)):y>v&&(a=a.slice(0,v).concat(a.slice(v+1,y)).concat(g).concat(a.slice(y,m)));continue t}}}for(var k=0;k<Math.min(n.length,m)&&a[k].eq(n[k]);)++k;for(;k<n.length;)e.text(e.markString(n.pop(),!1,t,s),!1);if(c&&e.text(c),o){for(;n.length<m;){var w=a[n.length];n.push(w),e.text(e.markString(w,!0,t,s),!1)}d&&o.isText?e.text(e.markString(f,!0,t,s)+o.text+e.markString(f,!1,t,s+1),!1):e.render(o,t,s)}};t.forEach(o),o(null,0,t.childCount)},yo.prototype.renderList=function(t,e,n){var r=this;this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);var o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach((function(i,s,a){a&&o&&r.flushClose(1),r.wrapBlock(e,n(a),t,(function(){return r.render(i,t,a)}))})),this.inTightList=i},yo.prototype.esc=function(t,e){return t=t.replace(/[`*\\~\[\]]/g,"\\$&"),e&&(t=t.replace(/^[:#\-*+]/,"\\$&").replace(/^(\d+)\./,"$1\\.")),t},yo.prototype.quote=function(t){var e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]},yo.prototype.repeat=function(t,e){for(var n="",r=0;r<e;r++)n+=t;return n},yo.prototype.markString=function(t,e,n,r){var o=this.marks[t.type.name],i=e?o.open:o.close;return"string"==typeof i?i:i(this,t,n,r)},yo.prototype.getEnclosingWhitespace=function(t){return{leading:(t.match(/^(\s+)/)||[])[0],trailing:(t.match(/(\s+)$/)||[])[0]}};for(var bo={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"},ko=bo,wo={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"},xo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Co="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),_o="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ao="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mo=xo&&(So||+xo[1]<57)||_o&&So,Do=0;Do<10;Do++)bo[48+Do]=bo[96+Do]=String(Do);for(Do=1;Do<=24;Do++)bo[Do+111]="F"+Do;for(Do=65;Do<=90;Do++)bo[Do]=String.fromCharCode(Do+32),wo[Do]=String.fromCharCode(Do);for(var Eo in bo)wo.hasOwnProperty(Eo)||(wo[Eo]=bo[Eo]);var Oo=function(t){var e=!(Mo&&(t.ctrlKey||t.altKey||t.metaKey)||(Co||Ao)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?wo:bo)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e},To="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function No(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);To?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function zo(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function qo(t){return new ge({props:{handleKeyDown:Io(t)}})}function Io(t){var e=function(t){var e=Object.create(null);for(var n in t)e[No(n)]=t[n];return e}(t);return function(t,n){var r,o=Oo(n),i=1==o.length&&" "!=o,s=e[zo(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey)&&(r=ko[n.keyCode])&&r!=o){var a=e[zo(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[zo(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Ro=function(){};Ro.prototype.append=function(t){return t.length?(t=Ro.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Ro.prototype.prepend=function(t){return t.length?Ro.from(t).append(this):this},Ro.prototype.appendInner=function(t){return new Lo(this,t)},Ro.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Ro.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Ro.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ro.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Ro.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Ro.from=function(t){return t instanceof Ro?t:t&&t.length?new Fo(t):Ro.empty};var Fo=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ro);Ro.empty=new Fo([]);var Lo=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Ro),Bo=Ro,Po=function(t,e){this.items=t,this.eventCount=e};Po.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new Vo(t.map));var p,h=t.step.map(r.slice(o));h&&c.maybeStep(h).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new Vo(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Po(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Po.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var l,u=t.steps[c].invert(t.docs[c]),p=new Vo(t.mapping.maps[c],u,e);(l=a&&a.merge(p))&&(p=l,c?o.pop():s=s.slice(0,s.length-1)),o.push(p),e&&(i++,e=null),r||(a=p)}var h,f,d,m=i-n.depth;return m>jo&&(f=m,(h=s).forEach((function(t,e){if(t.selection&&0==f--)return d=e,!1})),s=h.slice(d),i-=m),new Po(s.append(o),i)},Po.prototype.remapping=function(t,e){var n=new bt;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Po.prototype.addMaps=function(t){return 0==this.eventCount?this:new Po(this.items.append(t.map((function(t){return new Vo(t)}))),this.eventCount)},Po.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new Vo(c,l,u))}else n.push(new Vo(c))}}),r);for(var c=[],l=e;l<i;l++)c.push(new Vo(o.maps[l]));var u=this.items.slice(0,r).append(c).append(n),p=new Po(u,s);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},Po.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Po.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new Vo(c.invert(),a,l),h=r.length-1;(u=r.length&&r[h].merge(p))?r[h]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new Po(Bo.from(r.reverse()),o)},Po.empty=new Po(Bo.empty,0);var Vo=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Vo.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Vo(e.getMap().invert(),e,this.selection)}};var $o=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},jo=20;function Jo(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ho(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Wo(t,e,n,r){var o=Go(e),i=Zo.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new $o(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(Zo,{redo:r,historyState:l}).scrollIntoView())}}var Uo=!1,Ko=null;function Go(t){var e=t.plugins;if(Ko!=e){Uo=!1,Ko=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Uo=!0;break}}return Uo}var Zo=new ke("history"),Yo=new ke("closeHistory");function Qo(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new ge({key:Zo,state:{init:function(){return new $o(Po.empty,Po.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(Zo);if(i)return i.historyState;n.getMeta(Yo)&&(t=new $o(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Zo))return s.getMeta(Zo).redo?new $o(t.done.addTransform(n,null,r,Go(e)),t.undone,Jo(n.mapping.maps[n.steps.length-1]),t.prevTime):new $o(t.done,t.undone.addTransform(n,null,r,Go(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new $o(t.done.rebased(n,o),t.undone.rebased(n,o),Ho(t.prevRanges,n.mapping),t.prevTime):new $o(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ho(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ho(t.prevRanges,n.mapping):Jo(n.mapping.maps[n.steps.length-1]);return new $o(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Go(e)),Po.empty,c,n.time)}(n,r,e,t)}},config:t})}function Xo(t,e){var n=Zo.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Wo(n,t,e,!1),!0)}function ti(t,e){var n=Zo.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Wo(n,t,e,!0),!0)}function ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function ri(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function ii(t,e){var n,r=t.selection,o=r instanceof re;if(o){if(r.node.isTextblock||!It(t.doc,r.from))return!1;n=r.from}else if(null==(n=Ft(t.doc,r.from,-1)))return!1;if(e){var i=t.tr.join(n);o&&i.setSelection(re.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function si(t,e){var n,r=t.selection;if(r instanceof re){if(r.node.isTextblock||!It(t.doc,r.to))return!1;n=r.to}else if(null==(n=Ft(t.doc,r.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function ai(t,e){var n=t.selection,r=n.$from,o=n.$to,i=r.blockRange(o),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function ci(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function li(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=ci(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),l=t.tr.replaceWith(c,c,a.createAndFill());l.setSelection(Qt.near(l.doc.resolve(c),1)),e(l.scrollIntoView())}return!0}function ui(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof re&&t.selection.node.isBlock)return!(!r.parentOffset||!qt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,a=t.tr;t.selection instanceof ee&&a.deleteSelection();var c=0==r.depth?null:ci(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&c?[{type:c}]:null,u=qt(a.doc,a.mapping.map(r.pos),1,l);l||u||!qt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(l=[{type:c}],u=!0),u&&(a.split(a.mapping.map(r.pos),1,l),i||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from(c.create(),r.parent))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0}function pi(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(re.create(t.doc,n))),!0)}function hi(t,e,n){var r,o,i=e.nodeBefore,a=e.nodeAfter;if(i.type.spec.isolating||a.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!It(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;if(e.parent.canReplace(e.index(),e.index()+1)&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var c=e.pos+a.nodeSize,l=s.empty,u=r.length-1;u>=0;u--)l=s.from(r[u].create(null,l));l=s.from(i.copy(l));var p=t.tr.step(new Dt(e.pos-1,c,e.pos,c,new f(l,1,0),r.length,!0)),h=c+2*r.length;It(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}var d=Qt.findFrom(e,1),m=d&&d.$from.blockRange(d.$to),v=m&&Tt(m);return null!=v&&v>=e.depth&&(n&&n(t.tr.lift(m,v).scrollIntoView()),!0)}function fi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Nt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function di(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function mi(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],h=p.$from,f=p.$to;c=n.doc.rangeHasMark(h.pos,f.pos,t)}for(var d=0;d<a.length;d++){var m=a[d],v=m.$from,g=m.$to;c?l.removeMark(v.pos,g.pos,t):l.addMark(v.pos,g.pos,t.create(e))}r(l.scrollIntoView())}return!0}}function vi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var gi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r);if(!o){var i=r.blockRange(),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(a,"end")||re.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(ni(a,"end")?Qt.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):re.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r),i=o&&o.nodeBefore;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)})),yi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r);if(!o)return!1;var i=o.nodeAfter;if(hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(i,"start")||re.isSelectable(i))){if(e){var s=t.tr.deleteRange(r.before(),r.after());s.setSelection(ni(i,"start")?Qt.findFrom(s.doc.resolve(s.mapping.map(o.pos)),1):re.create(s.doc,s.mapping.map(o.pos))),e(s.scrollIntoView())}return!0}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r),i=o&&o.nodeAfter;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos)).scrollIntoView()),!0)})),bi={Enter:vi((function(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(r.parent.inlineContent||o.parent.inlineContent)return!1;var i=ci(r.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}),(function(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(qt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Tt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),ui),"Mod-Enter":li,Backspace:gi,"Mod-Backspace":gi,Delete:yi,"Mod-Delete":yi,"Mod-a":function(t,e){return e&&e(t.tr.setSelection(new ie(t.doc))),!0}},ki={"Ctrl-h":bi.Backspace,"Alt-Backspace":bi["Mod-Backspace"],"Ctrl-d":bi.Delete,"Ctrl-Alt-Backspace":bi["Mod-Delete"],"Alt-Delete":bi["Mod-Delete"],"Alt-d":bi["Mod-Delete"]};for(var wi in bi)ki[wi]=bi[wi];var xi=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?ki:bi;function Ci(t){return void 0===t&&(t={}),new ge({view:function(e){return new _i(e,t)}})}var _i=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};_i.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},_i.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},_i.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},_i.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a=this.editorView.dom.offsetParent;this.element||(this.element=a.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);var c=!a||a==document.body&&"static"==getComputedStyle(a).position?{left:-pageXOffset,top:-pageYOffset}:a.getBoundingClientRect();this.element.style.left=t.left-c.left+"px",this.element.style.top=t.top-c.top+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},_i.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},_i.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Lt(this.editorView.state.doc,n,this.editorView.dragging.slice))&&(n=e.pos),this.setCursor(n),this.scheduleRemoval(5e3)}}},_i.prototype.dragend=function(){this.scheduleRemoval(20)},_i.prototype.drop=function(){this.scheduleRemoval(20)},_i.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Si=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return f.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new Ai(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).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}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.maybeChild(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;i=n>0?i.firstChild:i.lastChild;){o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null},e}(Qt);Si.prototype.visible=!1,Qt.jsonID("gapcursor",Si);var Ai=function(t){this.pos=t};Ai.prototype.map=function(t){return new Ai(t.map(this.pos))},Ai.prototype.resolve=function(t){var e=t.resolve(this.pos);return Si.valid(e)?new Si(e):Qt.near(e)};var Mi=Io({ArrowLeft:Di("horiz",-1),ArrowRight:Di("horiz",1),ArrowUp:Di("vert",-1),ArrowDown:Di("vert",1)});function Di(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof ee){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=Si.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new Si(c))),!0)}}function Ei(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!Si.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&re.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new Si(r))),!0)}function Oi(t){if(!(t.selection instanceof Si))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pr.create(t.doc,[Rr.widget(t.selection.head,e,{key:"gapcursor"})])}function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Ni=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){!function(e){var n,r="function",o=function(t,e){return Ti(t)===e},i=function t(e,n){null!==n&&(Array.isArray(n)?n.map((function(n){return t(e,n)})):(s.isNode(n)||(n=document.createTextNode(n)),e.appendChild(n)))};function s(t,e){var n,a,c=arguments,l=1;if(t=s.isElement(t)?t:document.createElement(t),o(e,"object")&&!s.isNode(e)&&!Array.isArray(e))for(n in l++,e)a=e[n],n=s.attrMap[n]||n,o(n,r)?n(t,a):o(a,r)?t[n]=a:t.setAttribute(n,a);for(;l<c.length;l++)i(t,c[l]);return t}s.attrMap={},s.isElement=function(t){return t instanceof Element},s.isNode=function(t){return t instanceof Node},s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}}),n=s,t.exports=n}()})),zi="http://www.w3.org/2000/svg",qi="ProseMirror-icon";function Ii(t){var e=document.createElement("div");if(e.className=qi,t.path){var n="pm-icon-"+function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e}(t.path).toString(16);document.getElementById(n)||function(t,e){var n=document.getElementById(qi+"-collection");n||((n=document.createElementNS(zi,"svg")).id=qi+"-collection",n.style.display="none",document.body.insertBefore(n,document.body.firstChild));var r=document.createElementNS(zi,"symbol");r.id=t,r.setAttribute("viewBox","0 0 "+e.width+" "+e.height),r.appendChild(document.createElementNS(zi,"path")).setAttribute("d",e.path),n.appendChild(r)}(n,t);var r=e.appendChild(document.createElementNS(zi,"svg"));r.style.width=t.width/t.height+"em",r.appendChild(document.createElementNS(zi,"use")).setAttributeNS("http://www.w3.org/1999/xlink","href",/([^#]*)/.exec(document.location)[1]+"#"+n)}else t.dom?e.appendChild(t.dom.cloneNode(!0)):(e.appendChild(document.createElement("span")).textContent=t.text||"",t.css&&(e.firstChild.style.cssText=t.css));return e}var Ri="ProseMirror-menu",Fi=function(t){this.spec=t};function Li(t,e){return t._props.translate?t._props.translate(e):e}Fi.prototype.render=function(t){var e=this.spec,n=e.render?e.render(t):e.icon?Ii(e.icon):e.label?Ni("div",null,Li(t,e.label)):null;if(!n)throw new RangeError("MenuItem without icon or label property");if(e.title){var r="function"==typeof e.title?e.title(t.state):e.title;n.setAttribute("title",Li(t,r))}return e.class&&n.classList.add(e.class),e.css&&(n.style.cssText+=e.css),n.addEventListener("mousedown",(function(r){r.preventDefault(),n.classList.contains(Ri+"-disabled")||e.run(t.state,t.dispatch,t,r)})),{dom:n,update:function(t){if(e.select){var r=e.select(t);if(n.style.display=r?"":"none",!r)return!1}var o=!0;if(e.enable&&(o=e.enable(t)||!1,Xi(n,Ri+"-disabled",!o)),e.active){var i=o&&e.active(t)||!1;Xi(n,Ri+"-active",i)}return!0}}};var Bi={time:0,node:null};function Pi(t){Bi.time=Date.now(),Bi.node=t.target}function Vi(t){return Date.now()-100<Bi.time&&Bi.node&&t.contains(Bi.node)}var $i=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};function ji(t,e){for(var n=[],r=[],o=0;o<t.length;o++){var i=t[o].render(e),s=i.dom,a=i.update;n.push(Ni("div",{class:Ri+"-dropdown-item"},s)),r.push(a)}return{dom:n,update:Ji(r,n)}}function Ji(t,e){return function(n){for(var r=!1,o=0;o<t.length;o++){var i=t[o](n);e[o].style.display=i?"":"none",i&&(r=!0)}return r}}$i.prototype.render=function(t){var e=this,n=ji(this.content,t),r=Ni("div",{class:Ri+"-dropdown "+(this.options.class||""),style:this.options.css},Li(t,this.options.label));this.options.title&&r.setAttribute("title",Li(t,this.options.title));var o=Ni("div",{class:Ri+"-dropdown-wrap"},r),i=null,s=null,a=function(){i&&i.close()&&(i=null,window.removeEventListener("mousedown",s))};return r.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),i?a():(i=e.expand(o,n.dom),window.addEventListener("mousedown",s=function(){Vi(o)||a()}))})),{dom:o,update:function(t){var e=n.update(t);return o.style.display=e?"":"none",e}}},$i.prototype.expand=function(t,e){var n=Ni("div",{class:Ri+"-dropdown-menu "+(this.options.class||"")},e),r=!1;return t.appendChild(n),{close:function(){if(!r)return r=!0,t.removeChild(n),!0},node:n}};var Hi=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};Hi.prototype.render=function(t){var e=ji(this.content,t),n=Ni("div",{class:Ri+"-submenu-label"},Li(t,this.options.label)),r=Ni("div",{class:Ri+"-submenu-wrap"},n,Ni("div",{class:Ri+"-submenu"},e.dom)),o=null;return n.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),Xi(r,Ri+"-submenu-wrap-active"),o||window.addEventListener("mousedown",o=function(){Vi(r)||(r.classList.remove(Ri+"-submenu-wrap-active"),window.removeEventListener("mousedown",o),o=null)})})),{dom:r,update:function(t){var n=e.update(t);return r.style.display=n?"":"none",n}}};var Wi={join:{width:800,height:900,path:"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z"},lift:{width:1024,height:1024,path:"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z"},selectParentNode:{text:"⬚",css:"font-weight: bold"},undo:{width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"},redo:{width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"},strong:{width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},em:{width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},code:{width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"},link:{width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"},bulletList:{width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"},orderedList:{width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"},blockquote:{width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},Ui=new Fi({title:"Join with above block",run:ii,select:function(t){return ii(t)},icon:Wi.join}),Ki=new Fi({title:"Lift out of enclosing block",run:ai,select:function(t){return ai(t)},icon:Wi.lift}),Gi=new Fi({title:"Select parent node",run:pi,select:function(t){return pi(t)},icon:Wi.selectParentNode}),Zi=new Fi({title:"Undo last change",run:Xo,enable:function(t){return Xo(t)},icon:Wi.undo}),Yi=new Fi({title:"Redo last undone change",run:ti,enable:function(t){return ti(t)},icon:Wi.redo});function Qi(t,e){var n=di(t,e.attrs),r={run:n,enable:function(t){return n(t)},active:function(n){var r=n.selection,o=r.$from,i=r.to,s=r.node;return s?s.hasMarkup(t,e.attrs):i<=o.end()&&o.parent.hasMarkup(t,e.attrs)}};for(var o in e)r[o]=e[o];return new Fi(r)}function Xi(t,e,n){n?t.classList.add(e):t.classList.remove(e)}var ts="ProseMirror-menubar";var es=function(t,e){var n=this;this.editorView=t,this.options=e,this.wrapper=Ni("div",{class:ts+"-wrapper"}),this.menu=this.wrapper.appendChild(Ni("div",{class:ts})),this.menu.className=ts,this.spacer=null,t.dom.parentNode.replaceChild(this.wrapper,t.dom),this.wrapper.appendChild(t.dom),this.maxHeight=0,this.widthForMaxHeight=0,this.floating=!1;var r=function(t,e){for(var n=document.createDocumentFragment(),r=[],o=[],i=0;i<e.length;i++){for(var s=e[i],a=[],c=[],l=0;l<s.length;l++){var u=s[l].render(t),p=u.dom,h=u.update,f=Ni("span",{class:Ri+"item"},p);n.appendChild(f),c.push(f),a.push(h)}a.length&&(r.push(Ji(a,c)),i<e.length-1&&o.push(n.appendChild(Ni("span",{class:Ri+"separator"}))))}return{dom:n,update:function(t){for(var e=!1,n=!1,i=0;i<r.length;i++){var s=r[i](t);i&&(o[i-1].style.display=n&&s?"":"none"),n=s,s&&(e=!0)}return e}}}(this.editorView,this.options.content),o=r.dom,i=r.update;if(this.contentUpdate=i,this.menu.appendChild(o),this.update(),e.floating&&!function(){if("undefined"==typeof navigator)return!1;var t=navigator.userAgent;return!/Edge\/\d/.test(t)&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t)}()){this.updateFloat();var s=function(t){for(var e=[window],n=t.parentNode;n;n=n.parentNode)e.push(n);return e}(this.wrapper);this.scrollFunc=function(t){var e=n.editorView.root;(e.body||e).contains(n.wrapper)?n.updateFloat(t.target.getBoundingClientRect&&t.target):s.forEach((function(t){return t.removeEventListener("scroll",n.scrollFunc)}))},s.forEach((function(t){return t.addEventListener("scroll",n.scrollFunc)}))}};es.prototype.update=function(){this.contentUpdate(this.editorView.state),this.floating?this.updateScrollCursor():(this.menu.offsetWidth!=this.widthForMaxHeight&&(this.widthForMaxHeight=this.menu.offsetWidth,this.maxHeight=0),this.menu.offsetHeight>this.maxHeight&&(this.maxHeight=this.menu.offsetHeight,this.menu.style.minHeight=this.maxHeight+"px"))},es.prototype.updateScrollCursor=function(){var t=this.editorView.root.getSelection();if(t.focusNode){var e=t.getRangeAt(0).getClientRects(),n=e[function(t){if(t.anchorNode==t.focusNode)return t.anchorOffset>t.focusOffset;return t.anchorNode.compareDocumentPosition(t.focusNode)==Node.DOCUMENT_POSITION_FOLLOWING}(t)?0:e.length-1];if(n){var r=this.menu.getBoundingClientRect();if(n.top<r.bottom&&n.bottom>r.top){var o=function(t){for(var e=t.parentNode;e;e=e.parentNode)if(e.scrollHeight>e.clientHeight)return e}(this.wrapper);o&&(o.scrollTop-=r.bottom-n.top)}}}},es.prototype.updateFloat=function(t){var e=this.wrapper,n=e.getBoundingClientRect(),r=t?Math.max(0,t.getBoundingClientRect().top):0;if(this.floating)if(n.top>=r||n.bottom<this.menu.offsetHeight+10)this.floating=!1,this.menu.style.position=this.menu.style.left=this.menu.style.top=this.menu.style.width="",this.menu.style.display="",this.spacer.parentNode.removeChild(this.spacer),this.spacer=null;else{var o=(e.offsetWidth-e.clientWidth)/2;this.menu.style.left=n.left+o+"px",this.menu.style.display=n.top>window.innerHeight?"none":"",t&&(this.menu.style.top=r+"px")}else if(n.top<r&&n.bottom>=this.menu.offsetHeight+10){this.floating=!0;var i=this.menu.getBoundingClientRect();this.menu.style.left=i.left+"px",this.menu.style.width=i.width+"px",t&&(this.menu.style.top=r+"px"),this.menu.style.position="fixed",this.spacer=Ni("div",{class:ts+"-spacer",style:"height: "+i.height+"px"}),e.insertBefore(this.spacer,this.menu)}},es.prototype.destroy=function(){this.wrapper.parentNode&&this.wrapper.parentNode.replaceChild(this.editorView.dom,this.wrapper)};function ns(t,e){return function(n,r){var o=n.selection,i=o.$from,a=o.$to,c=i.blockRange(a),l=!1,u=c;if(!c)return!1;if(c.depth>=2&&i.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==i.index(c.depth-1))return!1;var p=n.doc.resolve(c.start-2);u=new M(p,p,c.depth),c.endIndex<c.parent.childCount&&(c=new M(i,n.doc.resolve(a.end(c.depth)),c.depth)),l=!0}var h=Nt(u,t,e,c);return!!h&&(r&&r(function(t,e,n,r,o){for(var i=s.empty,a=n.length-1;a>=0;a--)i=s.from(n[a].type.create(n[a].attrs,i));t.step(new Dt(e.start-(r?2:0),e.end,e.start,e.end,new f(i,0,0),n.length,!0));for(var c=0,l=0;l<n.length;l++)n[l].type==o&&(c=l+1);for(var u=n.length-c,p=e.start+n.length-(r?2:0),h=e.parent,d=e.startIndex,m=e.endIndex,v=!0;d<m;d++,v=!1)!v&&qt(t.doc,p,u)&&(t.split(p,u),p+=2*u),p+=h.child(d).nodeSize;return t}(n.tr,c,h,l,t).scrollIntoView()),!0)}}function rs(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));return!!a&&(!n||(o.node(a.depth-1).type==t?function(t,e,n,r){var o=t.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new Dt(i-1,a,i,a,new f(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new M(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));return e(o.lift(r,Tt(r)).scrollIntoView()),!0}(e,n,t,a):function(t,e,n){for(var r=t.tr,o=n.parent,i=n.end,a=n.endIndex-1,c=n.startIndex;a>c;a--)i-=o.child(a).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(n.start),u=l.nodeAfter,p=0==n.startIndex,h=n.endIndex==o.childCount,d=l.node(-1),m=l.index(-1);if(!d.canReplace(m+(p?0:1),m+1,u.content.append(h?s.empty:s.from(o))))return!1;var v=l.pos,g=v+u.nodeSize;return r.step(new Dt(v-(p?1:0),g+(h?1:0),v+1,g-1,new f((p?s.empty:s.from(o.copy(s.empty))).append(h?s.empty:s.from(o.copy(s.empty))),p?0:1,h?0:1),p?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}var is=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function ss(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}function as(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));var l=s.doc.resolve(i.from).marks();e(s.replaceWith(i.from,i.to,t.schema.text(i.text,l)))}return!0}}return!1}var cs=new is(/--$/,"—"),ls=new is(/\.\.\.$/,"…"),us=[new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new is(/"$/,"”"),new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new is(/'$/,"’")];function ps(t,e,n,r){return new is(t,(function(t,o,i,s){var a=n instanceof Function?n(o):n,c=t.tr.delete(i,s),l=c.doc.resolve(i).blockRange(),u=l&&Nt(l,e,a);if(!u)return null;c.wrap(l,u);var p=c.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&It(c.doc,i-1)&&(!r||r(o,p))&&c.join(i-1),c}))}function hs(t,e,n){return new is(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}function fs(t){var e=document.body.appendChild(document.createElement("div"));e.className="ProseMirror-prompt";var n=function(t){e.contains(t.target)||r()};setTimeout((function(){return window.addEventListener("mousedown",n)}),50);var r=function(){window.removeEventListener("mousedown",n),e.parentNode&&e.parentNode.removeChild(e)},o=[];for(var i in t.fields)o.push(t.fields[i].render());var s=document.createElement("button");s.type="submit",s.className="ProseMirror-prompt-submit",s.textContent="OK";var a=document.createElement("button");a.type="button",a.className="ProseMirror-prompt-cancel",a.textContent="Cancel",a.addEventListener("click",r);var c=e.appendChild(document.createElement("form"));t.title&&(c.appendChild(document.createElement("h5")).textContent=t.title),o.forEach((function(t){c.appendChild(document.createElement("div")).appendChild(t)}));var l=c.appendChild(document.createElement("div"));l.className="ProseMirror-prompt-buttons",l.appendChild(s),l.appendChild(document.createTextNode(" ")),l.appendChild(a);var u=e.getBoundingClientRect();e.style.top=(window.innerHeight-u.height)/2+"px",e.style.left=(window.innerWidth-u.width)/2+"px";var p=function(){var e=function(t,e){var n=Object.create(null),r=0;for(var o in t){var i=t[o],s=e[r++],a=i.read(s),c=i.validate(a);if(c)return ds(s,c),null;n[o]=i.clean(a)}return n}(t.fields,o);e&&(r(),t.callback(e))};c.addEventListener("submit",(function(t){t.preventDefault(),p()})),c.addEventListener("keydown",(function(t){27==t.keyCode?(t.preventDefault(),r()):13!=t.keyCode||t.ctrlKey||t.metaKey||t.shiftKey?9==t.keyCode&&window.setTimeout((function(){e.contains(document.activeElement)||r()}),500):(t.preventDefault(),p())}));var h=c.elements[0];h&&h.focus()}function ds(t,e){var n=t.parentNode,r=n.appendChild(document.createElement("div"));r.style.left=t.offsetLeft+t.offsetWidth+2+"px",r.style.top=t.offsetTop-5+"px",r.className="ProseMirror-invalid",r.textContent=e,setTimeout((function(){return n.removeChild(r)}),1500)}var ms=function(t){this.options=t};ms.prototype.read=function(t){return t.value},ms.prototype.validateType=function(t){},ms.prototype.validate=function(t){return!t&&this.options.required?"Required field":this.validateType(t)||this.options.validate&&this.options.validate(t)},ms.prototype.clean=function(t){return this.options.clean?this.options.clean(t):t};var vs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=document.createElement("input");return t.type="text",t.placeholder=this.options.label,t.value=this.options.value||"",t.autocomplete="off",t},e}(ms);function gs(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1}function ys(t,e){var n={label:e.title,run:t};for(var r in e)n[r]=e[r];return e.enable&&!0!==e.enable||e.select||(n[e.enable?"enable":"select"]=function(e){return t(e)}),new Fi(n)}function bs(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to;return n.empty?e.isInSet(t.storedMarks||o.marks()):t.doc.rangeHasMark(r,i,e)}function ks(t,e){var n={active:function(e){return bs(e,t)},enable:!0};for(var r in e)n[r]=e[r];return ys(mi(t),n)}function ws(t,e){return ys(ns(t,e.attrs),e)}function xs(t){var e,n,r,o={};if((e=t.marks.strong)&&(o.toggleStrong=ks(e,{title:"Toggle strong style",icon:Wi.strong})),(e=t.marks.em)&&(o.toggleEm=ks(e,{title:"Toggle emphasis",icon:Wi.em})),(e=t.marks.code)&&(o.toggleCode=ks(e,{title:"Toggle code font",icon:Wi.code})),(e=t.marks.link)&&(o.toggleLink=(n=e,new Fi({title:"Add or remove link",icon:Wi.link,active:function(t){return bs(t,n)},enable:function(t){return!t.selection.empty},run:function(t,e,r){if(bs(t,n))return mi(n)(t,e),!0;fs({title:"Create a link",fields:{href:new vs({label:"Link target",required:!0}),title:new vs({label:"Title"})},callback:function(t){mi(n,t)(r.state,r.dispatch),r.focus()}})}}))),(e=t.nodes.image)&&(o.insertImage=(r=e,new Fi({title:"Insert image",label:"Image",enable:function(t){return gs(t,r)},run:function(t,e,n){var o=t.selection,i=o.from,s=o.to,a=null;t.selection instanceof re&&t.selection.node.type==r&&(a=t.selection.node.attrs),fs({title:"Insert image",fields:{src:new vs({label:"Location",required:!0,value:a&&a.src}),title:new vs({label:"Title",value:a&&a.title}),alt:new vs({label:"Description",value:a?a.alt:t.doc.textBetween(i,s," ")})},callback:function(t){n.dispatch(n.state.tr.replaceSelectionWith(r.createAndFill(t))),n.focus()}})}}))),(e=t.nodes.bullet_list)&&(o.wrapBulletList=ws(e,{title:"Wrap in bullet list",icon:Wi.bulletList})),(e=t.nodes.ordered_list)&&(o.wrapOrderedList=ws(e,{title:"Wrap in ordered list",icon:Wi.orderedList})),(e=t.nodes.blockquote)&&(o.wrapBlockQuote=function(t,e){var n={run:function(n,r){return fi(t,e.attrs)(n,r)},select:function(n){return fi(t,e.attrs instanceof Function?null:e.attrs)(n)}};for(var r in e)n[r]=e[r];return new Fi(n)}(e,{title:"Wrap in block quote",icon:Wi.blockquote})),(e=t.nodes.paragraph)&&(o.makeParagraph=Qi(e,{title:"Change to paragraph",label:"Plain"})),(e=t.nodes.code_block)&&(o.makeCodeBlock=Qi(e,{title:"Change to code block",label:"Code"})),e=t.nodes.heading)for(var i=1;i<=10;i++)o["makeHead"+i]=Qi(e,{title:"Change to heading "+i,label:"Level "+i,attrs:{level:i}});if(e=t.nodes.horizontal_rule){var s=e;o.insertHorizontalRule=new Fi({title:"Insert horizontal rule",label:"Horizontal rule",enable:function(t){return gs(t,s)},run:function(t,e){e(t.tr.replaceSelectionWith(s.create()))}})}var a=function(t){return t.filter((function(t){return t}))};return o.insertMenu=new $i(a([o.insertImage,o.insertHorizontalRule]),{label:"Insert"}),o.typeMenu=new $i(a([o.makeParagraph,o.makeCodeBlock,o.makeHead1&&new Hi(a([o.makeHead1,o.makeHead2,o.makeHead3,o.makeHead4,o.makeHead5,o.makeHead6]),{label:"Heading"})]),{label:"Type..."}),o.inlineMenu=[a([o.toggleStrong,o.toggleEm,o.toggleCode,o.toggleLink])],o.blockMenu=[a([o.wrapBulletList,o.wrapOrderedList,o.wrapBlockQuote,Ui,Ki,Gi])],o.fullMenu=o.inlineMenu.concat([[o.insertMenu,o.typeMenu]],[[Zi,Yi]],o.blockMenu),o}var Cs="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _s(t,e){var n,r,o={};function i(t,n){if(e){var r=e[t];if(!1===r)return;r&&(t=r)}o[t]=n}if(i("Mod-z",Xo),i("Shift-Mod-z",ti),i("Backspace",as),Cs||i("Mod-y",ti),i("Alt-ArrowUp",ii),i("Alt-ArrowDown",si),i("Mod-BracketLeft",ai),i("Escape",pi),(n=t.marks.strong)&&(i("Mod-b",mi(n)),i("Mod-B",mi(n))),(n=t.marks.em)&&(i("Mod-i",mi(n)),i("Mod-I",mi(n))),(n=t.marks.code)&&i("Mod-`",mi(n)),(n=t.nodes.bullet_list)&&i("Shift-Ctrl-8",ns(n)),(n=t.nodes.ordered_list)&&i("Shift-Ctrl-9",ns(n)),(n=t.nodes.blockquote)&&i("Ctrl->",fi(n)),n=t.nodes.hard_break){var a=n,c=vi(li,(function(t,e){return e(t.tr.replaceSelectionWith(a.create()).scrollIntoView()),!0}));i("Mod-Enter",c),i("Shift-Enter",c),Cs&&i("Ctrl-Enter",c)}if((n=t.nodes.list_item)&&(i("Enter",(r=n,function(t,e){var n=t.selection,o=n.$from,i=n.$to,a=n.node;if(a&&a.isBlock||o.depth<2||!o.sameParent(i))return!1;var c=o.node(-1);if(c.type!=r)return!1;if(0==o.parent.content.size){if(2==o.depth||o.node(-3).type!=r||o.index(-2)!=o.node(-2).childCount-1)return!1;if(e){for(var l=s.empty,u=o.index(-1)>0,p=o.depth-(u?1:2);p>=o.depth-3;p--)l=s.from(o.node(p).copy(l));l=l.append(s.from(r.createAndFill()));var h=t.tr.replace(o.before(u?null:-1),o.after(-3),new f(l,u?3:2,2));h.setSelection(t.selection.constructor.near(h.doc.resolve(o.pos+(u?3:2)))),e(h.scrollIntoView())}return!0}var d=i.pos==o.end()?c.contentMatchAt(0).defaultType:null,m=t.tr.delete(o.pos,i.pos),v=d&&[null,{type:d}];return!!qt(m.doc,o.pos,2,v)&&(e&&e(m.split(o.pos,2,v).scrollIntoView()),!0)})),i("Mod-[",rs(n)),i("Mod-]",function(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var l=a.parent,u=l.child(c-1);if(u.type!=t)return!1;if(n){var p=u.lastChild&&u.lastChild.type==l.type,h=s.from(p?t.create():null),d=new f(s.from(t.create(null,s.from(l.type.create(null,h)))),p?3:1,0),m=a.start,v=a.end;n(e.tr.step(new Dt(m-(p?3:1),v,m,v,d,1,!0)).scrollIntoView())}return!0}}(n))),(n=t.nodes.paragraph)&&i("Shift-Ctrl-0",di(n)),(n=t.nodes.code_block)&&i("Shift-Ctrl-\\",di(n)),n=t.nodes.heading)for(var l=1;l<=6;l++)i("Shift-Ctrl-"+l,di(n,{level:l}));if(n=t.nodes.horizontal_rule){var u=n;i("Mod-_",(function(t,e){return e(t.tr.replaceSelectionWith(u.create()).scrollIntoView()),!0}))}return o}function Ss(t){var e,n=us.concat(ls,cs);return(e=t.nodes.blockquote)&&n.push(ps(/^\s*>\s$/,e)),(e=t.nodes.ordered_list)&&n.push(function(t){return ps(/^(\d+)\.\s$/,t,(function(t){return{order:+t[1]}}),(function(t,e){return e.childCount+e.attrs.order==+t[1]}))}(e)),(e=t.nodes.bullet_list)&&n.push(function(t){return ps(/^\s*([-+*])\s$/,t)}(e)),(e=t.nodes.code_block)&&n.push(function(t){return hs(/^```$/,t)}(e)),(e=t.nodes.heading)&&n.push(function(t,e){return hs(new RegExp("^(#{1,"+e+"})\\s$"),t,(function(t){return{level:t[1].length}}))}(e,6)),function(t){var e=t.rules,n=new ge({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return ss(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&ss(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:n})}function As(t){var e=[Ss(t.schema),qo(_s(t.schema,t.mapKeys)),qo(xi),Ci(),new ge({props:{decorations:Oi,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Si.valid(n))return new Si(n)},handleClick:Ei,handleKeyDown:Mi}})];return!1!==t.menuBar&&e.push(function(t){return new ge({view:function(e){return new es(e,t)}})}({floating:!1!==t.floatingMenu,content:t.menuContent||xs(t.schema).fullMenu})),!1!==t.history&&e.push(Qo()),e.concat(new ge({props:{attributes:{class:"ProseMirror-example-setup-style"}}}))}function Ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}new(function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=new Yr(e,{state:de.create({doc:ho.parse(n),plugins:As({schema:io})}),dispatchTransaction:function(t){document.querySelector("#content").value=mo.serialize(t.doc);var e=this.state.apply(t);this.updateState(e)}})}var e,n,r;return e=t,(n=[{key:"focus",value:function(){this.view.focus()}},{key:"destroy",value:function(){this.view.destroy()}},{key:"content",get:function(){return mo.serialize(this.view.state.doc)}}])&&Ms(e.prototype,n),r&&Ms(e,r),t}())(document.querySelector("#editor"),document.querySelector("#content").value)}]);
\ No newline at end of file
diff --git a/prose/prose.js b/prose/prose.js
index 45cce5b..3bd5b10 100644
--- a/prose/prose.js
+++ b/prose/prose.js
@@ -1,52 +1,51 @@
// class MarkdownView {
// constructor(target, content) {
// this.textarea = target.appendChild(document.createElement("textarea"))
// this.textarea.value = content
// }
// get content() { return this.textarea.value }
// focus() { this.textarea.focus() }
// destroy() { this.textarea.remove() }
// }
import {EditorView} from "prosemirror-view"
-import {EditorState, Plugin} from "prosemirror-state"
-import {schema, defaultMarkdownParser,
- defaultMarkdownSerializer} from "prosemirror-markdown"
+import {EditorState} from "prosemirror-state"
+import {schema, defaultMarkdownParser, defaultMarkdownSerializer} from "prosemirror-markdown"
import {exampleSetup} from "prosemirror-example-setup"
class ProseMirrorView {
constructor(target, content) {
this.view = new EditorView(target, {
state: EditorState.create({
doc: defaultMarkdownParser.parse(content),
plugins: exampleSetup({schema})
}), dispatchTransaction(transaction) {
- document.querySelector('#content').innerText = defaultMarkdownSerializer.serialize(transaction.doc)
+ document.querySelector('#content').value = defaultMarkdownSerializer.serialize(transaction.doc)
let newState = this.state.apply(transaction)
this.updateState(newState)
}
})
}
get content() {
return defaultMarkdownSerializer.serialize(this.view.state.doc)
}
focus() { this.view.focus() }
destroy() { this.view.destroy() }
}
let place = document.querySelector("#editor")
let view = new ProseMirrorView(place, document.querySelector('#content').value)
// document.querySelectorAll("input[type=radio]").forEach(button => {
// button.addEventListener("change", () => {
// if (!button.checked) return
// let View = button.value == "markdown" ? MarkdownView : ProseMirrorView
// if (view instanceof View) return
// let content = view.content
// view.destroy()
// view = new View(place, content)
// view.focus()
// })
// })
diff --git a/static/js/h.js b/static/js/h.js
index ca18fba..5dac2f5 100644
--- a/static/js/h.js
+++ b/static/js/h.js
@@ -1,271 +1,260 @@
/**
* H.js
*
* Lightweight, extremely bare-bones library for manipulating the DOM and
* saving some typing.
*/
var Element = function(domElement) {
this.el = domElement;
};
/**
* Creates a toggle button that adds / removes the given class name from the
* given element.
*
* @param {Element} $el - The element to modify.
* @param {string} onClass - The class to add to the given element.
* @param {function} onFunc - Additional actions when toggling on.
* @param {function} offFunc - Additional actions when toggling off.
*/
Element.prototype.createToggle = function($el, onClass, onFunc, offFunc) {
this.on('click', function(e) {
if ($el.el.className === '') {
$el.el.className = onClass;
onFunc(new Element(this), e);
} else {
$el.el.className = '';
offFunc(new Element(this), e);
}
e.preventDefault();
}, false);
};
Element.prototype.on = function(event, func) {
events = event.split(' ');
var el = this.el;
if (el == null) {
console.error("Error: element for event is null");
return;
}
var addEvent = function(e) {
if (el.addEventListener) {
el.addEventListener(e, func, false);
} else if (el.attachEvent) {
el.attachEvent(e, func);
}
};
if (events.length === 1) {
addEvent(event);
} else {
for(var i=0; i<events.length; i++) {
addEvent(events[i]);
}
}
};
Element.prototype.setClass = function(className) {
if (this.el == null) {
console.error("Error: element to set class on is null");
return;
}
this.el.className = className;
};
Element.prototype.removeClass = function(className) {
if (this.el == null) {
console.error("Error: element to remove class on is null");
return;
}
var regex = new RegExp(' ?' + className, 'g');
this.el.className = this.el.className.replace(regex, '');
};
Element.prototype.text = function(text, className) {
if (this.el == null) {
console.error("Error: element for setting text is null");
return;
}
if (this.el.textContent !== text) {
this.el.textContent = text;
if (typeof className !== 'undefined') {
this.el.className = this.el.className + ' ' + className;
}
}
};
Element.prototype.insertAfter = function(newNode) {
if (this.el == null) {
console.error("Error: element for insertAfter is null");
return;
}
this.el.parentNode.insertBefore(newNode, this.el.nextSibling);
};
Element.prototype.remove = function() {
if (this.el == null) {
console.error("Didn't remove element");
return;
}
this.el.parentNode.removeChild(this.el);
};
Element.prototype.hide = function() {
if (this.el == null) {
console.error("Didn't hide element");
return;
}
this.el.className += ' effect fade-out';
};
Element.prototype.show = function() {
if (this.el == null) {
console.error("Didn't show element");
return;
}
this.el.className += ' effect';
};
var H = {
getQEl: function(elementQuery) {
return new Element(document.querySelector(elementQuery));
},
getEl: function(elementId) {
return new Element(document.getElementById(elementId));
},
save: function($el, key) {
localStorage.setItem(key, $el.el.value);
},
load: function($el, key, onlyLoadPopulated) {
var val = localStorage.getItem(key);
if (onlyLoadPopulated && val == null) {
// Do nothing
return;
}
$el.el.value = val;
},
- saveText: function($el, key) {
- localStorage.setItem(key, $el.el.innerText);
- },
- loadText: function($el, key, onlyLoadPopulated) {
- var val = localStorage.getItem(key);
- if (onlyLoadPopulated && val == null) {
- // Do nothing
- return;
- }
- $el.el.innerText = val;
- },
set: function(key, value) {
localStorage.setItem(key, value);
},
get: function(key, defaultValue) {
var val = localStorage.getItem(key);
if (val == null) {
val = defaultValue;
}
return val;
},
remove: function(key) {
localStorage.removeItem(key);
},
exists: function(key) {
return localStorage.getItem(key) !== null;
},
createPost: function(id, editToken, content, created) {
var summaryLen = 200;
var titleLen = 80;
var getPostMeta = function(content) {
var eol = content.indexOf("\n");
if (content.indexOf("# ") === 0) {
// Title is in the format:
//
// # Some title
var summary = content.substring(eol).trim();
if (summary.length > summaryLen) {
summary = summary.substring(0, summaryLen) + "...";
}
return {
title: content.substring("# ".length, eol),
summary: summary,
};
}
var blankLine = content.indexOf("\n\n");
if (blankLine !== -1 && blankLine <= eol && blankLine <= titleLen) {
// Title is in the format:
//
// Some title
//
// The body starts after that blank line above it.
var summary = content.substring(blankLine).trim();
if (summary.length > summaryLen) {
summary = summary.substring(0, summaryLen) + "...";
}
return {
title: content.substring(0, blankLine),
summary: summary,
};
}
// TODO: move this to the beginning
var title = content.trim();
var summary = "";
if (title.length > titleLen) {
// Content can't fit in the title, so figure out the summary
summary = title;
title = "";
if (summary.length > summaryLen) {
summary = summary.substring(0, summaryLen) + "...";
}
} else if (eol > 0) {
summary = title.substring(eol+1);
title = title.substring(0, eol);
}
return {
title: title,
summary: summary
};
};
var post = getPostMeta(content);
post.id = id;
post.token = editToken;
post.created = created ? new Date(created) : new Date();
post.client = "Pad";
return post;
},
getTitleStrict: function(content) {
var eol = content.indexOf("\n");
var title = "";
var newContent = content;
if (content.indexOf("# ") === 0) {
// Title is in the format:
// # Some title
if (eol !== -1) {
// First line should start with # and end with \n
newContent = content.substring(eol).leftTrim();
title = content.substring("# ".length, eol);
}
}
return {
title: title,
content: newContent
};
},
};
var He = {
create: function(name) {
return document.createElement(name);
},
get: function(id) {
return document.getElementById(id);
},
$: function(selector) {
var els = document.querySelectorAll(selector);
return els;
},
postJSON: function(url, params, callback) {
var http = new XMLHttpRequest();
http.open("POST", url, true);
// Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/json");
http.onreadystatechange = function() {
if (http.readyState == 4) {
callback(http.status, JSON.parse(http.responseText));
}
}
http.send(JSON.stringify(params));
},
};
String.prototype.leftTrim = function() {
return this.replace(/^\s+/,"");
};
diff --git a/static/js/prose.bundle.js b/static/js/prose.bundle.js
index 448defa..c6fe84f 100644
--- a/static/js/prose.bundle.js
+++ b/static/js/prose.bundle.js
@@ -1,2 +1,2 @@
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=70)}([function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=Object.prototype.hasOwnProperty;function i(t,e){return o.call(t,e)}function s(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(65535!=(65535&t)&&65534!=(65535&t)&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function a(t){if(t>65535){var e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}var c=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,l=new RegExp(c.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),u=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,p=n(4);var h=/[&<>"]/,f=/[&<>"]/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function m(t){return d[t]}var v=/[.?*+^$[\]\\(){}|-]/g;var g=n(1);e.lib={},e.lib.mdurl=n(5),e.lib.ucmicro=n(20),e.assign=function(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach((function(e){if(e){if("object"!==r(e))throw new TypeError(e+"must be object");Object.keys(e).forEach((function(n){t[n]=e[n]}))}})),t},e.isString=function(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)},e.has=i,e.unescapeMd=function(t){return t.indexOf("\\")<0?t:t.replace(c,"$1")},e.unescapeAll=function(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(l,(function(t,e,n){return e||function(t,e){var n=0;return i(p,e)?p[e]:35===e.charCodeAt(0)&&u.test(e)&&s(n="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10))?a(n):t}(t,n)}))},e.isValidEntityCode=s,e.fromCodePoint=a,e.escapeHtml=function(t){return h.test(t)?t.replace(f,m):t},e.arrayReplaceAt=function(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))},e.isSpace=function(t){switch(t){case 9:case 32:return!0}return!1},e.isWhiteSpace=function(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1},e.isMdAsciiPunct=function(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}},e.isPunctChar=function(t){return g.test(t)},e.escapeRE=function(t){return t.replace(v,"\\$&")},e.normalizeReference=function(t){return t=t.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}},function(t,e){t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(t,e,n){"use strict";function r(){this.__rules__=[],this.__cache__=null}r.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},r.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach((function(t){t.enabled&&t.alt.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))})),t.__cache__={},e.forEach((function(e){t.__cache__[e]=[],t.__rules__.forEach((function(n){n.enabled&&(e&&n.alt.indexOf(e)<0||t.__cache__[e].push(n.fn))}))}))},r.prototype.at=function(t,e,n){var r=this.__find__(t),o=n||{};if(-1===r)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=o.alt||[],this.__cache__=null},r.prototype.before=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},r.prototype.after=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o+1,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},r.prototype.push=function(t,e,n){var r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},r.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach((function(t){var r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!0,n.push(t)}),this),this.__cache__=null,n},r.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach((function(t){t.enabled=!1})),this.enable(t,e)},r.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach((function(t){var r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!1,n.push(t)}),this),this.__cache__=null,n},r.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},t.exports=r},function(t,e,n){"use strict";function r(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}r.prototype.attrIndex=function(t){var e,n,r;if(!this.attrs)return-1;for(n=0,r=(e=this.attrs).length;n<r;n++)if(e[n][0]===t)return n;return-1},r.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},r.prototype.attrSet=function(t,e){var n=this.attrIndex(t),r=[t,e];n<0?this.attrPush(r):this.attrs[n]=r},r.prototype.attrGet=function(t){var e=this.attrIndex(t),n=null;return e>=0&&(n=this.attrs[e][1]),n},r.prototype.attrJoin=function(t,e){var n=this.attrIndex(t);n<0?this.attrPush([t,e]):this.attrs[n][1]=this.attrs[n][1]+" "+e},t.exports=r},function(t,e,n){"use strict";t.exports=n(15)},function(t,e,n){"use strict";t.exports.encode=n(16),t.exports.decode=n(17),t.exports.format=n(18),t.exports.parse=n(19)},function(t,e){t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(t,e){t.exports=/[\0-\x1F\x7F-\x9F]/},function(t,e){t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},function(t,e,n){"use strict";var r="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",o="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",i=new RegExp("^(?:"+r+"|"+o+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?].*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),s=new RegExp("^(?:"+r+"|"+o+")");t.exports.HTML_TAG_RE=i,t.exports.HTML_OPEN_CLOSE_TAG_RE=s},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a=[],c=e.length;for(n=0;n<c;n++)126===(o=e[n]).marker&&-1!==o.end&&(i=e[o.end],(s=t.tokens[o.token]).type="s_open",s.tag="s",s.nesting=1,s.markup="~~",s.content="",(s=t.tokens[i.token]).type="s_close",s.tag="s",s.nesting=-1,s.markup="~~",s.content="","text"===t.tokens[i.token-1].type&&"~"===t.tokens[i.token-1].content&&a.push(i.token-1));for(;a.length;){for(r=(n=a.pop())+1;r<t.tokens.length&&"s_close"===t.tokens[r].type;)r++;n!==--r&&(s=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=s)}}t.exports.tokenize=function(t,e){var n,r,o,i,s=t.pos,a=t.src.charCodeAt(s);if(e)return!1;if(126!==a)return!1;if(o=(r=t.scanDelims(t.pos,!0)).length,i=String.fromCharCode(a),o<2)return!1;for(o%2&&(t.push("text","",0).content=i,o--),n=0;n<o;n+=2)t.push("text","",0).content=i+i,t.delimiters.push({marker:a,length:0,jump:n,token:t.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return t.pos+=r.length,!0},t.exports.postProcess=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(t,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(t,n[e].delimiters)}},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a;for(n=e.length-1;n>=0;n--)95!==(r=e[n]).marker&&42!==r.marker||-1!==r.end&&(o=e[r.end],a=n>0&&e[n-1].end===r.end+1&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1&&e[n-1].marker===r.marker,s=String.fromCharCode(r.marker),(i=t.tokens[r.token]).type=a?"strong_open":"em_open",i.tag=a?"strong":"em",i.nesting=1,i.markup=a?s+s:s,i.content="",(i=t.tokens[o.token]).type=a?"strong_close":"em_close",i.tag=a?"strong":"em",i.nesting=-1,i.markup=a?s+s:s,i.content="",a&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}t.exports.tokenize=function(t,e){var n,r,o=t.pos,i=t.src.charCodeAt(o);if(e)return!1;if(95!==i&&42!==i)return!1;for(r=t.scanDelims(t.pos,42===i),n=0;n<r.length;n++)t.push("text","",0).content=String.fromCharCode(i),t.delimiters.push({marker:i,length:r.length,jump:n,token:t.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return t.pos+=r.length,!0},t.exports.postProcess=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(t,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(t,n[e].delimiters)}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";t.exports=n(14)},function(t,e,n){"use strict";var r=n(0),o=n(22),i=n(26),s=n(27),a=n(35),c=n(49),l=n(62),u=n(5),p=n(64),h={default:n(67),zero:n(68),commonmark:n(69)},f=/^(vbscript|javascript|file|data):/,d=/^data:image\/(gif|png|jpeg|webp);/;function m(t){var e=t.trim().toLowerCase();return!f.test(e)||!!d.test(e)}var v=["http:","https:","mailto:"];function g(t){var e=u.parse(t,!0);if(e.hostname&&(!e.protocol||v.indexOf(e.protocol)>=0))try{e.hostname=p.toASCII(e.hostname)}catch(t){}return u.encode(u.format(e))}function y(t){var e=u.parse(t,!0);if(e.hostname&&(!e.protocol||v.indexOf(e.protocol)>=0))try{e.hostname=p.toUnicode(e.hostname)}catch(t){}return u.decode(u.format(e))}function b(t,e){if(!(this instanceof b))return new b(t,e);e||r.isString(t)||(e=t||{},t="default"),this.inline=new c,this.block=new a,this.core=new s,this.renderer=new i,this.linkify=new l,this.validateLink=m,this.normalizeLink=g,this.normalizeLinkText=y,this.utils=r,this.helpers=r.assign({},o),this.options={},this.configure(t),e&&this.set(e)}b.prototype.set=function(t){return r.assign(this.options,t),this},b.prototype.configure=function(t){var e,n=this;if(r.isString(t)&&!(t=h[e=t]))throw new Error('Wrong `markdown-it` preset "'+e+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&n.set(t.options),t.components&&Object.keys(t.components).forEach((function(e){t.components[e].rules&&n[e].ruler.enableOnly(t.components[e].rules),t.components[e].rules2&&n[e].ruler2.enableOnly(t.components[e].rules2)})),this},b.prototype.enable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.enable(t,!0))}),this),n=n.concat(this.inline.ruler2.enable(t,!0));var r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},b.prototype.disable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.disable(t,!0))}),this),n=n.concat(this.inline.ruler2.disable(t,!0));var r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},b.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},b.prototype.parse=function(t,e){if("string"!=typeof t)throw new Error("Input data should be a String");var n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},b.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},b.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},b.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)},t.exports=b},function(t){t.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}')},function(t,e,n){"use strict";var r={};function o(t,e,n){var i,s,a,c,l,u="";for("string"!=typeof e&&(n=e,e=o.defaultChars),void 0===n&&(n=!0),l=function(t){var e,n,o=r[t];if(o)return o;for(o=r[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?o.push(n):o.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)o[t.charCodeAt(e)]=t[e];return o}(e),i=0,s=t.length;i<s;i++)if(a=t.charCodeAt(i),n&&37===a&&i+2<s&&/^[0-9a-f]{2}$/i.test(t.slice(i+1,i+3)))u+=t.slice(i,i+3),i+=2;else if(a<128)u+=l[a];else if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&i+1<s&&(c=t.charCodeAt(i+1))>=56320&&c<=57343){u+=encodeURIComponent(t[i]+t[i+1]),i++;continue}u+="%EF%BF%BD"}else u+=encodeURIComponent(t[i]);return u}o.defaultChars=";/?:@&=+$,-_.!~*'()#",o.componentChars="-_.!~*'()",t.exports=o},function(t,e,n){"use strict";var r={};function o(t,e){var n;return"string"!=typeof e&&(e=o.defaultChars),n=function(t){var e,n,o=r[t];if(o)return o;for(o=r[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),o.push(n);for(e=0;e<t.length;e++)o[n=t.charCodeAt(e)]="%"+("0"+n.toString(16).toUpperCase()).slice(-2);return o}(e),t.replace(/(%[a-f0-9]{2})+/gi,(function(t){var e,r,o,i,s,a,c,l="";for(e=0,r=t.length;e<r;e+=3)(o=parseInt(t.slice(e+1,e+3),16))<128?l+=n[o]:192==(224&o)&&e+3<r&&128==(192&(i=parseInt(t.slice(e+4,e+6),16)))?(l+=(c=o<<6&1984|63&i)<128?"��":String.fromCharCode(c),e+=3):224==(240&o)&&e+6<r&&(i=parseInt(t.slice(e+4,e+6),16),s=parseInt(t.slice(e+7,e+9),16),128==(192&i)&&128==(192&s))?(l+=(c=o<<12&61440|i<<6&4032|63&s)<2048||c>=55296&&c<=57343?"���":String.fromCharCode(c),e+=6):240==(248&o)&&e+9<r&&(i=parseInt(t.slice(e+4,e+6),16),s=parseInt(t.slice(e+7,e+9),16),a=parseInt(t.slice(e+10,e+12),16),128==(192&i)&&128==(192&s)&&128==(192&a))?((c=o<<18&1835008|i<<12&258048|s<<6&4032|63&a)<65536||c>1114111?l+="����":(c-=65536,l+=String.fromCharCode(55296+(c>>10),56320+(1023&c))),e+=9):l+="�";return l}))}o.defaultChars=";/?:@&=+$,#",o.componentChars="",t.exports=o},function(t,e,n){"use strict";t.exports=function(t){var e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&-1!==t.hostname.indexOf(":")?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||""}},function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var o=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(a),l=["%","/","?",";","#"].concat(c),u=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},d={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};r.prototype.parse=function(t,e){var n,r,i,a,c,m=t;if(m=m.trim(),!e&&1===t.split("#").length){var v=s.exec(m);if(v)return this.pathname=v[1],v[2]&&(this.search=v[2]),this}var g=o.exec(m);if(g&&(i=(g=g[0]).toLowerCase(),this.protocol=g,m=m.substr(g.length)),(e||g||m.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(c="//"===m.substr(0,2))||g&&f[g]||(m=m.substr(2),this.slashes=!0)),!f[g]&&(c||g&&!d[g])){var y,b,k=-1;for(n=0;n<u.length;n++)-1!==(a=m.indexOf(u[n]))&&(-1===k||a<k)&&(k=a);for(-1!==(b=-1===k?m.lastIndexOf("@"):m.lastIndexOf("@",k))&&(y=m.slice(0,b),m=m.slice(b+1),this.auth=y),k=-1,n=0;n<l.length;n++)-1!==(a=m.indexOf(l[n]))&&(-1===k||a<k)&&(k=a);-1===k&&(k=m.length),":"===m[k-1]&&k--;var w=m.slice(0,k);m=m.slice(k),this.parseHost(w),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x){var C=this.hostname.split(/\./);for(n=0,r=C.length;n<r;n++){var _=C[n];if(_&&!_.match(p)){for(var S="",A=0,M=_.length;A<M;A++)_.charCodeAt(A)>127?S+="x":S+=_[A];if(!S.match(p)){var D=C.slice(0,n),E=C.slice(n+1),O=_.match(h);O&&(D.push(O[1]),E.unshift(O[2])),E.length&&(m=E.join(".")+m),this.hostname=D.join(".");break}}}}this.hostname.length>255&&(this.hostname=""),x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var T=m.indexOf("#");-1!==T&&(this.hash=m.substr(T),m=m.slice(0,T));var N=m.indexOf("?");return-1!==N&&(this.search=m.substr(N),m=m.slice(0,N)),m&&(this.pathname=m),d[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this},r.prototype.parseHost=function(t){var e=i.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},t.exports=function(t,e){if(t&&t instanceof r)return t;var n=new r;return n.parse(t,e),n}},function(t,e,n){"use strict";e.Any=n(6),e.Cc=n(7),e.Cf=n(21),e.P=n(1),e.Z=n(8)},function(t,e){t.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/},function(t,e,n){"use strict";e.parseLinkLabel=n(23),e.parseLinkDestination=n(24),e.parseLinkTitle=n(25)},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i,s,a=-1,c=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<c;){if(93===(i=t.src.charCodeAt(t.pos))&&0===--r){o=!0;break}if(s=t.pos,t.md.inline.skipToken(t),91===i)if(s===t.pos-1)r++;else if(n)return t.pos=l,-1}return o&&(a=t.pos),t.pos=l,a}},function(t,e,n){"use strict";var r=n(0).unescapeAll;t.exports=function(t,e,n){var o,i,s=e,a={ok:!1,pos:0,lines:0,str:""};if(60===t.charCodeAt(e)){for(e++;e<n;){if(10===(o=t.charCodeAt(e)))return a;if(62===o)return a.pos=e+1,a.str=r(t.slice(s+1,e)),a.ok=!0,a;92===o&&e+1<n?e+=2:e++}return a}for(i=0;e<n&&32!==(o=t.charCodeAt(e))&&!(o<32||127===o);)if(92===o&&e+1<n)e+=2;else{if(40===o&&i++,41===o){if(0===i)break;i--}e++}return s===e||0!==i||(a.str=r(t.slice(s,e)),a.lines=0,a.pos=e,a.ok=!0),a}},function(t,e,n){"use strict";var r=n(0).unescapeAll;t.exports=function(t,e,n){var o,i,s=0,a=e,c={ok:!1,pos:0,lines:0,str:""};if(e>=n)return c;if(34!==(i=t.charCodeAt(e))&&39!==i&&40!==i)return c;for(e++,40===i&&(i=41);e<n;){if((o=t.charCodeAt(e))===i)return c.pos=e+1,c.lines=s,c.str=r(t.slice(a+1,e)),c.ok=!0,c;10===o?s++:92===o&&e+1<n&&(e++,10===t.charCodeAt(e)&&s++),e++}return c}},function(t,e,n){"use strict";var r=n(0).assign,o=n(0).unescapeAll,i=n(0).escapeHtml,s={};function a(){this.rules=r({},s)}s.code_inline=function(t,e,n,r,o){var s=t[e];return"<code"+o.renderAttrs(s)+">"+i(t[e].content)+"</code>"},s.code_block=function(t,e,n,r,o){var s=t[e];return"<pre"+o.renderAttrs(s)+"><code>"+i(t[e].content)+"</code></pre>\n"},s.fence=function(t,e,n,r,s){var a,c,l,u,p=t[e],h=p.info?o(p.info).trim():"",f="";return h&&(f=h.split(/\s+/g)[0]),0===(a=n.highlight&&n.highlight(p.content,f)||i(p.content)).indexOf("<pre")?a+"\n":h?(c=p.attrIndex("class"),l=p.attrs?p.attrs.slice():[],c<0?l.push(["class",n.langPrefix+f]):l[c][1]+=" "+n.langPrefix+f,u={attrs:l},"<pre><code"+s.renderAttrs(u)+">"+a+"</code></pre>\n"):"<pre><code"+s.renderAttrs(p)+">"+a+"</code></pre>\n"},s.image=function(t,e,n,r,o){var i=t[e];return i.attrs[i.attrIndex("alt")][1]=o.renderInlineAsText(i.children,n,r),o.renderToken(t,e,n)},s.hardbreak=function(t,e,n){return n.xhtmlOut?"<br />\n":"<br>\n"},s.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?"<br />\n":"<br>\n":"\n"},s.text=function(t,e){return i(t[e].content)},s.html_block=function(t,e){return t[e].content},s.html_inline=function(t,e){return t[e].content},a.prototype.renderAttrs=function(t){var e,n,r;if(!t.attrs)return"";for(r="",e=0,n=t.attrs.length;e<n;e++)r+=" "+i(t.attrs[e][0])+'="'+i(t.attrs[e][1])+'"';return r},a.prototype.renderToken=function(t,e,n){var r,o="",i=!1,s=t[e];return s.hidden?"":(s.block&&-1!==s.nesting&&e&&t[e-1].hidden&&(o+="\n"),o+=(-1===s.nesting?"</":"<")+s.tag,o+=this.renderAttrs(s),0===s.nesting&&n.xhtmlOut&&(o+=" /"),s.block&&(i=!0,1===s.nesting&&e+1<t.length&&("inline"===(r=t[e+1]).type||r.hidden||-1===r.nesting&&r.tag===s.tag)&&(i=!1)),o+=i?">\n":">")},a.prototype.renderInline=function(t,e,n){for(var r,o="",i=this.rules,s=0,a=t.length;s<a;s++)void 0!==i[r=t[s].type]?o+=i[r](t,s,e,n,this):o+=this.renderToken(t,s,e);return o},a.prototype.renderInlineAsText=function(t,e,n){for(var r="",o=0,i=t.length;o<i;o++)"text"===t[o].type?r+=t[o].content:"image"===t[o].type&&(r+=this.renderInlineAsText(t[o].children,e,n));return r},a.prototype.render=function(t,e,n){var r,o,i,s="",a=this.rules;for(r=0,o=t.length;r<o;r++)"inline"===(i=t[r].type)?s+=this.renderInline(t[r].children,e,n):void 0!==a[i]?s+=a[t[r].type](t,r,e,n,this):s+=this.renderToken(t,r,e,n);return s},t.exports=a},function(t,e,n){"use strict";var r=n(2),o=[["normalize",n(28)],["block",n(29)],["inline",n(30)],["linkify",n(31)],["replacements",n(32)],["smartquotes",n(33)]];function i(){this.ruler=new r;for(var t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1])}i.prototype.process=function(t){var e,n,r;for(e=0,n=(r=this.ruler.getRules("")).length;e<n;e++)r[e](t)},i.prototype.State=n(34),t.exports=i},function(t,e,n){"use strict";var r=/\r\n?|\n/g,o=/\0/g;t.exports=function(t){var e;e=(e=t.src.replace(r,"\n")).replace(o,"�"),t.src=e}},function(t,e,n){"use strict";t.exports=function(t){var e;t.inlineMode?((e=new t.Token("inline","",0)).content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r,o=t.tokens;for(n=0,r=o.length;n<r;n++)"inline"===(e=o[n]).type&&t.md.inline.parse(e.content,t.md,t.env,e.children)}},function(t,e,n){"use strict";var r=n(0).arrayReplaceAt;function o(t){return/^<\/a\s*>/i.test(t)}t.exports=function(t){var e,n,i,s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w=t.tokens;if(t.md.options.linkify)for(n=0,i=w.length;n<i;n++)if("inline"===w[n].type&&t.md.linkify.pretest(w[n].content))for(m=0,e=(s=w[n].children).length-1;e>=0;e--)if("link_close"!==(c=s[e]).type){if("html_inline"===c.type&&(k=c.content,/^<a[>\s]/i.test(k)&&m>0&&m--,o(c.content)&&m++),!(m>0)&&"text"===c.type&&t.md.linkify.test(c.content)){for(p=c.content,b=t.md.linkify.match(p),l=[],d=c.level,f=0,u=0;u<b.length;u++)v=b[u].url,g=t.md.normalizeLink(v),t.md.validateLink(g)&&(y=b[u].text,y=b[u].schema?"mailto:"!==b[u].schema||/^mailto:/i.test(y)?t.md.normalizeLinkText(y):t.md.normalizeLinkText("mailto:"+y).replace(/^mailto:/,""):t.md.normalizeLinkText("http://"+y).replace(/^http:\/\//,""),(h=b[u].index)>f&&((a=new t.Token("text","",0)).content=p.slice(f,h),a.level=d,l.push(a)),(a=new t.Token("link_open","a",1)).attrs=[["href",g]],a.level=d++,a.markup="linkify",a.info="auto",l.push(a),(a=new t.Token("text","",0)).content=y,a.level=d,l.push(a),(a=new t.Token("link_close","a",-1)).level=--d,a.markup="linkify",a.info="auto",l.push(a),f=b[u].lastIndex);f<p.length&&((a=new t.Token("text","",0)).content=p.slice(f),a.level=d,l.push(a)),w[n].children=s=r(s,e,l)}}else for(e--;s[e].level!==c.level&&"link_open"!==s[e].type;)e--}},function(t,e,n){"use strict";var r=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,o=/\((c|tm|r|p)\)/i,i=/\((c|tm|r|p)\)/gi,s={c:"©",r:"®",p:"§",tm:"™"};function a(t,e){return s[e.toLowerCase()]}function c(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)"text"!==(n=t[e]).type||r||(n.content=n.content.replace(i,a)),"link_open"===n.type&&"auto"===n.info&&r--,"link_close"===n.type&&"auto"===n.info&&r++}function l(t){var e,n,o=0;for(e=t.length-1;e>=0;e--)"text"!==(n=t[e]).type||o||r.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),"link_open"===n.type&&"auto"===n.info&&o--,"link_close"===n.type&&"auto"===n.info&&o++}t.exports=function(t){var e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&(o.test(t.tokens[e].content)&&c(t.tokens[e].children),r.test(t.tokens[e].content)&&l(t.tokens[e].children))}},function(t,e,n){"use strict";var r=n(0).isWhiteSpace,o=n(0).isPunctChar,i=n(0).isMdAsciiPunct,s=/['"]/,a=/['"]/g;function c(t,e,n){return t.substr(0,e)+n+t.substr(e+1)}function l(t,e){var n,s,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S,A,M;for(S=[],n=0;n<t.length;n++){for(s=t[n],f=t[n].level,C=S.length-1;C>=0&&!(S[C].level<=f);C--);if(S.length=C+1,"text"===s.type){p=0,h=(l=s.content).length;t:for(;p<h&&(a.lastIndex=p,u=a.exec(l));){if(w=x=!0,p=u.index+1,_="'"===u[0],m=32,u.index-1>=0)m=l.charCodeAt(u.index-1);else for(C=n-1;C>=0&&("softbreak"!==t[C].type&&"hardbreak"!==t[C].type);C--)if("text"===t[C].type){m=t[C].content.charCodeAt(t[C].content.length-1);break}if(v=32,p<h)v=l.charCodeAt(p);else for(C=n+1;C<t.length&&("softbreak"!==t[C].type&&"hardbreak"!==t[C].type);C++)if("text"===t[C].type){v=t[C].content.charCodeAt(0);break}if(g=i(m)||o(String.fromCharCode(m)),y=i(v)||o(String.fromCharCode(v)),b=r(m),(k=r(v))?w=!1:y&&(b||g||(w=!1)),b?x=!1:g&&(k||y||(x=!1)),34===v&&'"'===u[0]&&m>=48&&m<=57&&(x=w=!1),w&&x&&(w=!1,x=y),w||x){if(x)for(C=S.length-1;C>=0&&(d=S[C],!(S[C].level<f));C--)if(d.single===_&&S[C].level===f){d=S[C],_?(A=e.md.options.quotes[2],M=e.md.options.quotes[3]):(A=e.md.options.quotes[0],M=e.md.options.quotes[1]),s.content=c(s.content,u.index,M),t[d.token].content=c(t[d.token].content,d.pos,A),p+=M.length-1,d.token===n&&(p+=A.length-1),h=(l=s.content).length,S.length=C;continue t}w?S.push({token:n,pos:u.index,single:_,level:f}):x&&_&&(s.content=c(s.content,u.index,"’"))}else _&&(s.content=c(s.content,u.index,"’"))}}}}t.exports=function(t){var e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&s.test(t.tokens[e].content)&&l(t.tokens[e].children,t)}},function(t,e,n){"use strict";var r=n(3);function o(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}o.prototype.Token=r,t.exports=o},function(t,e,n){"use strict";var r=n(2),o=[["table",n(36),["paragraph","reference"]],["code",n(37)],["fence",n(38),["paragraph","reference","blockquote","list"]],["blockquote",n(39),["paragraph","reference","blockquote","list"]],["hr",n(40),["paragraph","reference","blockquote","list"]],["list",n(41),["paragraph","reference","blockquote"]],["reference",n(42)],["heading",n(43),["paragraph","reference","blockquote"]],["lheading",n(44)],["html_block",n(45),["paragraph","reference","blockquote"]],["paragraph",n(47)]];function i(){this.ruler=new r;for(var t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1],{alt:(o[t][2]||[]).slice()})}i.prototype.tokenize=function(t,e,n){for(var r,o=this.ruler.getRules(""),i=o.length,s=e,a=!1,c=t.md.options.maxNesting;s<n&&(t.line=s=t.skipEmptyLines(s),!(s>=n))&&!(t.sCount[s]<t.blkIndent);){if(t.level>=c){t.line=n;break}for(r=0;r<i&&!o[r](t,s,n,!1);r++);t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),(s=t.line)<n&&t.isEmpty(s)&&(a=!0,s++,t.line=s)}},i.prototype.parse=function(t,e,n,r){var o;t&&(o=new this.State(t,e,n,r),this.tokenize(o,o.line,o.lineMax))},i.prototype.State=n(48),t.exports=i},function(t,e,n){"use strict";var r=n(0).isSpace;function o(t,e){var n=t.bMarks[e]+t.blkIndent,r=t.eMarks[e];return t.src.substr(n,r-n)}function i(t){var e,n=[],r=0,o=t.length,i=0,s=0,a=!1,c=0;for(e=t.charCodeAt(r);r<o;)96===e?a?(a=!1,c=r):i%2==0&&(a=!0,c=r):124!==e||i%2!=0||a||(n.push(t.substring(s,r)),s=r+1),92===e?i++:i=0,++r===o&&a&&(a=!1,r=c+1),e=t.charCodeAt(r);return n.push(t.substring(s)),n}t.exports=function(t,e,n,s){var a,c,l,u,p,h,f,d,m,v,g,y;if(e+2>n)return!1;if(p=e+1,t.sCount[p]<t.blkIndent)return!1;if(t.sCount[p]-t.blkIndent>=4)return!1;if((l=t.bMarks[p]+t.tShift[p])>=t.eMarks[p])return!1;if(124!==(a=t.src.charCodeAt(l++))&&45!==a&&58!==a)return!1;for(;l<t.eMarks[p];){if(124!==(a=t.src.charCodeAt(l))&&45!==a&&58!==a&&!r(a))return!1;l++}for(h=(c=o(t,e+1)).split("|"),m=[],u=0;u<h.length;u++){if(!(v=h[u].trim())){if(0===u||u===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(v))return!1;58===v.charCodeAt(v.length-1)?m.push(58===v.charCodeAt(0)?"center":"right"):58===v.charCodeAt(0)?m.push("left"):m.push("")}if(-1===(c=o(t,e).trim()).indexOf("|"))return!1;if(t.sCount[e]-t.blkIndent>=4)return!1;if((f=(h=i(c.replace(/^\||\|$/g,""))).length)>m.length)return!1;if(s)return!0;for((d=t.push("table_open","table",1)).map=g=[e,0],(d=t.push("thead_open","thead",1)).map=[e,e+1],(d=t.push("tr_open","tr",1)).map=[e,e+1],u=0;u<h.length;u++)(d=t.push("th_open","th",1)).map=[e,e+1],m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=t.push("inline","",0)).content=h[u].trim(),d.map=[e,e+1],d.children=[],d=t.push("th_close","th",-1);for(d=t.push("tr_close","tr",-1),d=t.push("thead_close","thead",-1),(d=t.push("tbody_open","tbody",1)).map=y=[e+2,0],p=e+2;p<n&&!(t.sCount[p]<t.blkIndent)&&-1!==(c=o(t,p).trim()).indexOf("|")&&!(t.sCount[p]-t.blkIndent>=4);p++){for(h=i(c.replace(/^\||\|$/g,"")),d=t.push("tr_open","tr",1),u=0;u<f;u++)d=t.push("td_open","td",1),m[u]&&(d.attrs=[["style","text-align:"+m[u]]]),(d=t.push("inline","",0)).content=h[u]?h[u].trim():"",d.children=[],d=t.push("td_close","td",-1);d=t.push("tr_close","tr",-1)}return d=t.push("tbody_close","tbody",-1),d=t.push("table_close","table",-1),g[1]=y[1]=p,t.line=p,!0}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i;if(t.sCount[e]-t.blkIndent<4)return!1;for(o=r=e+1;r<n;)if(t.isEmpty(r))r++;else{if(!(t.sCount[r]-t.blkIndent>=4))break;o=++r}return t.line=o,(i=t.push("code_block","code",0)).content=t.getLines(e,o,4+t.blkIndent,!0),i.map=[e,t.line],!0}},function(t,e,n){"use strict";t.exports=function(t,e,n,r){var o,i,s,a,c,l,u,p=!1,h=t.bMarks[e]+t.tShift[e],f=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(h+3>f)return!1;if(126!==(o=t.src.charCodeAt(h))&&96!==o)return!1;if(c=h,(i=(h=t.skipChars(h,o))-c)<3)return!1;if(u=t.src.slice(c,h),s=t.src.slice(h,f),96===o&&s.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;for(a=e;!(++a>=n)&&!((h=c=t.bMarks[a]+t.tShift[a])<(f=t.eMarks[a])&&t.sCount[a]<t.blkIndent);)if(t.src.charCodeAt(h)===o&&!(t.sCount[a]-t.blkIndent>=4||(h=t.skipChars(h,o))-c<i||(h=t.skipSpaces(h))<f)){p=!0;break}return i=t.sCount[e],t.line=a+(p?1:0),(l=t.push("fence","code",0)).info=s,l.content=t.getLines(e+1,a,i,!0),l.markup=u,l.map=[e,t.line],!0}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S=t.lineMax,A=t.bMarks[e]+t.tShift[e],M=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(62!==t.src.charCodeAt(A++))return!1;if(o)return!0;for(c=f=t.sCount[e]+A-(t.bMarks[e]+t.tShift[e]),32===t.src.charCodeAt(A)?(A++,c++,f++,i=!1,k=!0):9===t.src.charCodeAt(A)?(k=!0,(t.bsCount[e]+f)%4==3?(A++,c++,f++,i=!1):i=!0):k=!1,d=[t.bMarks[e]],t.bMarks[e]=A;A<M&&(s=t.src.charCodeAt(A),r(s));)9===s?f+=4-(f+t.bsCount[e]+(i?1:0))%4:f++,A++;for(m=[t.bsCount[e]],t.bsCount[e]=t.sCount[e]+1+(k?1:0),u=A>=M,y=[t.sCount[e]],t.sCount[e]=f-c,b=[t.tShift[e]],t.tShift[e]=A-t.bMarks[e],x=t.md.block.ruler.getRules("blockquote"),g=t.parentType,t.parentType="blockquote",_=!1,h=e+1;h<n&&(t.sCount[h]<t.blkIndent&&(_=!0),!((A=t.bMarks[h]+t.tShift[h])>=(M=t.eMarks[h])));h++)if(62!==t.src.charCodeAt(A++)||_){if(u)break;for(w=!1,a=0,l=x.length;a<l;a++)if(x[a](t,h,n,!0)){w=!0;break}if(w){t.lineMax=h,0!==t.blkIndent&&(d.push(t.bMarks[h]),m.push(t.bsCount[h]),b.push(t.tShift[h]),y.push(t.sCount[h]),t.sCount[h]-=t.blkIndent);break}d.push(t.bMarks[h]),m.push(t.bsCount[h]),b.push(t.tShift[h]),y.push(t.sCount[h]),t.sCount[h]=-1}else{for(c=f=t.sCount[h]+A-(t.bMarks[h]+t.tShift[h]),32===t.src.charCodeAt(A)?(A++,c++,f++,i=!1,k=!0):9===t.src.charCodeAt(A)?(k=!0,(t.bsCount[h]+f)%4==3?(A++,c++,f++,i=!1):i=!0):k=!1,d.push(t.bMarks[h]),t.bMarks[h]=A;A<M&&(s=t.src.charCodeAt(A),r(s));)9===s?f+=4-(f+t.bsCount[h]+(i?1:0))%4:f++,A++;u=A>=M,m.push(t.bsCount[h]),t.bsCount[h]=t.sCount[h]+1+(k?1:0),y.push(t.sCount[h]),t.sCount[h]=f-c,b.push(t.tShift[h]),t.tShift[h]=A-t.bMarks[h]}for(v=t.blkIndent,t.blkIndent=0,(C=t.push("blockquote_open","blockquote",1)).markup=">",C.map=p=[e,0],t.md.block.tokenize(t,e,h),(C=t.push("blockquote_close","blockquote",-1)).markup=">",t.lineMax=S,t.parentType=g,p[1]=t.line,a=0;a<b.length;a++)t.bMarks[a+e]=d[a],t.tShift[a+e]=b[a],t.sCount[a+e]=y[a],t.bsCount[a+e]=m[a];return t.blkIndent=v,!0}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(42!==(i=t.src.charCodeAt(l++))&&45!==i&&95!==i)return!1;for(s=1;l<u;){if((a=t.src.charCodeAt(l++))!==i&&!r(a))return!1;a===i&&s++}return!(s<3)&&(o||(t.line=e+1,(c=t.push("hr","hr",0)).map=[e,t.line],c.markup=Array(s+1).join(String.fromCharCode(i))),!0)}},function(t,e,n){"use strict";var r=n(0).isSpace;function o(t,e){var n,o,i,s;return o=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],42!==(n=t.src.charCodeAt(o++))&&45!==n&&43!==n||o<i&&(s=t.src.charCodeAt(o),!r(s))?-1:o}function i(t,e){var n,o=t.bMarks[e]+t.tShift[e],i=o,s=t.eMarks[e];if(i+1>=s)return-1;if((n=t.src.charCodeAt(i++))<48||n>57)return-1;for(;;){if(i>=s)return-1;if(!((n=t.src.charCodeAt(i++))>=48&&n<=57)){if(41===n||46===n)break;return-1}if(i-o>=10)return-1}return i<s&&(n=t.src.charCodeAt(i),!r(n))?-1:i}t.exports=function(t,e,n,r){var s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x,C,_,S,A,M,D,E,O,T,N,z,q=!1,I=!0;if(t.sCount[e]-t.blkIndent>=4)return!1;if(t.listIndent>=0&&t.sCount[e]-t.listIndent>=4&&t.sCount[e]<t.blkIndent)return!1;if(r&&"paragraph"===t.parentType&&t.tShift[e]>=t.blkIndent&&(q=!0),(D=i(t,e))>=0){if(h=!0,O=t.bMarks[e]+t.tShift[e],y=Number(t.src.substr(O,D-O-1)),q&&1!==y)return!1}else{if(!((D=o(t,e))>=0))return!1;h=!1}if(q&&t.skipSpaces(D)>=t.eMarks[e])return!1;if(g=t.src.charCodeAt(D-1),r)return!0;for(v=t.tokens.length,h?(z=t.push("ordered_list_open","ol",1),1!==y&&(z.attrs=[["start",y]])):z=t.push("bullet_list_open","ul",1),z.map=m=[e,0],z.markup=String.fromCharCode(g),k=e,E=!1,N=t.md.block.ruler.getRules("list"),C=t.parentType,t.parentType="list";k<n;){for(M=D,b=t.eMarks[k],p=w=t.sCount[k]+D-(t.bMarks[e]+t.tShift[e]);M<b;){if(9===(s=t.src.charCodeAt(M)))w+=4-(w+t.bsCount[k])%4;else{if(32!==s)break;w++}M++}if((u=(a=M)>=b?1:w-p)>4&&(u=1),l=p+u,(z=t.push("list_item_open","li",1)).markup=String.fromCharCode(g),z.map=f=[e,0],A=t.tight,S=t.tShift[e],_=t.sCount[e],x=t.listIndent,t.listIndent=t.blkIndent,t.blkIndent=l,t.tight=!0,t.tShift[e]=a-t.bMarks[e],t.sCount[e]=w,a>=b&&t.isEmpty(e+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,e,n,!0),t.tight&&!E||(I=!1),E=t.line-e>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=x,t.tShift[e]=S,t.sCount[e]=_,t.tight=A,(z=t.push("list_item_close","li",-1)).markup=String.fromCharCode(g),k=e=t.line,f[1]=k,a=t.bMarks[e],k>=n)break;if(t.sCount[k]<t.blkIndent)break;if(t.sCount[e]-t.blkIndent>=4)break;for(T=!1,c=0,d=N.length;c<d;c++)if(N[c](t,k,n,!0)){T=!0;break}if(T)break;if(h){if((D=i(t,k))<0)break}else if((D=o(t,k))<0)break;if(g!==t.src.charCodeAt(D-1))break}return(z=h?t.push("ordered_list_close","ol",-1):t.push("bullet_list_close","ul",-1)).markup=String.fromCharCode(g),m[1]=k,t.line=k,t.parentType=C,I&&function(t,e){var n,r,o=t.level+2;for(n=e+2,r=t.tokens.length-2;n<r;n++)t.tokens[n].level===o&&"paragraph_open"===t.tokens[n].type&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}(t,v),!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e,n,i){var s,a,c,l,u,p,h,f,d,m,v,g,y,b,k,w,x=0,C=t.bMarks[e]+t.tShift[e],_=t.eMarks[e],S=e+1;if(t.sCount[e]-t.blkIndent>=4)return!1;if(91!==t.src.charCodeAt(C))return!1;for(;++C<_;)if(93===t.src.charCodeAt(C)&&92!==t.src.charCodeAt(C-1)){if(C+1===_)return!1;if(58!==t.src.charCodeAt(C+1))return!1;break}for(l=t.lineMax,k=t.md.block.ruler.getRules("reference"),m=t.parentType,t.parentType="reference";S<l&&!t.isEmpty(S);S++)if(!(t.sCount[S]-t.blkIndent>3||t.sCount[S]<0)){for(b=!1,p=0,h=k.length;p<h;p++)if(k[p](t,S,l,!0)){b=!0;break}if(b)break}for(_=(y=t.getLines(e,S,t.blkIndent,!1).trim()).length,C=1;C<_;C++){if(91===(s=y.charCodeAt(C)))return!1;if(93===s){d=C;break}(10===s||92===s&&++C<_&&10===y.charCodeAt(C))&&x++}if(d<0||58!==y.charCodeAt(d+1))return!1;for(C=d+2;C<_;C++)if(10===(s=y.charCodeAt(C)))x++;else if(!o(s))break;if(!(v=t.md.helpers.parseLinkDestination(y,C,_)).ok)return!1;if(u=t.md.normalizeLink(v.str),!t.md.validateLink(u))return!1;for(a=C=v.pos,c=x+=v.lines,g=C;C<_;C++)if(10===(s=y.charCodeAt(C)))x++;else if(!o(s))break;for(v=t.md.helpers.parseLinkTitle(y,C,_),C<_&&g!==C&&v.ok?(w=v.str,C=v.pos,x+=v.lines):(w="",C=a,x=c);C<_&&(s=y.charCodeAt(C),o(s));)C++;if(C<_&&10!==y.charCodeAt(C)&&w)for(w="",C=a,x=c;C<_&&(s=y.charCodeAt(C),o(s));)C++;return!(C<_&&10!==y.charCodeAt(C))&&(!!(f=r(y.slice(1,d)))&&(i||(void 0===t.env.references&&(t.env.references={}),void 0===t.env.references[f]&&(t.env.references[f]={title:w,href:u}),t.parentType=m,t.line=e+x+1),!0))}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e,n,o){var i,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(35!==(i=t.src.charCodeAt(l))||l>=u)return!1;for(s=1,i=t.src.charCodeAt(++l);35===i&&l<u&&s<=6;)s++,i=t.src.charCodeAt(++l);return!(s>6||l<u&&!r(i))&&(o||(u=t.skipSpacesBack(u,l),(a=t.skipCharsBack(u,35,l))>l&&r(t.src.charCodeAt(a-1))&&(u=a),t.line=e+1,(c=t.push("heading_open","h"+String(s),1)).markup="########".slice(0,s),c.map=[e,t.line],(c=t.push("inline","",0)).content=t.src.slice(l,u).trim(),c.map=[e,t.line],c.children=[],(c=t.push("heading_close","h"+String(s),-1)).markup="########".slice(0,s)),!0)}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o,i,s,a,c,l,u,p,h,f=e+1,d=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;for(h=t.parentType,t.parentType="paragraph";f<n&&!t.isEmpty(f);f++)if(!(t.sCount[f]-t.blkIndent>3)){if(t.sCount[f]>=t.blkIndent&&(c=t.bMarks[f]+t.tShift[f])<(l=t.eMarks[f])&&(45===(p=t.src.charCodeAt(c))||61===p)&&(c=t.skipChars(c,p),(c=t.skipSpaces(c))>=l)){u=61===p?1:2;break}if(!(t.sCount[f]<0)){for(o=!1,i=0,s=d.length;i<s;i++)if(d[i](t,f,n,!0)){o=!0;break}if(o)break}}return!!u&&(r=t.getLines(e,f,t.blkIndent,!1).trim(),t.line=f+1,(a=t.push("heading_open","h"+String(u),1)).markup=String.fromCharCode(p),a.map=[e,t.line],(a=t.push("inline","",0)).content=r,a.map=[e,t.line-1],a.children=[],(a=t.push("heading_close","h"+String(u),-1)).markup=String.fromCharCode(p),t.parentType=h,!0)}},function(t,e,n){"use strict";var r=n(46),o=n(9).HTML_OPEN_CLOSE_TAG_RE,i=[[/^<(script|pre|style)(?=(\s|>|$))/i,/<\/(script|pre|style)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+r.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(o.source+"\\s*$"),/^$/,!1]];t.exports=function(t,e,n,r){var o,s,a,c,l=t.bMarks[e]+t.tShift[e],u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(!t.md.options.html)return!1;if(60!==t.src.charCodeAt(l))return!1;for(c=t.src.slice(l,u),o=0;o<i.length&&!i[o][0].test(c);o++);if(o===i.length)return!1;if(r)return i[o][2];if(s=e+1,!i[o][1].test(c))for(;s<n&&!(t.sCount[s]<t.blkIndent);s++)if(l=t.bMarks[s]+t.tShift[s],u=t.eMarks[s],c=t.src.slice(l,u),i[o][1].test(c)){0!==c.length&&s++;break}return t.line=s,(a=t.push("html_block","",0)).map=[e,s],a.content=t.getLines(e,s,t.blkIndent,!0),!0}},function(t,e,n){"use strict";t.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o,i,s,a,c=e+1,l=t.md.block.ruler.getRules("paragraph"),u=t.lineMax;for(a=t.parentType,t.parentType="paragraph";c<u&&!t.isEmpty(c);c++)if(!(t.sCount[c]-t.blkIndent>3||t.sCount[c]<0)){for(r=!1,o=0,i=l.length;o<i;o++)if(l[o](t,c,u,!0)){r=!0;break}if(r)break}return n=t.getLines(e,c,t.blkIndent,!1).trim(),t.line=c,(s=t.push("paragraph_open","p",1)).map=[e,t.line],(s=t.push("inline","",0)).content=n,s.map=[e,t.line],s.children=[],s=t.push("paragraph_close","p",-1),t.parentType=a,!0}},function(t,e,n){"use strict";var r=n(3),o=n(0).isSpace;function i(t,e,n,r){var i,s,a,c,l,u,p,h;for(this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",h=!1,a=c=u=p=0,l=(s=this.src).length;c<l;c++){if(i=s.charCodeAt(c),!h){if(o(i)){u++,9===i?p+=4-p%4:p++;continue}h=!0}10!==i&&c!==l-1||(10!==i&&c++,this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(u),this.sCount.push(p),this.bsCount.push(0),h=!1,u=0,p=0,a=c+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}i.prototype.push=function(t,e,n){var o=new r(t,e,n);return o.block=!0,n<0&&this.level--,o.level=this.level,n>0&&this.level++,this.tokens.push(o),o},i.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},i.prototype.skipEmptyLines=function(t){for(var e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},i.prototype.skipSpaces=function(t){for(var e,n=this.src.length;t<n&&(e=this.src.charCodeAt(t),o(e));t++);return t},i.prototype.skipSpacesBack=function(t,e){if(t<=e)return t;for(;t>e;)if(!o(this.src.charCodeAt(--t)))return t+1;return t},i.prototype.skipChars=function(t,e){for(var n=this.src.length;t<n&&this.src.charCodeAt(t)===e;t++);return t},i.prototype.skipCharsBack=function(t,e,n){if(t<=n)return t;for(;t>n;)if(e!==this.src.charCodeAt(--t))return t+1;return t},i.prototype.getLines=function(t,e,n,r){var i,s,a,c,l,u,p,h=t;if(t>=e)return"";for(u=new Array(e-t),i=0;h<e;h++,i++){for(s=0,p=c=this.bMarks[h],l=h+1<e||r?this.eMarks[h]+1:this.eMarks[h];c<l&&s<n;){if(a=this.src.charCodeAt(c),o(a))9===a?s+=4-(s+this.bsCount[h])%4:s++;else{if(!(c-p<this.tShift[h]))break;s++}c++}u[i]=s>n?new Array(s-n+1).join(" ")+this.src.slice(c,l):this.src.slice(c,l)}return u.join("")},i.prototype.Token=r,t.exports=i},function(t,e,n){"use strict";var r=n(2),o=[["text",n(50)],["newline",n(51)],["escape",n(52)],["backticks",n(53)],["strikethrough",n(10).tokenize],["emphasis",n(11).tokenize],["link",n(54)],["image",n(55)],["autolink",n(56)],["html_inline",n(57)],["entity",n(58)]],i=[["balance_pairs",n(59)],["strikethrough",n(10).postProcess],["emphasis",n(11).postProcess],["text_collapse",n(60)]];function s(){var t;for(this.ruler=new r,t=0;t<o.length;t++)this.ruler.push(o[t][0],o[t][1]);for(this.ruler2=new r,t=0;t<i.length;t++)this.ruler2.push(i[t][0],i[t][1])}s.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,s=t.md.options.maxNesting,a=t.cache;if(void 0===a[r]){if(t.level<s)for(n=0;n<i&&(t.level++,e=o[n](t,!0),t.level--,!e);n++);else t.pos=t.posMax;e||t.pos++,a[r]=t.pos}else t.pos=a[r]},s.prototype.tokenize=function(t){for(var e,n,r=this.ruler.getRules(""),o=r.length,i=t.posMax,s=t.md.options.maxNesting;t.pos<i;){if(t.level<s)for(n=0;n<o&&!(e=r[n](t,!1));n++);if(e){if(t.pos>=i)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},s.prototype.parse=function(t,e,n,r){var o,i,s,a=new this.State(t,e,n,r);for(this.tokenize(a),s=(i=this.ruler2.getRules("")).length,o=0;o<s;o++)i[o](a)},s.prototype.State=n(61),t.exports=s},function(t,e,n){"use strict";function r(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}t.exports=function(t,e){for(var n=t.pos;n<t.posMax&&!r(t.src.charCodeAt(n));)n++;return n!==t.pos&&(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}},function(t,e,n){"use strict";var r=n(0).isSpace;t.exports=function(t,e){var n,o,i=t.pos;if(10!==t.src.charCodeAt(i))return!1;for(n=t.pending.length-1,o=t.posMax,e||(n>=0&&32===t.pending.charCodeAt(n)?n>=1&&32===t.pending.charCodeAt(n-1)?(t.pending=t.pending.replace(/ +$/,""),t.push("hardbreak","br",0)):(t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0)):t.push("softbreak","br",0)),i++;i<o&&r(t.src.charCodeAt(i));)i++;return t.pos=i,!0}},function(t,e,n){"use strict";for(var r=n(0).isSpace,o=[],i=0;i<256;i++)o.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(t){o[t.charCodeAt(0)]=1})),t.exports=function(t,e){var n,i=t.pos,s=t.posMax;if(92!==t.src.charCodeAt(i))return!1;if(++i<s){if((n=t.src.charCodeAt(i))<256&&0!==o[n])return e||(t.pending+=t.src[i]),t.pos+=2,!0;if(10===n){for(e||t.push("hardbreak","br",0),i++;i<s&&(n=t.src.charCodeAt(i),r(n));)i++;return t.pos=i,!0}}return e||(t.pending+="\\"),t.pos++,!0}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o,i,s,a,c=t.pos;if(96!==t.src.charCodeAt(c))return!1;for(n=c,c++,r=t.posMax;c<r&&96===t.src.charCodeAt(c);)c++;for(o=t.src.slice(n,c),i=s=c;-1!==(i=t.src.indexOf("`",s));){for(s=i+1;s<r&&96===t.src.charCodeAt(s);)s++;if(s-i===o.length)return e||((a=t.push("code_inline","code",0)).markup=o,a.content=t.src.slice(c,i).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),t.pos=s,!0}return e||(t.pending+=o),t.pos+=o.length,!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e){var n,i,s,a,c,l,u,p,h,f="",d=t.pos,m=t.posMax,v=t.pos,g=!0;if(91!==t.src.charCodeAt(t.pos))return!1;if(c=t.pos+1,(a=t.md.helpers.parseLinkLabel(t,t.pos,!0))<0)return!1;if((l=a+1)<m&&40===t.src.charCodeAt(l)){for(g=!1,l++;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);if(l>=m)return!1;for(v=l,(u=t.md.helpers.parseLinkDestination(t.src,l,t.posMax)).ok&&(f=t.md.normalizeLink(u.str),t.md.validateLink(f)?l=u.pos:f=""),v=l;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);if(u=t.md.helpers.parseLinkTitle(t.src,l,t.posMax),l<m&&v!==l&&u.ok)for(h=u.str,l=u.pos;l<m&&(i=t.src.charCodeAt(l),o(i)||10===i);l++);else h="";(l>=m||41!==t.src.charCodeAt(l))&&(g=!0),l++}if(g){if(void 0===t.env.references)return!1;if(l<m&&91===t.src.charCodeAt(l)?(v=l+1,(l=t.md.helpers.parseLinkLabel(t,l))>=0?s=t.src.slice(v,l++):l=a+1):l=a+1,s||(s=t.src.slice(c,a)),!(p=t.env.references[r(s)]))return t.pos=d,!1;f=p.href,h=p.title}return e||(t.pos=c,t.posMax=a,t.push("link_open","a",1).attrs=n=[["href",f]],h&&n.push(["title",h]),t.md.inline.tokenize(t),t.push("link_close","a",-1)),t.pos=l,t.posMax=m,!0}},function(t,e,n){"use strict";var r=n(0).normalizeReference,o=n(0).isSpace;t.exports=function(t,e){var n,i,s,a,c,l,u,p,h,f,d,m,v,g="",y=t.pos,b=t.posMax;if(33!==t.src.charCodeAt(t.pos))return!1;if(91!==t.src.charCodeAt(t.pos+1))return!1;if(l=t.pos+2,(c=t.md.helpers.parseLinkLabel(t,t.pos+1,!1))<0)return!1;if((u=c+1)<b&&40===t.src.charCodeAt(u)){for(u++;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);if(u>=b)return!1;for(v=u,(h=t.md.helpers.parseLinkDestination(t.src,u,t.posMax)).ok&&(g=t.md.normalizeLink(h.str),t.md.validateLink(g)?u=h.pos:g=""),v=u;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);if(h=t.md.helpers.parseLinkTitle(t.src,u,t.posMax),u<b&&v!==u&&h.ok)for(f=h.str,u=h.pos;u<b&&(i=t.src.charCodeAt(u),o(i)||10===i);u++);else f="";if(u>=b||41!==t.src.charCodeAt(u))return t.pos=y,!1;u++}else{if(void 0===t.env.references)return!1;if(u<b&&91===t.src.charCodeAt(u)?(v=u+1,(u=t.md.helpers.parseLinkLabel(t,u))>=0?a=t.src.slice(v,u++):u=c+1):u=c+1,a||(a=t.src.slice(l,c)),!(p=t.env.references[r(a)]))return t.pos=y,!1;g=p.href,f=p.title}return e||(s=t.src.slice(l,c),t.md.inline.parse(s,t.md,t.env,m=[]),(d=t.push("image","img",0)).attrs=n=[["src",g],["alt",""]],d.children=m,d.content=s,f&&n.push(["title",f])),t.pos=u,t.posMax=b,!0}},function(t,e,n){"use strict";var r=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,o=/^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;t.exports=function(t,e){var n,i,s,a,c,l,u=t.pos;return 60===t.src.charCodeAt(u)&&(!((n=t.src.slice(u)).indexOf(">")<0)&&(o.test(n)?(a=(i=n.match(o))[0].slice(1,-1),c=t.md.normalizeLink(a),!!t.md.validateLink(c)&&(e||((l=t.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=t.push("text","",0)).content=t.md.normalizeLinkText(a),(l=t.push("link_close","a",-1)).markup="autolink",l.info="auto"),t.pos+=i[0].length,!0)):!!r.test(n)&&(a=(s=n.match(r))[0].slice(1,-1),c=t.md.normalizeLink("mailto:"+a),!!t.md.validateLink(c)&&(e||((l=t.push("link_open","a",1)).attrs=[["href",c]],l.markup="autolink",l.info="auto",(l=t.push("text","",0)).content=t.md.normalizeLinkText(a),(l=t.push("link_close","a",-1)).markup="autolink",l.info="auto"),t.pos+=s[0].length,!0))))}},function(t,e,n){"use strict";var r=n(9).HTML_TAG_RE;t.exports=function(t,e){var n,o,i,s=t.pos;return!!t.md.options.html&&(i=t.posMax,!(60!==t.src.charCodeAt(s)||s+2>=i)&&(!(33!==(n=t.src.charCodeAt(s+1))&&63!==n&&47!==n&&!function(t){var e=32|t;return e>=97&&e<=122}(n))&&(!!(o=t.src.slice(s).match(r))&&(e||(t.push("html_inline","",0).content=t.src.slice(s,s+o[0].length)),t.pos+=o[0].length,!0))))}},function(t,e,n){"use strict";var r=n(4),o=n(0).has,i=n(0).isValidEntityCode,s=n(0).fromCodePoint,a=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,c=/^&([a-z][a-z0-9]{1,31});/i;t.exports=function(t,e){var n,l,u=t.pos,p=t.posMax;if(38!==t.src.charCodeAt(u))return!1;if(u+1<p)if(35===t.src.charCodeAt(u+1)){if(l=t.src.slice(u).match(a))return e||(n="x"===l[1][0].toLowerCase()?parseInt(l[1].slice(1),16):parseInt(l[1],10),t.pending+=i(n)?s(n):s(65533)),t.pos+=l[0].length,!0}else if((l=t.src.slice(u).match(c))&&o(r,l[1]))return e||(t.pending+=r[l[1]]),t.pos+=l[0].length,!0;return e||(t.pending+="&"),t.pos++,!0}},function(t,e,n){"use strict";function r(t,e){var n,r,o,i,s,a,c,l,u={},p=e.length;for(n=0;n<p;n++)if((o=e[n]).length=o.length||0,o.close){for(u.hasOwnProperty(o.marker)||(u[o.marker]=[-1,-1,-1]),s=u[o.marker][o.length%3],a=-1,r=n-o.jump-1;r>s;r-=i.jump+1)if((i=e[r]).marker===o.marker&&(-1===a&&(a=r),i.open&&i.end<0&&i.level===o.level&&(c=!1,(i.close||o.open)&&(i.length+o.length)%3==0&&(i.length%3==0&&o.length%3==0||(c=!0)),!c))){l=r>0&&!e[r-1].open?e[r-1].jump+1:0,o.jump=n-r+l,o.open=!1,i.end=n,i.jump=l,i.close=!1,a=-1;break}-1!==a&&(u[o.marker][(o.length||0)%3]=a)}}t.exports=function(t){var e,n=t.tokens_meta,o=t.tokens_meta.length;for(r(0,t.delimiters),e=0;e<o;e++)n[e]&&n[e].delimiters&&r(0,n[e].delimiters)}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r=0,o=t.tokens,i=t.tokens.length;for(e=n=0;e<i;e++)o[e].nesting<0&&r--,o[e].level=r,o[e].nesting>0&&r++,"text"===o[e].type&&e+1<i&&"text"===o[e+1].type?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}},function(t,e,n){"use strict";var r=n(3),o=n(0).isWhiteSpace,i=n(0).isPunctChar,s=n(0).isMdAsciiPunct;function a(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[]}a.prototype.pushPending=function(){var t=new r("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},a.prototype.push=function(t,e,n){this.pending&&this.pushPending();var o=new r(t,e,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),o.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(o),this.tokens_meta.push(i),o},a.prototype.scanDelims=function(t,e){var n,r,a,c,l,u,p,h,f,d=t,m=!0,v=!0,g=this.posMax,y=this.src.charCodeAt(t);for(n=t>0?this.src.charCodeAt(t-1):32;d<g&&this.src.charCodeAt(d)===y;)d++;return a=d-t,r=d<g?this.src.charCodeAt(d):32,p=s(n)||i(String.fromCharCode(n)),f=s(r)||i(String.fromCharCode(r)),u=o(n),(h=o(r))?m=!1:f&&(u||p||(m=!1)),u?v=!1:p&&(h||f||(v=!1)),e?(c=m,l=v):(c=m&&(!v||p),l=v&&(!m||f)),{can_open:c,can_close:l,length:a}},a.prototype.Token=r,t.exports=a},function(t,e,n){"use strict";function r(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach((function(e){e&&Object.keys(e).forEach((function(n){t[n]=e[n]}))})),t}function o(t){return Object.prototype.toString.call(t)}function i(t){return"[object Function]"===o(t)}function s(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var a={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var c={"http:":{validate:function(t,e,n){var r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){var r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&":"===t[e-3]||e>=3&&"/"===t[e-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){var r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},l="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function u(t){var e=t.re=n(63)(t.__opts__),r=t.__tlds__.slice();function a(t){return t.replace("%TLDS%",e.src_tlds)}t.onCompile(),t.__tlds_replaced__||r.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),r.push(e.src_xn),e.src_tlds=r.join("|"),e.email_fuzzy=RegExp(a(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(a(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(a(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(a(e.tpl_host_fuzzy_test),"i");var c=[];function l(t,e){throw new Error('(LinkifyIt) Invalid schema "'+t+'": '+e)}t.__compiled__={},Object.keys(t.__schemas__).forEach((function(e){var n=t.__schemas__[e];if(null!==n){var r={validate:null,link:null};if(t.__compiled__[e]=r,"[object Object]"===o(n))return!function(t){return"[object RegExp]"===o(t)}(n.validate)?i(n.validate)?r.validate=n.validate:l(e,n):r.validate=function(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}(n.validate),void(i(n.normalize)?r.normalize=n.normalize:n.normalize?l(e,n):r.normalize=function(t,e){e.normalize(t)});!function(t){return"[object String]"===o(t)}(n)?l(e,n):c.push(e)}})),c.forEach((function(e){t.__compiled__[t.__schemas__[e]]&&(t.__compiled__[e].validate=t.__compiled__[t.__schemas__[e]].validate,t.__compiled__[e].normalize=t.__compiled__[t.__schemas__[e]].normalize)})),t.__compiled__[""]={validate:null,normalize:function(t,e){e.normalize(t)}};var u=Object.keys(t.__compiled__).filter((function(e){return e.length>0&&t.__compiled__[e]})).map(s).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+u+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+u+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),function(t){t.__index__=-1,t.__text_cache__=""}(t)}function p(t,e){var n=t.__index__,r=t.__last_index__,o=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=o,this.text=o,this.url=o}function h(t,e){var n=new p(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function f(t,e){if(!(this instanceof f))return new f(t,e);var n;e||(n=t,Object.keys(n||{}).reduce((function(t,e){return t||a.hasOwnProperty(e)}),!1)&&(e=t,t={})),this.__opts__=r({},a,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=r({},c,t),this.__compiled__={},this.__tlds__=l,this.__tlds_replaced__=!1,this.re={},u(this)}f.prototype.add=function(t,e){return this.__schemas__[t]=e,u(this),this},f.prototype.set=function(t){return this.__opts__=r(this.__opts__,t),this},f.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;var e,n,r,o,i,s,a,c;if(this.re.schema_test.test(t))for((a=this.re.schema_search).lastIndex=0;null!==(e=a.exec(t));)if(o=this.testSchemaAt(t,e[2],a.lastIndex)){this.__schema__=e[2],this.__index__=e.index+e[1].length,this.__last_index__=e.index+e[0].length+o;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=t.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||c<this.__index__)&&null!==(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(i=n.index+n[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=n.index+n[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&t.indexOf("@")>=0&&null!==(r=t.match(this.re.email_fuzzy))&&(i=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=s)),this.__index__>=0},f.prototype.pretest=function(t){return this.re.pretest.test(t)},f.prototype.testSchemaAt=function(t,e,n){return this.__compiled__[e.toLowerCase()]?this.__compiled__[e.toLowerCase()].validate(t,n,this):0},f.prototype.match=function(t){var e=0,n=[];this.__index__>=0&&this.__text_cache__===t&&(n.push(h(this,e)),e=this.__last_index__);for(var r=e?t.slice(e):t;this.test(r);)n.push(h(this,e)),r=r.slice(this.__last_index__),e+=this.__last_index__;return n.length?n:null},f.prototype.tlds=function(t,e){return t=Array.isArray(t)?t:[t],e?(this.__tlds__=this.__tlds__.concat(t).sort().filter((function(t,e,n){return t!==n[e-1]})).reverse(),u(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,u(this),this)},f.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),"mailto:"!==t.schema||/^mailto:/i.test(t.url)||(t.url="mailto:"+t.url)},f.prototype.onCompile=function(){},t.exports=f},function(t,e,n){"use strict";t.exports=function(t){var e={};e.src_Any=n(6).source,e.src_Cc=n(7).source,e.src_Z=n(8).source,e.src_P=n(1).source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");return e.src_pseudo_letter="(?:(?![><|]|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|[><|]|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+e.src_ZCc+").|\\!(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy='(^|[><|]|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}},function(t,e,n){(function(t,r){var o;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
-/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){var a="object"==i(e)&&e&&!e.nodeType&&e,c="object"==i(t)&&t&&!t.nodeType&&t,l="object"==(void 0===r?"undefined":i(r))&&r;l.global!==l&&l.window!==l&&l.self!==l||(s=l);var u,p,h=2147483647,f=/^xn--/,d=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,y=String.fromCharCode;function b(t){throw new RangeError(v[t])}function k(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function w(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+k((t=t.replace(m,".")).split("."),e).join(".")}function x(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function C(t){return k(t,(function(t){var e="";return t>65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=y(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var r=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;r+=36)t=g(t/35);return g(r+36*t/(t+38))}function A(t){var e,n,r,o,i,s,a,c,l,u,p,f=[],d=t.length,m=0,v=128,y=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&b("not-basic"),f.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<d;){for(i=m,s=1,a=36;o>=d&&b("invalid-input"),((c=(p=t.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||c>g((h-m)/s))&&b("overflow"),m+=c*s,!(c<(l=a<=y?1:a>=y+26?26:a-y));a+=36)s>g(h/(u=36-l))&&b("overflow"),s*=u;y=S(m-i,e=f.length+1,0==i),g(m/e)>h-v&&b("overflow"),v+=g(m/e),m%=e,f.splice(m++,0,v)}return C(f)}function M(t){var e,n,r,o,i,s,a,c,l,u,p,f,d,m,v,k=[];for(f=(t=x(t)).length,e=128,n=0,i=72,s=0;s<f;++s)(p=t[s])<128&&k.push(y(p));for(r=o=k.length,o&&k.push("-");r<f;){for(a=h,s=0;s<f;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>g((h-n)/(d=r+1))&&b("overflow"),n+=(a-e)*d,e=a,s=0;s<f;++s)if((p=t[s])<e&&++n>h&&b("overflow"),p==e){for(c=n,l=36;!(c<(u=l<=i?1:l>=i+26?26:l-i));l+=36)v=c-u,m=36-u,k.push(y(_(u+v%m,0))),c=g(v/m);k.push(y(_(c,0))),i=S(n,d,r==o),n=0,++r}++n,++e}return k.join("")}if(u={version:"1.4.1",ucs2:{decode:x,encode:C},decode:A,encode:M,toASCII:function(t){return w(t,(function(t){return d.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return w(t,(function(t){return f.test(t)?A(t.slice(4).toLowerCase()):t}))}},"object"==i(n(12))&&n(12))void 0===(o=function(){return u}.call(e,n,e,t))||(t.exports=o);else if(a&&c)if(t.exports==a)c.exports=u;else for(p in u)u.hasOwnProperty(p)&&(a[p]=u[p]);else s.punycode=u}(this)}).call(this,n(65)(t),n(66))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},function(t,e,n){"use strict";t.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},a={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},s.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},s.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},s.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new s(r,this.size+t.size)},s.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,i=0;i<e;o++){var a=this.content[o],c=i+a.nodeSize;c>t&&((i<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-i),Math.min(a.text.length,e-i)):a.cut(Math.max(0,t-i-1),Math.min(a.content.size,e-i-1))),n.push(a),r+=a.nodeSize),i=c}return new s(n,r)},s.prototype.cutByIndex=function(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))},s.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new s(r,o)},s.prototype.addToStart=function(t){return new s([t].concat(this.content),this.size+t.nodeSize)},s.prototype.addToEnd=function(t){return new s(this.content.concat(t),this.size+t.nodeSize)},s.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},a.firstChild.get=function(){return this.content.length?this.content[0]:null},a.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},a.childCount.get=function(){return this.content.length},s.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},s.prototype.maybeChild=function(t){return this.content[t]},s.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},s.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},s.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),l=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var u=0,p=Math.min(a.text.length,c.text.length);u<p&&a.text[a.text.length-u-1]==c.text[c.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var h=t(a.content,c.content,r-1,o-1);if(h)return h}r-=l,o-=l}else r-=l,o-=l}}(this,t,e,n)},s.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?l(n+1,o):l(n,r);r=o}},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(t){return t.toJSON()})):null},s.fromJSON=function(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(e.map(t.nodeFromJSON))},s.fromArray=function(t){if(!t.length)return s.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new s(e||t,n)},s.from=function(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,a);var c={index:0,offset:0};function l(t,e){return c.index=t,c.offset=e,c}function u(t,e){if(t===e)return!0;if(!t||"object"!=i(t)||!e||"object"!=i(e))return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!u(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e&&u(t[o],e[o])))return!1;for(var s in e)if(!(s in t))return!1}return!0}s.empty=new s([],0);var p=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}p.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},p.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},p.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},p.prototype.eq=function(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)},p.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},p.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},p.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},p.setFrom=function(t){if(!t||0==t.length)return p.none;if(t instanceof p)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},p.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},d={size:{configurable:!0}};function m(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return function t(e,n,r,o){var i=e.index(o),a=e.node(o);if(i==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(i,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var l=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(s.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),u=l.start,p=l.end;return k(a,function t(e,n,r,o,i){var a=e.depth>i&&g(e,n,i+1),c=o.depth>i&&g(r,o,i+1),l=[];b(null,e,i,l),a&&c&&n.index(i)==r.index(i)?(v(a,c),y(k(a,t(e,n,r,o,i+1)),l)):(a&&y(k(a,w(e,n,i+1)),l),b(n,r,i,l),c&&y(k(c,w(r,o,i+1)),l));return b(o,null,i,l),new s(l)}(e,u,p,n,o))}var h=e.parent,f=h.content;return k(h,f.cut(0,e.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return k(a,w(e,n,o))}(t,e,n,0)}function v(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){var r=t.node(n);return v(r,e.node(n)),r}function y(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function b(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(y(t.nodeAfter,r),i++));for(var a=i;a<s;a++)y(o.child(a),r);e&&e.depth==n&&e.textOffset&&y(e.nodeBefore,r)}function k(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var r=[];(b(null,t,n,r),t.depth>n)&&y(k(g(t,e,n+1),w(t,e,n+1)),r);return b(e,null,n,r),new s(r)}d.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var l=t(c.content,n-a-1,r);return l&&e.replaceChild(s,c.copy(l))}(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),l=c.index,u=c.offset;if(s==n||a.isText){if(u!=r&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(s.fromJSON(t,e.content),e.openStart||0,e.openEnd||0)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,d),f.empty=new f(s.empty,0,0);var x=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};x.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},x.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},x.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},x.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},x.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},x.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},x.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},x.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},x.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},x.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},x.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},x.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new M(this,t,n)},x.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},x.prototype.max=function(t){return t.pos>this.pos?t:this},x.prototype.min=function(t){return t.pos<this.pos?t:this},x.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},x.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new x(e,n,o)},x.resolveCached=function(t,e){for(var n=0;n<_.length;n++){var r=_[n];if(r.pos==e&&r.doc==t)return r}var o=_[S]=x.resolve(t,e);return S=(S+1)%A,o},Object.defineProperties(x.prototype,C);var _=[],S=0,A=12,M=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},D={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};D.start.get=function(){return this.$from.before(this.depth+1)},D.end.get=function(){return this.$to.after(this.depth+1)},D.parent.get=function(){return this.$from.node(this.depth)},D.startIndex.get=function(){return this.$from.index(this.depth)},D.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(M.prototype,D);var E=Object.create(null),O=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||s.empty,this.marks=r||p.none},T={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}};T.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},T.childCount.get=function(){return this.content.childCount},O.prototype.child=function(t){return this.content.child(t)},O.prototype.maybeChild=function(t){return this.content.maybeChild(t)},O.prototype.forEach=function(t){this.content.forEach(t)},O.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},O.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},T.textContent.get=function(){return this.textBetween(0,this.content.size,"")},O.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},T.firstChild.get=function(){return this.content.firstChild},T.lastChild.get=function(){return this.content.lastChild},O.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},O.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},O.prototype.hasMarkup=function(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||E)&&p.sameSet(this.marks,n||p.none)},O.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},O.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},O.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},O.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},O.prototype.replace=function(t,e,n){return m(this.resolve(t),this.resolve(e),n)},O.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},O.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},O.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},O.prototype.resolve=function(t){return x.resolveCached(this,t)},O.prototype.resolveNoCache=function(t){return x.resolve(this,t)},O.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},T.isBlock.get=function(){return this.type.isBlock},T.isTextblock.get=function(){return this.type.isTextblock},T.inlineContent.get=function(){return this.type.inlineContent},T.isInline.get=function(){return this.type.isInline},T.isText.get=function(){return this.type.isText},T.isLeaf.get=function(){return this.type.isLeaf},T.isAtom.get=function(){return this.type.isAtom},O.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),z(this.marks,t)},O.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},O.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},O.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},O.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},O.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));this.content.forEach((function(t){return t.check()}))},O.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},O.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=s.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(O.prototype,T);var N=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):z(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(O);function z(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var q=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},I={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};q.parse=function(t,e){var n=new R(t,e);if(null==n.next)return q.empty;var r=L(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];J(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new q(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(J(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var l=n();return o(t(e.expr,i),l),o(t(e.expr,l),l),[r(l)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var u=i,p=0;p<e.min;p++){var h=n();o(t(e.expr,u),h),u=h}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var d=n();r(u,d),o(t(e.expr,u),d),u=d}return[r(u)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position")}}(o,n),o},q.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},q.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},I.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},I.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},q.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},q.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(i,a){var c=i.matchFragment(t,n);if(c&&(!e||c.validEnd))return s.from(a.map((function(t){return t.createAndFill()})));for(var l=0;l<i.next.length;l+=2){var u=i.next[l],p=i.next[l+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var h=o(p,a.concat(u));if(h)return h}}}(this,[])},q.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},q.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},I.edgeCount.get=function(){return this.next.length>>1},q.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},q.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(q.prototype,I),q.empty=new q(!0);var R=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.unshift()},F={next:{configurable:!0}};function L(t){var e=[];do{e.push(B(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function B(t){var e=[];do{e.push(P(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function P(t){for(var e=function(t){if(t.eat("(")){var e=L(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=$(t,e)}return e}function V(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function $(t,e){var n=V(t),r=n;return t.eat(",")&&(r="}"!=t.next?V(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j(t,e){return e-t}function J(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(j)}function H(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function W(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function U(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new Z(t[n]);return e}F.next.get=function(){return this.tokens[this.pos]},R.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},R.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(R.prototype,F);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=U(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},G={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};G.isInline.get=function(){return!this.isBlock},G.isTextblock.get=function(){return this.isBlock&&this.inlineContent},G.isLeaf.get=function(){return this.contentMatch==q.empty},G.isAtom.get=function(){return this.isLeaf||this.spec.atom},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new O(this,this.computeAttrs(t),s.from(e),p.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=s.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new O(this,this.computeAttrs(t),e,p.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=s.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(s.empty,!0);return o?new O(this,t,e.append(o),p.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.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 o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,G);var Z=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(Z.prototype,Y);var Q=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=U(r.attrs),this.rank=e,this.excluded=null;var o=H(this.attrs);this.instance=o&&new p(this,o)};Q.prototype.create=function(t){return!t&&this.instance?this.instance:new p(this,W(this.attrs,t))},Q.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Q(t,r++,e,o)})),n},Q.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t.slice(0,e).concat(t.slice(e+1));return t},Q.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Q.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var X=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=Q.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],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=q.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?tt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:tt(this,u.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 tt(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}X.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},X.prototype.text=function(t,e){var n=this.nodes.text;return new N(n,n.defaultAttrs,t,p.setFrom(e))},X.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},X.prototype.nodeFromJSON=function(t){return O.fromJSON(this,t)},X.prototype.markFromJSON=function(t){return p.fromJSON(this,t)},X.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var et=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)}))};et.prototype.parse=function(t,e){void 0===e&&(e={});var n=new at(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},et.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new at(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},et.prototype.matchTag=function(t,e){for(var n=0;n<this.tags.length;n++){var r=this.tags[n];if(lt(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){var o=r.getAttrs(t);if(!1===o)continue;r.attrs=o}return r}}},et.prototype.matchStyle=function(t,e,n){for(var r=0;r<this.styles.length;r++){var o=this.styles[r];if(!(0!=o.style.indexOf(t)||o.context&&!n.matchesContext(o.context)||o.style.length>t.length&&(61!=o.style.charCodeAt(t.length)||o.style.slice(t.length+1)!=e))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i}return o}}},et.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=ut(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=ut(t)),t.node=s}));return e},et.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new et(t,et.schemaRules(t)))};var nt={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},rt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0};function it(t){return(t?1:0)|("full"===t?2:0)}var st=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r};st.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(s.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},st.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=s.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},st.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):pt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var at=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=it(e.preserveWhitespace)|(n?4:0);r=o?new st(o.type,o.attrs,p.none,p.none,!0,e.topMatch||o.type.contentMatch,i):new st(n?null:t.schema.topNodeType,null,p.none,p.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ct={top:{configurable:!0},currentPos:{configurable:!0}};function lt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ut(t){var e={};for(var n in t)e[n]=t[n];return e}function pt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[];return function t(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var o=n.edge(r),s=o.type,a=o.next;if(s==e)return!0;if(i.indexOf(a)<0&&t(a))return!0}}(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ct.top.get=function(){return this.nodes[this.open]},at.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},at.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if((n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)2&n.options||(e=e.replace(/\r?\n|\r/g," "));else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},at.prototype.addElement=function(t){var e=t.nodeName.toLowerCase();ot.hasOwnProperty(e)&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ot.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var n=this.options.ruleFromNode&&this.options.ruleFromNode(t)||this.parser.matchTag(t,this);if(n?n.ignore:rt.hasOwnProperty(e))this.findInside(t);else if(!n||n.skip){n&&n.skip.nodeType&&(t=n.skip);var r,o=this.top,i=this.needsBlock;if(nt.hasOwnProperty(e))r=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),r&&this.sync(o),this.needsBlock=i}else this.addElementByRule(t,n)},at.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},at.prototype.readStyles=function(t){for(var e=p.none,n=0;n<t.length;n+=2){var r=this.parser.matchStyle(t[n],t[n+1],this);if(r){if(r.ignore)return null;e=this.parser.schema.marks[r.mark].create(r.attrs).addToSet(e)}}return e},at.prototype.addElementByRule=function(t,e){var n,r,o,i=this;e.node?(r=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(r.create(e.attrs))||this.leafFallback(t):n=this.enter(r,e.attrs,e.preserveWhitespace):(o=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(o));var s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return i.insertNode(t)}));else{var a=e.contentElement;"string"==typeof a?a=t.querySelector(a):"function"==typeof a&&(a=a(t)),a||(a=t),this.findAround(t,a,!0),this.addAll(a,n)}n&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},at.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&nt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},at.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},at.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},at.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},at.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:it(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new st(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},at.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},at.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},at.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ct.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},at.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},at.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},at.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},at.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},at.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function t(s,a){for(;s>=0;s--){var c=n[s];if(""==c){if(s==n.length-1||0==s)continue;for(;a>=i;a--)if(t(s-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0}(n.length-1,this.open)},at.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},at.prototype.addPendingMark=function(t){this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},at.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1?r.pendingMarks=t.removeFromSet(r.pendingMarks):r.activeMarks=t.removeFromSet(r.activeMarks),r==e)break}},Object.defineProperties(at.prototype,ct);var ht=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dt(t){return t.document||window.document}ht.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=dt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNode(t,e))})),n},ht.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=ht.renderSpec(dt(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},ht.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},ht.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&ht.renderSpec(dt(n),r(t,e))},ht.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var s=null,a=n?t.createElementNS(n,r):t.createElement(r),c=e[1],l=1;if(c&&"object"==i(c)&&null==c.nodeType&&!Array.isArray(c))for(var u in l=2,c)if(null!=c[u]){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):a.setAttribute(u,c[u])}for(var h=l;h<e.length;h++){var f=e[h];if(0===f){if(h<e.length-1||h>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var d=ht.renderSpec(t,f,n),m=d.dom,v=d.contentDOM;if(a.appendChild(m),v){if(s)throw new RangeError("Multiple content holes");s=v}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ht.marksFromSchema=function(t){return ft(t.marks)};var mt=Math.pow(2,16);function vt(t){return 65535&t}var gt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},yt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};yt.prototype.recover=function(t){var e=0,n=vt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/mt}(t)},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},yt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var h=s/3+(t-a)*mt;return new gt(p,e<0?t!=a:t!=u,h)}r+=l-c}return n?t+r:new gt(t+r)},yt.prototype.touches=function(t,e){for(var n=0,r=vt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},yt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},yt.prototype.invert=function(){return new yt(this.ranges,!this.inverted)},yt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},yt.offset=function(t){return 0==t?yt.empty:new yt(t<0?[0,-t,0]:[0,0,t])},yt.empty=new yt([]);var bt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function kt(t){var e=Error.call(this,t);return e.__proto__=kt.prototype,e}bt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new bt(this.maps,this.mirror,t,e)},bt.prototype.copy=function(){return new bt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},bt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},bt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},bt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},bt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},bt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},bt.prototype.invert=function(){var t=new bt;return t.appendMappingInverted(this),t},bt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},bt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},bt.prototype._map=function(t,e,n){for(var r=!1,o=null,i=this.from;i<this.to;i++){var s=this.maps[i],a=o&&o[i];if(null!=a&&s.touches(t,a))t=s.recover(a);else{var c=s.mapResult(t,e);if(null!=c.recover){var l=this.getMirror(i);if(null!=l&&l>i&&l<this.to){if(c.deleted){i=l,t=this.maps[l].recover(c.recover);continue}(o||(o=Object.create(null)))[l]=c.recover}}c.deleted&&(r=!0),t=c.pos}}return n?t:new gt(t,r)},kt.prototype=Object.create(Error.prototype),kt.prototype.constructor=kt,kt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bt},xt={before:{configurable:!0},docChanged:{configurable:!0}};function Ct(){throw new Error("Override me")}xt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new kt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},xt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,xt);var _t=Object.create(null),St=function(){};St.prototype.apply=function(t){return Ct()},St.prototype.getMap=function(){return yt.empty},St.prototype.invert=function(t){return Ct()},St.prototype.map=function(t){return Ct()},St.prototype.merge=function(t){return null},St.prototype.toJSON=function(){return Ct()},St.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=_t[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},St.jsonID=function(t,e){if(t in _t)throw new RangeError("Duplicate use of step JSON ID "+t);return _t[t]=e,e.prototype.jsonID=t,e};var At=function(t,e){this.doc=t,this.failed=e};At.ok=function(t){return new At(t,null)},At.fail=function(t){return new At(null,t)},At.fromReplace=function(t,e,n,r){try{return At.ok(t.replace(e,n,r))}catch(t){if(t instanceof h)return At.fail(t.message);throw t}};var Mt=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Et(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new yt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure!=this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?f.empty:new f(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?f.empty:new f(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,f.fromJSON(t,n.slice),!!n.structure)},e}(St);St.jsonID("replace",Mt);var Dt=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Et(t,this.from,this.gapFrom)||Et(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return At.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?At.fromReplace(t,this.from,this.to,n):At.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,f.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(St);function Et(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Ot(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Tt(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Ot(r,o,i))break}}function Nt(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(zt).concat({type:e,attrs:n}).concat(i.map(zt)):null}function zt(t){return{type:t,attrs:null}}function qt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),h=r&&r[c]||l;if(h!=l&&(p=p.replaceChild(0,h.type.create(h.attrs))),!l.canReplace(u+1,l.childCount)||!h.type.validContent(p))return!1}var f=o.indexAfter(i),d=r&&r[0];return o.node(i).canReplaceWith(f,f,d?d.type:o.node(i+1).type)}function It(t,e){var n=t.resolve(e),r=n.index();return Rt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Ft(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Rt(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function Lt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Bt(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Bt(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return s.fromArray(r)}St.jsonID("replaceAround",Dt),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,i=n.before(o+1),a=r.after(o+1),c=i,l=a,u=s.empty,p=0,h=o,d=!1;h>e;h--)d||n.index(h)>0?(d=!0,u=s.from(n.node(h).copy(u)),p++):c--;for(var m=s.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,m=s.from(r.node(g).copy(m)),v++):l++;return this.step(new Dt(c,l,i,a,new f(u.append(m),p,v),u.size-p,!0))},wt.prototype.wrap=function(t,e){for(var n=s.empty,r=e.length-1;r>=0;r--)n=s.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Dt(o,i,o,i,new f(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var a=o.mapping.slice(i),c=a.map(e,1),l=a.map(e+t.nodeSize,1);return o.step(new Dt(c,l,c+1,l-1,new f(s.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Dt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new f(s.from(i),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=s.empty,i=s.empty,a=r.depth,c=r.depth-e,l=e-1;a>c;a--,l--){o=s.from(r.node(a).copy(o));var u=n&&n[l];i=s.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Mt(t,t,new f(o.append(i),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Mt(t-e,t+e,f.empty,!0);return this.step(n)};var Pt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new f(Bt(n.content,(function(t,n){return n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);St.jsonID("addMark",Pt);var Vt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new f(Bt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Pt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);function $t(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=f.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);if(Ht(o,i,r))return new Mt(e,n,r);var a=function(t,e){var n=function t(e,n,r,o){var i=s.empty,a=0,c=r[n];if(e.depth>n){var l=t(e,n+1,r,o||c);a=l.openEnd+1,i=s.from(e.node(n+1).copy(l.content))}c&&(i=i.append(c.content),a=c.openEnd);o&&(i=i.append(e.node(n).contentMatchAt(e.indexAfter(n)).fillBefore(s.empty,!0)),a=0);return{content:i,openEnd:a}}(t,0,e,!1),r=n.content,o=n.openEnd;return new f(r,t.depth,o||0)}(o,function(t,e){for(var n=new Wt(t),r=1;e.size&&r<=3;r++){var o=n.placeSlice(e.content,e.openStart,e.openEnd,r);3==r&&o!=e&&o.size&&(r=0),e=o}for(;n.open.length;)n.closeNode();return n.placed}(o,r)),c=Jt(o,i,a);if(!c)return null;if(a.size!=c.size&&function(t,e,n){if(!e.parent.isTextblock)return!1;var r,o=n.openEnd?function(t,e){for(var n=1;n<e;n++)t=t.lastChild.content;return t.lastChild}(n.content,n.openEnd):t.node(t.depth-(n.openStart-n.openEnd));if(!o.isTextblock)return!1;for(var i=e.index();i<e.parent.childCount;i++)if(!o.type.allowsMarks(e.parent.child(i).marks))return!1;n.openEnd?r=o.contentMatchAt(o.childCount):(r=o.contentMatchAt(o.childCount),n.size&&(r=r.matchFragment(n.content,n.openStart?1:0)));return(r=r.matchFragment(e.parent.content,e.index()))&&r.validEnd}(o,i,a)){for(var l=i.depth,u=i.after(l);l>1&&u==i.end(--l);)++u;var p=Jt(o,t.resolve(u),a);if(p)return new Dt(e,u,n,i.end(),p,a.size)}return c.size||e!=n?new Mt(e,n,c):null}function jt(t,e,n,r,o,i,a){var c,l=t.childCount,u=l-(a>0?1:0),p=i<0?e:n.node(o);c=i<0?p.contentMatchAt(u):1==l&&a>0?p.contentMatchAt(i?n.index(o):n.indexAfter(o)):p.contentMatchAt(n.indexAfter(o)).matchFragment(t,l>0&&i?1:0,u);var h=r.node(o);if(a>0&&o<r.depth){var f=h.content.cutByIndex(r.indexAfter(o)).addToStart(t.lastChild),d=c.fillBefore(f,!0);if(d&&d.size&&i>0&&1==l&&(d=null),d){var m=jt(t.lastChild.content,t.lastChild,n,r,o+1,1==l?i-1:-1,a-1);if(m){var v=t.lastChild.copy(m);return d.size?t.cutByIndex(0,l-1).append(d).addToEnd(v):t.replaceChild(l-1,v)}}}a>0&&(c=c.matchType((1==l&&i>0?n.node(o+1):t.lastChild).type));var g=r.index(o);if(g==h.childCount&&!h.type.compatibleContent(e.type))return null;for(var y=c.fillBefore(h.content,!0,g),b=g;y&&b<h.content.childCount;b++)p.type.allowsMarks(h.content.child(b).marks)||(y=null);if(!y)return null;if(a>0){var k=function t(e,n,r,o,i){var a,c=e.content,l=c.childCount;a=i>=0?r.node(o).contentMatchAt(r.indexAfter(o)).matchFragment(c,i>0?1:0,l):e.contentMatchAt(l);if(n>0){var u=t(c.lastChild,n-1,r,o+1,1==l?i-1:-1);c=c.replaceChild(l-1,u)}return e.copy(c.append(a.fillBefore(s.empty,!0)))}(t.lastChild,a-1,n,o+1,1==l?i-1:-1);t=t.replaceChild(l-1,k)}return t=t.append(y),r.depth>o&&(t=t.addToEnd(function t(e,n){var r=e.node(n),o=r.contentMatchAt(0).fillBefore(r.content,!0,e.index(n));e.depth>n&&(o=o.addToEnd(t(e,n+1)));return r.copy(o)}(r,o+1))),t}function Jt(t,e,n){var r=jt(n.content,t.node(0),t,e,0,n.openStart,n.openEnd);return r?function(t,e,n){for(;e>0&&n>0&&1==t.childCount;)t=t.firstChild.content,e--,n--;return new f(t,e,n)}(r,n.openStart,e.depth):null}function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}St.jsonID("removeMark",Vt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),h=Math.min(c+r.nodeSize,e),f=n.addToSet(u),d=0;d<u.length;d++)u[d].isInSet(f)||(s&&s.to==p&&s.mark.eq(u[d])?s.to=h:o.push(s=new Vt(p,h,u[d])));a&&a.to==p?a.to=h:i.push(a=new Pt(p,h,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof Q){var c=n.isInSet(r.marks);c&&(a=[c])}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var l=Math.min(s+r.nodeSize,e),u=0;u<a.length;u++){for(var p=a[u],h=void 0,f=0;f<o.length;f++){var d=o[f];d.step==i-1&&p.eq(o[f].style)&&(h=d)}h?(h.to=l,h.step=i):o.push({style:p,from:Math.max(s,t),to:l,step:i})}}})),o.forEach((function(t){return r.step(new Vt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],i=t+1,a=0;a<r.childCount;a++){var c=r.child(a),l=i+c.nodeSize,u=n.matchType(c.type,c.attrs);if(u){n=u;for(var p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||this.step(new Vt(i,l,c.marks[p]))}else o.push(new Mt(i,l,f.empty));i=l}if(!n.validEnd){var h=n.fillBefore(s.empty,!0);this.replace(i,i,new f(h,0,0))}for(var d=o.length-1;d>=0;d--)this.step(o[d]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=f.empty);var r=$t(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new f(s.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,f.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Wt=function(t){this.open=[];for(var e=0;e<=t.depth;e++){var n=t.node(e),r=n.contentMatchAt(t.indexAfter(e));this.open.push({parent:n,match:r,content:s.empty,wrapper:!1,openEnd:0,depth:e})}this.placed=[]};function Ut(t,e,n){var r=t.content;if(e>1){var o=Ut(t.firstChild,e-1,1==t.childCount?n-1:0);r=t.content.replaceChild(0,o)}var i=t.type.contentMatch.fillBefore(r,0==n);return t.copy(i.append(r))}function Kt(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(Kt(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(s.empty,!0))}return t}function Gt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}function Zt(t){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Wt.prototype.placeSlice=function(t,e,n,r,o){if(e>0){var i=t.firstChild,a=this.placeSlice(i.content,Math.max(0,e-1),n&&1==t.childCount?n-1:0,r,i);a.content!=i.content&&(a.content.size?(t=t.replaceChild(0,i.copy(a.content)),e=a.openStart+1):(1==t.childCount&&(n=0),t=t.cutByIndex(1),e=0))}var c=this.placeContent(t,e,n,r,o);if(r>2&&c.size&&0==e){var l=c.content.firstChild,u=1==c.content.childCount;this.placeContent(l.content,0,n&&u?n-1:0,r,l),c=u?s.empty:new f(c.content.cutByIndex(1),0,n)}return c},Wt.prototype.placeContent=function(t,e,n,r,o){for(var i=0;i<t.childCount;i++){for(var a=t.child(i),c=!1,l=i==t.childCount-1,u=this.open.length-1;u>=0;u--){var p=this.open[u],h=void 0;if(r>1&&(h=p.match.findWrapping(a.type))&&(!o||!h.length||h[h.length-1]!=o.type)){for(;this.open.length-1>u;)this.closeNode();for(var d=0;d<h.length;d++)p.match=p.match.matchType(h[d]),u++,p={parent:h[d].create(),match:h[d].contentMatch,content:s.empty,wrapper:!0,openEnd:0,depth:u+d},this.open.push(p)}var m=p.match.matchType(a.type);if(!m){var v=p.match.fillBefore(s.from(a));if(!v){if(o&&p.match.matchType(o.type))break;continue}for(var g=0;g<v.childCount;g++){var y=v.child(g);this.addNode(p,y,0),m=p.match.matchFragment(y)}}for(;this.open.length-1>u;)this.closeNode();a=a.mark(p.parent.type.allowedMarks(a.marks)),e&&(a=Ut(a,e,l?n:0),e=0),this.addNode(p,a,l?n:0),p.match=m,l&&(n=0),c=!0;break}if(!c)break}return this.open.length>1&&(i>0&&i==t.childCount||o&&this.open[this.open.length-1].parent.type==o.type)&&this.closeNode(),new f(t.cutByIndex(i),e,n)},Wt.prototype.addNode=function(t,e,n){var r,o;t.content=(r=t.content,o=t.openEnd,o?r.replaceChild(r.childCount-1,function t(e,n){var r=e.content;if(n>1){var o=t(e.lastChild,n-1);r=e.content.replaceChild(e.childCount-1,o)}var i=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(i))}(r.lastChild,o)):r).addToEnd(e),t.openEnd=n},Wt.prototype.closeNode=function(){var t=this.open.pop();0==t.content.size||(t.wrapper?this.addNode(this.open[this.open.length-1],t.parent.copy(t.content),t.openEnd+1):this.placed[t.depth]={depth:t.depth,content:t.content,openEnd:t.openEnd})},wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new Mt(t,e,n));var i=Gt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],h=n.openStart,d=n.content,m=0;;m++){var v=d.firstChild;if(p.push(v),m==n.openStart)break;d=v.content}h>0&&p[h-1].type.spec.defining&&r.node(u).type!=p[h-1].type?h-=1:h>=2&&p[h-1].isTextblock&&p[h-2].type.spec.defining&&r.node(u).type!=p[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=p[y];if(b)for(var k=0;k<i.length;k++){var w=i[(k+u)%i.length],x=!0;w<0&&(x=!1,w=-w);var C=r.node(w-1),_=r.index(w-1);if(C.canReplaceWith(_,_,b.type,b.marks))return this.replace(r.before(w),x?o.after(w):e,new f(Kt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,A=i.length-1;A>=0&&(this.replace(t,e,n),!(this.steps.length>S));A--){var M=i[A];A<0||(t=r.before(M),e=o.after(M))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new f(s.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Gt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Yt=Object.create(null),Qt=function(t,e,n){this.ranges=n||[new te(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Xt={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Xt.anchor.get=function(){return this.$anchor.pos},Xt.head.get=function(){return this.$head.pos},Xt.from.get=function(){return this.$from.pos},Xt.to.get=function(){return this.$to.pos},Xt.$from.get=function(){return this.ranges[0].$from},Xt.$to.get=function(){return this.ranges[0].$to},Xt.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},Qt.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Qt.prototype.replace=function(t,e){void 0===e&&(e=f.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],l=c.$from,u=c.$to,p=t.mapping.slice(i);t.replaceRange(p.map(l.pos),p.map(u.pos),a?f.empty:e),0==a&&ce(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Qt.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),ce(t,n,e.isInline?-1:1))}},Qt.findFrom=function(t,e,n){var r=t.parent.inlineContent?new ee(t):ae(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?ae(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):ae(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Qt.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ie(t.node(0))},Qt.atStart=function(t){return ae(t,t,0,0,1)||new ie(t)},Qt.atEnd=function(t){return ae(t,t,t.content.size,t.childCount,-1)||new ie(t)},Qt.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Yt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Qt.jsonID=function(t,e){if(t in Yt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Yt[t]=e,e.prototype.jsonID=t,e},Qt.prototype.getBookmark=function(){return ee.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Qt.prototype,Xt),Qt.prototype.visible=!0;var te=function(t,e){this.$from=t,this.$to=e},ee=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),t.prototype.replace.call(this,e,n),n==f.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new ne(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(Qt);Qt.jsonID("text",ee);var ne=function(t,e){this.anchor=t,this.head=e};ne.prototype.map=function(t){return new ne(t.map(this.anchor),t.map(this.head))},ne.prototype.resolve=function(t){return ee.between(t.resolve(this.anchor),t.resolve(this.head))};var re=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new f(s.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new oe(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(Qt);re.prototype.visible=!1,Qt.jsonID("node",re);var oe=function(t){this.anchor=t};oe.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new ne(r,r):new oe(r)},oe.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&re.isSelectable(n)?new re(e):Qt.near(e)};var ie=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return se},e}(Qt);Qt.jsonID("all",ie);var se={map:function(){return this},resolve:function(t){return new ie(t)}};function ae(t,e,n,r,o,i){if(e.inlineContent)return ee.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&re.isSelectable(a))return re.create(t,n-(o<0?a.nodeSize:0))}else{var c=ae(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ce(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Mt||i instanceof Dt)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(Qt.near(t.doc.resolve(o),n))}}var le=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;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},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return p.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Qt.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function ue(t,e){return e&&t?t.bind(e):t}var pe=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},he=[new pe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new pe("selection",{init:function(t,e){return t.selection||Qt.atStart(e.doc)},apply:function(t){return t.selection}}),new pe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],fe=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new pe(t.key,t.spec.state,t))}))},de=function(t){this.config=t},me={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};me.schema.get=function(){return this.config.schema},me.plugins.get=function(){return this.config.plugins},de.prototype.apply=function(t){return this.applyTransaction(t).state},de.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},de.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},de.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new de(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<ve.length;i++)ve[i](this,t,e);return e},me.tr.get=function(){return new le(this)},de.create=function(t){for(var e=new fe(t.schema||t.doc.type.schema,t.plugins),n=new de(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},de.prototype.reconfigure=function(t){for(var e=new fe(t.schema||this.schema,t.plugins),n=e.fields,r=new de(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},de.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==Zt(t))for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},de.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new fe(t.schema,t.plugins),o=new de(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=O.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=Qt.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},de.addApplyListener=function(t){ve.push(t)},de.removeApplyListener=function(t){var e=ve.indexOf(t);e>-1&&ve.splice(e,1)},Object.defineProperties(de.prototype,me);var ve=[];var ge=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:be("plugin")};ge.prototype.getState=function(t){return t[this.key]};var ye=Object.create(null);function be(t){return t in ye?t+"$"+ ++ye[t]:(ye[t]=0,t+"$")}var ke=function(t){void 0===t&&(t="key"),this.key=be(t)};ke.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ke.prototype.getState=function(t){return t[this.key]};var we={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var xe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);we.mac=/Mac/.test(navigator.platform);var Se=we.ie=!!(Ce||_e||xe);we.ie_version=Ce?document.documentMode||6:_e?+_e[1]:xe?+xe[1]:null,we.gecko=!Se&&/gecko\/(\d+)/i.test(navigator.userAgent),we.gecko_version=we.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Ae=!Se&&/Chrome\/(\d+)/.exec(navigator.userAgent);we.chrome=!!Ae,we.chrome_version=Ae&&+Ae[1],we.ios=!Se&&/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),we.android=/Android \d/.test(navigator.userAgent),we.webkit=!Se&&"WebkitAppearance"in document.documentElement.style,we.safari=/Apple Computer/.test(navigator.vendor),we.webkit_version=we.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Me=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},De=function(t){var e=t.parentNode;return e&&11==e.nodeType?e.host:e},Ee=function(t,e,n){var r=document.createRange();return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Oe=function(t,e,n,r){return n&&(Ne(t,e,n,r,-1)||Ne(t,e,n,r,1))},Te=/^(img|br|input|textarea|hr)$/i;function Ne(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:ze(t))){var i=t.parentNode;if(1!=i.nodeType||qe(t)||Te.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Me(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?ze(t):0}}}function ze(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function qe(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Ie=function(t){var e=t.isCollapsed;return e&&we.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Re(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Le(t,e){return"number"==typeof t?t:t[e]}function Be(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=i.defaultView,a=n||t.dom;a;a=De(a))if(1==a.nodeType){var c=a==i.body||1!=a.nodeType,l=c?Fe(s):a.getBoundingClientRect(),u=0,p=0;if(e.top<l.top+Le(r,"top")?p=-(l.top-e.top+Le(o,"top")):e.bottom>l.bottom-Le(r,"bottom")&&(p=e.bottom-l.bottom+Le(o,"bottom")),e.left<l.left+Le(r,"left")?u=-(l.left-e.left+Le(o,"left")):e.right>l.right-Le(r,"right")&&(u=e.right-l.right+Le(o,"right")),(u||p)&&(c?s.scrollBy(u,p):(p&&(a.scrollTop+=p),u&&(a.scrollLeft+=u),e={left:e.left-u,top:e.top-p,right:e.right-u,bottom:e.bottom-p})),c)break}}function Pe(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=De(t));return e}function Ve(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var $e=null;function je(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=Ee(c).getClientRects()}for(var p=0;p<u.length;p++){var h=u[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);var f=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:h.right<e.left?h.right:h.left,top:e.top}:e,1==c.nodeType&&f&&(i=l+(e.left>=(h.left+h.right)/2?1:0));continue}}!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=We(r,1);if(i.top!=i.bottom&&Je(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:je(n,r)}function Je(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function He(t,e){var n,r,o,i,s=t.root;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var l,u=s.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!Je(e,p))return null;if(!(u=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),l=0;l<c.length;l++){var u=c[l];if(Je(n,u))return t(a,n,u)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,p)))return null}if(u=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(u,e),o){if(we.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var h,f=o.childNodes[i];"IMG"==f.nodeName&&(h=f.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=je(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var d=t.docView.nearestDesc(u,!0);return{pos:l,inside:d?d.posAtStart-d.border:-1}}function We(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function Ue(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset;if(3==r.nodeType&&(we.chrome||we.gecko)){var i=We(Ee(r,o,o),0);if(we.gecko&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){var s=We(Ee(r,o-1,o-1),-1);if(Math.abs(s.left-i.left)<1&&s.top==i.top){var a=We(Ee(r,o,o+1),-1);return Ke(a,a.left<s.left)}}return i}if(1==r.nodeType&&!t.state.doc.resolve(e).parent.inlineContent){var c,l=!0;if(o<r.childNodes.length){var u=r.childNodes[o];1==u.nodeType&&(c=u.getBoundingClientRect())}if(!c&&o){var p=r.childNodes[o-1];1==p.nodeType&&(c=p.getBoundingClientRect(),l=!1)}return function(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}(c||r.getBoundingClientRect(),l)}for(var h=-1;h<2;h+=2)if(h<0&&o){var f=void 0,d=3==r.nodeType?Ee(r,o-1,o):3==(f=r.childNodes[o-1]).nodeType?Ee(f):1==f.nodeType&&"BR"!=f.nodeName?f:null;if(d){var m=We(d,1);if(m.top<m.bottom)return Ke(m,!1)}}else if(h>0&&o<ze(r)){var v=void 0,g=3==r.nodeType?Ee(r,o,o+1):3==(v=r.childNodes[o]).nodeType?Ee(v):1==v.nodeType?v:null;if(g){var y=We(g,-1);if(y.top<y.bottom)return Ke(y,!0)}}return Ke(We(3==r.nodeType?Ee(r):r,0),!1)}function Ke(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ge(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o.focus()}}var Ze=/[\u0590-\u08ac]/;var Ye=null,Qe=null,Xe=!1;function tn(t,e,n){return Ye==e&&Qe==n?Xe:(Ye=e,Qe=n,Xe="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$anchor.min(r.$head):r.$anchor.max(r.$head);return Ge(t,e,(function(){for(var e=t.docView.domFromPos(o.pos).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Ue(t,o.pos),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=Ee(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top&&("up"==n?l.bottom<i.top+1:l.top>i.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return Ze.test(r.parent.textContent)&&a.modify?Ge(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var en=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},nn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0}};en.prototype.matchesWidget=function(){return!1},en.prototype.matchesMark=function(){return!1},en.prototype.matchesNode=function(){return!1},en.prototype.matchesHack=function(){return!1},nn.beforePosition.get=function(){return!1},en.prototype.parseRule=function(){return null},en.prototype.stopEvent=function(){return!1},nn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},nn.border.get=function(){return 0},en.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},en.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},nn.posBefore.get=function(){return this.parent.posBeforeChild(this)},nn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},nn.posAfter.get=function(){return this.posBefore+this.size},nn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},en.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},en.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(t):o.nodeDOM==t))return o;n=!1}}},en.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},en.prototype.posFromDOM=function(t,e,n){for(var r=t;;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}},en.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},en.prototype.domFromPos=function(t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var e=0,n=0;;n++){if(e==t){for(;n<this.children.length&&(this.children[n].beforePosition||this.children[n].dom.parentNode!=this.contentDOM);)n++;return{node:this.contentDOM,offset:n==this.children.length?this.contentDOM.childNodes.length:Me(this.children[n].dom)}}if(n==this.children.length)throw new Error("Invalid position "+t);var r=this.children[n],o=e+r.size;if(t<o)return r.domFromPos(t-e-r.border);e=o}},en.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Me(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&e<=c){e=c;for(var h=s+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Me(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},en.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},en.prototype.domAfterPos=function(t){var e=this.domFromPos(t),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},en.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],l=a+c.size;if(o>a&&i<l)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=l}var u=this.domFromPos(t),p=this.domFromPos(e),h=n.getSelection(),f=document.createRange();if(r||!Oe(u.node,u.offset,h.anchorNode,h.anchorOffset)||!Oe(p.node,p.offset,h.focusNode,h.focusOffset)){if(h.extend)f.setEnd(u.node,u.offset),f.collapse(!1);else{if(t>e){var d=u;u=p,p=d}f.setEnd(p.node,p.offset),f.setStart(u.node,u.offset)}h.removeAllRanges(),h.addRange(f),h.extend&&h.extend(p.node,p.offset)}},en.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},nn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},en.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},en.prototype.markParentsDirty=function(){for(var t=this.parent;t;t=t.parent){t.dirty<2&&(t.dirty=2)}},Object.defineProperties(en.prototype,nn);var rn=[],on=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,rn,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={beforePosition:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},Object.defineProperties(e.prototype,n),e}(en),sn=function(t){function e(e,n,r,o){t.call(this,e,rn,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(en),an=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=ht.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,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}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Cn(i,n,s,r)),t>0&&(i=Cn(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(en),cn=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?rn:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,l=i.nodeViews[n.type.name],u=l&&l(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r),p=u&&u.dom,h=u&&u.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(a=ht.renderSpec(document,n.type.spec.toDOM(n))).dom,h=a.contentDOM);h||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=yn(p,r,n),u?c=new hn(t,n,r,o,p,h,f,u,i,s+1):n.isText?new un(t,n,r,o,p,f,i):new e(t,n,r,o,p,h,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?s.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&bn(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=r&&t.composing&&this.localCompositionNode(t,e),s=new wn(this,i&&i.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var h=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[h])).push(o[c++]);if(f){f.sort(xn);for(var d=0;d<f.length;d++)n(f[d],p,!!u)}else n(h,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from==i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var k=0;k<l.length;k++)l[k].to<b&&(b=l[k].to);b<y&&(u=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}r(m,l.length?l.slice():rn,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?s.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&s.syncToMarks(i==n.node.childCount?p.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(rn,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),this.renderChildren())},e.prototype.renderChildren=function(){!function t(e,n){for(var r=e.firstChild,o=0;o<n.length;o++){var i=n[o],s=i.dom;if(s.parentNode==e){for(;s!=r;)r=kn(r);r=r.nextSibling}else e.insertBefore(s,r);if(i instanceof an){var a=r?r.previousSibling:e.lastChild;t(i.contentDOM,i.children),r=a?a.nextSibling:e.firstChild}}for(;r;)r=kn(r)}(this.contentDOM,this.children),we.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom)},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof ee)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=ze(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new sn(this,i,n,o);t.compositionNodes.push(s),this.children=Cn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!bn(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=vn(this.dom,this.nodeDOM,mn(this.outerDeco,this.node,e),mn(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!1)},Object.defineProperties(e.prototype,n),e}(en);function ln(t,e,n,r,o){return yn(r,e,t),new cn(null,t,e,n,r,r,r,o,0)}var un=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{skip:this.nodeDOM.parentNode||!0}},e.prototype.update=function(t,e){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e}(cn),pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},e}(en),hn=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(cn);function fn(t){t&&(this.nodeName=t)}fn.prototype=Object.create(null);var dn=[new fn];function mn(t,e,n){if(0==t.length)return dn;for(var r=n?dn[0]:new fn,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs,a=r;if(s)for(var c in s.nodeName&&o.push(a=new fn(s.nodeName)),s){var l=s[c];null!=l&&(n&&1==o.length&&o.push(a=r=new fn(e.isInline?"span":"div")),"class"==c?a.class=(a.class?a.class+" ":"")+l:"style"==c?a.style=(a.style?a.style+";":"")+l:"nodeName"!=c&&(a[c]=l))}}return o}function vn(t,e,n,r){if(n==dn&&r==dn)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).appendChild(o),a=dn[0]),o=c}gn(o,a||dn[0],s)}return o}function gn(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" "):rn,s=n.class?n.class.split(" "):rn,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c])}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function yn(t,e,n){return vn(t,t,dn,mn(e,n,1!=t.nodeType))}function bn(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function kn(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var wn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1;var n=function(t,e){for(var n=[],r=t.childCount,o=e.length-1;r>0&&o>=0;o--){var i=e[o],s=i.node;if(s){if(s!=t.child(r-1))break;n.push(i),--r}}return{nodes:n.reverse(),offset:r}}(t.node.content,t.children);this.preMatched=n.nodes,this.preMatchOffset=n.offset};function xn(t,e){return t.type.side-e.type.side}function Cn(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function _n(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Qt.findFrom(s,e)}function Sn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function An(t,e,n){var r=t.state.selection;if(r instanceof ee){if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var o=_n(t.state,e);return!!(o&&o instanceof re)&&Sn(t,o)}var i,s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText)return!1;var c=e<0?s.pos-a.nodeSize:s.pos;return!!(a.isAtom||(i=t.docView.descAt(c))&&!i.contentDOM)&&(re.isSelectable(a)?Sn(t,new re(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):!!we.webkit&&Sn(t,new ee(t.state.doc.resolve(e<0?c:c+a.nodeSize))))}if(r instanceof re&&r.node.isInline)return Sn(t,new ee(e>0?r.$to:r.$from));var l=_n(t.state,e);return!!l&&Sn(t,l)}function Mn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Dn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function En(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(we.gecko&&1==n.nodeType&&r<Mn(n)&&Dn(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Dn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Tn(n))break;for(var c=n.previousSibling;c&&Dn(c);)o=n.parentNode,i=Me(c),c=c.previousSibling;if(c)r=Mn(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Nn(t,e,n,r):o&&Nn(t,e,o,i)}}function On(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Mn(n);;)if(r<s){if(1!=n.nodeType)break;if(!Dn(n.childNodes[r]))break;o=n,i=++r}else{if(Tn(n))break;for(var a=n.nextSibling;a&&Dn(a);)o=a.parentNode,i=Me(a)+1,a=a.nextSibling;if(a)r=0,s=Mn(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Nn(t,e,o,i)}}function Tn(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Nn(t,e,n,r){if(Ie(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection()}function zn(t,e,n){var r=t.state.selection;if(r instanceof ee&&!r.empty||n.indexOf("s")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=_n(t.state,e);if(s&&s instanceof re)return Sn(t,s)}if(!o.parent.inlineContent){var a=Qt.findFrom(e<0?o:i,e);return!a||Sn(t,a)}return!1}function qn(t,e){if(!(t.state.selection instanceof ee))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function In(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Rn(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||we.mac&&72==n&&"c"==r?qn(t,-1)||En(t):46==n||we.mac&&68==n&&"c"==r?qn(t,1)||On(t):13==n&&!we.ios||27==n||(37==n?An(t,-1,r)||En(t):39==n?An(t,1,r)||On(t):38==n?zn(t,-1,r)||En(t):40==n?function(t){if(we.chrome&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;In(t,o,!0),setTimeout((function(){return In(t,o,!1)}),20)}}}(t)||zn(t,1,r)||On(t):r==(we.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Fn(t,e){var n,r,o=t.root.getSelection(),i=t.state.doc,s=t.docView.nearestDesc(o.focusNode),a=s&&0==s.size,c=t.docView.posFromDOM(o.focusNode,o.focusOffset),l=i.resolve(c);if(Ie(o)){for(n=l;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&re.isSelectable(s.node)&&s.parent&&(!s.node.isInline||!function(t,e,n){for(var r=0==e,o=e==ze(t);r||o;){if(t==n)return!0;var i=Me(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==ze(t)}}(o.focusNode,o.focusOffset,s.dom))){var u=s.posBefore;r=new re(c==u?l:i.resolve(u))}}else n=i.resolve(t.docView.posFromDOM(o.anchorNode,o.anchorOffset));r||(r=Hn(t,n,l,"pointer"==e||t.state.selection.head<l.pos&&!a?1:-1));return r}function Ln(t,e){var n=t.state.selection;if(jn(t,n),t.editable?t.hasFocus():Wn(t)&&document.activeElement.contains(t.dom)){if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,Me(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&we.ie&&we.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,s=n.head;!Bn||n instanceof ee||(n.$from.parent.inlineContent||(r=Pn(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Pn(t,n.to))),t.docView.setSelection(i,s,t.root,e),Bn&&(r&&$n(r),o&&$n(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):i!=s&&(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),t.dom.classList.remove("ProseMirror-hideselection"))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}wn.prototype.getPreMatch=function(t){return t>=this.preMatchOffset?this.preMatched[t-this.preMatchOffset]:null},wn.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},wn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},wn.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=an.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},wn.prototype.findNodeMatch=function(t,e,n,r){var o=-1,i=r<0?void 0:this.getPreMatch(r),s=this.top.children;if(i&&i.matchesNode(t,e,n))o=s.indexOf(i);else for(var a=this.index,c=Math.min(s.length,a+5);a<c;a++){var l=s[a];if(l.matchesNode(t,e,n)&&this.preMatched.indexOf(l)<0){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},wn.prototype.updateNextNode=function(t,e,n,r,o){if(this.index==this.top.children.length)return!1;var i=this.top.children[this.index];if(i instanceof cn){var s=this.preMatched.indexOf(i);if(s>-1&&s+this.preMatchOffset!=o)return!1;var a=i.dom;if(!(this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))&&!(t.isText&&i.node&&i.node.isText&&i.nodeDOM.nodeValue==t.text&&3!=i.dirty&&bn(e,i.outerDeco)))&&i.update(t,e,n,r))return i.dom!=a&&(this.changed=!0),this.index++,!0}return!1},wn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,cn.create(this.top,t,e,n,r,o)),this.changed=!0},wn.prototype.placeWidget=function(t,e,n){if(this.index<this.top.children.length&&this.top.children[this.index].matchesWidget(t))this.index++;else{var r=new on(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}},wn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof an;)t=t.children[t.children.length-1];if(!t||!(t instanceof un)||/\n$/.test(t.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var e=document.createElement("br");this.top.children.splice(this.index++,0,new pn(this.top,rn,e,null)),this.changed=!0}};var Bn=we.safari||we.chrome&&we.chrome_version<63;function Pn(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(we.safari&&i&&"false"==i.contentEditable)return Vn(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Vn(i);if(s)return Vn(s)}}function Vn(t){return t.contentEditable="true",we.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $n(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jn(t,e){if(e instanceof re){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Jn(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Jn(t)}function Jn(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Hn(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||ee.between(e,n,r)}function Wn(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Un(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(we.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||we.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Kn(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==i?c.setMeta("pointer",!0):"key"==i&&c.scrollIntoView(),t.dispatch(c)}}else{var l=t.state.doc.resolve(e),u=l.sharedDepth(n);e=l.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p,h,f=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Ie(l)||u.push({node:l.focusNode,offset:l.focusOffset})),we.chrome&&8===t.lastKeyCode)for(var h=s;h>i;h--){var f=o.childNodes[h-1],d=f.pmViewDesc;if("BR"==f.nodeType&&!d){s=h;break}if(!d||d.size)break}var m=t.state.doc,v=t.someProp("domParser")||et.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Un,context:g});if(u&&null!=u[0].pos){var k=u[0].pos,w=u[1]&&u[1].pos;null==w&&(w=k),y={anchor:k+a,head:w+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n),m=t.state.doc,v=m.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.lastKeyCode=null;var g=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var l=Math.max(0,i-Math.min(a,c));r-=a+l-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(v.content,d.doc.content,d.from,p,h);if(!g){if(!(r&&f instanceof ee&&!f.empty&&f.$head.sameParent(f.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){var y=Gn(t,t.state.doc,d.sel);y&&!y.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(y))}return}g={start:f.from,endA:f.to,endB:f.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof ee&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),we.ie&&we.ie_version<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>d.from&&"  "==d.doc.textBetween(g.start-d.from-1,g.start-d.from+1)&&(g.start--,g.endA--,g.endB--);var b,k=d.doc.resolveNoCache(g.start-d.from),w=d.doc.resolveNoCache(g.endB-d.from);if((we.ios&&t.lastIOSEnter>Date.now()-100&&(!k.sameParent(w)||o.some((function(t){return"DIV"==t.nodeName})))||!k.sameParent(w)&&k.pos<d.doc.content.size&&(b=Qt.findFrom(d.doc.resolve(k.pos+1),1,!0))&&b.head==w.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>g.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Zn(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Zn(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,g.start,g.endA,k,w)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))we.android&&we.chrome&&t.domObserver.suppressSelectionUpdates();else{var x,C,_,S,A=g.start,M=g.endA;if(k.sameParent(w)&&k.parent.inlineContent)if(k.pos==w.pos)we.ie&&we.ie_version<=11&&0==k.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Ln(t)}),20)),x=t.state.tr.delete(A,M),C=m.resolve(g.start).marksAcross(m.resolve(g.endA));else if(g.endA==g.endB&&(S=m.resolve(g.start))&&(_=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,c=i,l=a,u=0;u<a.length;u++)c=a[u].removeFromSet(c);for(var p=0;p<i.length;p++)l=i[p].removeFromSet(l);if(1==c.length&&0==l.length)r=c[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=l.length)return null;r=l[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var h=[],f=0;f<e.childCount;f++)h.push(o(e.child(f)));if(s.from(h).eq(t))return{mark:r,type:n}}(k.parent.content.cut(k.parentOffset,w.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start()))))x=t.state.tr,"add"==_.type?x.addMark(A,M,_.mark):x.removeMark(A,M,_.mark);else if(k.parent.child(k.index()).isText&&k.index()==w.index()-(w.textOffset?0:1)){var D=k.parent.textBetween(k.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,A,M,D)})))return;x=t.state.tr.insertText(D,A,M)}if(x||(x=t.state.tr.replace(A,M,d.doc.slice(g.start-d.from,g.endB-d.from))),d.sel){var E=Gn(t,x.doc,d.sel);E&&!(we.chrome&&we.android&&t.composing&&E.empty&&E.head==A||we.ie&&E.empty&&E.head==A)&&x.setSelection(E)}C&&x.ensureMarks(C),t.dispatch(x.scrollIntoView())}}}function Gn(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hn(t,e.resolve(n.anchor),e.resolve(n.head))}function Zn(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Yn(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.type.hasRequiredAttrs()?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||ht.fromSchema(t.state.schema),c=rr(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=er[p.nodeName.toLowerCase()]);){for(var h=u.length-1;h>=0;h--){for(var f=c.createElement(u[h]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Qn(t,e,n,r,o){var i,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var l=e&&(r||c||!n);if(l){if(t.someProp("transformPastedText",(function(t){e=t(e)})),c)return new f(s.from(t.state.schema.text(e)),0,0);var u=t.someProp("clipboardTextParser",(function(t){return t(e,o)}));u?a=u:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=rr().createElement("div"),o=/(?:<meta [^>]*>)*<([a-z][^>\s]+)/i.exec(t),i=0;(n=o&&er[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""),i=n.length);r.innerHTML=t;for(var s=0;s<i;s++)r=r.firstChild;return r}(n);var p=i&&i.querySelector("[data-pm-slice]"),h=p&&/^(\d+) (\d+) (.*)/.exec(p.getAttribute("data-pm-slice"));if(!a){var d=t.someProp("clipboardParser")||t.someProp("domParser")||et.fromSchema(t.state.schema);a=d.parseSlice(i,{preserveWhitespace:!(!l&&!h),context:o})}return a=h?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var l=r.nodes[n[c]];if(!l||l.hasRequiredAttrs())break;o=s.from(l.create(n[c+1],o)),i++,a++}return new f(o,i,a)}(function(t,e,n){e<t.openStart&&(t=new f(tr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd));n<t.openEnd&&(t=new f(tr(t.content,1,n,t.openEnd,0,0),t.openStart,n));return t}(a,+h[1],+h[2]),h[3]):f.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,i=[];if(t.forEach((function(t){if(i){var e,n=r.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&o.length&&function t(e,n,r,o,i){if(i<e.length&&i<n.length&&e[i]==n[i]){var a=t(e,n,r,o.lastChild,i+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(i==e.length-1?r.type:e[i+1]))return o.copy(o.content.append(s.from(Xn(r,e,i+1))))}}(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),o=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(o))}(i[i.length-1],o.length));var a=Xn(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}})),i)return{v:s.from(i)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(a.content,o),!1),t.someProp("transformPasted",(function(t){a=t(a)})),a}function Xn(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,s.from(t));return t}function tr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,c=a.content;return o<r-1&&(c=tr(c,e,n,r,o+1,i)),o>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||i<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var er={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nr=null;function rr(){return nr||(nr=document.implementation.createHTMLDocument("title"))}var or={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ir=we.ie&&we.ie_version<=11,sr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};sr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},sr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var ar=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=!1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);we.ie&&we.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new sr,ir&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};ar.prototype.flushSoon=function(){var t=this;this.flushingSoon||(this.flushingSoon=!0,window.setTimeout((function(){t.flushingSoon=!1,t.flush()}),20))},ar.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,or),ir&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},ar.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}ir&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},ar.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},ar.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},ar.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},ar.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Wn(t)){var t;if(this.suppressingSelectionUpdates)return Ln(this.view);if(we.ie&&we.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&Oe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},ar.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},ar.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},ar.prototype.flush=function(){if(this.view.docView&&!this.flushingSoon){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Wn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&!this.view.composing&&(i=!0))}if(we.gecko&&s.length>1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(cr)return;cr=!0,"normal"==getComputedStyle(t.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,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Ln(this.view))}},ar.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){var r=t.previousSibling,o=t.nextSibling;if(we.ie&&we.ie_version<=11&&t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){var s=t.addedNodes[i],a=s.previousSibling,c=s.nextSibling;(!a||Array.prototype.indexOf.call(t.addedNodes,a)<0)&&(r=a),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c)}for(var l=r&&r.parentNode==t.target?Me(r)+1:0,u=n.localPosFromDOM(t.target,l,-1),p=o&&o.parentNode==t.target?Me(o):t.target.childNodes.length,h=0;h<t.addedNodes.length;h++)e.push(t.addedNodes[h]);return{from:u,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var cr=!1;var lr={},ur={};function pr(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function hr(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return fr(t,e)})}))}function fr(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function dr(t){return{left:t.clientX,top:t.clientY}}function mr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function vr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function gr(t,e,n,r,o){return mr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof re&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(vr(t,re.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&re.isSelectable(r))&&(vr(t,new re(n),"pointer"),!0)}(t,n))}function yr(t,e,n,r){return mr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function br(t,e,n,r){return mr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(vr(t,ee.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)vr(t,ee.create(n,s+1,s+1+i.content.size),"pointer");else{if(!re.isSelectable(i))continue;vr(t,re.create(n,s),"pointer")}return!0}}(t,n)}function kr(t){return Ar(t)}ur.keydown=function(t,e){t.shiftKey=16==e.keyCode||e.shiftKey,Cr(t,e)||(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!we.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey?t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Rn(t,e)?e.preventDefault():pr(t,"key"):t.lastIOSEnter=Date.now())},ur.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},ur.keypress=function(t,e){if(!(Cr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||we.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof ee&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var wr=we.mac?"metaKey":"ctrlKey";lr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=kr(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[wr]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(dr(e));i&&("singleClick"==o?t.mouseDown=new xr(t,i,e,n):("doubleClick"==o?yr:br)(t,i.pos,i.inside,e)?e.preventDefault():pr(t,"pointer"))};var xr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[wr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof re&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&we.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(){return s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),pr(t,"pointer")};function Cr(t,e){return!!t.composing||!!(we.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}xr.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.draggable=!1),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xr.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(dr(t))),this.allowDefault||!e?pr(this.view,"pointer"):gr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():!this.flushed&&(!we.chrome||this.view.state.selection instanceof ee||e.pos!=this.view.state.selection.from&&e.pos!=this.view.state.selection.to)?pr(this.view,"pointer"):(vr(this.view,Qt.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault())}},xr.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),pr(this.view,"pointer")},lr.touchdown=function(t){kr(t),pr(t,"pointer")},lr.contextmenu=function(t){return kr(t)};var _r=we.android?5e3:-1;function Sr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Ar(t)}),e))}function Ar(t,e){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty();return!(!e&&!t.docView.dirty)&&(t.updateState(t.state),!0)}ur.compositionstart=ur.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Ar(t,!0),t.markCursor=null;else if(Ar(t),we.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Sr(t,_r)},ur.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Sr(t,20))};var Mr=we.ie&&we.ie_version<15||we.ios&&we.webkit_version<604;function Dr(t,e,n,r){var o=Qn(t,e,n,t.shiftKey,t.state.selection.$from);if(!t.someProp("handlePaste",(function(e){return e(t,r,o||f.empty)}))&&o){var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste"))}}lr.copy=ur.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Mr?null:e.clipboardData,i=Yn(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){var n=t.dom.ownerDocument,r=n.body.appendChild(n.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),i=n.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((function(){n.body.removeChild(r),t.focus()}),50)}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},ur.paste=function(t,e){var n=Mr?null:e.clipboardData,r=n&&n.getData("text/html"),o=n&&n.getData("text/plain");n&&(r||o||n.files.length)?(Dr(t,o,r,e),e.preventDefault()):function(t,e){var n=t.dom.ownerDocument,r=t.shiftKey||t.state.selection.$from.parent.type.spec.code,o=n.body.appendChild(n.createElement(r?"textarea":"div"));r||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((function(){t.focus(),n.body.removeChild(o),r?Dr(t,o.value,null,e):Dr(t,o.textContent,o.innerHTML,e)}),50)}(t,e)};var Er=function(t,e){this.slice=t,this.move=e},Or=we.mac?"altKey":"ctrlKey";for(var Tr in lr.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(dr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof re?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=Yn(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Mr?"Text":"text/html",c.innerHTML),Mr||e.dataTransfer.setData("text/plain",l),t.dragging=new Er(s,!e[Or])}},lr.dragend=function(t){window.setTimeout((function(){return t.dragging=null}),50)},ur.dragover=ur.dragenter=function(t,e){return e.preventDefault()},ur.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(dr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||Qn(t,e.dataTransfer.getData(Mr?"Text":"text/plain"),Mr?null:e.dataTransfer.getData("text/html"),!1,o);if(i&&(e.preventDefault(),!t.someProp("handleDrop",(function(r){return r(t,e,i,n&&n.move)})))){var s=i?Lt(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var a=t.state.tr;n&&n.move&&a.deleteSelection();var c=a.mapping.map(s),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=a.doc;if(l?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),!a.doc.eq(u)){var p=a.doc.resolve(c);l&&re.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild)?a.setSelection(new re(p)):a.setSelection(Hn(t,p,a.doc.resolve(a.mapping.map(s)))),t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}}}}}},lr.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Ln(t)}),20))},lr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},lr.beforeinput=function(t,e){if(we.chrome&&we.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},ur)lr[Tr]=ur[Tr];function Nr(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var zr=function(t,e){this.spec=e||Br,this.side=this.spec.side||0,this.toDOM=t};zr.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Rr(i-n,i-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(t){return this==t||t instanceof zr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Nr(this.spec,t.spec))};var qr=function(t,e){this.spec=e||Br,this.attrs=t};qr.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Rr(o,i,this)},qr.prototype.valid=function(t,e){return e.from<e.to},qr.prototype.eq=function(t){return this==t||t instanceof qr&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)},qr.is=function(t){return t.type instanceof qr};var Ir=function(t,e){this.spec=e||Br,this.attrs=t};Ir.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Rr(o.pos-n,i.pos-n,this)},Ir.prototype.valid=function(t,e){var n=t.content.findIndex(e.from),r=n.index,o=n.offset;return o==e.from&&o+t.child(r).nodeSize==e.to},Ir.prototype.eq=function(t){return this==t||t instanceof Ir&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)};var Rr=function(t,e,n){this.from=t,this.to=e,this.type=n},Fr={spec:{configurable:!0}};Rr.prototype.copy=function(t,e){return new Rr(t,e,this.type)},Rr.prototype.eq=function(t){return this.type.eq(t.type)&&this.from==t.from&&this.to==t.to},Rr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Rr.widget=function(t,e,n){return new Rr(t,t,new zr(e,n))},Rr.inline=function(t,e,n,r){return new Rr(t,e,new qr(n,r))},Rr.node=function(t,e,n,r){return new Rr(t,e,new Ir(n,r))},Fr.spec.get=function(){return this.type.spec},Object.defineProperties(Rr.prototype,Fr);var Lr=[],Br={},Pr=function(t,e){this.local=t&&t.length?t:Lr,this.children=e&&e.length?e:Lr};Pr.create=function(t,e){return e.length?Wr(e,t,0,Br):Vr},Pr.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Pr.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Pr.prototype.map=function(t,e,n){return this==Vr||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Br)},Pr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:(l=r-n-(e-t)+(i-o))&&(a[s]+=l,a[s+1]+=l))}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(-1==a[p+1]){var h=n.map(a[p]+i),f=h-o;if(f<0||f>=r.content.size){u=!0;continue}var d=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==d){var b=a[p+2].mapInner(n,y,h+1,a[p]+i+1,s);b!=Vr?(a[p]=f,a[p+1]=d,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var k=Wr(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=k.local;for(var w=0;w<a.length;w+=3)a[w+1]<0&&(a.splice(w,3),w-=3);for(var x=0,C=0;x<k.children.length;x+=3){for(var _=k.children[x];C<a.length&&a[C]<_;)C+=3;a.splice(C,0,k.children[x],k.children[x+1],k.children[x+2])}}return new Pr(e&&e.sort(Ur),a)}(this.children,i,t,e,n,r,o):i?new Pr(i.sort(Ur)):Vr},Pr.prototype.add=function(t,e){return e.length?this==Vr?Pr.create(t,e):this.addInner(t,e,0):this},Pr.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Jr(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Wr(a,t,c+1,Br)),i+=3}}));var s=jr(i?Hr(e):e,-n);return new Pr(s.length?this.local.concat(s).sort(Ur):this.local,r||this.children)},Pr.prototype.remove=function(t){return 0==t.length||this==Vr?this:this.removeInner(t,0)},Pr.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=Vr?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,h=void 0;p<t.length;p++)if(h=t[p])for(var f=0;f<r.length;f++)r[f].type.eq(h.type)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Pr(r,n):Vr},Pr.prototype.forChild=function(t,e){if(this==Vr)return this;if(e.isLeaf)return Pr.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof qr){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Pr(r.sort(Ur));return n?new $r([p,n]):p}return n||Vr},Pr.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Pr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Pr.prototype.locals=function(t){return Kr(this.localsInner(t))},Pr.prototype.localsInner=function(t){if(this==Vr)return Lr;if(t.inlineContent||!this.local.some(qr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qr||e.push(this.local[n]);return e};var Vr=new Pr;Pr.empty=Vr,Pr.removeOverlap=Kr;var $r=function(t){this.members=t};function jr(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Rr(o.from+e,o.to+e,o.type))}return n}function Jr(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Hr(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Wr(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Jr(t,e,s+n);if(a){i=!0;var c=Wr(a,e,n+s+1,r);c!=Vr&&o.push(s,s+e.nodeSize,c)}}));for(var s=jr(i?Hr(t):t,-n).sort(Ur),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Pr(s,o):Vr}function Ur(t,e){return t.from-e.from||t.to-e.to}function Kr(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gr(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Gr(e,o+1,i.copy(r.to,i.to)))}}return e}function Gr(t,e,n){for(;e<t.length&&Ur(n,t[e])>0;)e++;t.splice(e,0,n)}function Zr(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Vr&&e.push(r)})),t.cursorWrapper&&e.push(Pr.create(t.state.doc,[t.cursorWrapper.deco])),$r.from(e)}$r.prototype.forChild=function(t,e){if(e.isLeaf)return Pr.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Vr&&(o instanceof $r?n=n.concat(o.members):n.push(o))}return $r.from(n)},$r.prototype.eq=function(t){if(!(t instanceof $r)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},$r.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Kr(n?e:e.sort(Ur)):Lr},$r.from=function(t){switch(t.length){case 0:return Vr;case 1:return t[0];default:return new $r(t)}};var Yr=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=eo(this),this.markCursor=null,this.cursorWrapper=null,to(this),this.nodeViews=no(this),this.docView=ln(this.state.doc,Xr(this),Zr(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new ar(t,(function(e,n,r,o){return Kn(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=lr[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||fr(t,e)||!t.editable&&e.type in ur||n(t,e)})};for(var n in lr)e(n);we.safari&&t.dom.addEventListener("input",(function(){return null})),hr(t)}(this),this.pluginViews=[],this.updatePluginViews()},Qr={props:{configurable:!0},root:{configurable:!0}};function Xr(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r?e.class+=" "+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Rr.node(0,t.state.doc.content.size,e)]}function to(t){var e=t.state.selection,n=e.$head,r=e.$anchor,o=e.visible;if(t.markCursor){var i=document.createElement("img");i.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:i,deco:Rr.widget(n.pos,i,{raw:!0,marks:t.markCursor})}}else if(o||n.pos!=r.pos)t.cursorWrapper=null;else{var s;!t.cursorWrapper||t.cursorWrapper.dom.childNodes.length?((s=document.createElement("div")).style.position="absolute",s.style.left="-100000px"):t.cursorWrapper.deco.pos!=n.pos&&(s=t.cursorWrapper.dom),s&&(t.cursorWrapper={dom:s,deco:Rr.widget(n.pos,s,{raw:!0})})}}function eo(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function no(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}Qr.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Yr.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&hr(this),this._props=t,this.updateStateInner(t.state,!0)},Yr.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},Yr.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Yr.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1;if(this.state=t,e){var i=no(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(i,this.nodeViews)&&(this.nodeViews=i,o=!0),hr(this)}this.editable=eo(this),to(this);var s,a,c,l,u,p,h,f,d,m,v,g=Zr(this),y=Xr(this),b=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",k=o||!this.docView.matchesNode(t.doc,y,g),w=k||!t.selection.eq(r.selection),x="preserve"==b&&w&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Pe(t.dom)}}(this);if(w){this.domObserver.stop();var C=k&&(we.ie||we.chrome)&&!r.selection.empty&&!t.selection.empty&&(l=r.selection,u=t.selection,p=Math.min(l.$anchor.sharedDepth(l.head),u.$anchor.sharedDepth(u.head)),l.$anchor.node(p)!=u.$anchor.node(p));k&&(!o&&this.docView.update(t.doc,y,g,this)||(this.docView.destroy(),this.docView=ln(t.doc,y,g,this.dom,this))),C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(s=this,a=s.docView.domFromPos(s.state.selection.anchor),c=s.root.getSelection(),Oe(a.node,a.offset,c.anchorNode,c.anchorOffset)))?Ln(this,C):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==b)this.dom.scrollTop=0;else if("to selection"==b){var _=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof re?Be(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),_):Be(this,this.coordsAtPos(t.selection.head),_))}else x&&(f=(h=x).refDOM,d=h.refTop,m=h.stack,v=f?f.getBoundingClientRect().top:0,Ve(m,0==v?0:v-d))},Yr.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Yr.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var o=this.state.plugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}},Yr.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;var o=this.state.plugins;if(o)for(var i=0;i<o.length;i++){var s=o[i].props[t];if(null!=s&&(n=e?e(s):s))return n}},Yr.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Yr.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if($e)return t.focus($e);var e=Pe(t);t.focus(null==$e?{get preventScroll(){return $e={preventScroll:!0},!0}}:void 0),$e||($e=!1,Ve(e,0))}(this.dom),Ln(this),this.domObserver.start()},Qr.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Yr.prototype.posAtCoords=function(t){return He(this,t)},Yr.prototype.coordsAtPos=function(t){return Ue(this,t)},Yr.prototype.domAtPos=function(t){return this.docView.domFromPos(t)},Yr.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Yr.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Yr.prototype.endOfTextblock=function(t,e){return tn(this,e||this.state,t)},Yr.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Yr.prototype.dispatchEvent=function(t){return function(t,e){fr(t,e)||!lr[e.type]||!t.editable&&e.type in ur||lr[e.type](t,e)}(this,t)},Yr.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Yr.prototype,Qr);var ro=n(13),oo=n.n(ro),io=new X({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:function(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:function(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:function(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){return{params:t.getAttribute("data-params")||""}}}],toDOM:function(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:function(t){return{tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:function(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:function(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM:function(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:function(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:function(t){return"italic"==t&&null}}],toDOM:function(){return["em"]}},strong:{parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-weight",getAttrs:function(t){return/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}}],toDOM:function(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:function(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM:function(){return["code"]}}}});var so=function(t,e){this.schema=t,this.stack=[{type:t.topNodeType,content:[]}],this.marks=p.none,this.tokenHandlers=e};function ao(t,e){return t.getAttrs?t.getAttrs(e):t.attrs instanceof Function?t.attrs(e):t.attrs}function co(t){return"code_inline"==t||"code_block"==t||"fence"==t}function lo(t){return"\n"==t[t.length-1]?t.slice(0,t.length-1):t}function uo(){}so.prototype.top=function(){return this.stack[this.stack.length-1]},so.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},so.prototype.addText=function(t){if(t){var e,n=this.top().content,r=n[n.length-1],o=this.schema.text(t,this.marks);r&&(e=function(t,e){if(t.isText&&e.isText&&p.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(r,o))?n[n.length-1]=e:n.push(o)}},so.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},so.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},so.prototype.parseTokens=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=this.tokenHandlers[n.type];if(!r)throw new Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n)}},so.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},so.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},so.prototype.closeNode=function(){this.marks.length&&(this.marks=p.none);var t=this.stack.pop();return this.addNode(t.type,t.attrs,t.content)};var po=function(t,e,n){this.tokens=n,this.schema=t,this.tokenizer=e,this.tokenHandlers=function(t,e){var n=Object.create(null),r=function(r){var o=e[r];if(o.block){var i=t.nodeType(o.block);co(r)?n[r]=function(t,e){t.openNode(i,ao(o,e)),t.addText(lo(e.content)),t.closeNode()}:(n[r+"_open"]=function(t,e){return t.openNode(i,ao(o,e))},n[r+"_close"]=function(t){return t.closeNode()})}else if(o.node){var s=t.nodeType(o.node);n[r]=function(t,e){return t.addNode(s,ao(o,e))}}else if(o.mark){var a=t.marks[o.mark];co(r)?n[r]=function(t,e){t.openMark(a.create(ao(o,e))),t.addText(lo(e.content)),t.closeMark(a)}:(n[r+"_open"]=function(t,e){return t.openMark(a.create(ao(o,e)))},n[r+"_close"]=function(t){return t.closeMark(a)})}else{if(!o.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(o));co(r)?n[r]=uo:(n[r+"_open"]=uo,n[r+"_close"]=uo)}};for(var o in e)r(o);return n.text=function(t,e){return t.addText(e.content)},n.inline=function(t,e){return t.parseTokens(e.children)},n.softbreak=n.softbreak||function(t){return t.addText("\n")},n}(t,n)};po.prototype.parse=function(t){var e,n=new so(this.schema,this.tokenHandlers);n.parseTokens(this.tokenizer.parse(t,{}));do{e=n.closeNode()}while(n.stack.length);return e};var ho=new po(io,oo()("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list"},ordered_list:{block:"ordered_list",getAttrs:function(t){return{order:+t.attrGet("start")||1}}},heading:{block:"heading",getAttrs:function(t){return{level:+t.tag.slice(1)}}},code_block:{block:"code_block"},fence:{block:"code_block",getAttrs:function(t){return{params:t.info||""}}},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:function(t){return{src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null}}},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:function(t){return{href:t.attrGet("href"),title:t.attrGet("title")||null}}},code_inline:{mark:"code"}}),fo=function(t,e){this.nodes=t,this.marks=e};fo.prototype.serialize=function(t,e){var n=new yo(this.nodes,this.marks,e);return n.renderContent(t),n.out};var mo=new fo({blockquote:function(t,e){t.wrapBlock("> ",null,e,(function(){return t.renderContent(e)}))},code_block:function(t,e){t.write("```"+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},heading:function(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e),t.closeBlock(e)},horizontal_rule:function(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list:function(t,e){t.renderList(e," ",(function(){return(e.attrs.bullet||"*")+" "}))},ordered_list:function(t,e){var n=e.attrs.order||1,r=String(n+e.childCount-1).length,o=t.repeat(" ",r+2);t.renderList(e,o,(function(e){var o=String(n+e);return t.repeat(" ",r-o.length)+o+". "}))},list_item:function(t,e){t.renderContent(e)},paragraph:function(t,e){t.renderInline(e),t.closeBlock(e)},image:function(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+t.esc(e.attrs.src)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")")},hard_break:function(t,e,n,r){for(var o=r+1;o<n.childCount;o++)if(n.child(o).type!=e.type)return void t.write("\\\n")},text:function(t,e){t.text(e.text)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open:function(t,e,n,r){return go(e,n,r,1)?"<":"["},close:function(t,e,n,r){return go(e,n,r,-1)?">":"]("+t.esc(e.attrs.href)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")"}},code:{open:function(t,e,n,r){return vo(n.child(r),-1)},close:function(t,e,n,r){return vo(n.child(r-1),1)},escape:!1}});function vo(t,e){var n,r=/`+/g,o=0;if(t.isText)for(;n=r.exec(t.text);)o=Math.max(o,n[0].length);for(var i=o>0&&e>0?" `":"`",s=0;s<o;s++)i+="`";return o>0&&e<0&&(i+=" "),i}function go(t,e,n,r){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;var o=e.child(n+(r<0?-1:0));if(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t)return!1;if(n==(r<0?1:e.childCount-1))return!0;var i=e.child(n+(r<0?-2:1));return!t.isInSet(i.marks)}var yo=function(t,e,n){this.nodes=t,this.marks=e,this.delim=this.out="",this.closed=!1,this.inTightList=!1,this.options=n||{},void 0===this.options.tightLists&&(this.options.tightLists=!1)};yo.prototype.flushClose=function(t){if(this.closed){if(this.atBlank()||(this.out+="\n"),null==t&&(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;r<t;r++)this.out+=e+"\n"}this.closed=!1}},yo.prototype.wrapBlock=function(t,e,n,r){var o=this.delim;this.write(e||t),this.delim+=t,r(),this.delim=o,this.closeBlock(n)},yo.prototype.atBlank=function(){return/(^|\n)$/.test(this.out)},yo.prototype.ensureNewLine=function(){this.atBlank()||(this.out+="\n")},yo.prototype.write=function(t){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),t&&(this.out+=t)},yo.prototype.closeBlock=function(t){this.closed=t},yo.prototype.text=function(t,e){for(var n=t.split("\n"),r=0;r<n.length;r++){var o=this.atBlank()||this.closed;this.write(),this.out+=!1!==e?this.esc(n[r],o):n[r],r!=n.length-1&&(this.out+="\n")}},yo.prototype.render=function(t,e,n){if("number"==typeof e)throw new Error("!");this.nodes[t.type.name](this,t,e,n)},yo.prototype.renderContent=function(t){var e=this;t.forEach((function(n,r,o){return e.render(n,t,o)}))},yo.prototype.renderInline=function(t){var e=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[];o&&"hard_break"===o.type.name&&(a=a.filter((function(e){if(s+1==t.childCount)return!1;var n=t.child(s+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));var c=r;if(r="",o&&o.isText&&a.some((function(t){var n=e.marks[t.type.name];return n&&n.expelEnclosingWhitespace}))){var l=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=(l[0],l[1]),p=l[2],h=l[3];c+=u,r=h,(u||h)&&((o=p?o.withText(p):null)||(a=n))}var f=a.length&&a[a.length-1],d=f&&!1===e.marks[f.type.name].escape,m=a.length-(d?1:0);t:for(var v=0;v<m;v++){var g=a[v];if(!e.marks[g.type.name].mixable)break;for(var y=0;y<n.length;y++){var b=n[y];if(!e.marks[b.type.name].mixable)break;if(g.eq(b)){v>y?a=a.slice(0,y).concat(g).concat(a.slice(y,v)).concat(a.slice(v+1,m)):y>v&&(a=a.slice(0,v).concat(a.slice(v+1,y)).concat(g).concat(a.slice(y,m)));continue t}}}for(var k=0;k<Math.min(n.length,m)&&a[k].eq(n[k]);)++k;for(;k<n.length;)e.text(e.markString(n.pop(),!1,t,s),!1);if(c&&e.text(c),o){for(;n.length<m;){var w=a[n.length];n.push(w),e.text(e.markString(w,!0,t,s),!1)}d&&o.isText?e.text(e.markString(f,!0,t,s)+o.text+e.markString(f,!1,t,s+1),!1):e.render(o,t,s)}};t.forEach(o),o(null,0,t.childCount)},yo.prototype.renderList=function(t,e,n){var r=this;this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);var o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach((function(i,s,a){a&&o&&r.flushClose(1),r.wrapBlock(e,n(a),t,(function(){return r.render(i,t,a)}))})),this.inTightList=i},yo.prototype.esc=function(t,e){return t=t.replace(/[`*\\~\[\]]/g,"\\$&"),e&&(t=t.replace(/^[:#\-*+]/,"\\$&").replace(/^(\d+)\./,"$1\\.")),t},yo.prototype.quote=function(t){var e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]},yo.prototype.repeat=function(t,e){for(var n="",r=0;r<e;r++)n+=t;return n},yo.prototype.markString=function(t,e,n,r){var o=this.marks[t.type.name],i=e?o.open:o.close;return"string"==typeof i?i:i(this,t,n,r)},yo.prototype.getEnclosingWhitespace=function(t){return{leading:(t.match(/^(\s+)/)||[])[0],trailing:(t.match(/(\s+)$/)||[])[0]}};for(var bo={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"},ko=bo,wo={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"},xo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Co="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),_o="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ao="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mo=xo&&(So||+xo[1]<57)||_o&&So,Do=0;Do<10;Do++)bo[48+Do]=bo[96+Do]=String(Do);for(Do=1;Do<=24;Do++)bo[Do+111]="F"+Do;for(Do=65;Do<=90;Do++)bo[Do]=String.fromCharCode(Do+32),wo[Do]=String.fromCharCode(Do);for(var Eo in bo)wo.hasOwnProperty(Eo)||(wo[Eo]=bo[Eo]);var Oo=function(t){var e=!(Mo&&(t.ctrlKey||t.altKey||t.metaKey)||(Co||Ao)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?wo:bo)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e},To="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function No(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);To?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function zo(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function qo(t){return new ge({props:{handleKeyDown:Io(t)}})}function Io(t){var e=function(t){var e=Object.create(null);for(var n in t)e[No(n)]=t[n];return e}(t);return function(t,n){var r,o=Oo(n),i=1==o.length&&" "!=o,s=e[zo(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey)&&(r=ko[n.keyCode])&&r!=o){var a=e[zo(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[zo(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Ro=function(){};Ro.prototype.append=function(t){return t.length?(t=Ro.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Ro.prototype.prepend=function(t){return t.length?Ro.from(t).append(this):this},Ro.prototype.appendInner=function(t){return new Lo(this,t)},Ro.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Ro.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Ro.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ro.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Ro.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Ro.from=function(t){return t instanceof Ro?t:t&&t.length?new Fo(t):Ro.empty};var Fo=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ro);Ro.empty=new Fo([]);var Lo=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Ro),Bo=Ro,Po=function(t,e){this.items=t,this.eventCount=e};Po.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new Vo(t.map));var p,h=t.step.map(r.slice(o));h&&c.maybeStep(h).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new Vo(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Po(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Po.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var l,u=t.steps[c].invert(t.docs[c]),p=new Vo(t.mapping.maps[c],u,e);(l=a&&a.merge(p))&&(p=l,c?o.pop():s=s.slice(0,s.length-1)),o.push(p),e&&(i++,e=null),r||(a=p)}var h,f,d,m=i-n.depth;return m>jo&&(f=m,(h=s).forEach((function(t,e){if(t.selection&&0==f--)return d=e,!1})),s=h.slice(d),i-=m),new Po(s.append(o),i)},Po.prototype.remapping=function(t,e){var n=new bt;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Po.prototype.addMaps=function(t){return 0==this.eventCount?this:new Po(this.items.append(t.map((function(t){return new Vo(t)}))),this.eventCount)},Po.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new Vo(c,l,u))}else n.push(new Vo(c))}}),r);for(var c=[],l=e;l<i;l++)c.push(new Vo(o.maps[l]));var u=this.items.slice(0,r).append(c).append(n),p=new Po(u,s);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},Po.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Po.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new Vo(c.invert(),a,l),h=r.length-1;(u=r.length&&r[h].merge(p))?r[h]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new Po(Bo.from(r.reverse()),o)},Po.empty=new Po(Bo.empty,0);var Vo=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Vo.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Vo(e.getMap().invert(),e,this.selection)}};var $o=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},jo=20;function Jo(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ho(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Wo(t,e,n,r){var o=Go(e),i=Zo.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new $o(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(Zo,{redo:r,historyState:l}).scrollIntoView())}}var Uo=!1,Ko=null;function Go(t){var e=t.plugins;if(Ko!=e){Uo=!1,Ko=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Uo=!0;break}}return Uo}var Zo=new ke("history"),Yo=new ke("closeHistory");function Qo(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new ge({key:Zo,state:{init:function(){return new $o(Po.empty,Po.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(Zo);if(i)return i.historyState;n.getMeta(Yo)&&(t=new $o(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Zo))return s.getMeta(Zo).redo?new $o(t.done.addTransform(n,null,r,Go(e)),t.undone,Jo(n.mapping.maps[n.steps.length-1]),t.prevTime):new $o(t.done,t.undone.addTransform(n,null,r,Go(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new $o(t.done.rebased(n,o),t.undone.rebased(n,o),Ho(t.prevRanges,n.mapping),t.prevTime):new $o(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ho(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ho(t.prevRanges,n.mapping):Jo(n.mapping.maps[n.steps.length-1]);return new $o(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Go(e)),Po.empty,c,n.time)}(n,r,e,t)}},config:t})}function Xo(t,e){var n=Zo.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Wo(n,t,e,!1),!0)}function ti(t,e){var n=Zo.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Wo(n,t,e,!0),!0)}function ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function ri(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function ii(t,e){var n,r=t.selection,o=r instanceof re;if(o){if(r.node.isTextblock||!It(t.doc,r.from))return!1;n=r.from}else if(null==(n=Ft(t.doc,r.from,-1)))return!1;if(e){var i=t.tr.join(n);o&&i.setSelection(re.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function si(t,e){var n,r=t.selection;if(r instanceof re){if(r.node.isTextblock||!It(t.doc,r.to))return!1;n=r.to}else if(null==(n=Ft(t.doc,r.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function ai(t,e){var n=t.selection,r=n.$from,o=n.$to,i=r.blockRange(o),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function ci(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function li(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=ci(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),l=t.tr.replaceWith(c,c,a.createAndFill());l.setSelection(Qt.near(l.doc.resolve(c),1)),e(l.scrollIntoView())}return!0}function ui(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof re&&t.selection.node.isBlock)return!(!r.parentOffset||!qt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,a=t.tr;t.selection instanceof ee&&a.deleteSelection();var c=0==r.depth?null:ci(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&c?[{type:c}]:null,u=qt(a.doc,a.mapping.map(r.pos),1,l);l||u||!qt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(l=[{type:c}],u=!0),u&&(a.split(a.mapping.map(r.pos),1,l),i||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from(c.create(),r.parent))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0}function pi(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(re.create(t.doc,n))),!0)}function hi(t,e,n){var r,o,i=e.nodeBefore,a=e.nodeAfter;if(i.type.spec.isolating||a.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!It(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;if(e.parent.canReplace(e.index(),e.index()+1)&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var c=e.pos+a.nodeSize,l=s.empty,u=r.length-1;u>=0;u--)l=s.from(r[u].create(null,l));l=s.from(i.copy(l));var p=t.tr.step(new Dt(e.pos-1,c,e.pos,c,new f(l,1,0),r.length,!0)),h=c+2*r.length;It(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}var d=Qt.findFrom(e,1),m=d&&d.$from.blockRange(d.$to),v=m&&Tt(m);return null!=v&&v>=e.depth&&(n&&n(t.tr.lift(m,v).scrollIntoView()),!0)}function fi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Nt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function di(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function mi(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],h=p.$from,f=p.$to;c=n.doc.rangeHasMark(h.pos,f.pos,t)}for(var d=0;d<a.length;d++){var m=a[d],v=m.$from,g=m.$to;c?l.removeMark(v.pos,g.pos,t):l.addMark(v.pos,g.pos,t.create(e))}r(l.scrollIntoView())}return!0}}function vi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var gi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r);if(!o){var i=r.blockRange(),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(a,"end")||re.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(ni(a,"end")?Qt.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):re.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r),i=o&&o.nodeBefore;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)})),yi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r);if(!o)return!1;var i=o.nodeAfter;if(hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(i,"start")||re.isSelectable(i))){if(e){var s=t.tr.deleteRange(r.before(),r.after());s.setSelection(ni(i,"start")?Qt.findFrom(s.doc.resolve(s.mapping.map(o.pos)),1):re.create(s.doc,s.mapping.map(o.pos))),e(s.scrollIntoView())}return!0}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r),i=o&&o.nodeAfter;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos)).scrollIntoView()),!0)})),bi={Enter:vi((function(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(r.parent.inlineContent||o.parent.inlineContent)return!1;var i=ci(r.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}),(function(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(qt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Tt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),ui),"Mod-Enter":li,Backspace:gi,"Mod-Backspace":gi,Delete:yi,"Mod-Delete":yi,"Mod-a":function(t,e){return e&&e(t.tr.setSelection(new ie(t.doc))),!0}},ki={"Ctrl-h":bi.Backspace,"Alt-Backspace":bi["Mod-Backspace"],"Ctrl-d":bi.Delete,"Ctrl-Alt-Backspace":bi["Mod-Delete"],"Alt-Delete":bi["Mod-Delete"],"Alt-d":bi["Mod-Delete"]};for(var wi in bi)ki[wi]=bi[wi];var xi=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?ki:bi;function Ci(t){return void 0===t&&(t={}),new ge({view:function(e){return new _i(e,t)}})}var _i=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};_i.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},_i.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},_i.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},_i.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a=this.editorView.dom.offsetParent;this.element||(this.element=a.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);var c=!a||a==document.body&&"static"==getComputedStyle(a).position?{left:-pageXOffset,top:-pageYOffset}:a.getBoundingClientRect();this.element.style.left=t.left-c.left+"px",this.element.style.top=t.top-c.top+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},_i.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},_i.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Lt(this.editorView.state.doc,n,this.editorView.dragging.slice))&&(n=e.pos),this.setCursor(n),this.scheduleRemoval(5e3)}}},_i.prototype.dragend=function(){this.scheduleRemoval(20)},_i.prototype.drop=function(){this.scheduleRemoval(20)},_i.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Si=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return f.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new Ai(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).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}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.maybeChild(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;i=n>0?i.firstChild:i.lastChild;){o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null},e}(Qt);Si.prototype.visible=!1,Qt.jsonID("gapcursor",Si);var Ai=function(t){this.pos=t};Ai.prototype.map=function(t){return new Ai(t.map(this.pos))},Ai.prototype.resolve=function(t){var e=t.resolve(this.pos);return Si.valid(e)?new Si(e):Qt.near(e)};var Mi=Io({ArrowLeft:Di("horiz",-1),ArrowRight:Di("horiz",1),ArrowUp:Di("vert",-1),ArrowDown:Di("vert",1)});function Di(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof ee){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=Si.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new Si(c))),!0)}}function Ei(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!Si.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&re.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new Si(r))),!0)}function Oi(t){if(!(t.selection instanceof Si))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pr.create(t.doc,[Rr.widget(t.selection.head,e,{key:"gapcursor"})])}function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Ni=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){!function(e){var n,r="function",o=function(t,e){return Ti(t)===e},i=function t(e,n){null!==n&&(Array.isArray(n)?n.map((function(n){return t(e,n)})):(s.isNode(n)||(n=document.createTextNode(n)),e.appendChild(n)))};function s(t,e){var n,a,c=arguments,l=1;if(t=s.isElement(t)?t:document.createElement(t),o(e,"object")&&!s.isNode(e)&&!Array.isArray(e))for(n in l++,e)a=e[n],n=s.attrMap[n]||n,o(n,r)?n(t,a):o(a,r)?t[n]=a:t.setAttribute(n,a);for(;l<c.length;l++)i(t,c[l]);return t}s.attrMap={},s.isElement=function(t){return t instanceof Element},s.isNode=function(t){return t instanceof Node},s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}}),n=s,t.exports=n}()})),zi="http://www.w3.org/2000/svg",qi="ProseMirror-icon";function Ii(t){var e=document.createElement("div");if(e.className=qi,t.path){var n="pm-icon-"+function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e}(t.path).toString(16);document.getElementById(n)||function(t,e){var n=document.getElementById(qi+"-collection");n||((n=document.createElementNS(zi,"svg")).id=qi+"-collection",n.style.display="none",document.body.insertBefore(n,document.body.firstChild));var r=document.createElementNS(zi,"symbol");r.id=t,r.setAttribute("viewBox","0 0 "+e.width+" "+e.height),r.appendChild(document.createElementNS(zi,"path")).setAttribute("d",e.path),n.appendChild(r)}(n,t);var r=e.appendChild(document.createElementNS(zi,"svg"));r.style.width=t.width/t.height+"em",r.appendChild(document.createElementNS(zi,"use")).setAttributeNS("http://www.w3.org/1999/xlink","href",/([^#]*)/.exec(document.location)[1]+"#"+n)}else t.dom?e.appendChild(t.dom.cloneNode(!0)):(e.appendChild(document.createElement("span")).textContent=t.text||"",t.css&&(e.firstChild.style.cssText=t.css));return e}var Ri="ProseMirror-menu",Fi=function(t){this.spec=t};function Li(t,e){return t._props.translate?t._props.translate(e):e}Fi.prototype.render=function(t){var e=this.spec,n=e.render?e.render(t):e.icon?Ii(e.icon):e.label?Ni("div",null,Li(t,e.label)):null;if(!n)throw new RangeError("MenuItem without icon or label property");if(e.title){var r="function"==typeof e.title?e.title(t.state):e.title;n.setAttribute("title",Li(t,r))}return e.class&&n.classList.add(e.class),e.css&&(n.style.cssText+=e.css),n.addEventListener("mousedown",(function(r){r.preventDefault(),n.classList.contains(Ri+"-disabled")||e.run(t.state,t.dispatch,t,r)})),{dom:n,update:function(t){if(e.select){var r=e.select(t);if(n.style.display=r?"":"none",!r)return!1}var o=!0;if(e.enable&&(o=e.enable(t)||!1,Xi(n,Ri+"-disabled",!o)),e.active){var i=o&&e.active(t)||!1;Xi(n,Ri+"-active",i)}return!0}}};var Bi={time:0,node:null};function Pi(t){Bi.time=Date.now(),Bi.node=t.target}function Vi(t){return Date.now()-100<Bi.time&&Bi.node&&t.contains(Bi.node)}var $i=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};function ji(t,e){for(var n=[],r=[],o=0;o<t.length;o++){var i=t[o].render(e),s=i.dom,a=i.update;n.push(Ni("div",{class:Ri+"-dropdown-item"},s)),r.push(a)}return{dom:n,update:Ji(r,n)}}function Ji(t,e){return function(n){for(var r=!1,o=0;o<t.length;o++){var i=t[o](n);e[o].style.display=i?"":"none",i&&(r=!0)}return r}}$i.prototype.render=function(t){var e=this,n=ji(this.content,t),r=Ni("div",{class:Ri+"-dropdown "+(this.options.class||""),style:this.options.css},Li(t,this.options.label));this.options.title&&r.setAttribute("title",Li(t,this.options.title));var o=Ni("div",{class:Ri+"-dropdown-wrap"},r),i=null,s=null,a=function(){i&&i.close()&&(i=null,window.removeEventListener("mousedown",s))};return r.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),i?a():(i=e.expand(o,n.dom),window.addEventListener("mousedown",s=function(){Vi(o)||a()}))})),{dom:o,update:function(t){var e=n.update(t);return o.style.display=e?"":"none",e}}},$i.prototype.expand=function(t,e){var n=Ni("div",{class:Ri+"-dropdown-menu "+(this.options.class||"")},e),r=!1;return t.appendChild(n),{close:function(){if(!r)return r=!0,t.removeChild(n),!0},node:n}};var Hi=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};Hi.prototype.render=function(t){var e=ji(this.content,t),n=Ni("div",{class:Ri+"-submenu-label"},Li(t,this.options.label)),r=Ni("div",{class:Ri+"-submenu-wrap"},n,Ni("div",{class:Ri+"-submenu"},e.dom)),o=null;return n.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),Xi(r,Ri+"-submenu-wrap-active"),o||window.addEventListener("mousedown",o=function(){Vi(r)||(r.classList.remove(Ri+"-submenu-wrap-active"),window.removeEventListener("mousedown",o),o=null)})})),{dom:r,update:function(t){var n=e.update(t);return r.style.display=n?"":"none",n}}};var Wi={join:{width:800,height:900,path:"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z"},lift:{width:1024,height:1024,path:"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z"},selectParentNode:{text:"⬚",css:"font-weight: bold"},undo:{width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"},redo:{width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"},strong:{width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},em:{width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},code:{width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"},link:{width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"},bulletList:{width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"},orderedList:{width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"},blockquote:{width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},Ui=new Fi({title:"Join with above block",run:ii,select:function(t){return ii(t)},icon:Wi.join}),Ki=new Fi({title:"Lift out of enclosing block",run:ai,select:function(t){return ai(t)},icon:Wi.lift}),Gi=new Fi({title:"Select parent node",run:pi,select:function(t){return pi(t)},icon:Wi.selectParentNode}),Zi=new Fi({title:"Undo last change",run:Xo,enable:function(t){return Xo(t)},icon:Wi.undo}),Yi=new Fi({title:"Redo last undone change",run:ti,enable:function(t){return ti(t)},icon:Wi.redo});function Qi(t,e){var n=di(t,e.attrs),r={run:n,enable:function(t){return n(t)},active:function(n){var r=n.selection,o=r.$from,i=r.to,s=r.node;return s?s.hasMarkup(t,e.attrs):i<=o.end()&&o.parent.hasMarkup(t,e.attrs)}};for(var o in e)r[o]=e[o];return new Fi(r)}function Xi(t,e,n){n?t.classList.add(e):t.classList.remove(e)}var ts="ProseMirror-menubar";var es=function(t,e){var n=this;this.editorView=t,this.options=e,this.wrapper=Ni("div",{class:ts+"-wrapper"}),this.menu=this.wrapper.appendChild(Ni("div",{class:ts})),this.menu.className=ts,this.spacer=null,t.dom.parentNode.replaceChild(this.wrapper,t.dom),this.wrapper.appendChild(t.dom),this.maxHeight=0,this.widthForMaxHeight=0,this.floating=!1;var r=function(t,e){for(var n=document.createDocumentFragment(),r=[],o=[],i=0;i<e.length;i++){for(var s=e[i],a=[],c=[],l=0;l<s.length;l++){var u=s[l].render(t),p=u.dom,h=u.update,f=Ni("span",{class:Ri+"item"},p);n.appendChild(f),c.push(f),a.push(h)}a.length&&(r.push(Ji(a,c)),i<e.length-1&&o.push(n.appendChild(Ni("span",{class:Ri+"separator"}))))}return{dom:n,update:function(t){for(var e=!1,n=!1,i=0;i<r.length;i++){var s=r[i](t);i&&(o[i-1].style.display=n&&s?"":"none"),n=s,s&&(e=!0)}return e}}}(this.editorView,this.options.content),o=r.dom,i=r.update;if(this.contentUpdate=i,this.menu.appendChild(o),this.update(),e.floating&&!function(){if("undefined"==typeof navigator)return!1;var t=navigator.userAgent;return!/Edge\/\d/.test(t)&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t)}()){this.updateFloat();var s=function(t){for(var e=[window],n=t.parentNode;n;n=n.parentNode)e.push(n);return e}(this.wrapper);this.scrollFunc=function(t){var e=n.editorView.root;(e.body||e).contains(n.wrapper)?n.updateFloat(t.target.getBoundingClientRect&&t.target):s.forEach((function(t){return t.removeEventListener("scroll",n.scrollFunc)}))},s.forEach((function(t){return t.addEventListener("scroll",n.scrollFunc)}))}};es.prototype.update=function(){this.contentUpdate(this.editorView.state),this.floating?this.updateScrollCursor():(this.menu.offsetWidth!=this.widthForMaxHeight&&(this.widthForMaxHeight=this.menu.offsetWidth,this.maxHeight=0),this.menu.offsetHeight>this.maxHeight&&(this.maxHeight=this.menu.offsetHeight,this.menu.style.minHeight=this.maxHeight+"px"))},es.prototype.updateScrollCursor=function(){var t=this.editorView.root.getSelection();if(t.focusNode){var e=t.getRangeAt(0).getClientRects(),n=e[function(t){if(t.anchorNode==t.focusNode)return t.anchorOffset>t.focusOffset;return t.anchorNode.compareDocumentPosition(t.focusNode)==Node.DOCUMENT_POSITION_FOLLOWING}(t)?0:e.length-1];if(n){var r=this.menu.getBoundingClientRect();if(n.top<r.bottom&&n.bottom>r.top){var o=function(t){for(var e=t.parentNode;e;e=e.parentNode)if(e.scrollHeight>e.clientHeight)return e}(this.wrapper);o&&(o.scrollTop-=r.bottom-n.top)}}}},es.prototype.updateFloat=function(t){var e=this.wrapper,n=e.getBoundingClientRect(),r=t?Math.max(0,t.getBoundingClientRect().top):0;if(this.floating)if(n.top>=r||n.bottom<this.menu.offsetHeight+10)this.floating=!1,this.menu.style.position=this.menu.style.left=this.menu.style.top=this.menu.style.width="",this.menu.style.display="",this.spacer.parentNode.removeChild(this.spacer),this.spacer=null;else{var o=(e.offsetWidth-e.clientWidth)/2;this.menu.style.left=n.left+o+"px",this.menu.style.display=n.top>window.innerHeight?"none":"",t&&(this.menu.style.top=r+"px")}else if(n.top<r&&n.bottom>=this.menu.offsetHeight+10){this.floating=!0;var i=this.menu.getBoundingClientRect();this.menu.style.left=i.left+"px",this.menu.style.width=i.width+"px",t&&(this.menu.style.top=r+"px"),this.menu.style.position="fixed",this.spacer=Ni("div",{class:ts+"-spacer",style:"height: "+i.height+"px"}),e.insertBefore(this.spacer,this.menu)}},es.prototype.destroy=function(){this.wrapper.parentNode&&this.wrapper.parentNode.replaceChild(this.editorView.dom,this.wrapper)};function ns(t,e){return function(n,r){var o=n.selection,i=o.$from,a=o.$to,c=i.blockRange(a),l=!1,u=c;if(!c)return!1;if(c.depth>=2&&i.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==i.index(c.depth-1))return!1;var p=n.doc.resolve(c.start-2);u=new M(p,p,c.depth),c.endIndex<c.parent.childCount&&(c=new M(i,n.doc.resolve(a.end(c.depth)),c.depth)),l=!0}var h=Nt(u,t,e,c);return!!h&&(r&&r(function(t,e,n,r,o){for(var i=s.empty,a=n.length-1;a>=0;a--)i=s.from(n[a].type.create(n[a].attrs,i));t.step(new Dt(e.start-(r?2:0),e.end,e.start,e.end,new f(i,0,0),n.length,!0));for(var c=0,l=0;l<n.length;l++)n[l].type==o&&(c=l+1);for(var u=n.length-c,p=e.start+n.length-(r?2:0),h=e.parent,d=e.startIndex,m=e.endIndex,v=!0;d<m;d++,v=!1)!v&&qt(t.doc,p,u)&&(t.split(p,u),p+=2*u),p+=h.child(d).nodeSize;return t}(n.tr,c,h,l,t).scrollIntoView()),!0)}}function rs(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));return!!a&&(!n||(o.node(a.depth-1).type==t?function(t,e,n,r){var o=t.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new Dt(i-1,a,i,a,new f(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new M(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));return e(o.lift(r,Tt(r)).scrollIntoView()),!0}(e,n,t,a):function(t,e,n){for(var r=t.tr,o=n.parent,i=n.end,a=n.endIndex-1,c=n.startIndex;a>c;a--)i-=o.child(a).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(n.start),u=l.nodeAfter,p=0==n.startIndex,h=n.endIndex==o.childCount,d=l.node(-1),m=l.index(-1);if(!d.canReplace(m+(p?0:1),m+1,u.content.append(h?s.empty:s.from(o))))return!1;var v=l.pos,g=v+u.nodeSize;return r.step(new Dt(v-(p?1:0),g+(h?1:0),v+1,g-1,new f((p?s.empty:s.from(o.copy(s.empty))).append(h?s.empty:s.from(o.copy(s.empty))),p?0:1,h?0:1),p?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}var is=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function ss(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}function as(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));var l=s.doc.resolve(i.from).marks();e(s.replaceWith(i.from,i.to,t.schema.text(i.text,l)))}return!0}}return!1}var cs=new is(/--$/,"—"),ls=new is(/\.\.\.$/,"…"),us=[new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new is(/"$/,"”"),new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new is(/'$/,"’")];function ps(t,e,n,r){return new is(t,(function(t,o,i,s){var a=n instanceof Function?n(o):n,c=t.tr.delete(i,s),l=c.doc.resolve(i).blockRange(),u=l&&Nt(l,e,a);if(!u)return null;c.wrap(l,u);var p=c.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&It(c.doc,i-1)&&(!r||r(o,p))&&c.join(i-1),c}))}function hs(t,e,n){return new is(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}function fs(t){var e=document.body.appendChild(document.createElement("div"));e.className="ProseMirror-prompt";var n=function(t){e.contains(t.target)||r()};setTimeout((function(){return window.addEventListener("mousedown",n)}),50);var r=function(){window.removeEventListener("mousedown",n),e.parentNode&&e.parentNode.removeChild(e)},o=[];for(var i in t.fields)o.push(t.fields[i].render());var s=document.createElement("button");s.type="submit",s.className="ProseMirror-prompt-submit",s.textContent="OK";var a=document.createElement("button");a.type="button",a.className="ProseMirror-prompt-cancel",a.textContent="Cancel",a.addEventListener("click",r);var c=e.appendChild(document.createElement("form"));t.title&&(c.appendChild(document.createElement("h5")).textContent=t.title),o.forEach((function(t){c.appendChild(document.createElement("div")).appendChild(t)}));var l=c.appendChild(document.createElement("div"));l.className="ProseMirror-prompt-buttons",l.appendChild(s),l.appendChild(document.createTextNode(" ")),l.appendChild(a);var u=e.getBoundingClientRect();e.style.top=(window.innerHeight-u.height)/2+"px",e.style.left=(window.innerWidth-u.width)/2+"px";var p=function(){var e=function(t,e){var n=Object.create(null),r=0;for(var o in t){var i=t[o],s=e[r++],a=i.read(s),c=i.validate(a);if(c)return ds(s,c),null;n[o]=i.clean(a)}return n}(t.fields,o);e&&(r(),t.callback(e))};c.addEventListener("submit",(function(t){t.preventDefault(),p()})),c.addEventListener("keydown",(function(t){27==t.keyCode?(t.preventDefault(),r()):13!=t.keyCode||t.ctrlKey||t.metaKey||t.shiftKey?9==t.keyCode&&window.setTimeout((function(){e.contains(document.activeElement)||r()}),500):(t.preventDefault(),p())}));var h=c.elements[0];h&&h.focus()}function ds(t,e){var n=t.parentNode,r=n.appendChild(document.createElement("div"));r.style.left=t.offsetLeft+t.offsetWidth+2+"px",r.style.top=t.offsetTop-5+"px",r.className="ProseMirror-invalid",r.textContent=e,setTimeout((function(){return n.removeChild(r)}),1500)}var ms=function(t){this.options=t};ms.prototype.read=function(t){return t.value},ms.prototype.validateType=function(t){},ms.prototype.validate=function(t){return!t&&this.options.required?"Required field":this.validateType(t)||this.options.validate&&this.options.validate(t)},ms.prototype.clean=function(t){return this.options.clean?this.options.clean(t):t};var vs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=document.createElement("input");return t.type="text",t.placeholder=this.options.label,t.value=this.options.value||"",t.autocomplete="off",t},e}(ms);function gs(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1}function ys(t,e){var n={label:e.title,run:t};for(var r in e)n[r]=e[r];return e.enable&&!0!==e.enable||e.select||(n[e.enable?"enable":"select"]=function(e){return t(e)}),new Fi(n)}function bs(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to;return n.empty?e.isInSet(t.storedMarks||o.marks()):t.doc.rangeHasMark(r,i,e)}function ks(t,e){var n={active:function(e){return bs(e,t)},enable:!0};for(var r in e)n[r]=e[r];return ys(mi(t),n)}function ws(t,e){return ys(ns(t,e.attrs),e)}function xs(t){var e,n,r,o={};if((e=t.marks.strong)&&(o.toggleStrong=ks(e,{title:"Toggle strong style",icon:Wi.strong})),(e=t.marks.em)&&(o.toggleEm=ks(e,{title:"Toggle emphasis",icon:Wi.em})),(e=t.marks.code)&&(o.toggleCode=ks(e,{title:"Toggle code font",icon:Wi.code})),(e=t.marks.link)&&(o.toggleLink=(n=e,new Fi({title:"Add or remove link",icon:Wi.link,active:function(t){return bs(t,n)},enable:function(t){return!t.selection.empty},run:function(t,e,r){if(bs(t,n))return mi(n)(t,e),!0;fs({title:"Create a link",fields:{href:new vs({label:"Link target",required:!0}),title:new vs({label:"Title"})},callback:function(t){mi(n,t)(r.state,r.dispatch),r.focus()}})}}))),(e=t.nodes.image)&&(o.insertImage=(r=e,new Fi({title:"Insert image",label:"Image",enable:function(t){return gs(t,r)},run:function(t,e,n){var o=t.selection,i=o.from,s=o.to,a=null;t.selection instanceof re&&t.selection.node.type==r&&(a=t.selection.node.attrs),fs({title:"Insert image",fields:{src:new vs({label:"Location",required:!0,value:a&&a.src}),title:new vs({label:"Title",value:a&&a.title}),alt:new vs({label:"Description",value:a?a.alt:t.doc.textBetween(i,s," ")})},callback:function(t){n.dispatch(n.state.tr.replaceSelectionWith(r.createAndFill(t))),n.focus()}})}}))),(e=t.nodes.bullet_list)&&(o.wrapBulletList=ws(e,{title:"Wrap in bullet list",icon:Wi.bulletList})),(e=t.nodes.ordered_list)&&(o.wrapOrderedList=ws(e,{title:"Wrap in ordered list",icon:Wi.orderedList})),(e=t.nodes.blockquote)&&(o.wrapBlockQuote=function(t,e){var n={run:function(n,r){return fi(t,e.attrs)(n,r)},select:function(n){return fi(t,e.attrs instanceof Function?null:e.attrs)(n)}};for(var r in e)n[r]=e[r];return new Fi(n)}(e,{title:"Wrap in block quote",icon:Wi.blockquote})),(e=t.nodes.paragraph)&&(o.makeParagraph=Qi(e,{title:"Change to paragraph",label:"Plain"})),(e=t.nodes.code_block)&&(o.makeCodeBlock=Qi(e,{title:"Change to code block",label:"Code"})),e=t.nodes.heading)for(var i=1;i<=10;i++)o["makeHead"+i]=Qi(e,{title:"Change to heading "+i,label:"Level "+i,attrs:{level:i}});if(e=t.nodes.horizontal_rule){var s=e;o.insertHorizontalRule=new Fi({title:"Insert horizontal rule",label:"Horizontal rule",enable:function(t){return gs(t,s)},run:function(t,e){e(t.tr.replaceSelectionWith(s.create()))}})}var a=function(t){return t.filter((function(t){return t}))};return o.insertMenu=new $i(a([o.insertImage,o.insertHorizontalRule]),{label:"Insert"}),o.typeMenu=new $i(a([o.makeParagraph,o.makeCodeBlock,o.makeHead1&&new Hi(a([o.makeHead1,o.makeHead2,o.makeHead3,o.makeHead4,o.makeHead5,o.makeHead6]),{label:"Heading"})]),{label:"Type..."}),o.inlineMenu=[a([o.toggleStrong,o.toggleEm,o.toggleCode,o.toggleLink])],o.blockMenu=[a([o.wrapBulletList,o.wrapOrderedList,o.wrapBlockQuote,Ui,Ki,Gi])],o.fullMenu=o.inlineMenu.concat([[o.insertMenu,o.typeMenu]],[[Zi,Yi]],o.blockMenu),o}var Cs="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _s(t,e){var n,r,o={};function i(t,n){if(e){var r=e[t];if(!1===r)return;r&&(t=r)}o[t]=n}if(i("Mod-z",Xo),i("Shift-Mod-z",ti),i("Backspace",as),Cs||i("Mod-y",ti),i("Alt-ArrowUp",ii),i("Alt-ArrowDown",si),i("Mod-BracketLeft",ai),i("Escape",pi),(n=t.marks.strong)&&(i("Mod-b",mi(n)),i("Mod-B",mi(n))),(n=t.marks.em)&&(i("Mod-i",mi(n)),i("Mod-I",mi(n))),(n=t.marks.code)&&i("Mod-`",mi(n)),(n=t.nodes.bullet_list)&&i("Shift-Ctrl-8",ns(n)),(n=t.nodes.ordered_list)&&i("Shift-Ctrl-9",ns(n)),(n=t.nodes.blockquote)&&i("Ctrl->",fi(n)),n=t.nodes.hard_break){var a=n,c=vi(li,(function(t,e){return e(t.tr.replaceSelectionWith(a.create()).scrollIntoView()),!0}));i("Mod-Enter",c),i("Shift-Enter",c),Cs&&i("Ctrl-Enter",c)}if((n=t.nodes.list_item)&&(i("Enter",(r=n,function(t,e){var n=t.selection,o=n.$from,i=n.$to,a=n.node;if(a&&a.isBlock||o.depth<2||!o.sameParent(i))return!1;var c=o.node(-1);if(c.type!=r)return!1;if(0==o.parent.content.size){if(2==o.depth||o.node(-3).type!=r||o.index(-2)!=o.node(-2).childCount-1)return!1;if(e){for(var l=s.empty,u=o.index(-1)>0,p=o.depth-(u?1:2);p>=o.depth-3;p--)l=s.from(o.node(p).copy(l));l=l.append(s.from(r.createAndFill()));var h=t.tr.replace(o.before(u?null:-1),o.after(-3),new f(l,u?3:2,2));h.setSelection(t.selection.constructor.near(h.doc.resolve(o.pos+(u?3:2)))),e(h.scrollIntoView())}return!0}var d=i.pos==o.end()?c.contentMatchAt(0).defaultType:null,m=t.tr.delete(o.pos,i.pos),v=d&&[null,{type:d}];return!!qt(m.doc,o.pos,2,v)&&(e&&e(m.split(o.pos,2,v).scrollIntoView()),!0)})),i("Mod-[",rs(n)),i("Mod-]",function(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var l=a.parent,u=l.child(c-1);if(u.type!=t)return!1;if(n){var p=u.lastChild&&u.lastChild.type==l.type,h=s.from(p?t.create():null),d=new f(s.from(t.create(null,s.from(l.type.create(null,h)))),p?3:1,0),m=a.start,v=a.end;n(e.tr.step(new Dt(m-(p?3:1),v,m,v,d,1,!0)).scrollIntoView())}return!0}}(n))),(n=t.nodes.paragraph)&&i("Shift-Ctrl-0",di(n)),(n=t.nodes.code_block)&&i("Shift-Ctrl-\\",di(n)),n=t.nodes.heading)for(var l=1;l<=6;l++)i("Shift-Ctrl-"+l,di(n,{level:l}));if(n=t.nodes.horizontal_rule){var u=n;i("Mod-_",(function(t,e){return e(t.tr.replaceSelectionWith(u.create()).scrollIntoView()),!0}))}return o}function Ss(t){var e,n=us.concat(ls,cs);return(e=t.nodes.blockquote)&&n.push(ps(/^\s*>\s$/,e)),(e=t.nodes.ordered_list)&&n.push(function(t){return ps(/^(\d+)\.\s$/,t,(function(t){return{order:+t[1]}}),(function(t,e){return e.childCount+e.attrs.order==+t[1]}))}(e)),(e=t.nodes.bullet_list)&&n.push(function(t){return ps(/^\s*([-+*])\s$/,t)}(e)),(e=t.nodes.code_block)&&n.push(function(t){return hs(/^```$/,t)}(e)),(e=t.nodes.heading)&&n.push(function(t,e){return hs(new RegExp("^(#{1,"+e+"})\\s$"),t,(function(t){return{level:t[1].length}}))}(e,6)),function(t){var e=t.rules,n=new ge({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return ss(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&ss(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:n})}function As(t){var e=[Ss(t.schema),qo(_s(t.schema,t.mapKeys)),qo(xi),Ci(),new ge({props:{decorations:Oi,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Si.valid(n))return new Si(n)},handleClick:Ei,handleKeyDown:Mi}})];return!1!==t.menuBar&&e.push(function(t){return new ge({view:function(e){return new es(e,t)}})}({floating:!1!==t.floatingMenu,content:t.menuContent||xs(t.schema).fullMenu})),!1!==t.history&&e.push(Qo()),e.concat(new ge({props:{attributes:{class:"ProseMirror-example-setup-style"}}}))}function Ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}new(function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=new Yr(e,{state:de.create({doc:ho.parse(n),plugins:As({schema:io})}),dispatchTransaction:function(t){document.querySelector("#content").innerText=mo.serialize(t.doc);var e=this.state.apply(t);this.updateState(e)}})}var e,n,r;return e=t,(n=[{key:"focus",value:function(){this.view.focus()}},{key:"destroy",value:function(){this.view.destroy()}},{key:"content",get:function(){return mo.serialize(this.view.state.doc)}}])&&Ms(e.prototype,n),r&&Ms(e,r),t}())(document.querySelector("#editor"),document.querySelector("#content").value)}]);
\ No newline at end of file
+/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){var a="object"==i(e)&&e&&!e.nodeType&&e,c="object"==i(t)&&t&&!t.nodeType&&t,l="object"==(void 0===r?"undefined":i(r))&&r;l.global!==l&&l.window!==l&&l.self!==l||(s=l);var u,p,h=2147483647,f=/^xn--/,d=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,y=String.fromCharCode;function b(t){throw new RangeError(v[t])}function k(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function w(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+k((t=t.replace(m,".")).split("."),e).join(".")}function x(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function C(t){return k(t,(function(t){var e="";return t>65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=y(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var r=0;for(t=n?g(t/700):t>>1,t+=g(t/e);t>455;r+=36)t=g(t/35);return g(r+36*t/(t+38))}function A(t){var e,n,r,o,i,s,a,c,l,u,p,f=[],d=t.length,m=0,v=128,y=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&b("not-basic"),f.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<d;){for(i=m,s=1,a=36;o>=d&&b("invalid-input"),((c=(p=t.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||c>g((h-m)/s))&&b("overflow"),m+=c*s,!(c<(l=a<=y?1:a>=y+26?26:a-y));a+=36)s>g(h/(u=36-l))&&b("overflow"),s*=u;y=S(m-i,e=f.length+1,0==i),g(m/e)>h-v&&b("overflow"),v+=g(m/e),m%=e,f.splice(m++,0,v)}return C(f)}function M(t){var e,n,r,o,i,s,a,c,l,u,p,f,d,m,v,k=[];for(f=(t=x(t)).length,e=128,n=0,i=72,s=0;s<f;++s)(p=t[s])<128&&k.push(y(p));for(r=o=k.length,o&&k.push("-");r<f;){for(a=h,s=0;s<f;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>g((h-n)/(d=r+1))&&b("overflow"),n+=(a-e)*d,e=a,s=0;s<f;++s)if((p=t[s])<e&&++n>h&&b("overflow"),p==e){for(c=n,l=36;!(c<(u=l<=i?1:l>=i+26?26:l-i));l+=36)v=c-u,m=36-u,k.push(y(_(u+v%m,0))),c=g(v/m);k.push(y(_(c,0))),i=S(n,d,r==o),n=0,++r}++n,++e}return k.join("")}if(u={version:"1.4.1",ucs2:{decode:x,encode:C},decode:A,encode:M,toASCII:function(t){return w(t,(function(t){return d.test(t)?"xn--"+M(t):t}))},toUnicode:function(t){return w(t,(function(t){return f.test(t)?A(t.slice(4).toLowerCase()):t}))}},"object"==i(n(12))&&n(12))void 0===(o=function(){return u}.call(e,n,e,t))||(t.exports=o);else if(a&&c)if(t.exports==a)c.exports=u;else for(p in u)u.hasOwnProperty(p)&&(a[p]=u[p]);else s.punycode=u}(this)}).call(this,n(65)(t),n(66))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}},function(t,e,n){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}},function(t,e,n){"use strict";t.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}},function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},a={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};s.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},s.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},s.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},s.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new s(r,this.size+t.size)},s.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,i=0;i<e;o++){var a=this.content[o],c=i+a.nodeSize;c>t&&((i<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-i),Math.min(a.text.length,e-i)):a.cut(Math.max(0,t-i-1),Math.min(a.content.size,e-i-1))),n.push(a),r+=a.nodeSize),i=c}return new s(n,r)},s.prototype.cutByIndex=function(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))},s.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new s(r,o)},s.prototype.addToStart=function(t){return new s([t].concat(this.content),this.size+t.nodeSize)},s.prototype.addToEnd=function(t){return new s(this.content.concat(t),this.size+t.nodeSize)},s.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},a.firstChild.get=function(){return this.content.length?this.content[0]:null},a.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},a.childCount.get=function(){return this.content.length},s.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},s.prototype.maybeChild=function(t){return this.content[t]},s.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},s.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},s.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),l=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var u=0,p=Math.min(a.text.length,c.text.length);u<p&&a.text[a.text.length-u-1]==c.text[c.text.length-u-1];)u++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var h=t(a.content,c.content,r-1,o-1);if(h)return h}r-=l,o-=l}else r-=l,o-=l}}(this,t,e,n)},s.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?l(n+1,o):l(n,r);r=o}},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(t){return t.toJSON()})):null},s.fromJSON=function(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new s(e.map(t.nodeFromJSON))},s.fromArray=function(t){if(!t.length)return s.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new s(e||t,n)},s.from=function(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(s.prototype,a);var c={index:0,offset:0};function l(t,e){return c.index=t,c.offset=e,c}function u(t,e){if(t===e)return!0;if(!t||"object"!=i(t)||!e||"object"!=i(e))return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!u(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e&&u(t[o],e[o])))return!1;for(var s in e)if(!(s in t))return!1}return!0}s.empty=new s([],0);var p=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}p.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},p.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},p.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},p.prototype.eq=function(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)},p.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},p.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},p.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},p.setFrom=function(t){if(!t||0==t.length)return p.none;if(t instanceof p)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},p.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var f=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},d={size:{configurable:!0}};function m(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return function t(e,n,r,o){var i=e.index(o),a=e.node(o);if(i==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(i,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var l=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(s.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),u=l.start,p=l.end;return k(a,function t(e,n,r,o,i){var a=e.depth>i&&g(e,n,i+1),c=o.depth>i&&g(r,o,i+1),l=[];b(null,e,i,l),a&&c&&n.index(i)==r.index(i)?(v(a,c),y(k(a,t(e,n,r,o,i+1)),l)):(a&&y(k(a,w(e,n,i+1)),l),b(n,r,i,l),c&&y(k(c,w(r,o,i+1)),l));return b(o,null,i,l),new s(l)}(e,u,p,n,o))}var h=e.parent,f=h.content;return k(h,f.cut(0,e.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return k(a,w(e,n,o))}(t,e,n,0)}function v(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){var r=t.node(n);return v(r,e.node(n)),r}function y(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function b(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(y(t.nodeAfter,r),i++));for(var a=i;a<s;a++)y(o.child(a),r);e&&e.depth==n&&e.textOffset&&y(e.nodeBefore,r)}function k(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var r=[];(b(null,t,n,r),t.depth>n)&&y(k(g(t,e,n+1),w(t,e,n+1)),r);return b(e,null,n,r),new s(r)}d.size.get=function(){return this.content.size-this.openStart-this.openEnd},f.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var l=t(c.content,n-a-1,r);return l&&e.replaceChild(s,c.copy(l))}(this.content,t+this.openStart,e,null);return n&&new f(n,this.openStart,this.openEnd)},f.prototype.removeBetween=function(t,e){return new f(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),l=c.index,u=c.offset;if(s==n||a.isText){if(u!=r&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},f.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},f.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},f.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},f.fromJSON=function(t,e){if(!e)return f.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new f(s.fromJSON(t,e.content),e.openStart||0,e.openEnd||0)},f.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new f(t,n,r)},Object.defineProperties(f.prototype,d),f.empty=new f(s.empty,0,0);var x=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};x.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},x.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},x.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},x.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},x.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},x.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},x.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},x.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},x.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},x.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},x.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},x.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new M(this,t,n)},x.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},x.prototype.max=function(t){return t.pos>this.pos?t:this},x.prototype.min=function(t){return t.pos<this.pos?t:this},x.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},x.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new x(e,n,o)},x.resolveCached=function(t,e){for(var n=0;n<_.length;n++){var r=_[n];if(r.pos==e&&r.doc==t)return r}var o=_[S]=x.resolve(t,e);return S=(S+1)%A,o},Object.defineProperties(x.prototype,C);var _=[],S=0,A=12,M=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},D={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};D.start.get=function(){return this.$from.before(this.depth+1)},D.end.get=function(){return this.$to.after(this.depth+1)},D.parent.get=function(){return this.$from.node(this.depth)},D.startIndex.get=function(){return this.$from.index(this.depth)},D.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(M.prototype,D);var E=Object.create(null),O=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||s.empty,this.marks=r||p.none},T={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}};T.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},T.childCount.get=function(){return this.content.childCount},O.prototype.child=function(t){return this.content.child(t)},O.prototype.maybeChild=function(t){return this.content.maybeChild(t)},O.prototype.forEach=function(t){this.content.forEach(t)},O.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},O.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},T.textContent.get=function(){return this.textBetween(0,this.content.size,"")},O.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},T.firstChild.get=function(){return this.content.firstChild},T.lastChild.get=function(){return this.content.lastChild},O.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},O.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},O.prototype.hasMarkup=function(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||E)&&p.sameSet(this.marks,n||p.none)},O.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},O.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},O.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},O.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return f.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new f(a,r.depth-i,o.depth-i)},O.prototype.replace=function(t,e,n){return m(this.resolve(t),this.resolve(e),n)},O.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},O.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},O.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},O.prototype.resolve=function(t){return x.resolveCached(this,t)},O.prototype.resolveNoCache=function(t){return x.resolve(this,t)},O.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},T.isBlock.get=function(){return this.type.isBlock},T.isTextblock.get=function(){return this.type.isTextblock},T.inlineContent.get=function(){return this.type.inlineContent},T.isInline.get=function(){return this.type.isInline},T.isText.get=function(){return this.type.isText},T.isLeaf.get=function(){return this.type.isLeaf},T.isAtom.get=function(){return this.type.isAtom},O.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),z(this.marks,t)},O.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},O.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=s.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},O.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},O.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},O.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));this.content.forEach((function(t){return t.check()}))},O.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},O.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=s.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(O.prototype,T);var N=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):z(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(O);function z(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var q=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},I={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};q.parse=function(t,e){var n=new R(t,e);if(null==n.next)return q.empty;var r=L(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];J(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new q(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(j);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(J(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var l=n();return o(t(e.expr,i),l),o(t(e.expr,l),l),[r(l)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var u=i,p=0;p<e.min;p++){var h=n();o(t(e.expr,u),h),u=h}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var d=n();r(u,d),o(t(e.expr,u),d),u=d}return[r(u)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(l)&&r.push(l)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position")}}(o,n),o},q.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},q.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},I.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},I.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},q.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},q.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(i,a){var c=i.matchFragment(t,n);if(c&&(!e||c.validEnd))return s.from(a.map((function(t){return t.createAndFill()})));for(var l=0;l<i.next.length;l+=2){var u=i.next[l],p=i.next[l+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var h=o(p,a.concat(u));if(h)return h}}}(this,[])},q.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},q.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},I.edgeCount.get=function(){return this.next.length>>1},q.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},q.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(q.prototype,I),q.empty=new q(!0);var R=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.unshift()},F={next:{configurable:!0}};function L(t){var e=[];do{e.push(B(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function B(t){var e=[];do{e.push(P(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function P(t){for(var e=function(t){if(t.eat("(")){var e=L(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=$(t,e)}return e}function V(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function $(t,e){var n=V(t),r=n;return t.eat(",")&&(r="}"!=t.next?V(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j(t,e){return e-t}function J(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort(j)}function H(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function W(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function U(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new Z(t[n]);return e}F.next.get=function(){return this.tokens[this.pos]},R.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},R.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(R.prototype,F);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=U(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},G={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};G.isInline.get=function(){return!this.isBlock},G.isTextblock.get=function(){return this.isBlock&&this.inlineContent},G.isLeaf.get=function(){return this.contentMatch==q.empty},G.isAtom.get=function(){return this.isLeaf||this.spec.atom},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new O(this,this.computeAttrs(t),s.from(e),p.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=s.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new O(this,this.computeAttrs(t),e,p.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=s.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(s.empty,!0);return o?new O(this,t,e.append(o),p.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.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 o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,G);var Z=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(Z.prototype,Y);var Q=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=U(r.attrs),this.rank=e,this.excluded=null;var o=H(this.attrs);this.instance=o&&new p(this,o)};Q.prototype.create=function(t){return!t&&this.instance?this.instance:new p(this,W(this.attrs,t))},Q.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new Q(t,r++,e,o)})),n},Q.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t.slice(0,e).concat(t.slice(e+1));return t},Q.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Q.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var X=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=Q.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],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=q.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?tt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:tt(this,u.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 tt(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}X.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},X.prototype.text=function(t,e){var n=this.nodes.text;return new N(n,n.defaultAttrs,t,p.setFrom(e))},X.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},X.prototype.nodeFromJSON=function(t){return O.fromJSON(this,t)},X.prototype.markFromJSON=function(t){return p.fromJSON(this,t)},X.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var et=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)}))};et.prototype.parse=function(t,e){void 0===e&&(e={});var n=new at(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},et.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new at(this,e,!0);return n.addAll(t,null,e.from,e.to),f.maxOpen(n.finish())},et.prototype.matchTag=function(t,e){for(var n=0;n<this.tags.length;n++){var r=this.tags[n];if(lt(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){var o=r.getAttrs(t);if(!1===o)continue;r.attrs=o}return r}}},et.prototype.matchStyle=function(t,e,n){for(var r=0;r<this.styles.length;r++){var o=this.styles[r];if(!(0!=o.style.indexOf(t)||o.context&&!n.matchesContext(o.context)||o.style.length>t.length&&(61!=o.style.charCodeAt(t.length)||o.style.slice(t.length+1)!=e))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i}return o}}},et.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=ut(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=ut(t)),t.node=s}));return e},et.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new et(t,et.schemaRules(t)))};var nt={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},rt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0};function it(t){return(t?1:0)|("full"===t?2:0)}var st=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=p.none,this.pendingMarks=r};st.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(s.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},st.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=s.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},st.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):pt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}};var at=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=it(e.preserveWhitespace)|(n?4:0);r=o?new st(o.type,o.attrs,p.none,p.none,!0,e.topMatch||o.type.contentMatch,i):new st(n?null:t.schema.topNodeType,null,p.none,p.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ct={top:{configurable:!0},currentPos:{configurable:!0}};function lt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ut(t){var e={};for(var n in t)e[n]=t[n];return e}function pt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[];return function t(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var o=n.edge(r),s=o.type,a=o.next;if(s==e)return!0;if(i.indexOf(a)<0&&t(a))return!0}}(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ct.top.get=function(){return this.nodes[this.open]},at.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},at.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if((n.type?n.type.inlineContent:n.content.length&&n.content[0].isInline)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)2&n.options||(e=e.replace(/\r?\n|\r/g," "));else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},at.prototype.addElement=function(t){var e=t.nodeName.toLowerCase();ot.hasOwnProperty(e)&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ot.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var n=this.options.ruleFromNode&&this.options.ruleFromNode(t)||this.parser.matchTag(t,this);if(n?n.ignore:rt.hasOwnProperty(e))this.findInside(t);else if(!n||n.skip){n&&n.skip.nodeType&&(t=n.skip);var r,o=this.top,i=this.needsBlock;if(nt.hasOwnProperty(e))r=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),r&&this.sync(o),this.needsBlock=i}else this.addElementByRule(t,n)},at.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},at.prototype.readStyles=function(t){for(var e=p.none,n=0;n<t.length;n+=2){var r=this.parser.matchStyle(t[n],t[n+1],this);if(r){if(r.ignore)return null;e=this.parser.schema.marks[r.mark].create(r.attrs).addToSet(e)}}return e},at.prototype.addElementByRule=function(t,e){var n,r,o,i=this;e.node?(r=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(r.create(e.attrs))||this.leafFallback(t):n=this.enter(r,e.attrs,e.preserveWhitespace):(o=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(o));var s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return i.insertNode(t)}));else{var a=e.contentElement;"string"==typeof a?a=t.querySelector(a):"function"==typeof a&&(a=a(t)),a||(a=t),this.findAround(t,a,!0),this.addAll(a,n)}n&&(this.sync(s),this.open--),o&&this.removePendingMark(o,s)},at.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&nt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},at.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},at.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},at.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},at.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=null==r?-5&o.options:it(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new st(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},at.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},at.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},at.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ct.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},at.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},at.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},at.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},at.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},at.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function t(s,a){for(;s>=0;s--){var c=n[s];if(""==c){if(s==n.length-1||0==s)continue;for(;a>=i;a--)if(t(s-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0}(n.length-1,this.open)},at.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},at.prototype.addPendingMark=function(t){this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},at.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1?r.pendingMarks=t.removeFromSet(r.pendingMarks):r.activeMarks=t.removeFromSet(r.activeMarks),r==e)break}},Object.defineProperties(at.prototype,ct);var ht=function(t,e){this.nodes=t||{},this.marks=e||{}};function ft(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dt(t){return t.document||window.document}ht.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=dt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],l=r.serializeMark(c,t.isInline,e);l&&(i.push(c,o),o.appendChild(l.dom),o=l.contentDOM||l.dom)}}o.appendChild(r.serializeNode(t,e))})),n},ht.prototype.serializeNode=function(t,e){void 0===e&&(e={});var n=ht.renderSpec(dt(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},ht.prototype.serializeNodeAndMarks=function(t,e){void 0===e&&(e={});for(var n=this.serializeNode(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},ht.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&ht.renderSpec(dt(n),r(t,e))},ht.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var s=null,a=n?t.createElementNS(n,r):t.createElement(r),c=e[1],l=1;if(c&&"object"==i(c)&&null==c.nodeType&&!Array.isArray(c))for(var u in l=2,c)if(null!=c[u]){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):a.setAttribute(u,c[u])}for(var h=l;h<e.length;h++){var f=e[h];if(0===f){if(h<e.length-1||h>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var d=ht.renderSpec(t,f,n),m=d.dom,v=d.contentDOM;if(a.appendChild(m),v){if(s)throw new RangeError("Multiple content holes");s=v}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ft(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ht.marksFromSchema=function(t){return ft(t.marks)};var mt=Math.pow(2,16);function vt(t){return 65535&t}var gt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},yt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};yt.prototype.recover=function(t){var e=0,n=vt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/mt}(t)},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},yt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var h=s/3+(t-a)*mt;return new gt(p,e<0?t!=a:t!=u,h)}r+=l-c}return n?t+r:new gt(t+r)},yt.prototype.touches=function(t,e){for(var n=0,r=vt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},yt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],l=this.ranges[r+n];t(s,s+c,a,a+l),o+=l-c}},yt.prototype.invert=function(){return new yt(this.ranges,!this.inverted)},yt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},yt.offset=function(t){return 0==t?yt.empty:new yt(t<0?[0,-t,0]:[0,0,t])},yt.empty=new yt([]);var bt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function kt(t){var e=Error.call(this,t);return e.__proto__=kt.prototype,e}bt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new bt(this.maps,this.mirror,t,e)},bt.prototype.copy=function(){return new bt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},bt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},bt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},bt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},bt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},bt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},bt.prototype.invert=function(){var t=new bt;return t.appendMappingInverted(this),t},bt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},bt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},bt.prototype._map=function(t,e,n){for(var r=!1,o=null,i=this.from;i<this.to;i++){var s=this.maps[i],a=o&&o[i];if(null!=a&&s.touches(t,a))t=s.recover(a);else{var c=s.mapResult(t,e);if(null!=c.recover){var l=this.getMirror(i);if(null!=l&&l>i&&l<this.to){if(c.deleted){i=l,t=this.maps[l].recover(c.recover);continue}(o||(o=Object.create(null)))[l]=c.recover}}c.deleted&&(r=!0),t=c.pos}}return n?t:new gt(t,r)},kt.prototype=Object.create(Error.prototype),kt.prototype.constructor=kt,kt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bt},xt={before:{configurable:!0},docChanged:{configurable:!0}};function Ct(){throw new Error("Override me")}xt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new kt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},xt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,xt);var _t=Object.create(null),St=function(){};St.prototype.apply=function(t){return Ct()},St.prototype.getMap=function(){return yt.empty},St.prototype.invert=function(t){return Ct()},St.prototype.map=function(t){return Ct()},St.prototype.merge=function(t){return null},St.prototype.toJSON=function(){return Ct()},St.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=_t[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},St.jsonID=function(t,e){if(t in _t)throw new RangeError("Duplicate use of step JSON ID "+t);return _t[t]=e,e.prototype.jsonID=t,e};var At=function(t,e){this.doc=t,this.failed=e};At.ok=function(t){return new At(t,null)},At.fail=function(t){return new At(null,t)},At.fromReplace=function(t,e,n,r){try{return At.ok(t.replace(e,n,r))}catch(t){if(t instanceof h)return At.fail(t.message);throw t}};var Mt=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Et(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new yt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure!=this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?f.empty:new f(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?f.empty:new f(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,f.fromJSON(t,n.slice),!!n.structure)},e}(St);St.jsonID("replace",Mt);var Dt=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Et(t,this.from,this.gapFrom)||Et(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return At.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?At.fromReplace(t,this.from,this.to,n):At.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,f.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(St);function Et(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Ot(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Tt(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Ot(r,o,i))break}}function Nt(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(zt).concat({type:e,attrs:n}).concat(i.map(zt)):null}function zt(t){return{type:t,attrs:null}}function qt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),h=r&&r[c]||l;if(h!=l&&(p=p.replaceChild(0,h.type.create(h.attrs))),!l.canReplace(u+1,l.childCount)||!h.type.validContent(p))return!1}var f=o.indexAfter(i),d=r&&r[0];return o.node(i).canReplaceWith(f,f,d?d.type:o.node(i+1).type)}function It(t,e){var n=t.resolve(e),r=n.index();return Rt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Ft(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Rt(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function Lt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Bt(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Bt(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return s.fromArray(r)}St.jsonID("replaceAround",Dt),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,i=n.before(o+1),a=r.after(o+1),c=i,l=a,u=s.empty,p=0,h=o,d=!1;h>e;h--)d||n.index(h)>0?(d=!0,u=s.from(n.node(h).copy(u)),p++):c--;for(var m=s.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,m=s.from(r.node(g).copy(m)),v++):l++;return this.step(new Dt(c,l,i,a,new f(u.append(m),p,v),u.size-p,!0))},wt.prototype.wrap=function(t,e){for(var n=s.empty,r=e.length-1;r>=0;r--)n=s.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Dt(o,i,o,i,new f(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var a=o.mapping.slice(i),c=a.map(e,1),l=a.map(e+t.nodeSize,1);return o.step(new Dt(c,l,c+1,l-1,new f(s.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Dt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new f(s.from(i),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=s.empty,i=s.empty,a=r.depth,c=r.depth-e,l=e-1;a>c;a--,l--){o=s.from(r.node(a).copy(o));var u=n&&n[l];i=s.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Mt(t,t,new f(o.append(i),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Mt(t-e,t+e,f.empty,!0);return this.step(n)};var Pt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new f(Bt(n.content,(function(t,n){return n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);St.jsonID("addMark",Pt);var Vt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new f(Bt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Pt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(St);function $t(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=f.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);if(Ht(o,i,r))return new Mt(e,n,r);var a=function(t,e){var n=function t(e,n,r,o){var i=s.empty,a=0,c=r[n];if(e.depth>n){var l=t(e,n+1,r,o||c);a=l.openEnd+1,i=s.from(e.node(n+1).copy(l.content))}c&&(i=i.append(c.content),a=c.openEnd);o&&(i=i.append(e.node(n).contentMatchAt(e.indexAfter(n)).fillBefore(s.empty,!0)),a=0);return{content:i,openEnd:a}}(t,0,e,!1),r=n.content,o=n.openEnd;return new f(r,t.depth,o||0)}(o,function(t,e){for(var n=new Wt(t),r=1;e.size&&r<=3;r++){var o=n.placeSlice(e.content,e.openStart,e.openEnd,r);3==r&&o!=e&&o.size&&(r=0),e=o}for(;n.open.length;)n.closeNode();return n.placed}(o,r)),c=Jt(o,i,a);if(!c)return null;if(a.size!=c.size&&function(t,e,n){if(!e.parent.isTextblock)return!1;var r,o=n.openEnd?function(t,e){for(var n=1;n<e;n++)t=t.lastChild.content;return t.lastChild}(n.content,n.openEnd):t.node(t.depth-(n.openStart-n.openEnd));if(!o.isTextblock)return!1;for(var i=e.index();i<e.parent.childCount;i++)if(!o.type.allowsMarks(e.parent.child(i).marks))return!1;n.openEnd?r=o.contentMatchAt(o.childCount):(r=o.contentMatchAt(o.childCount),n.size&&(r=r.matchFragment(n.content,n.openStart?1:0)));return(r=r.matchFragment(e.parent.content,e.index()))&&r.validEnd}(o,i,a)){for(var l=i.depth,u=i.after(l);l>1&&u==i.end(--l);)++u;var p=Jt(o,t.resolve(u),a);if(p)return new Dt(e,u,n,i.end(),p,a.size)}return c.size||e!=n?new Mt(e,n,c):null}function jt(t,e,n,r,o,i,a){var c,l=t.childCount,u=l-(a>0?1:0),p=i<0?e:n.node(o);c=i<0?p.contentMatchAt(u):1==l&&a>0?p.contentMatchAt(i?n.index(o):n.indexAfter(o)):p.contentMatchAt(n.indexAfter(o)).matchFragment(t,l>0&&i?1:0,u);var h=r.node(o);if(a>0&&o<r.depth){var f=h.content.cutByIndex(r.indexAfter(o)).addToStart(t.lastChild),d=c.fillBefore(f,!0);if(d&&d.size&&i>0&&1==l&&(d=null),d){var m=jt(t.lastChild.content,t.lastChild,n,r,o+1,1==l?i-1:-1,a-1);if(m){var v=t.lastChild.copy(m);return d.size?t.cutByIndex(0,l-1).append(d).addToEnd(v):t.replaceChild(l-1,v)}}}a>0&&(c=c.matchType((1==l&&i>0?n.node(o+1):t.lastChild).type));var g=r.index(o);if(g==h.childCount&&!h.type.compatibleContent(e.type))return null;for(var y=c.fillBefore(h.content,!0,g),b=g;y&&b<h.content.childCount;b++)p.type.allowsMarks(h.content.child(b).marks)||(y=null);if(!y)return null;if(a>0){var k=function t(e,n,r,o,i){var a,c=e.content,l=c.childCount;a=i>=0?r.node(o).contentMatchAt(r.indexAfter(o)).matchFragment(c,i>0?1:0,l):e.contentMatchAt(l);if(n>0){var u=t(c.lastChild,n-1,r,o+1,1==l?i-1:-1);c=c.replaceChild(l-1,u)}return e.copy(c.append(a.fillBefore(s.empty,!0)))}(t.lastChild,a-1,n,o+1,1==l?i-1:-1);t=t.replaceChild(l-1,k)}return t=t.append(y),r.depth>o&&(t=t.addToEnd(function t(e,n){var r=e.node(n),o=r.contentMatchAt(0).fillBefore(r.content,!0,e.index(n));e.depth>n&&(o=o.addToEnd(t(e,n+1)));return r.copy(o)}(r,o+1))),t}function Jt(t,e,n){var r=jt(n.content,t.node(0),t,e,0,n.openStart,n.openEnd);return r?function(t,e,n){for(;e>0&&n>0&&1==t.childCount;)t=t.firstChild.content,e--,n--;return new f(t,e,n)}(r,n.openStart,e.depth):null}function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}St.jsonID("removeMark",Vt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),h=Math.min(c+r.nodeSize,e),f=n.addToSet(u),d=0;d<u.length;d++)u[d].isInSet(f)||(s&&s.to==p&&s.mark.eq(u[d])?s.to=h:o.push(s=new Vt(p,h,u[d])));a&&a.to==p?a.to=h:i.push(a=new Pt(p,h,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof Q){var c=n.isInSet(r.marks);c&&(a=[c])}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var l=Math.min(s+r.nodeSize,e),u=0;u<a.length;u++){for(var p=a[u],h=void 0,f=0;f<o.length;f++){var d=o[f];d.step==i-1&&p.eq(o[f].style)&&(h=d)}h?(h.to=l,h.step=i):o.push({style:p,from:Math.max(s,t),to:l,step:i})}}})),o.forEach((function(t){return r.step(new Vt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],i=t+1,a=0;a<r.childCount;a++){var c=r.child(a),l=i+c.nodeSize,u=n.matchType(c.type,c.attrs);if(u){n=u;for(var p=0;p<c.marks.length;p++)e.allowsMarkType(c.marks[p].type)||this.step(new Vt(i,l,c.marks[p]))}else o.push(new Mt(i,l,f.empty));i=l}if(!n.validEnd){var h=n.fillBefore(s.empty,!0);this.replace(i,i,new f(h,0,0))}for(var d=o.length-1;d>=0;d--)this.step(o[d]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=f.empty);var r=$t(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new f(s.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,f.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Wt=function(t){this.open=[];for(var e=0;e<=t.depth;e++){var n=t.node(e),r=n.contentMatchAt(t.indexAfter(e));this.open.push({parent:n,match:r,content:s.empty,wrapper:!1,openEnd:0,depth:e})}this.placed=[]};function Ut(t,e,n){var r=t.content;if(e>1){var o=Ut(t.firstChild,e-1,1==t.childCount?n-1:0);r=t.content.replaceChild(0,o)}var i=t.type.contentMatch.fillBefore(r,0==n);return t.copy(i.append(r))}function Kt(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(Kt(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(s.empty,!0))}return t}function Gt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}function Zt(t){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Wt.prototype.placeSlice=function(t,e,n,r,o){if(e>0){var i=t.firstChild,a=this.placeSlice(i.content,Math.max(0,e-1),n&&1==t.childCount?n-1:0,r,i);a.content!=i.content&&(a.content.size?(t=t.replaceChild(0,i.copy(a.content)),e=a.openStart+1):(1==t.childCount&&(n=0),t=t.cutByIndex(1),e=0))}var c=this.placeContent(t,e,n,r,o);if(r>2&&c.size&&0==e){var l=c.content.firstChild,u=1==c.content.childCount;this.placeContent(l.content,0,n&&u?n-1:0,r,l),c=u?s.empty:new f(c.content.cutByIndex(1),0,n)}return c},Wt.prototype.placeContent=function(t,e,n,r,o){for(var i=0;i<t.childCount;i++){for(var a=t.child(i),c=!1,l=i==t.childCount-1,u=this.open.length-1;u>=0;u--){var p=this.open[u],h=void 0;if(r>1&&(h=p.match.findWrapping(a.type))&&(!o||!h.length||h[h.length-1]!=o.type)){for(;this.open.length-1>u;)this.closeNode();for(var d=0;d<h.length;d++)p.match=p.match.matchType(h[d]),u++,p={parent:h[d].create(),match:h[d].contentMatch,content:s.empty,wrapper:!0,openEnd:0,depth:u+d},this.open.push(p)}var m=p.match.matchType(a.type);if(!m){var v=p.match.fillBefore(s.from(a));if(!v){if(o&&p.match.matchType(o.type))break;continue}for(var g=0;g<v.childCount;g++){var y=v.child(g);this.addNode(p,y,0),m=p.match.matchFragment(y)}}for(;this.open.length-1>u;)this.closeNode();a=a.mark(p.parent.type.allowedMarks(a.marks)),e&&(a=Ut(a,e,l?n:0),e=0),this.addNode(p,a,l?n:0),p.match=m,l&&(n=0),c=!0;break}if(!c)break}return this.open.length>1&&(i>0&&i==t.childCount||o&&this.open[this.open.length-1].parent.type==o.type)&&this.closeNode(),new f(t.cutByIndex(i),e,n)},Wt.prototype.addNode=function(t,e,n){var r,o;t.content=(r=t.content,o=t.openEnd,o?r.replaceChild(r.childCount-1,function t(e,n){var r=e.content;if(n>1){var o=t(e.lastChild,n-1);r=e.content.replaceChild(e.childCount-1,o)}var i=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(i))}(r.lastChild,o)):r).addToEnd(e),t.openEnd=n},Wt.prototype.closeNode=function(){var t=this.open.pop();0==t.content.size||(t.wrapper?this.addNode(this.open[this.open.length-1],t.parent.copy(t.content),t.openEnd+1):this.placed[t.depth]={depth:t.depth,content:t.content,openEnd:t.openEnd})},wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new Mt(t,e,n));var i=Gt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],h=n.openStart,d=n.content,m=0;;m++){var v=d.firstChild;if(p.push(v),m==n.openStart)break;d=v.content}h>0&&p[h-1].type.spec.defining&&r.node(u).type!=p[h-1].type?h-=1:h>=2&&p[h-1].isTextblock&&p[h-2].type.spec.defining&&r.node(u).type!=p[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=p[y];if(b)for(var k=0;k<i.length;k++){var w=i[(k+u)%i.length],x=!0;w<0&&(x=!1,w=-w);var C=r.node(w-1),_=r.index(w-1);if(C.canReplaceWith(_,_,b.type,b.marks))return this.replace(r.before(w),x?o.after(w):e,new f(Kt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,A=i.length-1;A>=0&&(this.replace(t,e,n),!(this.steps.length>S));A--){var M=i[A];A<0||(t=r.before(M),e=o.after(M))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new f(s.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Gt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Yt=Object.create(null),Qt=function(t,e,n){this.ranges=n||[new te(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Xt={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Xt.anchor.get=function(){return this.$anchor.pos},Xt.head.get=function(){return this.$head.pos},Xt.from.get=function(){return this.$from.pos},Xt.to.get=function(){return this.$to.pos},Xt.$from.get=function(){return this.ranges[0].$from},Xt.$to.get=function(){return this.ranges[0].$to},Xt.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},Qt.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},Qt.prototype.replace=function(t,e){void 0===e&&(e=f.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],l=c.$from,u=c.$to,p=t.mapping.slice(i);t.replaceRange(p.map(l.pos),p.map(u.pos),a?f.empty:e),0==a&&ce(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},Qt.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),l=c.map(s.pos),u=c.map(a.pos);o?t.deleteRange(l,u):(t.replaceRangeWith(l,u,e),ce(t,n,e.isInline?-1:1))}},Qt.findFrom=function(t,e,n){var r=t.parent.inlineContent?new ee(t):ae(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?ae(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):ae(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Qt.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ie(t.node(0))},Qt.atStart=function(t){return ae(t,t,0,0,1)||new ie(t)},Qt.atEnd=function(t){return ae(t,t,t.content.size,t.childCount,-1)||new ie(t)},Qt.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Yt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Qt.jsonID=function(t,e){if(t in Yt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Yt[t]=e,e.prototype.jsonID=t,e},Qt.prototype.getBookmark=function(){return ee.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Qt.prototype,Xt),Qt.prototype.visible=!0;var te=function(t,e){this.$from=t,this.$to=e},ee=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=f.empty),t.prototype.replace.call(this,e,n),n==f.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new ne(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(Qt);Qt.jsonID("text",ee);var ne=function(t,e){this.anchor=t,this.head=e};ne.prototype.map=function(t){return new ne(t.map(this.anchor),t.map(this.head))},ne.prototype.resolve=function(t){return ee.between(t.resolve(this.anchor),t.resolve(this.head))};var re=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new f(s.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new oe(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(Qt);re.prototype.visible=!1,Qt.jsonID("node",re);var oe=function(t){this.anchor=t};oe.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new ne(r,r):new oe(r)},oe.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&re.isSelectable(n)?new re(e):Qt.near(e)};var ie=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return se},e}(Qt);Qt.jsonID("all",ie);var se={map:function(){return this},resolve:function(t){return new ie(t)}};function ae(t,e,n,r,o,i){if(e.inlineContent)return ee.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&re.isSelectable(a))return re.create(t,n-(o<0?a.nodeSize:0))}else{var c=ae(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ce(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Mt||i instanceof Dt)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(Qt.near(t.doc.resolve(o),n))}}var le=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;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},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return p.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Qt.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function ue(t,e){return e&&t?t.bind(e):t}var pe=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},he=[new pe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new pe("selection",{init:function(t,e){return t.selection||Qt.atStart(e.doc)},apply:function(t){return t.selection}}),new pe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],fe=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new pe(t.key,t.spec.state,t))}))},de=function(t){this.config=t},me={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};me.schema.get=function(){return this.config.schema},me.plugins.get=function(){return this.config.plugins},de.prototype.apply=function(t){return this.applyTransaction(t).state},de.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},de.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,l=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(l&&n.filterTransaction(l,i)){if(l.setMeta("appendedTransaction",t),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:e.length}:{state:this,n:0})}e.push(l),n=n.applyInner(l),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},de.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new de(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<ve.length;i++)ve[i](this,t,e);return e},me.tr.get=function(){return new le(this)},de.create=function(t){for(var e=new fe(t.schema||t.doc.type.schema,t.plugins),n=new de(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},de.prototype.reconfigure=function(t){for(var e=new fe(t.schema||this.schema,t.plugins),n=e.fields,r=new de(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},de.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==Zt(t))for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},de.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new fe(t.schema,t.plugins),o=new de(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=O.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=Qt.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},de.addApplyListener=function(t){ve.push(t)},de.removeApplyListener=function(t){var e=ve.indexOf(t);e>-1&&ve.splice(e,1)},Object.defineProperties(de.prototype,me);var ve=[];var ge=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:be("plugin")};ge.prototype.getState=function(t){return t[this.key]};var ye=Object.create(null);function be(t){return t in ye?t+"$"+ ++ye[t]:(ye[t]=0,t+"$")}var ke=function(t){void 0===t&&(t="key"),this.key=be(t)};ke.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ke.prototype.getState=function(t){return t[this.key]};var we={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var xe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);we.mac=/Mac/.test(navigator.platform);var Se=we.ie=!!(Ce||_e||xe);we.ie_version=Ce?document.documentMode||6:_e?+_e[1]:xe?+xe[1]:null,we.gecko=!Se&&/gecko\/(\d+)/i.test(navigator.userAgent),we.gecko_version=we.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Ae=!Se&&/Chrome\/(\d+)/.exec(navigator.userAgent);we.chrome=!!Ae,we.chrome_version=Ae&&+Ae[1],we.ios=!Se&&/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),we.android=/Android \d/.test(navigator.userAgent),we.webkit=!Se&&"WebkitAppearance"in document.documentElement.style,we.safari=/Apple Computer/.test(navigator.vendor),we.webkit_version=we.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Me=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},De=function(t){var e=t.parentNode;return e&&11==e.nodeType?e.host:e},Ee=function(t,e,n){var r=document.createRange();return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Oe=function(t,e,n,r){return n&&(Ne(t,e,n,r,-1)||Ne(t,e,n,r,1))},Te=/^(img|br|input|textarea|hr)$/i;function Ne(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:ze(t))){var i=t.parentNode;if(1!=i.nodeType||qe(t)||Te.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Me(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?ze(t):0}}}function ze(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function qe(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Ie=function(t){var e=t.isCollapsed;return e&&we.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Re(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Le(t,e){return"number"==typeof t?t:t[e]}function Be(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=i.defaultView,a=n||t.dom;a;a=De(a))if(1==a.nodeType){var c=a==i.body||1!=a.nodeType,l=c?Fe(s):a.getBoundingClientRect(),u=0,p=0;if(e.top<l.top+Le(r,"top")?p=-(l.top-e.top+Le(o,"top")):e.bottom>l.bottom-Le(r,"bottom")&&(p=e.bottom-l.bottom+Le(o,"bottom")),e.left<l.left+Le(r,"left")?u=-(l.left-e.left+Le(o,"left")):e.right>l.right-Le(r,"right")&&(u=e.right-l.right+Le(o,"right")),(u||p)&&(c?s.scrollBy(u,p):(p&&(a.scrollTop+=p),u&&(a.scrollLeft+=u),e={left:e.left-u,top:e.top-p,right:e.right-u,bottom:e.bottom-p})),c)break}}function Pe(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=De(t));return e}function Ve(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var $e=null;function je(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(1==c.nodeType)u=c.getClientRects();else{if(3!=c.nodeType)continue;u=Ee(c).getClientRects()}for(var p=0;p<u.length;p++){var h=u[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);var f=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:h.right<e.left?h.right:h.left,top:e.top}:e,1==c.nodeType&&f&&(i=l+(e.left>=(h.left+h.right)/2?1:0));continue}}!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=We(r,1);if(i.top!=i.bottom&&Je(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:je(n,r)}function Je(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function He(t,e){var n,r,o,i,s=t.root;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var l,u=s.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!Je(e,p))return null;if(!(u=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),l=0;l<c.length;l++){var u=c[l];if(Je(n,u))return t(a,n,u)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,p)))return null}if(u=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(u,e),o){if(we.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var h,f=o.childNodes[i];"IMG"==f.nodeName&&(h=f.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=je(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var d=t.docView.nearestDesc(u,!0);return{pos:l,inside:d?d.posAtStart-d.border:-1}}function We(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function Ue(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset;if(3==r.nodeType&&(we.chrome||we.gecko)){var i=We(Ee(r,o,o),0);if(we.gecko&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){var s=We(Ee(r,o-1,o-1),-1);if(Math.abs(s.left-i.left)<1&&s.top==i.top){var a=We(Ee(r,o,o+1),-1);return Ke(a,a.left<s.left)}}return i}if(1==r.nodeType&&!t.state.doc.resolve(e).parent.inlineContent){var c,l=!0;if(o<r.childNodes.length){var u=r.childNodes[o];1==u.nodeType&&(c=u.getBoundingClientRect())}if(!c&&o){var p=r.childNodes[o-1];1==p.nodeType&&(c=p.getBoundingClientRect(),l=!1)}return function(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}(c||r.getBoundingClientRect(),l)}for(var h=-1;h<2;h+=2)if(h<0&&o){var f=void 0,d=3==r.nodeType?Ee(r,o-1,o):3==(f=r.childNodes[o-1]).nodeType?Ee(f):1==f.nodeType&&"BR"!=f.nodeName?f:null;if(d){var m=We(d,1);if(m.top<m.bottom)return Ke(m,!1)}}else if(h>0&&o<ze(r)){var v=void 0,g=3==r.nodeType?Ee(r,o,o+1):3==(v=r.childNodes[o]).nodeType?Ee(v):1==v.nodeType?v:null;if(g){var y=We(g,-1);if(y.top<y.bottom)return Ke(y,!0)}}return Ke(We(3==r.nodeType?Ee(r):r,0),!1)}function Ke(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ge(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o.focus()}}var Ze=/[\u0590-\u08ac]/;var Ye=null,Qe=null,Xe=!1;function tn(t,e,n){return Ye==e&&Qe==n?Xe:(Ye=e,Qe=n,Xe="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$anchor.min(r.$head):r.$anchor.max(r.$head);return Ge(t,e,(function(){for(var e=t.docView.domFromPos(o.pos).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Ue(t,o.pos),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=Ee(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var l=a[c];if(l.bottom>l.top&&("up"==n?l.bottom<i.top+1:l.top>i.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return Ze.test(r.parent.textContent)&&a.modify?Ge(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var en=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},nn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0}};en.prototype.matchesWidget=function(){return!1},en.prototype.matchesMark=function(){return!1},en.prototype.matchesNode=function(){return!1},en.prototype.matchesHack=function(){return!1},nn.beforePosition.get=function(){return!1},en.prototype.parseRule=function(){return null},en.prototype.stopEvent=function(){return!1},nn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},nn.border.get=function(){return 0},en.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},en.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},nn.posBefore.get=function(){return this.parent.posBeforeChild(this)},nn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},nn.posAfter.get=function(){return this.posBefore+this.size},nn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},en.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},en.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(t):o.nodeDOM==t))return o;n=!1}}},en.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},en.prototype.posFromDOM=function(t,e,n){for(var r=t;;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}},en.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},en.prototype.domFromPos=function(t){if(!this.contentDOM)return{node:this.dom,offset:0};for(var e=0,n=0;;n++){if(e==t){for(;n<this.children.length&&(this.children[n].beforePosition||this.children[n].dom.parentNode!=this.contentDOM);)n++;return{node:this.contentDOM,offset:n==this.children.length?this.contentDOM.childNodes.length:Me(this.children[n].dom)}}if(n==this.children.length)throw new Error("Invalid position "+t);var r=this.children[n],o=e+r.size;if(t<o)return r.domFromPos(t-e-r.border);e=o}},en.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Me(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&e<=c){e=c;for(var h=s+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Me(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},en.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},en.prototype.domAfterPos=function(t){var e=this.domFromPos(t),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},en.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],l=a+c.size;if(o>a&&i<l)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=l}var u=this.domFromPos(t),p=this.domFromPos(e),h=n.getSelection(),f=document.createRange();if(r||!Oe(u.node,u.offset,h.anchorNode,h.anchorOffset)||!Oe(p.node,p.offset,h.focusNode,h.focusOffset)){if(h.extend)f.setEnd(u.node,u.offset),f.collapse(!1);else{if(t>e){var d=u;u=p,p=d}f.setEnd(p.node,p.offset),f.setStart(u.node,u.offset)}h.removeAllRanges(),h.addRange(f),h.extend&&h.extend(p.node,p.offset)}},en.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},nn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},en.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},en.prototype.markParentsDirty=function(){for(var t=this.parent;t;t=t.parent){t.dirty<2&&(t.dirty=2)}},Object.defineProperties(en.prototype,nn);var rn=[],on=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,rn,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={beforePosition:{configurable:!0}};return n.beforePosition.get=function(){return this.widget.type.side<0},e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},Object.defineProperties(e.prototype,n),e}(en),sn=function(t){function e(e,n,r,o){t.call(this,e,rn,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(en),an=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=ht.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,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}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Cn(i,n,s,r)),t>0&&(i=Cn(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(en),cn=function(t){function e(e,n,r,o,i,s,a,c,l){t.call(this,e,n.isLeaf?rn:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,l)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,l=i.nodeViews[n.type.name],u=l&&l(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r),p=u&&u.dom,h=u&&u.contentDOM;if(n.isText)if(p){if(3!=p.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else p=document.createTextNode(n.text);else p||(p=(a=ht.renderSpec(document,n.type.spec.toDOM(n))).dom,h=a.contentDOM);h||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=yn(p,r,n),u?c=new hn(t,n,r,o,p,h,f,u,i,s+1):n.isText?new un(t,n,r,o,p,f,i):new e(t,n,r,o,p,h,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?s.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&bn(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=r&&t.composing&&this.localCompositionNode(t,e),s=new wn(this,i&&i.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,p=0;;){if(c<o.length&&o[c].to==i){for(var h=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[h])).push(o[c++]);if(f){f.sort(xn);for(var d=0;d<f.length;d++)n(f[d],p,!!u)}else n(h,p,!!u)}var m=void 0,v=void 0;if(u)v=-1,m=u,u=null;else{if(!(p<t.childCount))break;v=p,m=t.child(p++)}for(var g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;c<o.length&&o[c].from==i;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var k=0;k<l.length;k++)l[k].to<b&&(b=l[k].to);b<y&&(u=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}r(m,l.length?l.slice():rn,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?s.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&s.syncToMarks(i==n.node.childCount?p.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(rn,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),this.renderChildren())},e.prototype.renderChildren=function(){!function t(e,n){for(var r=e.firstChild,o=0;o<n.length;o++){var i=n[o],s=i.dom;if(s.parentNode==e){for(;s!=r;)r=kn(r);r=r.nextSibling}else e.insertBefore(s,r);if(i instanceof an){var a=r?r.previousSibling:e.lastChild;t(i.contentDOM,i.children),r=a?a.nextSibling:e.firstChild}}for(;r;)r=kn(r)}(this.contentDOM,this.children),we.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom)},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof ee)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=ze(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new sn(this,i,n,o);t.compositionNodes.push(s),this.children=Cn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!bn(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=vn(this.dom,this.nodeDOM,mn(this.outerDeco,this.node,e),mn(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!1)},Object.defineProperties(e.prototype,n),e}(en);function ln(t,e,n,r,o){return yn(r,e,t),new cn(null,t,e,n,r,r,r,o,0)}var un=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{skip:this.nodeDOM.parentNode||!0}},e.prototype.update=function(t,e){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e}(cn),pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},e}(en),hn=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(cn);function fn(t){t&&(this.nodeName=t)}fn.prototype=Object.create(null);var dn=[new fn];function mn(t,e,n){if(0==t.length)return dn;for(var r=n?dn[0]:new fn,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs,a=r;if(s)for(var c in s.nodeName&&o.push(a=new fn(s.nodeName)),s){var l=s[c];null!=l&&(n&&1==o.length&&o.push(a=r=new fn(e.isInline?"span":"div")),"class"==c?a.class=(a.class?a.class+" ":"")+l:"style"==c?a.style=(a.style?a.style+";":"")+l:"nodeName"!=c&&(a[c]=l))}}return o}function vn(t,e,n,r){if(n==dn&&r==dn)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).appendChild(o),a=dn[0]),o=c}gn(o,a||dn[0],s)}return o}function gn(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" "):rn,s=n.class?n.class.split(" "):rn,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c])}if(e.style!=n.style){if(e.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(e.style);)t.style.removeProperty(l[1]);n.style&&(t.style.cssText+=n.style)}}function yn(t,e,n){return vn(t,t,dn,mn(e,n,1!=t.nodeType))}function bn(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function kn(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var wn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1;var n=function(t,e){for(var n=[],r=t.childCount,o=e.length-1;r>0&&o>=0;o--){var i=e[o],s=i.node;if(s){if(s!=t.child(r-1))break;n.push(i),--r}}return{nodes:n.reverse(),offset:r}}(t.node.content,t.children);this.preMatched=n.nodes,this.preMatchOffset=n.offset};function xn(t,e){return t.type.side-e.type.side}function Cn(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],l=a,u=a+=c.size;l>=n||u<=e?i.push(c):(l<e&&i.push(c.slice(0,e-l,r)),o&&(i.push(o),o=null),u>n&&i.push(c.slice(n-l,c.size,r)))}return i}function _n(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Qt.findFrom(s,e)}function Sn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function An(t,e,n){var r=t.state.selection;if(r instanceof ee){if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var o=_n(t.state,e);return!!(o&&o instanceof re)&&Sn(t,o)}var i,s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText)return!1;var c=e<0?s.pos-a.nodeSize:s.pos;return!!(a.isAtom||(i=t.docView.descAt(c))&&!i.contentDOM)&&(re.isSelectable(a)?Sn(t,new re(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):!!we.webkit&&Sn(t,new ee(t.state.doc.resolve(e<0?c:c+a.nodeSize))))}if(r instanceof re&&r.node.isInline)return Sn(t,new ee(e>0?r.$to:r.$from));var l=_n(t.state,e);return!!l&&Sn(t,l)}function Mn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Dn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function En(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(we.gecko&&1==n.nodeType&&r<Mn(n)&&Dn(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Dn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Tn(n))break;for(var c=n.previousSibling;c&&Dn(c);)o=n.parentNode,i=Me(c),c=c.previousSibling;if(c)r=Mn(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Nn(t,e,n,r):o&&Nn(t,e,o,i)}}function On(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Mn(n);;)if(r<s){if(1!=n.nodeType)break;if(!Dn(n.childNodes[r]))break;o=n,i=++r}else{if(Tn(n))break;for(var a=n.nextSibling;a&&Dn(a);)o=a.parentNode,i=Me(a)+1,a=a.nextSibling;if(a)r=0,s=Mn(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Nn(t,e,o,i)}}function Tn(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Nn(t,e,n,r){if(Ie(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection()}function zn(t,e,n){var r=t.state.selection;if(r instanceof ee&&!r.empty||n.indexOf("s")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=_n(t.state,e);if(s&&s instanceof re)return Sn(t,s)}if(!o.parent.inlineContent){var a=Qt.findFrom(e<0?o:i,e);return!a||Sn(t,a)}return!1}function qn(t,e){if(!(t.state.selection instanceof ee))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function In(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Rn(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||we.mac&&72==n&&"c"==r?qn(t,-1)||En(t):46==n||we.mac&&68==n&&"c"==r?qn(t,1)||On(t):13==n&&!we.ios||27==n||(37==n?An(t,-1,r)||En(t):39==n?An(t,1,r)||On(t):38==n?zn(t,-1,r)||En(t):40==n?function(t){if(we.chrome&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;In(t,o,!0),setTimeout((function(){return In(t,o,!1)}),20)}}}(t)||zn(t,1,r)||On(t):r==(we.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Fn(t,e){var n,r,o=t.root.getSelection(),i=t.state.doc,s=t.docView.nearestDesc(o.focusNode),a=s&&0==s.size,c=t.docView.posFromDOM(o.focusNode,o.focusOffset),l=i.resolve(c);if(Ie(o)){for(n=l;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&re.isSelectable(s.node)&&s.parent&&(!s.node.isInline||!function(t,e,n){for(var r=0==e,o=e==ze(t);r||o;){if(t==n)return!0;var i=Me(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==ze(t)}}(o.focusNode,o.focusOffset,s.dom))){var u=s.posBefore;r=new re(c==u?l:i.resolve(u))}}else n=i.resolve(t.docView.posFromDOM(o.anchorNode,o.anchorOffset));r||(r=Hn(t,n,l,"pointer"==e||t.state.selection.head<l.pos&&!a?1:-1));return r}function Ln(t,e){var n=t.state.selection;if(jn(t,n),t.editable?t.hasFocus():Wn(t)&&document.activeElement.contains(t.dom)){if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,Me(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&we.ie&&we.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,s=n.head;!Bn||n instanceof ee||(n.$from.parent.inlineContent||(r=Pn(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=Pn(t,n.to))),t.docView.setSelection(i,s,t.root,e),Bn&&(r&&$n(r),o&&$n(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):i!=s&&(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),t.dom.classList.remove("ProseMirror-hideselection"))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}wn.prototype.getPreMatch=function(t){return t>=this.preMatchOffset?this.preMatched[t-this.preMatchOffset]:null},wn.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},wn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},wn.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=an.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},wn.prototype.findNodeMatch=function(t,e,n,r){var o=-1,i=r<0?void 0:this.getPreMatch(r),s=this.top.children;if(i&&i.matchesNode(t,e,n))o=s.indexOf(i);else for(var a=this.index,c=Math.min(s.length,a+5);a<c;a++){var l=s[a];if(l.matchesNode(t,e,n)&&this.preMatched.indexOf(l)<0){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)},wn.prototype.updateNextNode=function(t,e,n,r,o){if(this.index==this.top.children.length)return!1;var i=this.top.children[this.index];if(i instanceof cn){var s=this.preMatched.indexOf(i);if(s>-1&&s+this.preMatchOffset!=o)return!1;var a=i.dom;if(!(this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))&&!(t.isText&&i.node&&i.node.isText&&i.nodeDOM.nodeValue==t.text&&3!=i.dirty&&bn(e,i.outerDeco)))&&i.update(t,e,n,r))return i.dom!=a&&(this.changed=!0),this.index++,!0}return!1},wn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,cn.create(this.top,t,e,n,r,o)),this.changed=!0},wn.prototype.placeWidget=function(t,e,n){if(this.index<this.top.children.length&&this.top.children[this.index].matchesWidget(t))this.index++;else{var r=new on(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}},wn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof an;)t=t.children[t.children.length-1];if(!t||!(t instanceof un)||/\n$/.test(t.node.text))if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack())this.index++;else{var e=document.createElement("br");this.top.children.splice(this.index++,0,new pn(this.top,rn,e,null)),this.changed=!0}};var Bn=we.safari||we.chrome&&we.chrome_version<63;function Pn(t,e){var n=t.docView.domFromPos(e),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(we.safari&&i&&"false"==i.contentEditable)return Vn(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Vn(i);if(s)return Vn(s)}}function Vn(t){return t.contentEditable="true",we.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $n(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jn(t,e){if(e instanceof re){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Jn(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Jn(t)}function Jn(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Hn(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||ee.between(e,n,r)}function Wn(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Un(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(we.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||we.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Kn(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==i?c.setMeta("pointer",!0):"key"==i&&c.scrollIntoView(),t.dispatch(c)}}else{var l=t.state.doc.resolve(e),u=l.sharedDepth(n);e=l.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p,h,f=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Ie(l)||u.push({node:l.focusNode,offset:l.focusOffset})),we.chrome&&8===t.lastKeyCode)for(var h=s;h>i;h--){var f=o.childNodes[h-1],d=f.pmViewDesc;if("BR"==f.nodeType&&!d){s=h;break}if(!d||d.size)break}var m=t.state.doc,v=t.someProp("domParser")||et.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Un,context:g});if(u&&null!=u[0].pos){var k=u[0].pos,w=u[1]&&u[1].pos;null==w&&(w=k),y={anchor:k+a,head:w+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n),m=t.state.doc,v=m.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.lastKeyCode=null;var g=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var l=Math.max(0,i-Math.min(a,c));r-=a+l-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(v.content,d.doc.content,d.from,p,h);if(!g){if(!(r&&f instanceof ee&&!f.empty&&f.$head.sameParent(f.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){var y=Gn(t,t.state.doc,d.sel);y&&!y.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(y))}return}g={start:f.from,endA:f.to,endB:f.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof ee&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),we.ie&&we.ie_version<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>d.from&&"  "==d.doc.textBetween(g.start-d.from-1,g.start-d.from+1)&&(g.start--,g.endA--,g.endB--);var b,k=d.doc.resolveNoCache(g.start-d.from),w=d.doc.resolveNoCache(g.endB-d.from);if((we.ios&&t.lastIOSEnter>Date.now()-100&&(!k.sameParent(w)||o.some((function(t){return"DIV"==t.nodeName})))||!k.sameParent(w)&&k.pos<d.doc.content.size&&(b=Qt.findFrom(d.doc.resolve(k.pos+1),1,!0))&&b.head==w.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>g.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Zn(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Zn(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,g.start,g.endA,k,w)&&t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))we.android&&we.chrome&&t.domObserver.suppressSelectionUpdates();else{var x,C,_,S,A=g.start,M=g.endA;if(k.sameParent(w)&&k.parent.inlineContent)if(k.pos==w.pos)we.ie&&we.ie_version<=11&&0==k.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Ln(t)}),20)),x=t.state.tr.delete(A,M),C=m.resolve(g.start).marksAcross(m.resolve(g.endA));else if(g.endA==g.endB&&(S=m.resolve(g.start))&&(_=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,c=i,l=a,u=0;u<a.length;u++)c=a[u].removeFromSet(c);for(var p=0;p<i.length;p++)l=i[p].removeFromSet(l);if(1==c.length&&0==l.length)r=c[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=l.length)return null;r=l[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var h=[],f=0;f<e.childCount;f++)h.push(o(e.child(f)));if(s.from(h).eq(t))return{mark:r,type:n}}(k.parent.content.cut(k.parentOffset,w.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start()))))x=t.state.tr,"add"==_.type?x.addMark(A,M,_.mark):x.removeMark(A,M,_.mark);else if(k.parent.child(k.index()).isText&&k.index()==w.index()-(w.textOffset?0:1)){var D=k.parent.textBetween(k.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,A,M,D)})))return;x=t.state.tr.insertText(D,A,M)}if(x||(x=t.state.tr.replace(A,M,d.doc.slice(g.start-d.from,g.endB-d.from))),d.sel){var E=Gn(t,x.doc,d.sel);E&&!(we.chrome&&we.android&&t.composing&&E.empty&&E.head==A||we.ie&&E.empty&&E.head==A)&&x.setSelection(E)}C&&x.ensureMarks(C),t.dispatch(x.scrollIntoView())}}}function Gn(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hn(t,e.resolve(n.anchor),e.resolve(n.head))}function Zn(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Yn(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.type.hasRequiredAttrs()?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||ht.fromSchema(t.state.schema),c=rr(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=er[p.nodeName.toLowerCase()]);){for(var h=u.length-1;h>=0;h--){for(var f=c.createElement(u[h]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Qn(t,e,n,r,o){var i,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var l=e&&(r||c||!n);if(l){if(t.someProp("transformPastedText",(function(t){e=t(e)})),c)return new f(s.from(t.state.schema.text(e)),0,0);var u=t.someProp("clipboardTextParser",(function(t){return t(e,o)}));u?a=u:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=rr().createElement("div"),o=/(?:<meta [^>]*>)*<([a-z][^>\s]+)/i.exec(t),i=0;(n=o&&er[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""),i=n.length);r.innerHTML=t;for(var s=0;s<i;s++)r=r.firstChild;return r}(n);var p=i&&i.querySelector("[data-pm-slice]"),h=p&&/^(\d+) (\d+) (.*)/.exec(p.getAttribute("data-pm-slice"));if(!a){var d=t.someProp("clipboardParser")||t.someProp("domParser")||et.fromSchema(t.state.schema);a=d.parseSlice(i,{preserveWhitespace:!(!l&&!h),context:o})}return a=h?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var l=r.nodes[n[c]];if(!l||l.hasRequiredAttrs())break;o=s.from(l.create(n[c+1],o)),i++,a++}return new f(o,i,a)}(function(t,e,n){e<t.openStart&&(t=new f(tr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd));n<t.openEnd&&(t=new f(tr(t.content,1,n,t.openEnd,0,0),t.openStart,n));return t}(a,+h[1],+h[2]),h[3]):f.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,i=[];if(t.forEach((function(t){if(i){var e,n=r.findWrapping(t.type);if(!n)return i=null;if(e=i.length&&o.length&&function t(e,n,r,o,i){if(i<e.length&&i<n.length&&e[i]==n[i]){var a=t(e,n,r,o.lastChild,i+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(i==e.length-1?r.type:e[i+1]))return o.copy(o.content.append(s.from(Xn(r,e,i+1))))}}(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),o=e.contentMatchAt(e.childCount).fillBefore(s.empty,!0);return e.copy(r.append(o))}(i[i.length-1],o.length));var a=Xn(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}})),i)return{v:s.from(i)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(a.content,o),!1),t.someProp("transformPasted",(function(t){a=t(a)})),a}function Xn(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,s.from(t));return t}function tr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,c=a.content;return o<r-1&&(c=tr(c,e,n,r,o+1,i)),o>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||i<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(s.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var er={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nr=null;function rr(){return nr||(nr=document.implementation.createHTMLDocument("title"))}var or={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ir=we.ie&&we.ie_version<=11,sr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};sr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},sr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var ar=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=!1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);we.ie&&we.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new sr,ir&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};ar.prototype.flushSoon=function(){var t=this;this.flushingSoon||(this.flushingSoon=!0,window.setTimeout((function(){t.flushingSoon=!1,t.flush()}),20))},ar.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,or),ir&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},ar.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}ir&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},ar.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},ar.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},ar.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},ar.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Wn(t)){var t;if(this.suppressingSelectionUpdates)return Ln(this.view);if(we.ie&&we.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&Oe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},ar.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},ar.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},ar.prototype.flush=function(){if(this.view.docView&&!this.flushingSoon){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Wn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&!this.view.composing&&(i=!0))}if(we.gecko&&s.length>1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(cr)return;cr=!0,"normal"==getComputedStyle(t.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,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Ln(this.view))}},ar.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){var r=t.previousSibling,o=t.nextSibling;if(we.ie&&we.ie_version<=11&&t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){var s=t.addedNodes[i],a=s.previousSibling,c=s.nextSibling;(!a||Array.prototype.indexOf.call(t.addedNodes,a)<0)&&(r=a),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c)}for(var l=r&&r.parentNode==t.target?Me(r)+1:0,u=n.localPosFromDOM(t.target,l,-1),p=o&&o.parentNode==t.target?Me(o):t.target.childNodes.length,h=0;h<t.addedNodes.length;h++)e.push(t.addedNodes[h]);return{from:u,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var cr=!1;var lr={},ur={};function pr(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function hr(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return fr(t,e)})}))}function fr(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function dr(t){return{left:t.clientX,top:t.clientY}}function mr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function vr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function gr(t,e,n,r,o){return mr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof re&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(vr(t,re.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&re.isSelectable(r))&&(vr(t,new re(n),"pointer"),!0)}(t,n))}function yr(t,e,n,r){return mr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function br(t,e,n,r){return mr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(vr(t,ee.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)vr(t,ee.create(n,s+1,s+1+i.content.size),"pointer");else{if(!re.isSelectable(i))continue;vr(t,re.create(n,s),"pointer")}return!0}}(t,n)}function kr(t){return Ar(t)}ur.keydown=function(t,e){t.shiftKey=16==e.keyCode||e.shiftKey,Cr(t,e)||(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!we.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey?t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Rn(t,e)?e.preventDefault():pr(t,"key"):t.lastIOSEnter=Date.now())},ur.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},ur.keypress=function(t,e){if(!(Cr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||we.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof ee&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var wr=we.mac?"metaKey":"ctrlKey";lr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=kr(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[wr]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(dr(e));i&&("singleClick"==o?t.mouseDown=new xr(t,i,e,n):("doubleClick"==o?yr:br)(t,i.pos,i.inside,e)?e.preventDefault():pr(t,"pointer"))};var xr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[wr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof re&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&we.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(){return s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),pr(t,"pointer")};function Cr(t,e){return!!t.composing||!!(we.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}xr.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.draggable=!1),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},xr.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(dr(t))),this.allowDefault||!e?pr(this.view,"pointer"):gr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():!this.flushed&&(!we.chrome||this.view.state.selection instanceof ee||e.pos!=this.view.state.selection.from&&e.pos!=this.view.state.selection.to)?pr(this.view,"pointer"):(vr(this.view,Qt.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault())}},xr.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),pr(this.view,"pointer")},lr.touchdown=function(t){kr(t),pr(t,"pointer")},lr.contextmenu=function(t){return kr(t)};var _r=we.android?5e3:-1;function Sr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Ar(t)}),e))}function Ar(t,e){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty();return!(!e&&!t.docView.dirty)&&(t.updateState(t.state),!0)}ur.compositionstart=ur.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Ar(t,!0),t.markCursor=null;else if(Ar(t),we.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Sr(t,_r)},ur.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Sr(t,20))};var Mr=we.ie&&we.ie_version<15||we.ios&&we.webkit_version<604;function Dr(t,e,n,r){var o=Qn(t,e,n,t.shiftKey,t.state.selection.$from);if(!t.someProp("handlePaste",(function(e){return e(t,r,o||f.empty)}))&&o){var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste"))}}lr.copy=ur.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Mr?null:e.clipboardData,i=Yn(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){var n=t.dom.ownerDocument,r=n.body.appendChild(n.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),i=n.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((function(){n.body.removeChild(r),t.focus()}),50)}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},ur.paste=function(t,e){var n=Mr?null:e.clipboardData,r=n&&n.getData("text/html"),o=n&&n.getData("text/plain");n&&(r||o||n.files.length)?(Dr(t,o,r,e),e.preventDefault()):function(t,e){var n=t.dom.ownerDocument,r=t.shiftKey||t.state.selection.$from.parent.type.spec.code,o=n.body.appendChild(n.createElement(r?"textarea":"div"));r||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((function(){t.focus(),n.body.removeChild(o),r?Dr(t,o.value,null,e):Dr(t,o.textContent,o.innerHTML,e)}),50)}(t,e)};var Er=function(t,e){this.slice=t,this.move=e},Or=we.mac?"altKey":"ctrlKey";for(var Tr in lr.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(dr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof re?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(re.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=Yn(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Mr?"Text":"text/html",c.innerHTML),Mr||e.dataTransfer.setData("text/plain",l),t.dragging=new Er(s,!e[Or])}},lr.dragend=function(t){window.setTimeout((function(){return t.dragging=null}),50)},ur.dragover=ur.dragenter=function(t,e){return e.preventDefault()},ur.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(dr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||Qn(t,e.dataTransfer.getData(Mr?"Text":"text/plain"),Mr?null:e.dataTransfer.getData("text/html"),!1,o);if(i&&(e.preventDefault(),!t.someProp("handleDrop",(function(r){return r(t,e,i,n&&n.move)})))){var s=i?Lt(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var a=t.state.tr;n&&n.move&&a.deleteSelection();var c=a.mapping.map(s),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=a.doc;if(l?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),!a.doc.eq(u)){var p=a.doc.resolve(c);l&&re.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild)?a.setSelection(new re(p)):a.setSelection(Hn(t,p,a.doc.resolve(a.mapping.map(s)))),t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}}}}}},lr.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Ln(t)}),20))},lr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},lr.beforeinput=function(t,e){if(we.chrome&&we.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Re(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},ur)lr[Tr]=ur[Tr];function Nr(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var zr=function(t,e){this.spec=e||Br,this.side=this.spec.side||0,this.toDOM=t};zr.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Rr(i-n,i-n,this)},zr.prototype.valid=function(){return!0},zr.prototype.eq=function(t){return this==t||t instanceof zr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Nr(this.spec,t.spec))};var qr=function(t,e){this.spec=e||Br,this.attrs=t};qr.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Rr(o,i,this)},qr.prototype.valid=function(t,e){return e.from<e.to},qr.prototype.eq=function(t){return this==t||t instanceof qr&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)},qr.is=function(t){return t.type instanceof qr};var Ir=function(t,e){this.spec=e||Br,this.attrs=t};Ir.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Rr(o.pos-n,i.pos-n,this)},Ir.prototype.valid=function(t,e){var n=t.content.findIndex(e.from),r=n.index,o=n.offset;return o==e.from&&o+t.child(r).nodeSize==e.to},Ir.prototype.eq=function(t){return this==t||t instanceof Ir&&Nr(this.attrs,t.attrs)&&Nr(this.spec,t.spec)};var Rr=function(t,e,n){this.from=t,this.to=e,this.type=n},Fr={spec:{configurable:!0}};Rr.prototype.copy=function(t,e){return new Rr(t,e,this.type)},Rr.prototype.eq=function(t){return this.type.eq(t.type)&&this.from==t.from&&this.to==t.to},Rr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Rr.widget=function(t,e,n){return new Rr(t,t,new zr(e,n))},Rr.inline=function(t,e,n,r){return new Rr(t,e,new qr(n,r))},Rr.node=function(t,e,n,r){return new Rr(t,e,new Ir(n,r))},Fr.spec.get=function(){return this.type.spec},Object.defineProperties(Rr.prototype,Fr);var Lr=[],Br={},Pr=function(t,e){this.local=t&&t.length?t:Lr,this.children=e&&e.length?e:Lr};Pr.create=function(t,e){return e.length?Wr(e,t,0,Br):Vr},Pr.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Pr.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Pr.prototype.map=function(t,e,n){return this==Vr||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Br)},Pr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],l=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:(l=r-n-(e-t)+(i-o))&&(a[s]+=l,a[s+1]+=l))}},l=0;l<n.maps.length;l++)n.maps[l].forEach(c);for(var u=!1,p=0;p<a.length;p+=3)if(-1==a[p+1]){var h=n.map(a[p]+i),f=h-o;if(f<0||f>=r.content.size){u=!0;continue}var d=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==d){var b=a[p+2].mapInner(n,y,h+1,a[p]+i+1,s);b!=Vr?(a[p]=f,a[p+1]=d,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var k=Wr(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var l=0;l<t.children.length;l+=3)a(t.children[l+2],t.children[l]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=k.local;for(var w=0;w<a.length;w+=3)a[w+1]<0&&(a.splice(w,3),w-=3);for(var x=0,C=0;x<k.children.length;x+=3){for(var _=k.children[x];C<a.length&&a[C]<_;)C+=3;a.splice(C,0,k.children[x],k.children[x+1],k.children[x+2])}}return new Pr(e&&e.sort(Ur),a)}(this.children,i,t,e,n,r,o):i?new Pr(i.sort(Ur)):Vr},Pr.prototype.add=function(t,e){return e.length?this==Vr?Pr.create(t,e):this.addInner(t,e,0):this},Pr.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=Jr(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Wr(a,t,c+1,Br)),i+=3}}));var s=jr(i?Hr(e):e,-n);return new Pr(s.length?this.local.concat(s).sort(Ur):this.local,r||this.children)},Pr.prototype.remove=function(t){return 0==t.length||this==Vr?this:this.removeInner(t,0)},Pr.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,l=void 0;c<t.length;c++)(l=t[c])&&l.from>s&&l.to<a&&(t[c]=null,(i||(i=[])).push(l));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,s+1);u!=Vr?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,h=void 0;p<t.length;p++)if(h=t[p])for(var f=0;f<r.length;f++)r[f].type.eq(h.type)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Pr(r,n):Vr},Pr.prototype.forChild=function(t,e){if(this==Vr)return this;if(e.isLeaf)return Pr.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof qr){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;l<u&&(r||(r=[])).push(c.copy(l,u))}}if(r){var p=new Pr(r.sort(Ur));return n?new $r([p,n]):p}return n||Vr},Pr.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Pr)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Pr.prototype.locals=function(t){return Kr(this.localsInner(t))},Pr.prototype.localsInner=function(t){if(this==Vr)return Lr;if(t.inlineContent||!this.local.some(qr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof qr||e.push(this.local[n]);return e};var Vr=new Pr;Pr.empty=Vr,Pr.removeOverlap=Kr;var $r=function(t){this.members=t};function jr(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Rr(o.from+e,o.to+e,o.type))}return n}function Jr(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Hr(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Wr(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=Jr(t,e,s+n);if(a){i=!0;var c=Wr(a,e,n+s+1,r);c!=Vr&&o.push(s,s+e.nodeSize,c)}}));for(var s=jr(i?Hr(t):t,-n).sort(Ur),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Pr(s,o):Vr}function Ur(t,e){return t.from-e.from||t.to-e.to}function Kr(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gr(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Gr(e,o+1,i.copy(r.to,i.to)))}}return e}function Gr(t,e,n){for(;e<t.length&&Ur(n,t[e])>0;)e++;t.splice(e,0,n)}function Zr(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Vr&&e.push(r)})),t.cursorWrapper&&e.push(Pr.create(t.state.doc,[t.cursorWrapper.deco])),$r.from(e)}$r.prototype.forChild=function(t,e){if(e.isLeaf)return Pr.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Vr&&(o instanceof $r?n=n.concat(o.members):n.push(o))}return $r.from(n)},$r.prototype.eq=function(t){if(!(t instanceof $r)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},$r.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Kr(n?e:e.sort(Ur)):Lr},$r.from=function(t){switch(t.length){case 0:return Vr;case 1:return t[0];default:return new $r(t)}};var Yr=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=eo(this),this.markCursor=null,this.cursorWrapper=null,to(this),this.nodeViews=no(this),this.docView=ln(this.state.doc,Xr(this),Zr(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new ar(t,(function(e,n,r,o){return Kn(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=lr[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||fr(t,e)||!t.editable&&e.type in ur||n(t,e)})};for(var n in lr)e(n);we.safari&&t.dom.addEventListener("input",(function(){return null})),hr(t)}(this),this.pluginViews=[],this.updatePluginViews()},Qr={props:{configurable:!0},root:{configurable:!0}};function Xr(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r?e.class+=" "+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Rr.node(0,t.state.doc.content.size,e)]}function to(t){var e=t.state.selection,n=e.$head,r=e.$anchor,o=e.visible;if(t.markCursor){var i=document.createElement("img");i.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:i,deco:Rr.widget(n.pos,i,{raw:!0,marks:t.markCursor})}}else if(o||n.pos!=r.pos)t.cursorWrapper=null;else{var s;!t.cursorWrapper||t.cursorWrapper.dom.childNodes.length?((s=document.createElement("div")).style.position="absolute",s.style.left="-100000px"):t.cursorWrapper.deco.pos!=n.pos&&(s=t.cursorWrapper.dom),s&&(t.cursorWrapper={dom:s,deco:Rr.widget(n.pos,s,{raw:!0})})}}function eo(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function no(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}Qr.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Yr.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&hr(this),this._props=t,this.updateStateInner(t.state,!0)},Yr.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},Yr.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Yr.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1;if(this.state=t,e){var i=no(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(i,this.nodeViews)&&(this.nodeViews=i,o=!0),hr(this)}this.editable=eo(this),to(this);var s,a,c,l,u,p,h,f,d,m,v,g=Zr(this),y=Xr(this),b=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",k=o||!this.docView.matchesNode(t.doc,y,g),w=k||!t.selection.eq(r.selection),x="preserve"==b&&w&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Pe(t.dom)}}(this);if(w){this.domObserver.stop();var C=k&&(we.ie||we.chrome)&&!r.selection.empty&&!t.selection.empty&&(l=r.selection,u=t.selection,p=Math.min(l.$anchor.sharedDepth(l.head),u.$anchor.sharedDepth(u.head)),l.$anchor.node(p)!=u.$anchor.node(p));k&&(!o&&this.docView.update(t.doc,y,g,this)||(this.docView.destroy(),this.docView=ln(t.doc,y,g,this.dom,this))),C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(s=this,a=s.docView.domFromPos(s.state.selection.anchor),c=s.root.getSelection(),Oe(a.node,a.offset,c.anchorNode,c.anchorOffset)))?Ln(this,C):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==b)this.dom.scrollTop=0;else if("to selection"==b){var _=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof re?Be(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),_):Be(this,this.coordsAtPos(t.selection.head),_))}else x&&(f=(h=x).refDOM,d=h.refTop,m=h.stack,v=f?f.getBoundingClientRect().top:0,Ve(m,0==v?0:v-d))},Yr.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Yr.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var o=this.state.plugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}},Yr.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;var o=this.state.plugins;if(o)for(var i=0;i<o.length;i++){var s=o[i].props[t];if(null!=s&&(n=e?e(s):s))return n}},Yr.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Yr.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if($e)return t.focus($e);var e=Pe(t);t.focus(null==$e?{get preventScroll(){return $e={preventScroll:!0},!0}}:void 0),$e||($e=!1,Ve(e,0))}(this.dom),Ln(this),this.domObserver.start()},Qr.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Yr.prototype.posAtCoords=function(t){return He(this,t)},Yr.prototype.coordsAtPos=function(t){return Ue(this,t)},Yr.prototype.domAtPos=function(t){return this.docView.domFromPos(t)},Yr.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Yr.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Yr.prototype.endOfTextblock=function(t,e){return tn(this,e||this.state,t)},Yr.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Yr.prototype.dispatchEvent=function(t){return function(t,e){fr(t,e)||!lr[e.type]||!t.editable&&e.type in ur||lr[e.type](t,e)}(this,t)},Yr.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Yr.prototype,Qr);var ro=n(13),oo=n.n(ro),io=new X({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:function(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:function(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:function(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){return{params:t.getAttribute("data-params")||""}}}],toDOM:function(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:function(t){return{tight:t.hasAttribute("data-tight")}}}],toDOM:function(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:function(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:function(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM:function(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:function(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:function(t){return"italic"==t&&null}}],toDOM:function(){return["em"]}},strong:{parseDOM:[{tag:"b"},{tag:"strong"},{style:"font-weight",getAttrs:function(t){return/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}}],toDOM:function(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:function(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM:function(){return["code"]}}}});var so=function(t,e){this.schema=t,this.stack=[{type:t.topNodeType,content:[]}],this.marks=p.none,this.tokenHandlers=e};function ao(t,e){return t.getAttrs?t.getAttrs(e):t.attrs instanceof Function?t.attrs(e):t.attrs}function co(t){return"code_inline"==t||"code_block"==t||"fence"==t}function lo(t){return"\n"==t[t.length-1]?t.slice(0,t.length-1):t}function uo(){}so.prototype.top=function(){return this.stack[this.stack.length-1]},so.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},so.prototype.addText=function(t){if(t){var e,n=this.top().content,r=n[n.length-1],o=this.schema.text(t,this.marks);r&&(e=function(t,e){if(t.isText&&e.isText&&p.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(r,o))?n[n.length-1]=e:n.push(o)}},so.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},so.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},so.prototype.parseTokens=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=this.tokenHandlers[n.type];if(!r)throw new Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n)}},so.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},so.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},so.prototype.closeNode=function(){this.marks.length&&(this.marks=p.none);var t=this.stack.pop();return this.addNode(t.type,t.attrs,t.content)};var po=function(t,e,n){this.tokens=n,this.schema=t,this.tokenizer=e,this.tokenHandlers=function(t,e){var n=Object.create(null),r=function(r){var o=e[r];if(o.block){var i=t.nodeType(o.block);co(r)?n[r]=function(t,e){t.openNode(i,ao(o,e)),t.addText(lo(e.content)),t.closeNode()}:(n[r+"_open"]=function(t,e){return t.openNode(i,ao(o,e))},n[r+"_close"]=function(t){return t.closeNode()})}else if(o.node){var s=t.nodeType(o.node);n[r]=function(t,e){return t.addNode(s,ao(o,e))}}else if(o.mark){var a=t.marks[o.mark];co(r)?n[r]=function(t,e){t.openMark(a.create(ao(o,e))),t.addText(lo(e.content)),t.closeMark(a)}:(n[r+"_open"]=function(t,e){return t.openMark(a.create(ao(o,e)))},n[r+"_close"]=function(t){return t.closeMark(a)})}else{if(!o.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(o));co(r)?n[r]=uo:(n[r+"_open"]=uo,n[r+"_close"]=uo)}};for(var o in e)r(o);return n.text=function(t,e){return t.addText(e.content)},n.inline=function(t,e){return t.parseTokens(e.children)},n.softbreak=n.softbreak||function(t){return t.addText("\n")},n}(t,n)};po.prototype.parse=function(t){var e,n=new so(this.schema,this.tokenHandlers);n.parseTokens(this.tokenizer.parse(t,{}));do{e=n.closeNode()}while(n.stack.length);return e};var ho=new po(io,oo()("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list"},ordered_list:{block:"ordered_list",getAttrs:function(t){return{order:+t.attrGet("start")||1}}},heading:{block:"heading",getAttrs:function(t){return{level:+t.tag.slice(1)}}},code_block:{block:"code_block"},fence:{block:"code_block",getAttrs:function(t){return{params:t.info||""}}},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:function(t){return{src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null}}},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:function(t){return{href:t.attrGet("href"),title:t.attrGet("title")||null}}},code_inline:{mark:"code"}}),fo=function(t,e){this.nodes=t,this.marks=e};fo.prototype.serialize=function(t,e){var n=new yo(this.nodes,this.marks,e);return n.renderContent(t),n.out};var mo=new fo({blockquote:function(t,e){t.wrapBlock("> ",null,e,(function(){return t.renderContent(e)}))},code_block:function(t,e){t.write("```"+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},heading:function(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e),t.closeBlock(e)},horizontal_rule:function(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list:function(t,e){t.renderList(e," ",(function(){return(e.attrs.bullet||"*")+" "}))},ordered_list:function(t,e){var n=e.attrs.order||1,r=String(n+e.childCount-1).length,o=t.repeat(" ",r+2);t.renderList(e,o,(function(e){var o=String(n+e);return t.repeat(" ",r-o.length)+o+". "}))},list_item:function(t,e){t.renderContent(e)},paragraph:function(t,e){t.renderInline(e),t.closeBlock(e)},image:function(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+t.esc(e.attrs.src)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")")},hard_break:function(t,e,n,r){for(var o=r+1;o<n.childCount;o++)if(n.child(o).type!=e.type)return void t.write("\\\n")},text:function(t,e){t.text(e.text)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open:function(t,e,n,r){return go(e,n,r,1)?"<":"["},close:function(t,e,n,r){return go(e,n,r,-1)?">":"]("+t.esc(e.attrs.href)+(e.attrs.title?" "+t.quote(e.attrs.title):"")+")"}},code:{open:function(t,e,n,r){return vo(n.child(r),-1)},close:function(t,e,n,r){return vo(n.child(r-1),1)},escape:!1}});function vo(t,e){var n,r=/`+/g,o=0;if(t.isText)for(;n=r.exec(t.text);)o=Math.max(o,n[0].length);for(var i=o>0&&e>0?" `":"`",s=0;s<o;s++)i+="`";return o>0&&e<0&&(i+=" "),i}function go(t,e,n,r){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;var o=e.child(n+(r<0?-1:0));if(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t)return!1;if(n==(r<0?1:e.childCount-1))return!0;var i=e.child(n+(r<0?-2:1));return!t.isInSet(i.marks)}var yo=function(t,e,n){this.nodes=t,this.marks=e,this.delim=this.out="",this.closed=!1,this.inTightList=!1,this.options=n||{},void 0===this.options.tightLists&&(this.options.tightLists=!1)};yo.prototype.flushClose=function(t){if(this.closed){if(this.atBlank()||(this.out+="\n"),null==t&&(t=2),t>1){var e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(var r=1;r<t;r++)this.out+=e+"\n"}this.closed=!1}},yo.prototype.wrapBlock=function(t,e,n,r){var o=this.delim;this.write(e||t),this.delim+=t,r(),this.delim=o,this.closeBlock(n)},yo.prototype.atBlank=function(){return/(^|\n)$/.test(this.out)},yo.prototype.ensureNewLine=function(){this.atBlank()||(this.out+="\n")},yo.prototype.write=function(t){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),t&&(this.out+=t)},yo.prototype.closeBlock=function(t){this.closed=t},yo.prototype.text=function(t,e){for(var n=t.split("\n"),r=0;r<n.length;r++){var o=this.atBlank()||this.closed;this.write(),this.out+=!1!==e?this.esc(n[r],o):n[r],r!=n.length-1&&(this.out+="\n")}},yo.prototype.render=function(t,e,n){if("number"==typeof e)throw new Error("!");this.nodes[t.type.name](this,t,e,n)},yo.prototype.renderContent=function(t){var e=this;t.forEach((function(n,r,o){return e.render(n,t,o)}))},yo.prototype.renderInline=function(t){var e=this,n=[],r="",o=function(o,i,s){var a=o?o.marks:[];o&&"hard_break"===o.type.name&&(a=a.filter((function(e){if(s+1==t.childCount)return!1;var n=t.child(s+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));var c=r;if(r="",o&&o.isText&&a.some((function(t){var n=e.marks[t.type.name];return n&&n.expelEnclosingWhitespace}))){var l=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=(l[0],l[1]),p=l[2],h=l[3];c+=u,r=h,(u||h)&&((o=p?o.withText(p):null)||(a=n))}var f=a.length&&a[a.length-1],d=f&&!1===e.marks[f.type.name].escape,m=a.length-(d?1:0);t:for(var v=0;v<m;v++){var g=a[v];if(!e.marks[g.type.name].mixable)break;for(var y=0;y<n.length;y++){var b=n[y];if(!e.marks[b.type.name].mixable)break;if(g.eq(b)){v>y?a=a.slice(0,y).concat(g).concat(a.slice(y,v)).concat(a.slice(v+1,m)):y>v&&(a=a.slice(0,v).concat(a.slice(v+1,y)).concat(g).concat(a.slice(y,m)));continue t}}}for(var k=0;k<Math.min(n.length,m)&&a[k].eq(n[k]);)++k;for(;k<n.length;)e.text(e.markString(n.pop(),!1,t,s),!1);if(c&&e.text(c),o){for(;n.length<m;){var w=a[n.length];n.push(w),e.text(e.markString(w,!0,t,s),!1)}d&&o.isText?e.text(e.markString(f,!0,t,s)+o.text+e.markString(f,!1,t,s+1),!1):e.render(o,t,s)}};t.forEach(o),o(null,0,t.childCount)},yo.prototype.renderList=function(t,e,n){var r=this;this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);var o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach((function(i,s,a){a&&o&&r.flushClose(1),r.wrapBlock(e,n(a),t,(function(){return r.render(i,t,a)}))})),this.inTightList=i},yo.prototype.esc=function(t,e){return t=t.replace(/[`*\\~\[\]]/g,"\\$&"),e&&(t=t.replace(/^[:#\-*+]/,"\\$&").replace(/^(\d+)\./,"$1\\.")),t},yo.prototype.quote=function(t){var e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]},yo.prototype.repeat=function(t,e){for(var n="",r=0;r<e;r++)n+=t;return n},yo.prototype.markString=function(t,e,n,r){var o=this.marks[t.type.name],i=e?o.open:o.close;return"string"==typeof i?i:i(this,t,n,r)},yo.prototype.getEnclosingWhitespace=function(t){return{leading:(t.match(/^(\s+)/)||[])[0],trailing:(t.match(/(\s+)$/)||[])[0]}};for(var bo={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"},ko=bo,wo={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"},xo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Co="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),_o="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ao="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mo=xo&&(So||+xo[1]<57)||_o&&So,Do=0;Do<10;Do++)bo[48+Do]=bo[96+Do]=String(Do);for(Do=1;Do<=24;Do++)bo[Do+111]="F"+Do;for(Do=65;Do<=90;Do++)bo[Do]=String.fromCharCode(Do+32),wo[Do]=String.fromCharCode(Do);for(var Eo in bo)wo.hasOwnProperty(Eo)||(wo[Eo]=bo[Eo]);var Oo=function(t){var e=!(Mo&&(t.ctrlKey||t.altKey||t.metaKey)||(Co||Ao)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?wo:bo)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e},To="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function No(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);To?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function zo(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function qo(t){return new ge({props:{handleKeyDown:Io(t)}})}function Io(t){var e=function(t){var e=Object.create(null);for(var n in t)e[No(n)]=t[n];return e}(t);return function(t,n){var r,o=Oo(n),i=1==o.length&&" "!=o,s=e[zo(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey)&&(r=ko[n.keyCode])&&r!=o){var a=e[zo(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[zo(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Ro=function(){};Ro.prototype.append=function(t){return t.length?(t=Ro.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Ro.prototype.prepend=function(t){return t.length?Ro.from(t).append(this):this},Ro.prototype.appendInner=function(t){return new Lo(this,t)},Ro.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Ro.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Ro.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ro.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Ro.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Ro.from=function(t){return t instanceof Ro?t:t&&t.length?new Fo(t):Ro.empty};var Fo=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ro);Ro.empty=new Fo([]);var Lo=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Ro),Bo=Ro,Po=function(t,e){this.items=t,this.eventCount=e};Po.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new Vo(t.map));var p,h=t.step.map(r.slice(o));h&&c.maybeStep(h).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new Vo(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Po(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Po.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var l,u=t.steps[c].invert(t.docs[c]),p=new Vo(t.mapping.maps[c],u,e);(l=a&&a.merge(p))&&(p=l,c?o.pop():s=s.slice(0,s.length-1)),o.push(p),e&&(i++,e=null),r||(a=p)}var h,f,d,m=i-n.depth;return m>jo&&(f=m,(h=s).forEach((function(t,e){if(t.selection&&0==f--)return d=e,!1})),s=h.slice(d),i-=m),new Po(s.append(o),i)},Po.prototype.remapping=function(t,e){var n=new bt;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Po.prototype.addMaps=function(t){return 0==this.eventCount?this:new Po(this.items.append(t.map((function(t){return new Vo(t)}))),this.eventCount)},Po.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new Vo(c,l,u))}else n.push(new Vo(c))}}),r);for(var c=[],l=e;l<i;l++)c.push(new Vo(o.maps[l]));var u=this.items.slice(0,r).append(c).append(n),p=new Po(u,s);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},Po.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Po.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new Vo(c.invert(),a,l),h=r.length-1;(u=r.length&&r[h].merge(p))?r[h]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new Po(Bo.from(r.reverse()),o)},Po.empty=new Po(Bo.empty,0);var Vo=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Vo.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Vo(e.getMap().invert(),e,this.selection)}};var $o=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},jo=20;function Jo(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ho(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Wo(t,e,n,r){var o=Go(e),i=Zo.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),l=new $o(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(Zo,{redo:r,historyState:l}).scrollIntoView())}}var Uo=!1,Ko=null;function Go(t){var e=t.plugins;if(Ko!=e){Uo=!1,Ko=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Uo=!0;break}}return Uo}var Zo=new ke("history"),Yo=new ke("closeHistory");function Qo(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new ge({key:Zo,state:{init:function(){return new $o(Po.empty,Po.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(Zo);if(i)return i.historyState;n.getMeta(Yo)&&(t=new $o(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Zo))return s.getMeta(Zo).redo?new $o(t.done.addTransform(n,null,r,Go(e)),t.undone,Jo(n.mapping.maps[n.steps.length-1]),t.prevTime):new $o(t.done,t.undone.addTransform(n,null,r,Go(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new $o(t.done.rebased(n,o),t.undone.rebased(n,o),Ho(t.prevRanges,n.mapping),t.prevTime):new $o(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ho(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ho(t.prevRanges,n.mapping):Jo(n.mapping.maps[n.steps.length-1]);return new $o(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Go(e)),Po.empty,c,n.time)}(n,r,e,t)}},config:t})}function Xo(t,e){var n=Zo.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Wo(n,t,e,!1),!0)}function ti(t,e){var n=Zo.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Wo(n,t,e,!0),!0)}function ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function ri(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function ii(t,e){var n,r=t.selection,o=r instanceof re;if(o){if(r.node.isTextblock||!It(t.doc,r.from))return!1;n=r.from}else if(null==(n=Ft(t.doc,r.from,-1)))return!1;if(e){var i=t.tr.join(n);o&&i.setSelection(re.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function si(t,e){var n,r=t.selection;if(r instanceof re){if(r.node.isTextblock||!It(t.doc,r.to))return!1;n=r.to}else if(null==(n=Ft(t.doc,r.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function ai(t,e){var n=t.selection,r=n.$from,o=n.$to,i=r.blockRange(o),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function ci(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function li(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=ci(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),l=t.tr.replaceWith(c,c,a.createAndFill());l.setSelection(Qt.near(l.doc.resolve(c),1)),e(l.scrollIntoView())}return!0}function ui(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof re&&t.selection.node.isBlock)return!(!r.parentOffset||!qt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,a=t.tr;t.selection instanceof ee&&a.deleteSelection();var c=0==r.depth?null:ci(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&c?[{type:c}]:null,u=qt(a.doc,a.mapping.map(r.pos),1,l);l||u||!qt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(l=[{type:c}],u=!0),u&&(a.split(a.mapping.map(r.pos),1,l),i||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),s.from(c.create(),r.parent))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0}function pi(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(re.create(t.doc,n))),!0)}function hi(t,e,n){var r,o,i=e.nodeBefore,a=e.nodeAfter;if(i.type.spec.isolating||a.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!It(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;if(e.parent.canReplace(e.index(),e.index()+1)&&(r=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var c=e.pos+a.nodeSize,l=s.empty,u=r.length-1;u>=0;u--)l=s.from(r[u].create(null,l));l=s.from(i.copy(l));var p=t.tr.step(new Dt(e.pos-1,c,e.pos,c,new f(l,1,0),r.length,!0)),h=c+2*r.length;It(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}var d=Qt.findFrom(e,1),m=d&&d.$from.blockRange(d.$to),v=m&&Tt(m);return null!=v&&v>=e.depth&&(n&&n(t.tr.lift(m,v).scrollIntoView()),!0)}function fi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Nt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function di(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function mi(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,l=n.tr,u=0;!c&&u<a.length;u++){var p=a[u],h=p.$from,f=p.$to;c=n.doc.rangeHasMark(h.pos,f.pos,t)}for(var d=0;d<a.length;d++){var m=a[d],v=m.$from,g=m.$to;c?l.removeMark(v.pos,g.pos,t):l.addMark(v.pos,g.pos,t.create(e))}r(l.scrollIntoView())}return!0}}function vi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var gi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r);if(!o){var i=r.blockRange(),s=i&&Tt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(a,"end")||re.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(ni(a,"end")?Qt.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):re.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=ri(r),i=o&&o.nodeBefore;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)})),yi=vi(ei,(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r);if(!o)return!1;var i=o.nodeAfter;if(hi(t,o,e))return!0;if(0==r.parent.content.size&&(ni(i,"start")||re.isSelectable(i))){if(e){var s=t.tr.deleteRange(r.before(),r.after());s.setSelection(ni(i,"start")?Qt.findFrom(s.doc.resolve(s.mapping.map(o.pos)),1):re.create(s.doc,s.mapping.map(o.pos))),e(s.scrollIntoView())}return!0}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=oi(r),i=o&&o.nodeAfter;return!(!i||!re.isSelectable(i))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos)).scrollIntoView()),!0)})),bi={Enter:vi((function(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(r.parent.inlineContent||o.parent.inlineContent)return!1;var i=ci(r.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}),(function(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(qt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Tt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),ui),"Mod-Enter":li,Backspace:gi,"Mod-Backspace":gi,Delete:yi,"Mod-Delete":yi,"Mod-a":function(t,e){return e&&e(t.tr.setSelection(new ie(t.doc))),!0}},ki={"Ctrl-h":bi.Backspace,"Alt-Backspace":bi["Mod-Backspace"],"Ctrl-d":bi.Delete,"Ctrl-Alt-Backspace":bi["Mod-Delete"],"Alt-Delete":bi["Mod-Delete"],"Alt-d":bi["Mod-Delete"]};for(var wi in bi)ki[wi]=bi[wi];var xi=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?ki:bi;function Ci(t){return void 0===t&&(t={}),new ge({view:function(e){return new _i(e,t)}})}var _i=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};_i.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},_i.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},_i.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},_i.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a=this.editorView.dom.offsetParent;this.element||(this.element=a.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);var c=!a||a==document.body&&"static"==getComputedStyle(a).position?{left:-pageXOffset,top:-pageYOffset}:a.getBoundingClientRect();this.element.style.left=t.left-c.left+"px",this.element.style.top=t.top-c.top+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},_i.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},_i.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Lt(this.editorView.state.doc,n,this.editorView.dragging.slice))&&(n=e.pos),this.setCursor(n),this.scheduleRemoval(5e3)}}},_i.prototype.dragend=function(){this.scheduleRemoval(20)},_i.prototype.drop=function(){this.scheduleRemoval(20)},_i.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Si=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return f.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new Ai(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).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}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.maybeChild(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;i=n>0?i.firstChild:i.lastChild;){o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null},e}(Qt);Si.prototype.visible=!1,Qt.jsonID("gapcursor",Si);var Ai=function(t){this.pos=t};Ai.prototype.map=function(t){return new Ai(t.map(this.pos))},Ai.prototype.resolve=function(t){var e=t.resolve(this.pos);return Si.valid(e)?new Si(e):Qt.near(e)};var Mi=Io({ArrowLeft:Di("horiz",-1),ArrowRight:Di("horiz",1),ArrowUp:Di("vert",-1),ArrowDown:Di("vert",1)});function Di(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof ee){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=Si.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new Si(c))),!0)}}function Ei(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!Si.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&re.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new Si(r))),!0)}function Oi(t){if(!(t.selection instanceof Si))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pr.create(t.doc,[Rr.widget(t.selection.head,e,{key:"gapcursor"})])}function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Ni=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){!function(e){var n,r="function",o=function(t,e){return Ti(t)===e},i=function t(e,n){null!==n&&(Array.isArray(n)?n.map((function(n){return t(e,n)})):(s.isNode(n)||(n=document.createTextNode(n)),e.appendChild(n)))};function s(t,e){var n,a,c=arguments,l=1;if(t=s.isElement(t)?t:document.createElement(t),o(e,"object")&&!s.isNode(e)&&!Array.isArray(e))for(n in l++,e)a=e[n],n=s.attrMap[n]||n,o(n,r)?n(t,a):o(a,r)?t[n]=a:t.setAttribute(n,a);for(;l<c.length;l++)i(t,c[l]);return t}s.attrMap={},s.isElement=function(t){return t instanceof Element},s.isNode=function(t){return t instanceof Node},s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}}),n=s,t.exports=n}()})),zi="http://www.w3.org/2000/svg",qi="ProseMirror-icon";function Ii(t){var e=document.createElement("div");if(e.className=qi,t.path){var n="pm-icon-"+function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return e}(t.path).toString(16);document.getElementById(n)||function(t,e){var n=document.getElementById(qi+"-collection");n||((n=document.createElementNS(zi,"svg")).id=qi+"-collection",n.style.display="none",document.body.insertBefore(n,document.body.firstChild));var r=document.createElementNS(zi,"symbol");r.id=t,r.setAttribute("viewBox","0 0 "+e.width+" "+e.height),r.appendChild(document.createElementNS(zi,"path")).setAttribute("d",e.path),n.appendChild(r)}(n,t);var r=e.appendChild(document.createElementNS(zi,"svg"));r.style.width=t.width/t.height+"em",r.appendChild(document.createElementNS(zi,"use")).setAttributeNS("http://www.w3.org/1999/xlink","href",/([^#]*)/.exec(document.location)[1]+"#"+n)}else t.dom?e.appendChild(t.dom.cloneNode(!0)):(e.appendChild(document.createElement("span")).textContent=t.text||"",t.css&&(e.firstChild.style.cssText=t.css));return e}var Ri="ProseMirror-menu",Fi=function(t){this.spec=t};function Li(t,e){return t._props.translate?t._props.translate(e):e}Fi.prototype.render=function(t){var e=this.spec,n=e.render?e.render(t):e.icon?Ii(e.icon):e.label?Ni("div",null,Li(t,e.label)):null;if(!n)throw new RangeError("MenuItem without icon or label property");if(e.title){var r="function"==typeof e.title?e.title(t.state):e.title;n.setAttribute("title",Li(t,r))}return e.class&&n.classList.add(e.class),e.css&&(n.style.cssText+=e.css),n.addEventListener("mousedown",(function(r){r.preventDefault(),n.classList.contains(Ri+"-disabled")||e.run(t.state,t.dispatch,t,r)})),{dom:n,update:function(t){if(e.select){var r=e.select(t);if(n.style.display=r?"":"none",!r)return!1}var o=!0;if(e.enable&&(o=e.enable(t)||!1,Xi(n,Ri+"-disabled",!o)),e.active){var i=o&&e.active(t)||!1;Xi(n,Ri+"-active",i)}return!0}}};var Bi={time:0,node:null};function Pi(t){Bi.time=Date.now(),Bi.node=t.target}function Vi(t){return Date.now()-100<Bi.time&&Bi.node&&t.contains(Bi.node)}var $i=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};function ji(t,e){for(var n=[],r=[],o=0;o<t.length;o++){var i=t[o].render(e),s=i.dom,a=i.update;n.push(Ni("div",{class:Ri+"-dropdown-item"},s)),r.push(a)}return{dom:n,update:Ji(r,n)}}function Ji(t,e){return function(n){for(var r=!1,o=0;o<t.length;o++){var i=t[o](n);e[o].style.display=i?"":"none",i&&(r=!0)}return r}}$i.prototype.render=function(t){var e=this,n=ji(this.content,t),r=Ni("div",{class:Ri+"-dropdown "+(this.options.class||""),style:this.options.css},Li(t,this.options.label));this.options.title&&r.setAttribute("title",Li(t,this.options.title));var o=Ni("div",{class:Ri+"-dropdown-wrap"},r),i=null,s=null,a=function(){i&&i.close()&&(i=null,window.removeEventListener("mousedown",s))};return r.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),i?a():(i=e.expand(o,n.dom),window.addEventListener("mousedown",s=function(){Vi(o)||a()}))})),{dom:o,update:function(t){var e=n.update(t);return o.style.display=e?"":"none",e}}},$i.prototype.expand=function(t,e){var n=Ni("div",{class:Ri+"-dropdown-menu "+(this.options.class||"")},e),r=!1;return t.appendChild(n),{close:function(){if(!r)return r=!0,t.removeChild(n),!0},node:n}};var Hi=function(t,e){this.options=e||{},this.content=Array.isArray(t)?t:[t]};Hi.prototype.render=function(t){var e=ji(this.content,t),n=Ni("div",{class:Ri+"-submenu-label"},Li(t,this.options.label)),r=Ni("div",{class:Ri+"-submenu-wrap"},n,Ni("div",{class:Ri+"-submenu"},e.dom)),o=null;return n.addEventListener("mousedown",(function(t){t.preventDefault(),Pi(t),Xi(r,Ri+"-submenu-wrap-active"),o||window.addEventListener("mousedown",o=function(){Vi(r)||(r.classList.remove(Ri+"-submenu-wrap-active"),window.removeEventListener("mousedown",o),o=null)})})),{dom:r,update:function(t){var n=e.update(t);return r.style.display=n?"":"none",n}}};var Wi={join:{width:800,height:900,path:"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z"},lift:{width:1024,height:1024,path:"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z"},selectParentNode:{text:"⬚",css:"font-weight: bold"},undo:{width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"},redo:{width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"},strong:{width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},em:{width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},code:{width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"},link:{width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"},bulletList:{width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"},orderedList:{width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"},blockquote:{width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},Ui=new Fi({title:"Join with above block",run:ii,select:function(t){return ii(t)},icon:Wi.join}),Ki=new Fi({title:"Lift out of enclosing block",run:ai,select:function(t){return ai(t)},icon:Wi.lift}),Gi=new Fi({title:"Select parent node",run:pi,select:function(t){return pi(t)},icon:Wi.selectParentNode}),Zi=new Fi({title:"Undo last change",run:Xo,enable:function(t){return Xo(t)},icon:Wi.undo}),Yi=new Fi({title:"Redo last undone change",run:ti,enable:function(t){return ti(t)},icon:Wi.redo});function Qi(t,e){var n=di(t,e.attrs),r={run:n,enable:function(t){return n(t)},active:function(n){var r=n.selection,o=r.$from,i=r.to,s=r.node;return s?s.hasMarkup(t,e.attrs):i<=o.end()&&o.parent.hasMarkup(t,e.attrs)}};for(var o in e)r[o]=e[o];return new Fi(r)}function Xi(t,e,n){n?t.classList.add(e):t.classList.remove(e)}var ts="ProseMirror-menubar";var es=function(t,e){var n=this;this.editorView=t,this.options=e,this.wrapper=Ni("div",{class:ts+"-wrapper"}),this.menu=this.wrapper.appendChild(Ni("div",{class:ts})),this.menu.className=ts,this.spacer=null,t.dom.parentNode.replaceChild(this.wrapper,t.dom),this.wrapper.appendChild(t.dom),this.maxHeight=0,this.widthForMaxHeight=0,this.floating=!1;var r=function(t,e){for(var n=document.createDocumentFragment(),r=[],o=[],i=0;i<e.length;i++){for(var s=e[i],a=[],c=[],l=0;l<s.length;l++){var u=s[l].render(t),p=u.dom,h=u.update,f=Ni("span",{class:Ri+"item"},p);n.appendChild(f),c.push(f),a.push(h)}a.length&&(r.push(Ji(a,c)),i<e.length-1&&o.push(n.appendChild(Ni("span",{class:Ri+"separator"}))))}return{dom:n,update:function(t){for(var e=!1,n=!1,i=0;i<r.length;i++){var s=r[i](t);i&&(o[i-1].style.display=n&&s?"":"none"),n=s,s&&(e=!0)}return e}}}(this.editorView,this.options.content),o=r.dom,i=r.update;if(this.contentUpdate=i,this.menu.appendChild(o),this.update(),e.floating&&!function(){if("undefined"==typeof navigator)return!1;var t=navigator.userAgent;return!/Edge\/\d/.test(t)&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t)}()){this.updateFloat();var s=function(t){for(var e=[window],n=t.parentNode;n;n=n.parentNode)e.push(n);return e}(this.wrapper);this.scrollFunc=function(t){var e=n.editorView.root;(e.body||e).contains(n.wrapper)?n.updateFloat(t.target.getBoundingClientRect&&t.target):s.forEach((function(t){return t.removeEventListener("scroll",n.scrollFunc)}))},s.forEach((function(t){return t.addEventListener("scroll",n.scrollFunc)}))}};es.prototype.update=function(){this.contentUpdate(this.editorView.state),this.floating?this.updateScrollCursor():(this.menu.offsetWidth!=this.widthForMaxHeight&&(this.widthForMaxHeight=this.menu.offsetWidth,this.maxHeight=0),this.menu.offsetHeight>this.maxHeight&&(this.maxHeight=this.menu.offsetHeight,this.menu.style.minHeight=this.maxHeight+"px"))},es.prototype.updateScrollCursor=function(){var t=this.editorView.root.getSelection();if(t.focusNode){var e=t.getRangeAt(0).getClientRects(),n=e[function(t){if(t.anchorNode==t.focusNode)return t.anchorOffset>t.focusOffset;return t.anchorNode.compareDocumentPosition(t.focusNode)==Node.DOCUMENT_POSITION_FOLLOWING}(t)?0:e.length-1];if(n){var r=this.menu.getBoundingClientRect();if(n.top<r.bottom&&n.bottom>r.top){var o=function(t){for(var e=t.parentNode;e;e=e.parentNode)if(e.scrollHeight>e.clientHeight)return e}(this.wrapper);o&&(o.scrollTop-=r.bottom-n.top)}}}},es.prototype.updateFloat=function(t){var e=this.wrapper,n=e.getBoundingClientRect(),r=t?Math.max(0,t.getBoundingClientRect().top):0;if(this.floating)if(n.top>=r||n.bottom<this.menu.offsetHeight+10)this.floating=!1,this.menu.style.position=this.menu.style.left=this.menu.style.top=this.menu.style.width="",this.menu.style.display="",this.spacer.parentNode.removeChild(this.spacer),this.spacer=null;else{var o=(e.offsetWidth-e.clientWidth)/2;this.menu.style.left=n.left+o+"px",this.menu.style.display=n.top>window.innerHeight?"none":"",t&&(this.menu.style.top=r+"px")}else if(n.top<r&&n.bottom>=this.menu.offsetHeight+10){this.floating=!0;var i=this.menu.getBoundingClientRect();this.menu.style.left=i.left+"px",this.menu.style.width=i.width+"px",t&&(this.menu.style.top=r+"px"),this.menu.style.position="fixed",this.spacer=Ni("div",{class:ts+"-spacer",style:"height: "+i.height+"px"}),e.insertBefore(this.spacer,this.menu)}},es.prototype.destroy=function(){this.wrapper.parentNode&&this.wrapper.parentNode.replaceChild(this.editorView.dom,this.wrapper)};function ns(t,e){return function(n,r){var o=n.selection,i=o.$from,a=o.$to,c=i.blockRange(a),l=!1,u=c;if(!c)return!1;if(c.depth>=2&&i.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==i.index(c.depth-1))return!1;var p=n.doc.resolve(c.start-2);u=new M(p,p,c.depth),c.endIndex<c.parent.childCount&&(c=new M(i,n.doc.resolve(a.end(c.depth)),c.depth)),l=!0}var h=Nt(u,t,e,c);return!!h&&(r&&r(function(t,e,n,r,o){for(var i=s.empty,a=n.length-1;a>=0;a--)i=s.from(n[a].type.create(n[a].attrs,i));t.step(new Dt(e.start-(r?2:0),e.end,e.start,e.end,new f(i,0,0),n.length,!0));for(var c=0,l=0;l<n.length;l++)n[l].type==o&&(c=l+1);for(var u=n.length-c,p=e.start+n.length-(r?2:0),h=e.parent,d=e.startIndex,m=e.endIndex,v=!0;d<m;d++,v=!1)!v&&qt(t.doc,p,u)&&(t.split(p,u),p+=2*u),p+=h.child(d).nodeSize;return t}(n.tr,c,h,l,t).scrollIntoView()),!0)}}function rs(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));return!!a&&(!n||(o.node(a.depth-1).type==t?function(t,e,n,r){var o=t.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new Dt(i-1,a,i,a,new f(s.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new M(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));return e(o.lift(r,Tt(r)).scrollIntoView()),!0}(e,n,t,a):function(t,e,n){for(var r=t.tr,o=n.parent,i=n.end,a=n.endIndex-1,c=n.startIndex;a>c;a--)i-=o.child(a).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(n.start),u=l.nodeAfter,p=0==n.startIndex,h=n.endIndex==o.childCount,d=l.node(-1),m=l.index(-1);if(!d.canReplace(m+(p?0:1),m+1,u.content.append(h?s.empty:s.from(o))))return!1;var v=l.pos,g=v+u.nodeSize;return r.step(new Dt(v-(p?1:0),g+(h?1:0),v+1,g-1,new f((p?s.empty:s.from(o.copy(s.empty))).append(h?s.empty:s.from(o.copy(s.empty))),p?0:1,h?0:1),p?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}var is=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function ss(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l<o.length;l++){var u=o[l].match.exec(c),p=u&&o[l].handler(s,u,e-(u[0].length-r.length),n);if(p)return t.dispatch(p.setMeta(i,{transform:p,from:e,to:n,text:r})),!0}return!1}function as(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));var l=s.doc.resolve(i.from).marks();e(s.replaceWith(i.from,i.to,t.schema.text(i.text,l)))}return!0}}return!1}var cs=new is(/--$/,"—"),ls=new is(/\.\.\.$/,"…"),us=[new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new is(/"$/,"”"),new is(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new is(/'$/,"’")];function ps(t,e,n,r){return new is(t,(function(t,o,i,s){var a=n instanceof Function?n(o):n,c=t.tr.delete(i,s),l=c.doc.resolve(i).blockRange(),u=l&&Nt(l,e,a);if(!u)return null;c.wrap(l,u);var p=c.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&It(c.doc,i-1)&&(!r||r(o,p))&&c.join(i-1),c}))}function hs(t,e,n){return new is(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}function fs(t){var e=document.body.appendChild(document.createElement("div"));e.className="ProseMirror-prompt";var n=function(t){e.contains(t.target)||r()};setTimeout((function(){return window.addEventListener("mousedown",n)}),50);var r=function(){window.removeEventListener("mousedown",n),e.parentNode&&e.parentNode.removeChild(e)},o=[];for(var i in t.fields)o.push(t.fields[i].render());var s=document.createElement("button");s.type="submit",s.className="ProseMirror-prompt-submit",s.textContent="OK";var a=document.createElement("button");a.type="button",a.className="ProseMirror-prompt-cancel",a.textContent="Cancel",a.addEventListener("click",r);var c=e.appendChild(document.createElement("form"));t.title&&(c.appendChild(document.createElement("h5")).textContent=t.title),o.forEach((function(t){c.appendChild(document.createElement("div")).appendChild(t)}));var l=c.appendChild(document.createElement("div"));l.className="ProseMirror-prompt-buttons",l.appendChild(s),l.appendChild(document.createTextNode(" ")),l.appendChild(a);var u=e.getBoundingClientRect();e.style.top=(window.innerHeight-u.height)/2+"px",e.style.left=(window.innerWidth-u.width)/2+"px";var p=function(){var e=function(t,e){var n=Object.create(null),r=0;for(var o in t){var i=t[o],s=e[r++],a=i.read(s),c=i.validate(a);if(c)return ds(s,c),null;n[o]=i.clean(a)}return n}(t.fields,o);e&&(r(),t.callback(e))};c.addEventListener("submit",(function(t){t.preventDefault(),p()})),c.addEventListener("keydown",(function(t){27==t.keyCode?(t.preventDefault(),r()):13!=t.keyCode||t.ctrlKey||t.metaKey||t.shiftKey?9==t.keyCode&&window.setTimeout((function(){e.contains(document.activeElement)||r()}),500):(t.preventDefault(),p())}));var h=c.elements[0];h&&h.focus()}function ds(t,e){var n=t.parentNode,r=n.appendChild(document.createElement("div"));r.style.left=t.offsetLeft+t.offsetWidth+2+"px",r.style.top=t.offsetTop-5+"px",r.className="ProseMirror-invalid",r.textContent=e,setTimeout((function(){return n.removeChild(r)}),1500)}var ms=function(t){this.options=t};ms.prototype.read=function(t){return t.value},ms.prototype.validateType=function(t){},ms.prototype.validate=function(t){return!t&&this.options.required?"Required field":this.validateType(t)||this.options.validate&&this.options.validate(t)},ms.prototype.clean=function(t){return this.options.clean?this.options.clean(t):t};var vs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=document.createElement("input");return t.type="text",t.placeholder=this.options.label,t.value=this.options.value||"",t.autocomplete="off",t},e}(ms);function gs(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1}function ys(t,e){var n={label:e.title,run:t};for(var r in e)n[r]=e[r];return e.enable&&!0!==e.enable||e.select||(n[e.enable?"enable":"select"]=function(e){return t(e)}),new Fi(n)}function bs(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to;return n.empty?e.isInSet(t.storedMarks||o.marks()):t.doc.rangeHasMark(r,i,e)}function ks(t,e){var n={active:function(e){return bs(e,t)},enable:!0};for(var r in e)n[r]=e[r];return ys(mi(t),n)}function ws(t,e){return ys(ns(t,e.attrs),e)}function xs(t){var e,n,r,o={};if((e=t.marks.strong)&&(o.toggleStrong=ks(e,{title:"Toggle strong style",icon:Wi.strong})),(e=t.marks.em)&&(o.toggleEm=ks(e,{title:"Toggle emphasis",icon:Wi.em})),(e=t.marks.code)&&(o.toggleCode=ks(e,{title:"Toggle code font",icon:Wi.code})),(e=t.marks.link)&&(o.toggleLink=(n=e,new Fi({title:"Add or remove link",icon:Wi.link,active:function(t){return bs(t,n)},enable:function(t){return!t.selection.empty},run:function(t,e,r){if(bs(t,n))return mi(n)(t,e),!0;fs({title:"Create a link",fields:{href:new vs({label:"Link target",required:!0}),title:new vs({label:"Title"})},callback:function(t){mi(n,t)(r.state,r.dispatch),r.focus()}})}}))),(e=t.nodes.image)&&(o.insertImage=(r=e,new Fi({title:"Insert image",label:"Image",enable:function(t){return gs(t,r)},run:function(t,e,n){var o=t.selection,i=o.from,s=o.to,a=null;t.selection instanceof re&&t.selection.node.type==r&&(a=t.selection.node.attrs),fs({title:"Insert image",fields:{src:new vs({label:"Location",required:!0,value:a&&a.src}),title:new vs({label:"Title",value:a&&a.title}),alt:new vs({label:"Description",value:a?a.alt:t.doc.textBetween(i,s," ")})},callback:function(t){n.dispatch(n.state.tr.replaceSelectionWith(r.createAndFill(t))),n.focus()}})}}))),(e=t.nodes.bullet_list)&&(o.wrapBulletList=ws(e,{title:"Wrap in bullet list",icon:Wi.bulletList})),(e=t.nodes.ordered_list)&&(o.wrapOrderedList=ws(e,{title:"Wrap in ordered list",icon:Wi.orderedList})),(e=t.nodes.blockquote)&&(o.wrapBlockQuote=function(t,e){var n={run:function(n,r){return fi(t,e.attrs)(n,r)},select:function(n){return fi(t,e.attrs instanceof Function?null:e.attrs)(n)}};for(var r in e)n[r]=e[r];return new Fi(n)}(e,{title:"Wrap in block quote",icon:Wi.blockquote})),(e=t.nodes.paragraph)&&(o.makeParagraph=Qi(e,{title:"Change to paragraph",label:"Plain"})),(e=t.nodes.code_block)&&(o.makeCodeBlock=Qi(e,{title:"Change to code block",label:"Code"})),e=t.nodes.heading)for(var i=1;i<=10;i++)o["makeHead"+i]=Qi(e,{title:"Change to heading "+i,label:"Level "+i,attrs:{level:i}});if(e=t.nodes.horizontal_rule){var s=e;o.insertHorizontalRule=new Fi({title:"Insert horizontal rule",label:"Horizontal rule",enable:function(t){return gs(t,s)},run:function(t,e){e(t.tr.replaceSelectionWith(s.create()))}})}var a=function(t){return t.filter((function(t){return t}))};return o.insertMenu=new $i(a([o.insertImage,o.insertHorizontalRule]),{label:"Insert"}),o.typeMenu=new $i(a([o.makeParagraph,o.makeCodeBlock,o.makeHead1&&new Hi(a([o.makeHead1,o.makeHead2,o.makeHead3,o.makeHead4,o.makeHead5,o.makeHead6]),{label:"Heading"})]),{label:"Type..."}),o.inlineMenu=[a([o.toggleStrong,o.toggleEm,o.toggleCode,o.toggleLink])],o.blockMenu=[a([o.wrapBulletList,o.wrapOrderedList,o.wrapBlockQuote,Ui,Ki,Gi])],o.fullMenu=o.inlineMenu.concat([[o.insertMenu,o.typeMenu]],[[Zi,Yi]],o.blockMenu),o}var Cs="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _s(t,e){var n,r,o={};function i(t,n){if(e){var r=e[t];if(!1===r)return;r&&(t=r)}o[t]=n}if(i("Mod-z",Xo),i("Shift-Mod-z",ti),i("Backspace",as),Cs||i("Mod-y",ti),i("Alt-ArrowUp",ii),i("Alt-ArrowDown",si),i("Mod-BracketLeft",ai),i("Escape",pi),(n=t.marks.strong)&&(i("Mod-b",mi(n)),i("Mod-B",mi(n))),(n=t.marks.em)&&(i("Mod-i",mi(n)),i("Mod-I",mi(n))),(n=t.marks.code)&&i("Mod-`",mi(n)),(n=t.nodes.bullet_list)&&i("Shift-Ctrl-8",ns(n)),(n=t.nodes.ordered_list)&&i("Shift-Ctrl-9",ns(n)),(n=t.nodes.blockquote)&&i("Ctrl->",fi(n)),n=t.nodes.hard_break){var a=n,c=vi(li,(function(t,e){return e(t.tr.replaceSelectionWith(a.create()).scrollIntoView()),!0}));i("Mod-Enter",c),i("Shift-Enter",c),Cs&&i("Ctrl-Enter",c)}if((n=t.nodes.list_item)&&(i("Enter",(r=n,function(t,e){var n=t.selection,o=n.$from,i=n.$to,a=n.node;if(a&&a.isBlock||o.depth<2||!o.sameParent(i))return!1;var c=o.node(-1);if(c.type!=r)return!1;if(0==o.parent.content.size){if(2==o.depth||o.node(-3).type!=r||o.index(-2)!=o.node(-2).childCount-1)return!1;if(e){for(var l=s.empty,u=o.index(-1)>0,p=o.depth-(u?1:2);p>=o.depth-3;p--)l=s.from(o.node(p).copy(l));l=l.append(s.from(r.createAndFill()));var h=t.tr.replace(o.before(u?null:-1),o.after(-3),new f(l,u?3:2,2));h.setSelection(t.selection.constructor.near(h.doc.resolve(o.pos+(u?3:2)))),e(h.scrollIntoView())}return!0}var d=i.pos==o.end()?c.contentMatchAt(0).defaultType:null,m=t.tr.delete(o.pos,i.pos),v=d&&[null,{type:d}];return!!qt(m.doc,o.pos,2,v)&&(e&&e(m.split(o.pos,2,v).scrollIntoView()),!0)})),i("Mod-[",rs(n)),i("Mod-]",function(t){return function(e,n){var r=e.selection,o=r.$from,i=r.$to,a=o.blockRange(i,(function(e){return e.childCount&&e.firstChild.type==t}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var l=a.parent,u=l.child(c-1);if(u.type!=t)return!1;if(n){var p=u.lastChild&&u.lastChild.type==l.type,h=s.from(p?t.create():null),d=new f(s.from(t.create(null,s.from(l.type.create(null,h)))),p?3:1,0),m=a.start,v=a.end;n(e.tr.step(new Dt(m-(p?3:1),v,m,v,d,1,!0)).scrollIntoView())}return!0}}(n))),(n=t.nodes.paragraph)&&i("Shift-Ctrl-0",di(n)),(n=t.nodes.code_block)&&i("Shift-Ctrl-\\",di(n)),n=t.nodes.heading)for(var l=1;l<=6;l++)i("Shift-Ctrl-"+l,di(n,{level:l}));if(n=t.nodes.horizontal_rule){var u=n;i("Mod-_",(function(t,e){return e(t.tr.replaceSelectionWith(u.create()).scrollIntoView()),!0}))}return o}function Ss(t){var e,n=us.concat(ls,cs);return(e=t.nodes.blockquote)&&n.push(ps(/^\s*>\s$/,e)),(e=t.nodes.ordered_list)&&n.push(function(t){return ps(/^(\d+)\.\s$/,t,(function(t){return{order:+t[1]}}),(function(t,e){return e.childCount+e.attrs.order==+t[1]}))}(e)),(e=t.nodes.bullet_list)&&n.push(function(t){return ps(/^\s*([-+*])\s$/,t)}(e)),(e=t.nodes.code_block)&&n.push(function(t){return hs(/^```$/,t)}(e)),(e=t.nodes.heading)&&n.push(function(t,e){return hs(new RegExp("^(#{1,"+e+"})\\s$"),t,(function(t){return{level:t[1].length}}))}(e,6)),function(t){var e=t.rules,n=new ge({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return ss(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&ss(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:n})}function As(t){var e=[Ss(t.schema),qo(_s(t.schema,t.mapKeys)),qo(xi),Ci(),new ge({props:{decorations:Oi,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Si.valid(n))return new Si(n)},handleClick:Ei,handleKeyDown:Mi}})];return!1!==t.menuBar&&e.push(function(t){return new ge({view:function(e){return new es(e,t)}})}({floating:!1!==t.floatingMenu,content:t.menuContent||xs(t.schema).fullMenu})),!1!==t.history&&e.push(Qo()),e.concat(new ge({props:{attributes:{class:"ProseMirror-example-setup-style"}}}))}function Ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}new(function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=new Yr(e,{state:de.create({doc:ho.parse(n),plugins:As({schema:io})}),dispatchTransaction:function(t){document.querySelector("#content").value=mo.serialize(t.doc);var e=this.state.apply(t);this.updateState(e)}})}var e,n,r;return e=t,(n=[{key:"focus",value:function(){this.view.focus()}},{key:"destroy",value:function(){this.view.destroy()}},{key:"content",get:function(){return mo.serialize(this.view.state.doc)}}])&&Ms(e.prototype,n),r&&Ms(e,r),t}())(document.querySelector("#editor"),document.querySelector("#content").value)}]);
\ No newline at end of file
diff --git a/templates/wysiwyg.tmpl b/templates/wysiwyg.tmpl
index 18789e1..a2e05cd 100644
--- a/templates/wysiwyg.tmpl
+++ b/templates/wysiwyg.tmpl
@@ -1,376 +1,376 @@
{{define "pad"}}<!DOCTYPE HTML>
<html>
<head>
<title>{{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} &mdash; {{.SiteName}}</title>
<link rel="stylesheet" type="text/css" href="/css/write.css" />
<link rel="stylesheet" type="text/css" href="/css/prose.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="google" value="notranslate">
</head>
<body id="pad" class="light">
<div id="overlay"></div>
<!-- <div style="text-align: center"> -->
<!-- <label style="border-right: 1px solid silver"> -->
<!-- Markdown <input type=radio name=inputformat value=markdown checked>&nbsp;</label> -->
<!-- <label>&nbsp;<input type=radio name=inputformat value=prosemirror> WYSIWYM</label> -->
<!-- </div> -->
<div id="editor" style="margin-bottom: 0"></div>
<div style="display: none"><textarea id="content">{{if .Post.Content }}{{.Post.Content}}{{end}}</textarea></div>
<header id="tools">
<div id="clip">
{{if not .SingleUser}}<h1><a href="/me/c/" title="View blogs"><img class="ic-24dp" src="/img/ic_blogs_dark@2x.png" /></a></h1>{{end}}
<nav id="target" {{if .SingleUser}}style="margin-left:0"{{end}}><ul>
{{if .Editing}}<li>{{if .EditCollection}}<a href="{{.EditCollection.CanonicalURL}}">{{.EditCollection.Title}}</a>{{else}}<a>Draft</a>{{end}}</li>
{{else}}<li><a id="publish-to"><span id="target-name">Draft</span> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a>
<ul>
<li class="menu-heading">Publish to...</li>
{{if .Blogs}}{{range $idx, $el := .Blogs}}
<li class="target{{if eq $idx 0}} selected{{end}}" id="blog-{{$el.Alias}}"><a href="#{{$el.Alias}}"><i class="material-icons md-18">public</i> {{if $el.Title}}{{$el.Title}}{{else}}{{$el.Alias}}{{end}}</a></li>
{{end}}{{end}}
<li class="target" id="blog-anonymous"><a href="#anonymous"><i class="material-icons md-18">description</i> <em>Draft</em></a></li>
<li id="user-separator" class="separator"><hr /></li>
{{ if .SingleUser }}
<li><a href="/"><i class="material-icons md-18">launch</i> View Blog</a></li>
<li><a href="/me/c/{{.Username}}"><i class="material-icons md-18">palette</i> Customize</a></li>
<li><a href="/me/c/{{.Username}}/stats"><i class="material-icons md-18">trending_up</i> Stats</a></li>
{{ else }}
<li><a href="/me/c/"><i class="material-icons md-18">library_books</i> View Blogs</a></li>
{{ end }}
<li><a href="/me/posts/"><i class="material-icons md-18">view_list</i> View Drafts</a></li>
<li><a href="/me/logout"><i class="material-icons md-18">power_settings_new</i> Log out</a></li>
</ul>
</li>{{end}}
</ul></nav>
<nav id="font-picker" class="if-room room-3 hidden" style="margin-left:-1em"><ul>
<li><a href="#" id="" onclick="return false"><img class="ic-24dp" src="/img/ic_font_dark@2x.png" /> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a>
<ul style="text-align: center">
<li class="menu-heading">Font</li>
<li class="selected"><a class="font norm" href="#norm">Serif</a></li>
<li><a class="font sans" href="#sans">Sans-serif</a></li>
<li><a class="font wrap" href="#wrap">Monospace</a></li>
</ul>
</li>
</ul></nav>
<span id="wc" class="hidden if-room room-4">0 words</span>
</div>
<noscript style="margin-left: 2em;"><strong>NOTE</strong>: for now, you'll need Javascript enabled to post.</noscript>
<div id="belt">
{{if .Editing}}<div class="tool hidden if-room"><a href="{{if .EditCollection}}{{.EditCollection.CanonicalURL}}{{.Post.Slug}}/edit/meta{{else}}/{{if .SingleUser}}d/{{end}}{{.Post.Id}}/meta{{end}}" title="Edit post metadata" id="edit-meta"><img class="ic-24dp" src="/img/ic_info_dark@2x.png" /></a></div>{{end}}
<div class="tool hidden if-room room-2"><a href="#theme" title="Toggle theme" id="toggle-theme"><img class="ic-24dp" src="/img/ic_brightness_dark@2x.png" /></a></div>
<div class="tool if-room room-1"><a href="{{if not .User}}/pad/posts{{else}}/me/posts/{{end}}" title="View posts" id="view-posts"><img class="ic-24dp" src="/img/ic_list_dark@2x.png" /></a></div>
<div class="tool"><a href="#publish" title="Publish" id="publish"><img class="ic-24dp" src="/img/ic_send_dark@2x.png" /></a></div>
</div>
</header>
<script src="/js/prose.bundle.js"></script>
<script src="/js/h.js"></script>
<script>
function toggleTheme() {
var btns = Array.prototype.slice.call(document.getElementById('tools').querySelectorAll('a img'));
var newTheme = '';
if (document.body.classList.contains('light')) {
newTheme = 'dark';
document.body.className = document.body.className.replace(/(?:^|\s)light(?!\S)/g, newTheme);
for (var i=0; i<btns.length; i++) {
btns[i].src = btns[i].src.replace('_dark@2x.png', '@2x.png');
}
} else {
TextnewTheme = 'light';
document.body.className = document.body.className.replace(/(?:^|\s)dark(?!\S)/g, newTheme);
for (var i=0; i<btns.length; i++) {
btns[i].src = btns[i].src.replace('@2x.png', '_dark@2x.png');
}
}
H.set('padTheme', newTheme);
}
if (H.get('padTheme', 'light') != 'light') {
toggleTheme();
}
var $writer = H.getQEl('div.ProseMirror');
var $content = H.getEl('content');
var $btnPublish = H.getEl('publish');
var $wc = H.getEl("wc");
var updateWordCount = function() {
var words = 0;
- var val = $content.el.innerText.trim();
+ var val = $content.el.value.trim();
if (val != '') {
- words = $content.el.innerText.trim().replace(/\s+/gi, ' ').split(' ').length;
+ words = $content.el.value.trim().replace(/\s+/gi, ' ').split(' ').length;
}
$wc.el.innerText = words + " word" + (words != 1 ? "s" : "");
};
var setButtonStates = function() {
if (!canPublish) {
$btnPublish.el.className = 'disabled';
return;
}
- if ($content.el.innerText.length === 0 || (draftDoc != 'lastDoc' && $content.el.innerText == origDoc)) {
+ if ($content.el.value.length === 0 || (draftDoc != 'lastDoc' && $content.el.value == origDoc)) {
$btnPublish.el.className = 'disabled';
} else {
$btnPublish.el.className = '';
}
};
{{if .Post.Id}}var draftDoc = 'draft{{.Post.Id}}';
var origDoc = '{{.Post.Content}}';{{else}}var draftDoc = 'lastDoc';{{end}}
- H.loadText($content, draftDoc, true);
+ H.load($content, draftDoc, true);
updateWordCount();
var typingTimer;
var doneTypingInterval = 200;
var posts;
{{if and .Post.Id (not .Post.Slug)}}
var token = null;
var curPostIdx;
posts = JSON.parse(H.get('posts', '[]'));
for (var i=0; i<posts.length; i++) {
if (posts[i].id == "{{.Post.Id}}") {
token = posts[i].token;
break;
}
}
var canPublish = token != null;
{{else}}var canPublish = true;{{end}}
var publishing = false;
var justPublished = false;
var silenced = {{.Silenced}};
var publish = function(content, font) {
if (silenced === true) {
alert("Your account is silenced, so you can't publish or update posts.");
return;
}
{{if and (and .Post.Id (not .Post.Slug)) (not .User)}}
if (!token) {
alert("You don't have permission to update this post.");
return;
}
if ($btnPublish.el.className == 'disabled') {
return;
}
{{end}}
$btnPublish.el.children[0].textContent = 'more_horiz';
publishing = true;
var xpostTarg = H.get('crosspostTarget', '[]');
var http = new XMLHttpRequest();
var lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage);
lang = lang.substring(0, 2);
var post = H.getTitleStrict(content);
var params = {
body: post.content,
title: post.title,
font: font,
lang: lang
};
{{ if .Post.Slug }}
var url = "/api/collections/{{.EditCollection.Alias}}/posts/{{.Post.Id}}";
{{ else if .Post.Id }}
var url = "/api/posts/{{.Post.Id}}";
if (typeof token === 'undefined' || !token) {
token = "";
}
params.token = token;
{{ else }}
var url = "/api/posts";
var postTarget = H.get('postTarget', 'anonymous');
if (postTarget != 'anonymous') {
url = "/api/collections/" + postTarget + "/posts";
}
params.crosspost = JSON.parse(xpostTarg);
{{ end }}
http.open("POST", url, true);
// Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/json");
http.onreadystatechange = function() {
if (http.readyState == 4) {
publishing = false;
if (http.status == 200 || http.status == 201) {
data = JSON.parse(http.responseText);
id = data.data.id;
nextURL = '{{if .SingleUser}}/d{{end}}/'+id;
{{ if not .Post.Id }}
// Post created
if (postTarget != 'anonymous') {
nextURL = {{if not .SingleUser}}'/'+postTarget+{{end}}'/'+data.data.slug;
}
editToken = data.data.token;
{{ if not .User }}if (postTarget == 'anonymous') {
// Save the data
var posts = JSON.parse(H.get('posts', '[]'));
{{if .Post.Id}}var newPost = H.createPost("{{.Post.Id}}", token, content);
for (var i=0; i<posts.length; i++) {
if (posts[i].id == "{{.Post.Id}}") {
posts[i].title = newPost.title;
posts[i].summary = newPost.summary;
break;
}
}
nextURL = "/pad/posts";{{else}}posts.push(H.createPost(id, editToken, content));{{end}}
H.set('posts', JSON.stringify(posts));
}
{{ end }}
{{ end }}
justPublished = true;
if (draftDoc != 'lastDoc') {
H.remove(draftDoc);
{{if .Editing}}H.remove('draft{{.Post.Id}}font');{{end}}
} else {
H.set(draftDoc, '');
}
{{if .EditCollection}}
window.location = '{{.EditCollection.CanonicalURL}}{{.Post.Slug}}';
{{else}}
window.location = nextURL;
{{end}}
} else {
$btnPublish.el.children[0].textContent = 'send';
alert("Failed to post. Please try again.");
}
}
}
http.send(JSON.stringify(params));
};
setButtonStates();
$writer.on('keyup input', function() {
setButtonStates();
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
}, false);
$writer.on('keydown', function(e) {
clearTimeout(typingTimer);
if (e.keyCode == 13 && (e.metaKey || e.ctrlKey)) {
$btnPublish.el.click();
}
});
$btnPublish.on('click', function(e) {
e.preventDefault();
- if (!publishing && $content.el.innerText) {
- var content = $content.el.innerText;
+ if (!publishing && $content.el.value) {
+ var content = $content.el.value;
publish(content, selectedFont);
}
});
H.getEl('toggle-theme').on('click', function(e) {
e.preventDefault();
var newTheme = 'light';
if (document.body.className == 'light') {
newTheme = 'dark';
}
toggleTheme();
});
var targets = document.querySelectorAll('#target li.target a');
for (var i=0; i<targets.length; i++) {
targets[i].addEventListener('click', function(e) {
e.preventDefault();
var targetName = this.href.substring(this.href.indexOf('#')+1);
H.set('postTarget', targetName);
document.querySelector('#target li.target.selected').classList.remove('selected');
this.parentElement.classList.add('selected');
var newText = this.innerText.split(' ');
newText.shift();
document.getElementById('target-name').innerText = newText.join(' ');
});
}
var postTarget = H.get('postTarget', '{{if .Blogs}}{{$blog := index .Blogs 0}}{{$blog.Alias}}{{else}}anonymous{{end}}');
if (location.hash != '') {
postTarget = location.hash.substring(1);
// TODO: pushState to /pad (or whatever the URL is) so we live on a clean URL
location.hash = '';
}
var pte = document.querySelector('#target li.target#blog-'+postTarget+' a');
if (pte != null) {
pte.click();
} else {
postTarget = 'anonymous';
H.set('postTarget', postTarget);
}
var sansLoaded = false;
WebFontConfig = {
custom: { families: [ 'Lora:400,700:latin' ], urls: [ '/css/fonts.css' ] }
};
var loadSans = function() {
if (sansLoaded) return;
sansLoaded = true;
WebFontConfig.custom.families.push('Open+Sans:400,700:latin');
try {
(function() {
var wf=document.createElement('script');
wf.src = '/js/webfont.js';
wf.type='text/javascript';
wf.async='true';
var s=document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
} catch (e) {}
};
var fonts = document.querySelectorAll('nav#font-picker a.font');
for (var i=0; i<fonts.length; i++) {
fonts[i].addEventListener('click', function(e) {
e.preventDefault();
selectedFont = this.href.substring(this.href.indexOf('#')+1);
// TODO: don't change classes on the editor window
//$writer.el.className = selectedFont;
document.querySelector('nav#font-picker li.selected').classList.remove('selected');
this.parentElement.classList.add('selected');
H.set('{{if .Editing}}draft{{.Post.Id}}font{{else}}padFont{{end}}', selectedFont);
if (selectedFont == 'sans') {
loadSans();
}
});
}
var selectedFont = H.get('{{if .Editing}}draft{{.Post.Id}}font{{else}}padFont{{end}}', '{{.Post.Font}}');
var sfe = document.querySelector('nav#font-picker a.font.'+selectedFont);
if (sfe != null) {
sfe.click();
}
var doneTyping = function() {
- if (draftDoc == 'lastDoc' || $content.el.innerText != origDoc) {
- H.saveText($content, draftDoc);
+ if (draftDoc == 'lastDoc' || $content.el.value != origDoc) {
+ H.save($content, draftDoc);
updateWordCount();
}
};
window.addEventListener('beforeunload', function(e) {
- if (draftDoc != 'lastDoc' && $content.el.innerText == origDoc) {
+ if (draftDoc != 'lastDoc' && $content.el.value == origDoc) {
H.remove(draftDoc);
} else if (!justPublished) {
doneTyping();
}
});
try {
(function() {
var wf=document.createElement('script');
wf.src = '/js/webfont.js';
wf.type='text/javascript';
wf.async='true';
var s=document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
} catch (e) {
// whatevs
}
</script>
<link href="/css/icons.css" rel="stylesheet">
</body>
</html>{{end}}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 4:01 PM (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
28/21/347a5ff66b7a5413125a0f8fb03b

Event Timeline