@erpsquad/common 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +0 -25
  2. package/README.md +934 -946
  3. package/dist/{article-cell-editor-JDI676YI-Bgq3iI1C.esm.js → article-cell-editor-JDI676YI-Dc_C73-P.esm.js} +2 -2
  4. package/dist/{article-cell-editor-JDI676YI-Bgq3iI1C.esm.js.map → article-cell-editor-JDI676YI-Dc_C73-P.esm.js.map} +1 -1
  5. package/dist/{article-cell-editor-JDI676YI-C7s2Yz0q.js → article-cell-editor-JDI676YI-DdLmEDri.js} +2 -2
  6. package/dist/{article-cell-editor-JDI676YI-C7s2Yz0q.js.map → article-cell-editor-JDI676YI-DdLmEDri.js.map} +1 -1
  7. package/dist/components/index.d.ts +9 -0
  8. package/dist/components/index.esm.js +91 -82
  9. package/dist/components/index.js +1 -1
  10. package/dist/{index-Ctq0WMb1.js → index-Ch4YhLU3.js} +168 -152
  11. package/dist/index-Ch4YhLU3.js.map +1 -0
  12. package/dist/{index-D-LS9re6.esm.js → index-Ck1uBa0H.esm.js} +1830 -833
  13. package/dist/index-Ck1uBa0H.esm.js.map +1 -0
  14. package/dist/index.esm.js +109 -100
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/{number-overlay-editor-FPDVTUA6-C0znNQy0.esm.js → number-overlay-editor-FPDVTUA6-CIQKpJh_.esm.js} +2 -2
  18. package/dist/{number-overlay-editor-FPDVTUA6-C0znNQy0.esm.js.map → number-overlay-editor-FPDVTUA6-CIQKpJh_.esm.js.map} +1 -1
  19. package/dist/{number-overlay-editor-FPDVTUA6-BUC63sqH.js → number-overlay-editor-FPDVTUA6-CJNQkl_m.js} +2 -2
  20. package/dist/{number-overlay-editor-FPDVTUA6-BUC63sqH.js.map → number-overlay-editor-FPDVTUA6-CJNQkl_m.js.map} +1 -1
  21. package/dist/style.css +3 -3
  22. package/package.json +293 -293
  23. package/src/styles/css/reset.css +1 -7
  24. package/src/styles/index.ts +8 -7
  25. package/src/styles/sass/main.scss +4 -7
  26. package/dist/index-Ctq0WMb1.js.map +0 -1
  27. package/dist/index-D-LS9re6.esm.js.map +0 -1
  28. package/src/styles/sass/_mui-overrides.scss +0 -177
@@ -1,7 +1,7 @@
1
- "use strict";var t=require("./index-Ctq0WMb1.js"),e=require("react"),n=require("./DefaultPropsProvider-C8GxU9me.js");function r(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=/* @__PURE__ */Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e}var o=/* @__PURE__ */r(e);function i(t){this.content=t}function a(t,e,n){for(var r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;var o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var l=a(o.content,i.content,n+1);if(null!=l)return l}n+=o.nodeSize}else n+=o.nodeSize}}function s(t,e,n,r){for(var o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var a=t.child(--o),l=e.child(--i),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){for(var u=0,p=Math.min(a.text.length,l.text.length);u<p&&a.text[a.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){var d=s(a.content,l.content,n-1,r-1);if(d)return d}n-=c,r-=c}else n-=c,r-=c}}i.prototype={constructor:i,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 r=n&&n!=t?this.remove(n):this,o=r.find(t),a=r.content.slice();return-1==o?a.push(n||t,e):(a[o+1]=e,n&&(a[o]=n)),new i(a)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new i(n)},addToStart:function(t,e){return new i([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new i(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),a=r.find(t);return o.splice(-1==a?o.length:a,0,e,n),new i(o)},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=i.from(t)).size?new i(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=i.from(t)).size?new i(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=i.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}},i.from=function(t){if(t instanceof i)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new i(e)};var l=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},c={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};l.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,a=0;a<e;i++){var s=this.content[i],l=a+s.nodeSize;if(l>t&&!1!==n(s,r+a,o,i)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,t-c),Math.min(s.content.size,e-c),n,r+c)}a=l}},l.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},l.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,function(a,s){a.isText?(o+=a.text.slice(Math.max(t,s)-s,e-s),i=!n):a.isLeaf&&r?(o+=r,i=!n):!i&&a.isBlock&&(o+=n,i=!0)},0),o},l.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 l(r,this.size+t.size)},l.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],s=i+a.nodeSize;s>t&&((i<t||s>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=s}return new l(n,r)},l.prototype.cutByIndex=function(t,e){return t==e?l.empty:0==t&&e==this.content.length?this:new l(this.content.slice(t,e))},l.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 l(r,o)},l.prototype.addToStart=function(t){return new l([t].concat(this.content),this.size+t.nodeSize)},l.prototype.addToEnd=function(t){return new l(this.content.concat(t),this.size+t.nodeSize)},l.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},c.firstChild.get=function(){return this.content.length?this.content[0]:null},c.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},c.childCount.get=function(){return this.content.length},l.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},l.prototype.maybeChild=function(t){return this.content[t]},l.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}},l.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),a(this,t,e)},l.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),s(this,t,e,n)},l.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return p(0,t);if(t==this.size)return p(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?p(n+1,o):p(n,r);r=o}},l.prototype.toString=function(){return"<"+this.toStringInner()+">"},l.prototype.toStringInner=function(){return this.content.join(", ")},l.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},l.fromJSON=function(t,e){if(!e)return l.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new l(e.map(t.nodeFromJSON))},l.fromArray=function(t){if(!t.length)return l.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 l(e||t,n)},l.from=function(t){if(!t)return l.empty;if(t instanceof l)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new l([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(l.prototype,c);var u={index:0,offset:0};function p(t,e){return u.index=t,u.offset=e,u}function d(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof 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(!d(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!d(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}l.empty=new l([],0);var f=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}f.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},f.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},f.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},f.prototype.eq=function(t){return this==t||this.type==t.type&&d(this.attrs,t.attrs)},f.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},f.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)},f.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},f.setFrom=function(t){if(!t||0==t.length)return f.none;if(t instanceof f)return[t];var e=t.slice();return e.sort(function(t,e){return t.type.rank-e.type.rank}),e},f.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var m=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},v={size:{configurable:!0}};function g(t,e,n){var r=t.findIndex(e),o=r.index,i=r.offset,a=t.maybeChild(o),s=t.findIndex(n),l=s.index,c=s.offset;if(i==e||a.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(o,a.copy(g(a.content,e-i-1,n-i-1)))}function y(t,e,n,r){var o=t.findIndex(e),i=o.index,a=o.offset,s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));var l=y(s.content,e-a-1,n);return l&&t.replaceChild(i,s.copy(l))}function b(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 w(t,e,n,0)}function w(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){var a=w(t,e,n,r+1);return i.copy(i.content.replaceChild(o,a))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){var s=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(l.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return E(i,M(t,s.start,s.end,e,r))}var c=t.parent,u=c.content;return E(c,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}return E(i,N(t,e,r))}function k(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function x(t,e,n){var r=t.node(n);return k(r,e.node(n)),r}function C(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 T(t,e,n,r){var o=(e||t).node(n),i=0,a=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(C(t.nodeAfter,r),i++));for(var s=i;s<a;s++)C(o.child(s),r);e&&e.depth==n&&e.textOffset&&C(e.nodeBefore,r)}function E(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function M(t,e,n,r,o){var i=t.depth>o&&x(t,e,o+1),a=r.depth>o&&x(n,r,o+1),s=[];return T(null,t,o,s),i&&a&&e.index(o)==n.index(o)?(k(i,a),C(E(i,M(t,e,n,r,o+1)),s)):(i&&C(E(i,N(t,e,o+1)),s),T(e,n,o,s),a&&C(E(a,N(n,r,o+1)),s)),T(r,null,o,s),new l(s)}function N(t,e,n){var r=[];return T(null,t,n,r),t.depth>n&&C(E(x(t,e,n+1),N(t,e,n+1)),r),T(e,null,n,r),new l(r)}v.size.get=function(){return this.content.size-this.openStart-this.openEnd},m.prototype.insertAt=function(t,e){var n=y(this.content,t+this.openStart,e,null);return n&&new m(n,this.openStart,this.openEnd)},m.prototype.removeBetween=function(t,e){return new m(g(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},m.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},m.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},m.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},m.fromJSON=function(t,e){if(!e)return m.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 m(l.fromJSON(t,e.content),n,r)},m.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 m(t,n,r)},Object.defineProperties(m.prototype,v),m.empty=new m(l.empty,0,0);var S=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},D={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};S.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},D.parent.get=function(){return this.node(this.depth)},D.doc.get=function(){return this.node(0)},S.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},S.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},S.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},S.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},S.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},S.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]},S.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},D.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},D.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},D.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)},S.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},S.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return f.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,a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i},S.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},S.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},S.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 I(this,t,n)},S.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},S.prototype.max=function(t){return t.pos>this.pos?t:this},S.prototype.min=function(t){return t.pos<this.pos?t:this},S.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},S.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 a=i.content.findIndex(o),s=a.index,l=a.offset,c=o-l;if(n.push(i,s,r+l),!c)break;if((i=i.child(s)).isText)break;o=c-1,r+=l+1}return new S(e,n,o)},S.resolveCached=function(t,e){for(var n=0;n<L.length;n++){var r=L[n];if(r.pos==e&&r.doc==t)return r}var o=L[O]=S.resolve(t,e);return O=(O+1)%A,o},Object.defineProperties(S.prototype,D);var L=[],O=0,A=12,I=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},R={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};R.start.get=function(){return this.$from.before(this.depth+1)},R.end.get=function(){return this.$to.after(this.depth+1)},R.parent.get=function(){return this.$from.node(this.depth)},R.startIndex.get=function(){return this.$from.index(this.depth)},R.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(I.prototype,R);var P=/* @__PURE__ */Object.create(null),B=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||l.empty,this.marks=r||f.none},F={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}};F.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},F.childCount.get=function(){return this.content.childCount},B.prototype.child=function(t){return this.content.child(t)},B.prototype.maybeChild=function(t){return this.content.maybeChild(t)},B.prototype.forEach=function(t){this.content.forEach(t)},B.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},B.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},F.textContent.get=function(){return this.textBetween(0,this.content.size,"")},B.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},F.firstChild.get=function(){return this.content.firstChild},F.lastChild.get=function(){return this.content.lastChild},B.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},B.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},B.prototype.hasMarkup=function(t,e,n){return this.type==t&&d(this.attrs,e||t.defaultAttrs||P)&&f.sameSet(this.marks,n||f.none)},B.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},B.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},B.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},B.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return m.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),a=r.start(i),s=r.node(i).content.cut(r.pos-a,o.pos-a);return new m(s,r.depth-i,o.depth-i)},B.prototype.replace=function(t,e,n){return b(this.resolve(t),this.resolve(e),n)},B.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}},B.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}},B.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}},B.prototype.resolve=function(t){return S.resolveCached(this,t)},B.prototype.resolveNoCache=function(t){return S.resolve(this,t)},B.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},F.isBlock.get=function(){return this.type.isBlock},F.isTextblock.get=function(){return this.type.isTextblock},F.inlineContent.get=function(){return this.type.inlineContent},F.isInline.get=function(){return this.type.isInline},F.isText.get=function(){return this.type.isText},F.isLeaf.get=function(){return this.type.isLeaf},F.isAtom.get=function(){return this.type.isAtom},B.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()+")"),q(this.marks,t)},B.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},B.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=l.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 s=r;s<o;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0},B.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},B.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},B.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=f.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!f.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map(function(t){return t.type.name}));this.content.forEach(function(t){return t.check()})},B.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},B.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=l.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(B.prototype,F);var H=/* @__PURE__ */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):q(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}(B);function q(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var z=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},_={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};z.parse=function(t,e){var n=new j(t,e);if(null==n.next)return z.empty;var r=U(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=/* @__PURE__ */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),a=i>-1&&o[i+1];Z(t,r).forEach(function(t){a||o.push(n,a=[]),-1==a.indexOf(t)&&a.push(t)})}})});for(var i=e[r.join(",")]=new z(r.indexOf(t.length-1)>-1),a=0;a<o.length;a+=2){var s=o[a+1].sort(J);i.next.push(o[a],e[s.join(",")]||n(s))}return i}(Z(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 a=0;;a++){var s=t(e.exprs[a],i);if(a==e.exprs.length-1)return s;o(s,i=n())}else{if("star"==e.type){var l=n();return r(i,l),o(t(e.expr,l),l),[r(l)]}if("plus"==e.type){var c=n();return o(t(e.expr,i),c),o(t(e.expr,c),c),[r(c)]}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 d=n();o(t(e.expr,u),d),u=d}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var h=n();r(u,h),o(t(e.expr,u),h),u=h}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,a=[],s=0;s<o.next.length;s+=2){var l=o.next[s],c=o.next[s+1];a.push(l.name),!i||l.isText||l.hasRequiredAttrs()||(i=!1),-1==r.indexOf(c)&&r.push(c)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},z.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},z.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},_.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},_.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}},z.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},z.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 s=i.matchFragment(t,n);if(s&&(!e||s.validEnd))return l.from(a.map(function(t){return t.createAndFill()}));for(var c=0;c<i.next.length;c+=2){var u=i.next[c],p=i.next[c+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var d=o(p,a.concat(u));if(d)return d}}}(this,[])},z.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},z.prototype.computeWrapping=function(t){for(var e=/* @__PURE__ */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=[],a=r;a.type;a=a.via)i.push(a.type);return i.reverse()}for(var s=0;s<o.next.length;s+=2){var l=o.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in e||r.type&&!o.next[s+1].validEnd||(n.push({match:l.contentMatch,type:l,via:r}),e[l.name]=!0)}}},_.edgeCount.get=function(){return this.next.length>>1},z.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]}},z.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(z.prototype,_),z.empty=new z(!0);var j=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.shift()},V={next:{configurable:!0}};function U(t){var e=[];do{e.push($(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function $(t){var e=[];do{e.push(W(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function W(t){for(var e=function(t){if(t.eat("(")){var e=U(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 a=n[i];a.groups.indexOf(e)>-1&&o.push(a)}return 0==o.length&&t.err("No node type or group '"+e+"' found"),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=K(t,e)}return e}function G(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function K(t,e){var n=G(t),r=n;return t.eat(",")&&(r="}"!=t.next?G(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 Z(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 a=o[i],s=a.term,l=a.to;s||-1!=n.indexOf(l)||e(l)}}(e),n.sort(J)}function X(t){var e=/* @__PURE__ */Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Q(t,e){var n=/* @__PURE__ */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 Y(t){var e=/* @__PURE__ */Object.create(null);if(t)for(var n in t)e[n]=new nt(t[n]);return e}V.next.get=function(){return this.tokens[this.pos]},j.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},j.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(j.prototype,V);var tt=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=Y(n.attrs),this.defaultAttrs=X(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},et={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};et.isInline.get=function(){return!this.isBlock},et.isTextblock.get=function(){return this.isBlock&&this.inlineContent},et.isLeaf.get=function(){return this.contentMatch==z.empty},et.isAtom.get=function(){return this.isLeaf||this.spec.atom},tt.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},tt.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},tt.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:Q(this.attrs,t)},tt.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new B(this,this.computeAttrs(t),l.from(e),f.setFrom(n))},tt.prototype.createChecked=function(t,e,n){if(e=l.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new B(this,this.computeAttrs(t),e,f.setFrom(n))},tt.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=l.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(l.empty,!0);return o?new B(this,t,e.append(o),f.setFrom(n)):null},tt.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},tt.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},tt.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},tt.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:f.empty:t},tt.compile=function(t,e){var n=/* @__PURE__ */Object.create(null);t.forEach(function(t,r){return n[t]=new tt(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(tt.prototype,et);var nt=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},rt={isRequired:{configurable:!0}};rt.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(nt.prototype,rt);var ot=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=Y(r.attrs),this.rank=e,this.excluded=null;var o=X(this.attrs);this.instance=o&&new f(this,o)};ot.prototype.create=function(t){return!t&&this.instance?this.instance:new f(this,Q(this.attrs,t))},ot.compile=function(t,e){var n=/* @__PURE__ */Object.create(null),r=0;return t.forEach(function(t,o){return n[t]=new ot(t,r++,e,o)}),n},ot.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},ot.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},ot.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var it=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=i.from(t.nodes),this.spec.marks=i.from(t.marks),this.nodes=tt.compile(this.spec.nodes,this),this.marks=ot.compile(this.spec.marks,this);var n=/* @__PURE__ */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 o=this.nodes[r],a=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[a]||(n[a]=z.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?at(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],u=c.spec.excludes;c.excluded=null==u?[c]:""==u?[]:at(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=/* @__PURE__ */Object.create(null),this.cached.wrappings=/* @__PURE__ */Object.create(null)};function at(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],a=i;if(i)n.push(i);else for(var s in t.marks){var l=t.marks[s];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}it.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof tt))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)},it.prototype.text=function(t,e){var n=this.nodes.text;return new H(n,n.defaultAttrs,t,f.setFrom(e))},it.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},it.prototype.nodeFromJSON=function(t){return B.fromJSON(this,t)},it.prototype.markFromJSON=function(t){return f.fromJSON(this,t)},it.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var st=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)}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})};st.prototype.parse=function(t,e){void 0===e&&(e={});var n=new ft(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},st.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new ft(this,e,!0);return n.addAll(t,null,e.from,e.to),m.maxOpen(n.finish())},st.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(mt(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},st.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var a=i.getAttrs(e);if(!1===a)continue;i.attrs=a}return i}}},st.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=vt(t)),t.mark=e})};for(var o in t.marks)r(o);var i=function(e){var r=t.nodes[a].spec.parseDOM;r&&r.forEach(function(t){n(t=vt(t)),t.node=a})};for(var a in t.nodes)i();return e},st.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new st(t,st.schemaRules(t)))};var lt={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},ct={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ut={ol:!0,ul:!0};function pt(t){return(t?1:0)|("full"===t?2:0)}var dt=function(t,e,n,r,o,i,a){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&a?null:t.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=f.none,this.pendingMarks=r,this.stashMarks=[]};dt.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(l.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)},dt.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=l.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(l.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},dt.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},dt.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):gt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}},dt.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lt.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var ft=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=pt(e.preserveWhitespace)|(n?4:0);r=o?new dt(o.type,o.attrs,f.none,f.none,!0,e.topMatch||o.type.contentMatch,i):new dt(n?null:t.schema.topNodeType,null,f.none,f.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ht={top:{configurable:!0},currentPos:{configurable:!0}};function mt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vt(t){var e={};for(var n in t)e[n]=t[n];return e}function gt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],a=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,s=r.next;if(o==e)return!0;if(i.indexOf(s)<0&&a(s))return!0}};return a(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ht.top.get=function(){return this.nodes[this.open]},ft.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){for(var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];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)}},ft.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):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)},ft.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();ut.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ut.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:ct.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,a=this.top,s=this.needsBlock;if(lt.hasOwnProperty(r))i=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(a),this.needsBlock=s}else this.addElementByRule(t,o,!1===o.consuming?n:null)},ft.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},ft.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},ft.prototype.readStyles=function(t){var e=f.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},ft.prototype.addElementByRule=function(t,e,n){var r,o,i,a=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(function(t){return a.insertNode(t)});else{var l=e.contentElement;"string"==typeof l?l=t.querySelector(l):"function"==typeof l&&(l=l(t)),l||(l=t),this.findAround(t,l,!0),this.addAll(l,r)}r&&(this.sync(s),this.open--),i&&this.removePendingMark(i,s)},ft.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,a=null==r?null:t.childNodes[r];i!=a;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&lt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},ft.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 a=0;a<e.length;a++)this.enterInner(e[a],null,!1);return!0},ft.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},ft.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},ft.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:pt(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new dt(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},ft.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}},ft.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},ft.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ht.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},ft.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)},ft.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)},ft.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++)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)},ft.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))},ft.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),a=function(t,s){for(;t>=0;t--){var l=n[t];if(""==l){if(t==n.length-1||0==t)continue;for(;s>=i;s--)if(a(t-1,s))return!0;return!1}var c=s>0||0==s&&o?e.nodes[s].type:r&&s>=i?r.node(s-i).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;s--}return!0};return a(n.length-1,this.open)},ft.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}},ft.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},ft.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);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(ft.prototype,ht);var yt=function(t,e){this.nodes=t||{},this.marks=e||{}};function bt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function wt(t){return t.document||window.document}yt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=wt(e).createDocumentFragment());var o=n,i=null;return t.forEach(function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,a=0;n<i.length&&a<t.marks.length;){var s=t.marks[a];if(r.marks[s.type.name]){if(!s.eq(i[n])||!1===s.type.spec.spanning)break;n+=2,a++}else a++}for(;n<i.length;)o=i.pop(),i.pop();for(;a<t.marks.length;){var l=t.marks[a++],c=r.serializeMark(l,t.isInline,e);c&&(i.push(l,o),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(r.serializeNodeInner(t,e))}),n},yt.prototype.serializeNodeInner=function(t,e){void 0===e&&(e={});var n=yt.renderSpec(wt(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},yt.prototype.serializeNode=function(t,e){void 0===e&&(e={});for(var n=this.serializeNodeInner(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},yt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&yt.renderSpec(wt(n),r(t,e))},yt.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};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,a=n?t.createElementNS(n,r):t.createElement(r),s=e[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s))for(var c in l=2,s)if(null!=s[c]){var u=c.indexOf(" ");u>0?a.setAttributeNS(c.slice(0,u),c.slice(u+1),s[c]):a.setAttribute(c,s[c])}for(var p=l;p<e.length;p++){var d=e[p];if(0===d){if(p<e.length-1||p>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var f=yt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(a.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:a,contentDOM:i}},yt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new yt(this.nodesFromSchema(t),this.marksFromSchema(t)))},yt.nodesFromSchema=function(t){var e=bt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},yt.marksFromSchema=function(t){return bt(t.marks)};var kt={__proto__:null,ContentMatch:z,DOMParser:st,DOMSerializer:yt,Fragment:l,Mark:f,MarkType:ot,Node:B,NodeRange:I,NodeType:tt,ReplaceError:h,ResolvedPos:S,Schema:it,Slice:m},xt=Math.pow(2,16);function Ct(t,e){return t+e*xt}function Tt(t){return 65535&t}var Et=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},Mt=function t(e,n){if(void 0===n&&(n=!1),!e.length&&t.empty)return t.empty;this.ranges=e,this.inverted=n};Mt.prototype.recover=function(t){var e=0,n=Tt(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))/xt}(t)},Mt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},Mt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},Mt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>t)break;var l=this.ranges[a+o],c=this.ranges[a+i],u=s+l;if(t<=u){var p=s+r+((l?t==s?-1:t==u?1:e:e)<0?0:c);if(n)return p;var d=t==(e<0?s:u)?null:Ct(a/3,t-s);return new Et(p,e<0?t!=s:t!=u,d)}r+=c-l}return n?t+r:new Et(t+r)},Mt.prototype.touches=function(t,e){for(var n=0,r=Tt(e),o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>t)break;var l=this.ranges[a+o];if(t<=s+l&&a==3*r)return!0;n+=this.ranges[a+i]-l}return!1},Mt.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],a=i-(this.inverted?o:0),s=i+(this.inverted?0:o),l=this.ranges[r+e],c=this.ranges[r+n];t(a,a+l,s,s+c),o+=c-l}},Mt.prototype.invert=function(){return new Mt(this.ranges,!this.inverted)},Mt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},Mt.offset=function(t){return 0==t?Mt.empty:new Mt(t<0?[0,-t,0]:[0,0,t])},Mt.empty=new Mt([]);var Nt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function St(t){var e=Error.call(this,t);return e.__proto__=St.prototype,e}Nt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new Nt(this.maps,this.mirror,t,e)},Nt.prototype.copy=function(){return new Nt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},Nt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},Nt.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)}},Nt.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)]},Nt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},Nt.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)}},Nt.prototype.invert=function(){var t=new Nt;return t.appendMappingInverted(this),t},Nt.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},Nt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},Nt.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,t=this.maps[a].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new Et(t,r)},St.prototype=Object.create(Error.prototype),St.prototype.constructor=St,St.prototype.name="TransformError";var Dt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Nt},Lt={before:{configurable:!0},docChanged:{configurable:!0}};function Ot(){throw new Error("Override me")}Lt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},Dt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new St(e.failed);return this},Dt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},Lt.docChanged.get=function(){return this.steps.length>0},Dt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(Dt.prototype,Lt);var At=/* @__PURE__ */Object.create(null),It=function(){};It.prototype.apply=function(t){return Ot()},It.prototype.getMap=function(){return Mt.empty},It.prototype.invert=function(t){return Ot()},It.prototype.map=function(t){return Ot()},It.prototype.merge=function(t){return null},It.prototype.toJSON=function(){return Ot()},It.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=At[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},It.jsonID=function(t,e){if(t in At)throw new RangeError("Duplicate use of step JSON ID "+t);return At[t]=e,e.prototype.jsonID=t,e};var Rt=function(t,e){this.doc=t,this.failed=e};Rt.ok=function(t){return new Rt(t,null)},Rt.fail=function(t){return new Rt(null,t)},Rt.fromReplace=function(t,e,n,r){try{return Rt.ok(t.replace(e,n,r))}catch(o){if(o instanceof h)return Rt.fail(o.message);throw o}};var Pt=/* @__PURE__ */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&&Ft(t,this.from,this.to)?Rt.fail("Structure replace would overwrite content"):Rt.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new Mt([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?m.empty:new m(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?m.empty:new m(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,m.fromJSON(t,n.slice),!!n.structure)},e}(It);It.jsonID("replace",Pt);var Bt=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=a,this.structure=!!s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Ft(t,this.from,this.gapFrom)||Ft(t,this.gapTo,this.to)))return Rt.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Rt.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Rt.fromReplace(t,this.from,this.to,n):Rt.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new Mt([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,m.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(It);function Ft(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 a=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}return!1}function Ht(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function qt(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||!Ht(r,o,i))break}}function zt(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 a=i.length?i[0]:e;return n.canReplaceWith(r,o,a)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),a=e.contentMatch.findWrapping(i.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:e).contentMatch,l=r;s&&l<o;l++)s=s.matchType(n.child(l).type);return s&&s.validEnd?a:null}(r,e);return i?o.map(_t).concat({type:e,attrs:n}).concat(i.map(_t)):null}function _t(t){return{type:t,attrs:null}}function jt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,a=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var s=o.depth-1,l=n-2;s>i;s--,l--){var c=o.node(s),u=o.index(s);if(c.type.spec.isolating)return!1;var p=c.content.cutByIndex(u,c.childCount),d=r&&r[l]||c;if(d!=c&&(p=p.replaceChild(0,d.type.create(d.attrs))),!c.canReplace(u+1,c.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Vt(t,e){var n,r,o=t.resolve(e),i=o.index();return n=o.nodeBefore,r=o.nodeAfter,n&&r&&!n.isLeaf&&n.canAppend(r)&&o.parent.canReplace(i,i+1)}function Ut(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Ut(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return l.fromArray(r)}It.jsonID("replaceAround",Bt),Dt.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),s=i,c=a,u=l.empty,p=0,d=o,f=!1;d>e;d--)f||n.index(d)>0?(f=!0,u=l.from(n.node(d).copy(u)),p++):s--;for(var h=l.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,h=l.from(r.node(g).copy(h)),v++):c++;return this.step(new Bt(s,c,i,a,new m(u.append(h),p,v),u.size-p,!0))},Dt.prototype.wrap=function(t,e){for(var n=l.empty,r=e.length-1;r>=0;r--){if(n.size){var o=e[r].type.contentMatch.matchFragment(n);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=l.from(e[r].type.create(e[r].attrs,n))}var i=t.start,a=t.end;return this.step(new Bt(i,a,i,a,new m(n,0,0),e.length,!0))},Dt.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),s=a.map(e,1),c=a.map(e+t.nodeSize,1);return o.step(new Bt(s,c,s+1,c-1,new m(l.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}}),this},Dt.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 Bt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new m(l.from(i),0,0),1,!0))},Dt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=l.empty,i=l.empty,a=r.depth,s=r.depth-e,c=e-1;a>s;a--,c--){o=l.from(r.node(a).copy(o));var u=n&&n[c];i=l.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Pt(t,t,new m(o.append(i),e,e),!0))},Dt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Pt(t-e,t+e,m.empty,!0);return this.step(n)};var $t=/* @__PURE__ */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 m(Ut(n.content,function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t},o),n.openStart,n.openEnd);return Rt.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Wt(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}(It);It.jsonID("addMark",$t);var Wt=/* @__PURE__ */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 m(Ut(n.content,function(t){return t.mark(e.mark.removeFromSet(t.marks))}),n.openStart,n.openEnd);return Rt.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new $t(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}(It);function Gt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}It.jsonID("removeMark",Wt),Dt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],a=null,s=null;return this.doc.nodesBetween(t,e,function(r,l,c){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&c.type.allowsMarkType(n.type)){for(var p=Math.max(l,t),d=Math.min(l+r.nodeSize,e),f=n.addToSet(u),h=0;h<u.length;h++)u[h].isInSet(f)||(a&&a.to==p&&a.mark.eq(u[h])?a.to=d:o.push(a=new Wt(p,d,u[h])));s&&s.to==p?s.to=d:i.push(s=new $t(p,d,n))}}}),o.forEach(function(t){return r.step(t)}),i.forEach(function(t){return r.step(t)}),this},Dt.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,a){if(r.isInline){i++;var s=null;if(n instanceof ot)for(var l,c=r.marks;l=n.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else n?n.isInSet(r.marks)&&(s=[n]):s=r.marks;if(s&&s.length)for(var u=Math.min(a+r.nodeSize,e),p=0;p<s.length;p++){for(var d=s[p],f=void 0,h=0;h<o.length;h++){var m=o[h];m.step==i-1&&d.eq(o[h].style)&&(f=m)}f?(f.to=u,f.step=i):o.push({style:d,from:Math.max(a,t),to:u,step:i})}}}),o.forEach(function(t){return r.step(new Wt(t.from,t.to,t.style))}),this},Dt.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 s=r.child(a),c=i+s.nodeSize,u=n.matchType(s.type,s.attrs);if(u){n=u;for(var p=0;p<s.marks.length;p++)e.allowsMarkType(s.marks[p].type)||this.step(new Wt(i,c,s.marks[p]))}else o.push(new Pt(i,c,m.empty));i=c}if(!n.validEnd){var d=n.fillBefore(l.empty,!0);this.replace(i,i,new m(d,0,0))}for(var f=o.length-1;f>=0;f--)this.step(o[f]);return this},Dt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=m.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=m.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Gt(o,i,r)?new Pt(e,n,r):new Kt(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},Dt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new m(l.from(n),0,0))},Dt.prototype.delete=function(t,e){return this.replace(t,e,m.empty)},Dt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Kt=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=l.empty;for(var i=t.depth;i>0;i--)this.placed=l.from(t.node(i).copy(this.placed))},Jt={depth:{configurable:!0}};function Zt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Zt(t.firstChild.content,e-1,n)))}function Xt(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xt(t.lastChild.content,e-1,n)))}function Qt(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function Yt(t,e,n){if(e<=0)return t;var r=t.content;return e>1&&(r=r.replaceChild(0,Yt(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(l.empty,!0)))),t.copy(r)}function te(t,e,n,r,o){var i=t.node(e),a=o?t.indexAfter(e):t.index(e);if(a==i.childCount&&!n.compatibleContent(i.type))return null;var s=r.fillBefore(i.content,!0,a);return s&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,a)?s:null}function ee(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(ee(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),s=a.fillBefore(t).append(t);t=s.append(a.matchFragment(s).fillBefore(l.empty,!0))}return t}function ne(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)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}Jt.depth.get=function(){return this.frontier.length-1},Kt.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,a=r.depth,s=o.depth;a&&s&&1==i.childCount;)i=i.firstChild.content,a--,s--;var l=new m(i,a,s);return e>-1?new Bt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Pt(r.pos,o.pos,l):void 0},Kt.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Qt(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],a=i.type,s=i.match,c=void 0,u=void 0;if(1==t&&(r?s.matchType(r.type)||(u=s.fillBefore(l.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:u};if(2==t&&r&&(c=s.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&s.matchType(n.type))break}},Kt.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Qt(e,n);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new m(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),0))},Kt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Qt(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new m(Zt(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new m(Zt(e,n,1),n,r)},Kt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var a=0;a<i.length;a++)this.openFrontierNode(i[a]);var s=this.unplaced,c=r?r.content:s.content,u=s.openStart-e,p=0,d=[],f=this.frontier[n],h=f.match,v=f.type;if(o){for(var g=0;g<o.childCount;g++)d.push(o.child(g));h=h.matchFragment(o)}for(var y=c.size+e-(s.content.size-s.openEnd);p<c.childCount;){var b=c.child(p),w=h.matchType(b.type);if(!w)break;(++p>1||0==u||b.content.size)&&(h=w,d.push(Yt(b.mark(v.allowedMarks(b.marks)),1==p?u:0,p==c.childCount?y:-1)))}var k=p==c.childCount;k||(y=-1),this.placed=Xt(this.placed,n,l.from(d)),this.frontier[n].match=h,k&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x<y;x++){var T=C.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),C=T.content}this.unplaced=k?0==e?m.empty:new m(Zt(s.content,e-1,1),e-1,y<0?s.openEnd:e-1):new m(Zt(s.content,e,p),s.openStart,s.openEnd)},Kt.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!te(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},Kt.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),a=te(t,e,o,r,i);if(a){for(var s=e-1;s>=0;s--){var l=this.frontier[s],c=l.match,u=te(t,s,l.type,c,!0);if(!u||u.childCount)continue t}return{depth:e,fit:a,move:i?t.doc.resolve(t.after(e+1)):t}}}},Kt.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Xt(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},Kt.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Xt(this.placed,this.depth,l.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Kt.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(l.empty,!0);t.childCount&&(this.placed=Xt(this.placed,this.frontier.length,t))},Object.defineProperties(Kt.prototype,Jt),Dt.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(Gt(r,o,n))return this.step(new Pt(t,e,n));var i=ne(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var a=-(r.depth+1);i.unshift(a);for(var s=r.depth,l=r.pos-1;s>0;s--,l--){var c=r.node(s).type.spec;if(c.defining||c.isolating)break;i.indexOf(s)>-1?a=s:r.before(s)==l&&i.splice(1,0,-s)}for(var u=i.indexOf(a),p=[],d=n.openStart,f=n.content,h=0;;h++){var v=f.firstChild;if(p.push(v),h==n.openStart)break;f=v.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var g=n.openStart;g>=0;g--){var y=(g+d+1)%(n.openStart+1),b=p[y];if(b)for(var w=0;w<i.length;w++){var k=i[(w+u)%i.length],x=!0;k<0&&(x=!1,k=-k);var C=r.node(k-1),T=r.index(k-1);if(C.canReplaceWith(T,T,b.type,b.marks))return this.replace(r.before(k),x?o.after(k):e,new m(ee(n.content,0,n.openStart,y),y,n.openEnd))}}for(var E=this.steps.length,M=i.length-1;M>=0&&(this.replace(t,e,n),!(this.steps.length>E));M--){var N=i[M];N<0||(t=r.before(N),e=o.after(N))}return this},Dt.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 a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new m(l.from(n),0,0))},Dt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=ne(n,r),i=0;i<o.length;i++){var a=o[i],s=i==o.length-1;if(s&&0==a||n.node(a).type.contentMatch.validEnd)return this.delete(n.start(a),r.end(a));if(a>0&&(s||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return this.delete(n.before(a),r.after(a))}for(var l=1;l<=n.depth&&l<=r.depth;l++)if(t-n.start(l)==n.depth-l&&e>n.end(l)&&r.end(l)-e!=r.depth-l)return this.delete(n.before(l),e);return this.delete(t,e)};var re=/* @__PURE__ */Object.create(null),oe=function(t,e,n){this.ranges=n||[new ae(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ie={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ie.anchor.get=function(){return this.$anchor.pos},ie.head.get=function(){return this.$head.pos},ie.from.get=function(){return this.$from.pos},ie.to.get=function(){return this.$to.pos},ie.$from.get=function(){return this.ranges[0].$from},ie.$to.get=function(){return this.ranges[0].$to},ie.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},oe.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},oe.prototype.replace=function(t,e){void 0===e&&(e=m.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,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,u=l.$to,p=t.mapping.slice(i);t.replaceRange(p.map(c.pos),p.map(u.pos),s?m.empty:e),0==s&&he(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},oe.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],a=i.$from,s=i.$to,l=t.mapping.slice(n),c=l.map(a.pos),u=l.map(s.pos);o?t.deleteRange(c,u):(t.replaceRangeWith(c,u,e),he(t,n,e.isInline?-1:1))}},oe.findFrom=function(t,e,n){var r=t.parent.inlineContent?new se(t):fe(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?fe(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):fe(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},oe.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new pe(t.node(0))},oe.atStart=function(t){return fe(t,t,0,0,1)||new pe(t)},oe.atEnd=function(t){return fe(t,t,t.content.size,t.childCount,-1)||new pe(t)},oe.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=re[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},oe.jsonID=function(t,e){if(t in re)throw new RangeError("Duplicate use of selection JSON ID "+t);return re[t]=e,e.prototype.jsonID=t,e},oe.prototype.getBookmark=function(){return se.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(oe.prototype,ie),oe.prototype.visible=!0;var ae=function(t,e){this.$from=t,this.$to=e},se=/* @__PURE__ */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=m.empty),t.prototype.replace.call(this,e,n),n==m.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 le(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 a=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!a)return t.near(r,o);r=a.$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}(oe);oe.jsonID("text",se);var le=function(t,e){this.anchor=t,this.head=e};le.prototype.map=function(t){return new le(t.map(this.anchor),t.map(this.head))},le.prototype.resolve=function(t){return se.between(t.resolve(this.anchor),t.resolve(this.head))};var ce=/* @__PURE__ */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,a=o.pos,s=n.resolve(a);return i?t.near(s):new e(s)},e.prototype.content=function(){return new m(l.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 ue(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}(oe);ce.prototype.visible=!1,oe.jsonID("node",ce);var ue=function(t){this.anchor=t};ue.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new le(r,r):new ue(r)},ue.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&ce.isSelectable(n)?new ce(e):oe.near(e)};var pe=/* @__PURE__ */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.replace=function(e,n){if(void 0===n&&(n=m.empty),n==m.empty){e.delete(0,e.doc.content.size);var r=t.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else t.prototype.replace.call(this,e,n)},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 de},e}(oe);oe.jsonID("all",pe);var de={map:function(){return this},resolve:function(t){return new pe(t)}};function fe(t,e,n,r,o,i){if(e.inlineContent)return se.create(t,n);for(var a=r-(o>0?0:1);o>0?a<e.childCount:a>=0;a+=o){var s=e.child(a);if(s.isAtom){if(!i&&ce.isSelectable(s))return ce.create(t,n-(o<0?s.nodeSize:0))}else{var l=fe(t,s,n+o,o<0?s.childCount:0,o,i);if(l)return l}n+=s.nodeSize*o}}function he(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];(i instanceof Pt||i instanceof Bt)&&(t.mapping.maps[r].forEach(function(t,e,n,r){null==o&&(o=r)}),t.setSelection(oe.near(t.doc.resolve(o),n)))}}var me=/* @__PURE__ */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=/* @__PURE__ */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&this.updated|1,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 f.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)||f.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(oe.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}(Dt);function ve(t,e){return e&&t?t.bind(e):t}var ge=function(t,e,n){this.name=t,this.init=ve(e.init,n),this.apply=ve(e.apply,n)},ye=[new ge("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ge("selection",{init:function(t,e){return t.selection||oe.atStart(e.doc)},apply:function(t){return t.selection}}),new ge("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ge("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],be=function(t,e){var n=this;this.schema=t,this.fields=ye.concat(),this.plugins=[],this.pluginsByKey=/* @__PURE__ */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 ge(t.key,t.spec.state,t))})},we=function(t){this.config=t},ke={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ke.schema.get=function(){return this.config.schema},ke.plugins.get=function(){return this.config.plugins},we.prototype.apply=function(t){return this.applyTransaction(t).state},we.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},we.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 a=this.config.plugins[i];if(a.spec.appendTransaction){var s=r?r[i].n:0,l=r?r[i].state:this,c=s<e.length&&a.spec.appendTransaction.call(a,s?e.slice(s):e,l,n);if(c&&n.filterTransaction(c,i)){if(c.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(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},we.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new we(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<xe.length;i++)xe[i](this,t,e);return e},ke.tr.get=function(){return new me(this)},we.create=function(t){for(var e=new be(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new we(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},we.prototype.reconfigure=function(t){for(var e=new be(this.schema,t.plugins),n=e.fields,r=new we(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},we.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"==typeof 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},we.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 be(t.schema,t.plugins),o=new we(r);return r.fields.forEach(function(r){if("doc"==r.name)o.doc=B.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=oe.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 a=n[i],s=a.spec.state;if(a.key==r.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=s.fromJSON.call(a,t,e[i],o))}o[r.name]=r.init(t,o)}}),o},we.addApplyListener=function(t){xe.push(t)},we.removeApplyListener=function(t){var e=xe.indexOf(t);e>-1&&xe.splice(e,1)},Object.defineProperties(we.prototype,ke);var xe=[];function Ce(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Ce(o,e,{})),n[r]=o}return n}var Te=function(t){this.props={},t.props&&Ce(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Me("plugin")};Te.prototype.getState=function(t){return t[this.key]};var Ee=/* @__PURE__ */Object.create(null);function Me(t){return t in Ee?t+"$"+ ++Ee[t]:(Ee[t]=0,t+"$")}var Ne=function(t){void 0===t&&(t="key"),this.key=Me(t)};Ne.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Ne.prototype.getState=function(t){return t[this.key]};var Se={__proto__:null,AllSelection:pe,EditorState:we,NodeSelection:ce,Plugin:Te,PluginKey:Ne,Selection:oe,SelectionRange:ae,TextSelection:se,Transaction:me},De={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Le=/Edge\/(\d+)/.exec(navigator.userAgent),Oe=/MSIE \d/.test(navigator.userAgent),Ae=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);De.mac=/Mac/.test(navigator.platform);var Ie=De.ie=!!(Oe||Ae||Le);De.ie_version=Oe?document.documentMode||6:Ae?+Ae[1]:Le?+Le[1]:null,De.gecko=!Ie&&/gecko\/(\d+)/i.test(navigator.userAgent),De.gecko_version=De.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Re=!Ie&&/Chrome\/(\d+)/.exec(navigator.userAgent);De.chrome=!!Re,De.chrome_version=Re&&+Re[1],De.safari=!Ie&&/Apple Computer/.test(navigator.vendor),De.ios=De.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),De.android=/Android \d/.test(navigator.userAgent),De.webkit="webkitFontSmoothing"in document.documentElement.style,De.webkit_version=De.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Pe=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Be=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Fe=null,He=function(t,e,n){var r=Fe||(Fe=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},qe=function(t,e,n,r){return n&&(_e(t,e,n,r,-1)||_e(t,e,n,r,1))},ze=/^(img|br|input|textarea|hr)$/i;function _e(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:je(t))){var i=t.parentNode;if(1!=i.nodeType||Ve(t)||ze.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Pe(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?je(t):0}}}function je(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Ve(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 Ue=function(t){var e=t.isCollapsed;return e&&De.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function $e(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function We(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ge(t,e){return"number"==typeof t?t:t[e]}function Ke(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Je(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,a=n||t.dom;a;a=Be(a))if(1==a.nodeType){var s=a==i.body||1!=a.nodeType,l=s?We(i):Ke(a),c=0,u=0;if(e.top<l.top+Ge(r,"top")?u=-(l.top-e.top+Ge(o,"top")):e.bottom>l.bottom-Ge(r,"bottom")&&(u=e.bottom-l.bottom+Ge(o,"bottom")),e.left<l.left+Ge(r,"left")?c=-(l.left-e.left+Ge(o,"left")):e.right>l.right-Ge(r,"right")&&(c=e.right-l.right+Ge(o,"right")),c||u)if(s)i.defaultView.scrollBy(c,u);else{var p=a.scrollLeft,d=a.scrollTop;u&&(a.scrollTop+=u),c&&(a.scrollLeft+=c);var f=a.scrollLeft-p,h=a.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(s)break}}function Ze(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=Be(t));return e}function Xe(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,a=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=a&&(o.scrollLeft=a)}}var Qe=null;function Ye(t,e){for(var n,r,o=2e8,i=0,a=e.top,s=e.top,l=t.firstChild,c=0;l;l=l.nextSibling,c++){var u=void 0;if(1==l.nodeType)u=l.getClientRects();else{if(3!=l.nodeType)continue;u=He(l).getClientRects()}for(var p=0;p<u.length;p++){var d=u[p];if(d.top<=a&&d.bottom>=s){a=Math.max(d.bottom,a),s=Math.min(d.top,s);var f=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(f<o){n=l,o=f,r=f&&3==n.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==l.nodeType&&f&&(i=c+(e.left>=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=c+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=rn(r,1);if(i.top!=i.bottom&&tn(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}:Ye(n,r)}function tn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function en(t,e,n){var r=t.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var a=t.childNodes[i];if(1==a.nodeType)for(var s=a.getClientRects(),l=0;l<s.length;l++){var c=s[l];if(tn(e,c))return en(a,e,c)}if((i=(i+1)%r)==o)break}return t}function nn(t,e){var n,r,o,i,a=t.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(e.left,e.top);s&&(o=(n=s).offsetNode,i=n.offset)}catch(v){}if(!o&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(e.left,e.top);l&&(o=(r=l).startContainer,i=r.startOffset)}var c,u=a.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!tn(e,p))return null;if(!(u=en(t.dom,e,p)))return null}if(De.safari)for(var d=u;o&&d;d=Be(d))d.draggable&&(o=i=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(De.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var f,h=o.childNodes[i];"IMG"==h.nodeName&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(c=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)o=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;o=a.posAfter}}i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==c&&(c=function(t,e,n){var r=Ye(e,n),o=r.node,i=r.offset,a=-1;if(1==o.nodeType&&!o.firstChild){var s=o.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,i,a)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function rn(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var on=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function an(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,a=De.webkit||De.gecko;if(3==o.nodeType){if(!a||!on.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var s=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==o.nodeValue.length?(s--,c=1):n<0?s--:l++,sn(rn(He(o,s,l),c),c<0)}var u=rn(He(o,i,i),n);if(De.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var p=rn(He(o,i-1,i-1),-1);if(p.top==u.top){var d=rn(He(o,i,i+1),-1);if(d.top!=u.top)return sn(d,d.left<p.left)}}return u}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==je(o))){var f=o.childNodes[i-1];if(1==f.nodeType)return ln(f.getBoundingClientRect(),!1)}if(i<je(o)){var h=o.childNodes[i];if(1==h.nodeType)return ln(h.getBoundingClientRect(),!0)}return ln(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==je(o))){var m=o.childNodes[i-1],v=3==m.nodeType?He(m,je(m)-(a?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return sn(rn(v,1),!1)}if(i<je(o)){var g=o.childNodes[i],y=3==g.nodeType?He(g,0,a?0:1):1==g.nodeType?g:null;if(y)return sn(rn(y,-1),!0)}return sn(rn(3==o.nodeType?He(o):o,-n),n>=0)}function sn(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 ln(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}}function cn(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&&o.focus()}}var un=/[\u0590-\u08ac]/,pn=null,dn=null,fn=!1;var hn=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},mn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};hn.prototype.matchesWidget=function(){return!1},hn.prototype.matchesMark=function(){return!1},hn.prototype.matchesNode=function(){return!1},hn.prototype.matchesHack=function(t){return!1},mn.beforePosition.get=function(){return!1},hn.prototype.parseRule=function(){return null},hn.prototype.stopEvent=function(){return!1},mn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},mn.border.get=function(){return 0},hn.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()},hn.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}},mn.posBefore.get=function(){return this.parent.posBeforeChild(this)},mn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},mn.posAfter.get=function(){return this.posBefore+this.size},mn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},hn.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,a;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(a=i.pmViewDesc)||a.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}var s;if(t==this.dom&&this.contentDOM)s=e>Pe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var l=t;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&e==t.childNodes.length)for(var c=t;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},hn.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(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},hn.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},hn.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},hn.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}},hn.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=!0;;r++,o=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var i=r==this.children.length?null:this.children[r];if(n==t&&(0==e||!i||!i.size||i.border||e<0&&o)||i&&i.domAtom&&t<n+i.size)return{node:this.contentDOM,offset:i?Pe(i.dom):this.contentDOM.childNodes.length};if(!i)throw new Error("Invalid position "+t);var a=n+i.size;if(!i.domAtom&&(e<0&&!i.border?a>=t:a>t)&&(a>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=a}},hn.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,a=0;;a++){var s=this.children[a],l=i+s.size;if(-1==r&&t<=l){var c=i+s.border;if(t>=c&&e<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,e,c);t=i;for(var u=a;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Pe(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(l>e||a==this.children.length-1)){e=l;for(var d=a+1;d<this.children.length;d++){var f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Pe(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},hn.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)},hn.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),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]},hn.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(o>s&&i<c)return l.setSelection(t-s-l.border,e-s-l.border,n,r);s=c}var u=this.domFromPos(t,t?-1:1),p=e==t?u:this.domFromPos(e,e?-1:1),d=n.getSelection(),f=!1;if((De.gecko||De.safari)&&t==e){var h=u.node,m=u.offset;if(3==h.nodeType){if((f=m&&"\n"==h.nodeValue[m-1])&&m==h.nodeValue.length)for(var v=h,g=void 0;v;v=v.parentNode){if(g=v.nextSibling){"BR"==g.nodeName&&(u=p={node:g.parentNode,offset:Pe(g)+1});break}var y=v.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{var b=h.childNodes[m-1];f=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(De.gecko&&d.focusNode&&d.focusNode!=p.node&&1==d.focusNode.nodeType){var w=d.focusNode.childNodes[d.focusOffset];w&&"false"==w.contentEditable&&(r=!0)}if(r||f&&De.safari||!qe(u.node,u.offset,d.anchorNode,d.anchorOffset)||!qe(p.node,p.offset,d.focusNode,d.focusOffset)){var k=!1;if((d.extend||t==e)&&!f){d.collapse(u.node,u.offset);try{t!=e&&d.extend(p.node,p.offset),k=!0}catch(T){if(!(T instanceof DOMException))throw T}}if(!k){if(t>e){var x=u;u=p,p=x}var C=document.createRange();C.setEnd(p.node,p.offset),C.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(C)}}},hn.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},mn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},hn.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 a=n+o.border,s=i-o.border;if(t>=a&&e<=s)return this.dirty=t==n||e==i?2:1,void(t!=a||e!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-a,e-a):o.dirty=3);o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM?2:3}n=i}this.dirty=2},hn.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},mn.domAtom.get=function(){return!1},Object.defineProperties(hn.prototype,mn);var vn=[],gn=/* @__PURE__ */function(t){function e(e,n,r,o){var i,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o})),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}t.call(this,e,vn,a,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},domAtom:{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},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(hn),yn=/* @__PURE__ */function(t){function e(e,n,r,o){t.call(this,e,vn,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}(hn),bn=/* @__PURE__ */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],a=i&&i(n,o,r);return a&&a.dom||(a=yt.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,a.dom,a.contentDOM||a.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,a=this.size;n<a&&(i=Bn(i,n,a,r)),t>0&&(i=Bn(i,0,t,r));for(var s=0;s<i.length;s++)i[s].parent=o;return o.children=i,o},e}(hn),wn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s,l,c){t.call(this,e,n.isLeaf?vn:[],i,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=o,a&&this.updateChildren(l,c)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,r,o,i,a){var s,l,c=i.nodeViews[n.type.name],u=c&&c(n,i,function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a},r,o),p=u&&u.dom,d=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=(s=yt.renderSpec(document,n.type.spec.toDOM(n))).dom,d=s.contentDOM);d||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=On(p,r,n),u?l=new Tn(t,n,r,o,p,d,f,u,i,a+1):n.isText?new xn(t,n,r,o,p,f,i):new e(t,n,r,o,p,d,f,i,a+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?l.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&An(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=t.composing&&this.localCompositionInfo(t,e),a=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new Rn(this,a&&a.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0!=o.length)for(var a=0,s=[],l=null,c=0;;){if(a<o.length&&o[a].to==i){for(var u=o[a++],p=void 0;a<o.length&&o[a].to==i;)(p||(p=[u])).push(o[a++]);if(p){p.sort(Pn);for(var d=0;d<p.length;d++)n(p[d],c,!!l)}else n(u,c,!!l)}var f=void 0,h=void 0;if(l)h=-1,f=l,l=null;else{if(!(c<t.childCount))break;h=c,f=t.child(c++)}for(var m=0;m<s.length;m++)s[m].to<=i&&s.splice(m--,1);for(;a<o.length&&o[a].from<=i&&o[a].to>i;)s.push(o[a++]);var v=i+f.nodeSize;if(f.isText){var g=v;a<o.length&&o[a].from<g&&(g=o[a].from);for(var y=0;y<s.length;y++)s[y].to<g&&(g=s[y].to);g<v&&(l=f.cut(g-i),f=f.cut(0,g-i),v=g,h=-1)}r(f,s.length?f.isInline&&!f.isLeaf?s.filter(function(t){return!t.inline}):s.slice():vn,e.forChild(i,f),h),i=v}else for(var b=0;b<t.childCount;b++){var w=t.child(b);r(w,o,e.forChild(i,w),b),i+=w.nodeSize}}(this.node,this.innerDeco,function(e,i,a){e.spec.marks?l.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&l.syncToMarks(i==n.node.childCount?f.none:n.node.child(i).marks,r,t),l.placeWidget(e,t,o)},function(e,n,a,c){var u;l.syncToMarks(e.marks,r,t),l.findNodeMatch(e,n,a,c)||s&&t.state.selection.from>o&&t.state.selection.to<o+e.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,n,a,u,t)||l.updateNextNode(e,n,a,t,c)||l.addNode(e,n,a,t,o),o+=e.nodeSize}),l.syncToMarks(vn,r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(a&&this.protectLocalComposition(t,a),En(this.contentDOM,this.children,t),De.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.localCompositionInfo=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof se)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),a=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];e=je(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(a&&this.dom.contains(a.parentNode)){if(this.node.inlineContent){var s=a.nodeValue,l=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var a=t.child(o++),s=i;if(i+=a.nodeSize,a.isText){for(var l=a.text;o<t.childCount;){var c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){var u=l.lastIndexOf(e,r-s);if(u>=0&&u+e.length+s>=n)return s+u}}}return-1}(this.node.content,s,r-e,o-e);return l<0?null:{node:a,pos:l,text:s}}return{node:a,pos:-1}}}},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 a=new yn(this,i,n,o);t.compositionNodes.push(a),this.children=Bn(this.children,r,r+o.length,t,a)}},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(!An(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Dn(this.dom,this.nodeDOM,Sn(this.outerDeco,this.node,e),Sn(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.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(hn);function kn(t,e,n,r,o){return On(r,e,t),new wn(null,t,e,n,r,r,r,o,0)}var xn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s){t.call(this,e,n,r,o,i,null,a,s)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){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,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),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.prototype.markDirty=function(e,n){t.prototype.markDirty.call(this,e,n),this.dom==this.nodeDOM||0!=e&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(wn),Cn=/* @__PURE__ */function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(t){return 0==this.dirty&&this.dom.nodeName==t},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(hn),Tn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s,l,c,u){t.call(this,e,n,r,o,i,a,s,c,u),this.spec=l}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,r);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}(wn);function En(t,e,n){for(var r=t.firstChild,o=!1,i=0;i<e.length;i++){var a=e[i],s=a.dom;if(s.parentNode==t){for(;s!=r;)r=In(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(s,r);if(a instanceof bn){var l=r?r.previousSibling:t.lastChild;En(a.contentDOM,a.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=In(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}function Mn(t){t&&(this.nodeName=t)}Mn.prototype=/* @__PURE__ */Object.create(null);var Nn=[new Mn];function Sn(t,e,n){if(0==t.length)return Nn;for(var r=n?Nn[0]:new Mn,o=[r],i=0;i<t.length;i++){var a=t[i].type.attrs;if(a)for(var s in a.nodeName&&o.push(r=new Mn(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==o.length&&o.push(r=new Mn(e.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return o}function Dn(t,e,n,r){if(n==Nn&&r==Nn)return e;for(var o=e,i=0;i<r.length;i++){var a=r[i],s=n[i];if(i){var l=void 0;s&&s.nodeName==a.nodeName&&o!=t&&(l=o.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(o),s=Nn[0]),o=l}Ln(o,s||Nn[0],a)}return o}function Ln(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(" ").filter(Boolean):vn,a=n.class?n.class.split(" ").filter(Boolean):vn,s=0;s<i.length;s++)-1==a.indexOf(i[s])&&t.classList.remove(i[s]);for(var l=0;l<a.length;l++)-1==i.indexOf(a[l])&&t.classList.add(a[l])}if(e.style!=n.style){if(e.style)for(var c,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=u.exec(e.style);)t.style.removeProperty(c[1]);n.style&&(t.style.cssText+=n.style)}}function On(t,e,n){return Dn(t,t,Nn,Sn(e,n,1!=t.nodeType))}function An(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 In(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var Rn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){for(var n=t.childCount,r=e.length,o=/* @__PURE__ */new Map;n>0&&r>0;r--){var i=e[r-1],a=i.node;if(a){if(a!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Pn(t,e){return t.type.side-e.type.side}function Bn(t,e,n,r,o){for(var i=[],a=0,s=0;a<t.length;a++){var l=t[a],c=s,u=s+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=null),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Fn(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,a=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Ue(n)){for(s=c;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&ce.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==je(t);r||o;){if(t==n)return!0;var i=Pe(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==je(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;l=new ce(a==u?c:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;s=r.resolve(p)}return l||(l=Wn(t,s,c,"pointer"==e||t.state.selection.head<c.pos&&!i?1:-1)),l}function Hn(t){return t.editable?t.hasFocus():Gn(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qn(t,e){var n=t.state.selection;if(Un(t,n),Hn(t)){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,Pe(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&De.ie&&De.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,a=n.head;!zn||n instanceof se||(n.$from.parent.inlineContent||(r=_n(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=_n(t,n.to))),t.docView.setSelection(i,a,t.root,e),zn&&(r&&Vn(r),o&&Vn(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(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),setTimeout(function(){Hn(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")},20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}Rn.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}},Rn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Rn.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 a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(t[o])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=bn.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}},Rn.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var a=this.index;a<o.length;a++)if(o[a].matchesNode(t,e,n)){i=a;break}}else for(var s=this.index,l=Math.min(o.length,s+1);s<l;s++){var c=o[s];if(c.matchesNode(t,e,n)&&!this.preMatch.matched.has(c)){i=s;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))},Rn.prototype.updateNodeAt=function(t,e,n,r,o){return!!this.top.children[r].update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index=r+1,!0)},Rn.prototype.findIndexWithChild=function(t){for(;;){var e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){var n=t.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}t=e}},Rn.prototype.updateNextNode=function(t,e,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var a=this.top.children[i];if(a instanceof wn){var s=this.preMatch.matched.get(a);if(null!=s&&s!=o)return!1;var l=a.dom;if((!this.lock||!(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))||t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&3!=a.dirty&&An(e,a.outerDeco))&&a.update(t,e,n,r))return this.destroyBetween(this.index,i),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Rn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,wn.create(this.top,t,e,n,r,o)),this.changed=!0},Rn.prototype.placeWidget=function(t,e,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var o=new gn(this.top,t,e,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},Rn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof bn;)t=t.children[t.children.length-1];t&&t instanceof xn&&!/\n$/.test(t.node.text)||(De.safari&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},Rn.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var e=document.createElement(t);this.top.children.splice(this.index++,0,new Cn(this.top,vn,e,null)),this.changed=!0}};var zn=De.safari||De.chrome&&De.chrome_version<63;function _n(t,e){var n=t.docView.domFromPos(e,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(De.safari&&i&&"false"==i.contentEditable)return jn(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return jn(i);if(a)return jn(a)}}function jn(t){return t.contentEditable="true",De.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Vn(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Un(t,e){if(e instanceof ce){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&($n(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else $n(t)}function $n(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Wn(t,e,n,r){return t.someProp("createSelectionBetween",function(r){return r(t,e,n)})||se.between(e,n,r)}function Gn(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(n){return!1}}function Kn(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&oe.findFrom(a,e)}function Jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Zn(t,e,n){var r=t.state.selection;if(!(r instanceof se)){if(r instanceof ce&&r.node.isInline)return Jn(t,new se(e>0?r.$to:r.$from));var o=Kn(t.state,e);return!!o&&Jn(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=Kn(t.state,e);return!!(i&&i instanceof ce)&&Jn(t,i)}if(!(De.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=e<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=t.docView.descAt(c))&&!a.contentDOM)&&(ce.isSelectable(l)?Jn(t,new ce(e<0?t.state.doc.resolve(s.pos-l.nodeSize):s)):!!De.webkit&&Jn(t,new se(t.state.doc.resolve(e<0?c:c+l.nodeSize))))}}function Xn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Qn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Yn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,a=!1;for(De.gecko&&1==n.nodeType&&r<Xn(n)&&Qn(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Qn(s))o=n,i=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(er(n))break;for(var l=n.previousSibling;l&&Qn(l);)o=n.parentNode,i=Pe(l),l=l.previousSibling;if(l)r=Xn(n=l);else{if((n=n.parentNode)==t.dom)break;r=0}}a?nr(t,e,n,r):o&&nr(t,e,o,i)}}function tr(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,a=Xn(n);;)if(r<a){if(1!=n.nodeType)break;if(!Qn(n.childNodes[r]))break;o=n,i=++r}else{if(er(n))break;for(var s=n.nextSibling;s&&Qn(s);)o=s.parentNode,i=Pe(s)+1,s=s.nextSibling;if(s)r=0,a=Xn(n=s);else{if((n=n.parentNode)==t.dom)break;r=a=0}}o&&nr(t,e,o,i)}}function er(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function nr(t,e,n,r){if(Ue(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();var i=t.state;setTimeout(function(){t.state==i&&qn(t)},50)}function rr(t,e,n){var r=t.state.selection;if(r instanceof se&&!r.empty||n.indexOf("s")>-1)return!1;if(De.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var a=Kn(t.state,e);if(a&&a instanceof ce)return Jn(t,a)}if(!o.parent.inlineContent){var s=e<0?o:i,l=r instanceof pe?oe.near(s,e):oe.findFrom(s,e);return!!l&&Jn(t,l)}return!1}function or(t,e){if(!(t.state.selection instanceof se))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 a=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=t.state.tr;return e<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),t.dispatch(s),!0}return!1}function ir(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ar(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(De.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||De.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function sr(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Wn(t,e.resolve(n.anchor),e.resolve(n.head))}function lr(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 cr(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 a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=t.someProp("clipboardSerializer")||yt.fromSchema(t.state.schema),l=gr(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var u,p=c.firstChild;p&&1==p.nodeType&&(u=mr[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=l.createElement(u[d]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}p=c.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:c,text:t.someProp("clipboardTextSerializer",function(t){return t(e)})||e.content.textBetween(0,e.content.size,"\n\n")}}function ur(t,e,n,r,o){var i,a,s=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",function(t){e=t(e,s||r)}),s)return new m(l.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var u=t.someProp("clipboardTextParser",function(t){return t(e,o,r)});if(u)a=u;else{var p=o.marks(),d=t.state.schema,f=yt.fromSchema(d);i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach(function(t){i.appendChild(document.createElement("p")).appendChild(f.serializeNode(d.text(t,p)))})}}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=gr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);if((n=o&&mr[o[1].toLowerCase()])&&(t=n.map(function(t){return"<"+t+">"}).join("")+t+n.map(function(t){return"</"+t+">"}).reverse().join("")),r.innerHTML=t,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),De.webkit&&function(t){for(var e=t.querySelectorAll(De.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<e.length;n++){var r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(i);var h=i&&i.querySelector("[data-pm-slice]"),v=h&&/^(\d+) (\d+) (.*)/.exec(h.getAttribute("data-pm-slice"));if(!a){var g=t.someProp("clipboardParser")||t.someProp("domParser")||st.fromSchema(t.state.schema);a=g.parseSlice(i,{preserveWhitespace:!(!c&&!v),context:o})}return a=v?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(u){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,s=n.length-2;s>=0;s-=2){var c=r.nodes[n[s]];if(!c||c.hasRequiredAttrs())break;o=l.from(c.create(n[s+1],o)),i++,a++}return new m(o,i,a)}(function(t,e,n){return e<t.openStart&&(t=new m(hr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new m(hr(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}(a,+v[1],+v[2]),v[3]):m.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&&dr(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=fr(i[i.length-1],o.length));var a=pr(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}}),i)return{v:l.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 pr(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,l.from(t));return t}function dr(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){var i=dr(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(l.from(pr(n,t,o+1))))}}function fr(t,e){if(0==e)return t;var n=t.content.replaceChild(t.childCount-1,fr(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(l.empty,!0);return t.copy(n.append(r))}function hr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,s=a.content;return o<r-1&&(s=hr(s,e,n,r,o+1,i)),o>=n&&(s=e<0?a.contentMatchAt(0).fillBefore(s,t.childCount>1||i<=o).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(l.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(s))}var mr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},vr=null;function gr(){return vr||(vr=document.implementation.createHTMLDocument("title"))}var yr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},br=De.ie&&De.ie_version<=11,wr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};wr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},wr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var kr=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]);De.ie&&De.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 wr,br&&(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};kr.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))},kr.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},kr.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,yr),br&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},kr.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()}br&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},kr.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},kr.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},kr.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return t.suppressingSelectionUpdates=!1},50)},kr.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Gn(t)){var t;if(this.suppressingSelectionUpdates)return qn(this.view);if(De.ie&&De.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&qe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},kr.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},kr.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},kr.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){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)&&Gn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,a=[];if(this.view.editable)for(var s=0;s<t.length;s++){var l=this.registerMutation(t[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),o=o<0?l.to:Math.max(l.to,o),l.typeOver&&(i=!0))}if(De.gecko&&a.length>1){var c=a.filter(function(t){return"BR"==t.nodeName});if(2==c.length){var u=c[0],p=c[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),d=this.view,xr||(xr=!0,getComputedStyle(d.dom).whiteSpace)),this.handleDOMChange(r,o,i,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||qn(this.view),this.currentSelection.set(e))}var d},kr.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){for(var r=0;r<t.addedNodes.length;r++)e.push(t.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var o=t.previousSibling,i=t.nextSibling;if(De.ie&&De.ie_version<=11&&t.addedNodes.length)for(var a=0;a<t.addedNodes.length;a++){var s=t.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(o=l),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(i=c)}var u=o&&o.parentNode==t.target?Pe(o)+1:0,p=n.localPosFromDOM(t.target,u,-1),d=i&&i.parentNode==t.target?Pe(i):t.target.childNodes.length;return{from:p,to:n.localPosFromDOM(t.target,d,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 xr=!1,Cr={},Tr={};function Er(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function Mr(t){t.someProp("handleDOMEvents",function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return Nr(t,e)})})}function Nr(t,e){return t.someProp("handleDOMEvents",function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)})}function Sr(t){return{left:t.clientX,top:t.clientY}}function Dr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),a=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}},s=i.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Lr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Or(t,e,n,r){return Dr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",function(n){return n(t,e,r)})}function Ar(t,e,n,r){return Dr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",function(n){return n(t,e,r)})||function(t,e,n){if(0!=n.button)return!1;var r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Lr(t,se.create(r,0,r.content.size)),!0);for(var o=r.resolve(e),i=o.depth+1;i>0;i--){var a=i>o.depth?o.nodeAfter:o.node(i),s=o.before(i);if(a.inlineContent)Lr(t,se.create(r,s+1,s+1+a.content.size));else{if(!ce.isSelectable(a))continue;Lr(t,ce.create(r,s))}return!0}}(t,n,r)}function Ir(t){return zr(t)}Tr.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!Br(t,e))if(229!=e.keyCode&&t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!De.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",function(n){return n(t,e)})||function(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||De.mac&&72==n&&"c"==r?or(t,-1)||Yn(t):46==n||De.mac&&68==n&&"c"==r?or(t,1)||tr(t):13==n||27==n||(37==n?Zn(t,-1,r)||Yn(t):39==n?Zn(t,1,r)||tr(t):38==n?rr(t,-1,r)||Yn(t):40==n?function(t){if(De.safari&&!(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;ir(t,o,!0),setTimeout(function(){return ir(t,o,!1)},20)}}}(t)||rr(t,1,r)||tr(t):r==(De.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}(t,e)?e.preventDefault():Er(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout(function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}),t.lastIOSEnter=0)},200)}},Tr.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},Tr.keypress=function(t,e){if(!(Br(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||De.mac&&e.metaKey))if(t.someProp("handleKeyPress",function(n){return n(t,e)}))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof se&&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 Rr=De.mac?"metaKey":"ctrlKey";Cr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=Ir(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[Rr]&&("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(Sr(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Pr(t,i,e,n)):("doubleClick"==o?Or:Ar)(t,i.pos,i.inside,e)?e.preventDefault():Er(t,"pointer"))};var Pr=function(t,e,n,r){var o,i,a=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Rr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var s=t.state.doc.resolve(e.pos);o=s.parent,i=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?t.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null;var u=t.state.selection;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof ce&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&De.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Er(t,"pointer")};function Br(t,e){return!!t.composing||!!(De.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Pr.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Pr.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(Sr(t))),this.allowDefault||!e?Er(this.view,"pointer"):function(t,e,n,r,o){return Dr(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 ce&&(n=o.node);for(var i=t.state.doc.resolve(e),a=i.depth+1;a>0;a--){var s=a>i.depth?i.nodeAfter:i.node(a);if(ce.isSelectable(s)){r=n&&o.$from.depth>0&&a>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(a);break}}return null!=r&&(Lr(t,ce.create(t.state.doc,r)),!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&&ce.isSelectable(r))&&(Lr(t,new ce(n)),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||De.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||De.chrome&&!(this.view.state.selection instanceof se)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Lr(this.view,oe.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Er(this.view,"pointer")}},Pr.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),Er(this.view,"pointer"),0==t.buttons&&this.done()},Cr.touchdown=function(t){Ir(t),Er(t,"pointer")},Cr.contextmenu=function(t){return Ir(t)};var Fr=De.android?5e3:-1;function Hr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout(function(){return zr(t)},e))}function qr(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function zr(t,e){if(t.domObserver.forceFlush(),qr(t),e||t.docView.dirty){var n=Fn(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}Tr.compositionstart=Tr.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(),zr(t,!0),t.markCursor=null;else if(zr(t),De.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 a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}o=a,i=-1}t.composing=!0}Hr(t,Fr)},Tr.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Hr(t,20))};var _r=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function jr(t,e,n,r){var o=ur(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",function(e){return e(t,r,o||m.empty)}))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),a=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Cr.copy=Tr.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=_r?null:e.clipboardData,i=cr(t,n.content()),a=i.dom,s=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",s)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}}(t,a),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},Tr.paste=function(t,e){var n=_r?null:e.clipboardData;n&&jr(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,e):jr(t,r.textContent,r.innerHTML,e)},50)}}(t,e)};var Vr=function(t,e){this.slice=t,this.move=e},Ur=De.mac?"altKey":"ctrlKey";for(var $r in Cr.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(Sr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof ce?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ce.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);i&&i.node.type.spec.draggable&&i!=t.docView&&t.dispatch(t.state.tr.setSelection(ce.create(t.state.doc,i.posBefore)))}var a=t.state.selection.content(),s=cr(t,a),l=s.dom,c=s.text;e.dataTransfer.clearData(),e.dataTransfer.setData(_r?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",_r||e.dataTransfer.setData("text/plain",c),t.dragging=new Vr(a,!e[Ur])}},Cr.dragend=function(t){var e=t.dragging;window.setTimeout(function(){t.dragging==e&&(t.dragging=null)},50)},Tr.dragover=Tr.dragenter=function(t,e){return e.preventDefault()},Tr.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(Sr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",function(t){i=t(i)}):i=ur(t,e.dataTransfer.getData(_r?"Text":"text/plain"),_r?null:e.dataTransfer.getData("text/html"),!1,o);var a=n&&!e[Ur];if(t.someProp("handleDrop",function(n){return n(t,e,i||m.empty,a)}))e.preventDefault();else if(i){e.preventDefault();var s=i?function(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 a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),u=r.node(s),p=!1;if(1==a)p=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);p=d&&u.canReplaceWith(c,c,d[0])}if(p)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var l=t.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),!l.doc.eq(p)){var d=l.doc.resolve(c);if(u&&ce.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new ce(d));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach(function(t,e,n,r){return f=r}),l.setSelection(Wn(t,d,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}}}}}},Cr.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())&&qn(t)},20))},Cr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},Cr.beforeinput=function(t,e){if(De.chrome&&De.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,$e(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)}},Tr)Cr[$r]=Tr[$r];function Wr(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 Gr=function(t,e){this.spec=e||Yr,this.side=this.spec.side||0,this.toDOM=t};Gr.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 Zr(i-n,i-n,this)},Gr.prototype.valid=function(){return!0},Gr.prototype.eq=function(t){return this==t||t instanceof Gr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Wr(this.spec,t.spec))};var Kr=function(t,e){this.spec=e||Yr,this.attrs=t};Kr.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 Zr(o,i,this)},Kr.prototype.valid=function(t,e){return e.from<e.to},Kr.prototype.eq=function(t){return this==t||t instanceof Kr&&Wr(this.attrs,t.attrs)&&Wr(this.spec,t.spec)},Kr.is=function(t){return t.type instanceof Kr};var Jr=function(t,e){this.spec=e||Yr,this.attrs=t};Jr.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 Zr(o.pos-n,i.pos-n,this)},Jr.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},Jr.prototype.eq=function(t){return this==t||t instanceof Jr&&Wr(this.attrs,t.attrs)&&Wr(this.spec,t.spec)};var Zr=function(t,e,n){this.from=t,this.to=e,this.type=n},Xr={spec:{configurable:!0},inline:{configurable:!0}};Zr.prototype.copy=function(t,e){return new Zr(t,e,this.type)},Zr.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Zr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Zr.widget=function(t,e,n){return new Zr(t,t,new Gr(e,n))},Zr.inline=function(t,e,n,r){return new Zr(t,e,new Kr(n,r))},Zr.node=function(t,e,n,r){return new Zr(t,e,new Jr(n,r))},Xr.spec.get=function(){return this.type.spec},Xr.inline.get=function(){return this.type instanceof Kr},Object.defineProperties(Zr.prototype,Xr);var Qr=[],Yr={},to=function(t,e){this.local=t&&t.length?t:Qr,this.children=e&&e.length?e:Qr};to.create=function(t,e){return e.length?ao(e,t,0,Yr):eo},to.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},to.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var a=this.local[i];a.from<=e&&a.to>=t&&(!o||o(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){var l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,n,r+l,o)}},to.prototype.map=function(t,e,n){return this==eo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Yr)},to.prototype.mapInner=function(t,e,n,r,o){for(var i,a=0;a<this.local.length;a++){var s=this.local[a].map(t,n,r);s&&s.type.valid(e,s)?(i||(i=[])).push(s):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?function(t,e,n,r,o,i,a){for(var s=t.slice(),l=function(t,e,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||t>l+i||(e>=s[a]+i?s[a+1]=-1:n>=o&&(c=r-n-(e-t))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var u=!1,p=0;p<s.length;p+=3)if(-1==s[p+1]){var d=n.map(t[p]+i),f=d-o;if(f<0||f>=r.content.size){u=!0;continue}var h=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==h){var b=s[p+2].mapInner(n,y,d+1,t[p]+i+1,a);b!=eo?(s[p]=f,s[p+1]=h,s[p+2]=b):(s[p+1]=-2,u=!0)}else u=!0}if(u){var w=function(t,e,n,r,o,i,a){function s(t,e){for(var i=0;i<t.local.length;i++){var l=t.local[i].map(r,o,e);l?n.push(l):a.onRemove&&a.onRemove(t.local[i].spec)}for(var c=0;c<t.children.length;c+=3)s(t.children[c+2],t.children[c]+e+1)}for(var l=0;l<t.length;l+=3)-1==t[l+1]&&s(t[l+2],e[l]+i+1);return n}(s,t,e||[],n,o,i,a),k=ao(w,r,0,a);e=k.local;for(var x=0;x<s.length;x+=3)s[x+1]<0&&(s.splice(x,3),x-=3);for(var C=0,T=0;C<k.children.length;C+=3){for(var E=k.children[C];T<s.length&&s[T]<E;)T+=3;s.splice(T,0,k.children[C],k.children[C+1],k.children[C+2])}}return new to(e&&e.sort(so),s)}(this.children,i,t,e,n,r,o):i?new to(i.sort(so)):eo},to.prototype.add=function(t,e){return e.length?this==eo?to.create(t,e):this.addInner(t,e,0):this},to.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach(function(t,a){var s,l=a+n;if(s=oo(e,t,l)){for(r||(r=o.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(t,s,l+1):r.splice(i,0,a,a+t.nodeSize,ao(s,t,l+1,Yr)),i+=3}});for(var a=ro(i?io(e):e,-n),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||a.splice(s--,1);return new to(a.length?this.local.concat(a).sort(so):this.local,r||this.children)},to.prototype.remove=function(t){return 0==t.length||this==eo?this:this.removeInner(t,0)},to.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,a=n[o]+e,s=n[o+1]+e,l=0,c=void 0;l<t.length;l++)(c=t[l])&&c.from>a&&c.to<s&&(t[l]=null,(i||(i=[])).push(c));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,a+1);u!=eo?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,d=void 0;p<t.length;p++)if(d=t[p])for(var f=0;f<r.length;f++)r[f].eq(d,e)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new to(r,n):eo},to.prototype.forChild=function(t,e){if(this==eo)return this;if(e.isLeaf)return to.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,a=i+e.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>i&&l.type instanceof Kr){var c=Math.max(i,l.from)-i,u=Math.min(a,l.to)-i;c<u&&(r||(r=[])).push(l.copy(c,u))}}if(r){var p=new to(r.sort(so));return n?new no([p,n]):p}return n||eo},to.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof to)||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},to.prototype.locals=function(t){return lo(this.localsInner(t))},to.prototype.localsInner=function(t){if(this==eo)return Qr;if(t.inlineContent||!this.local.some(Kr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Kr||e.push(this.local[n]);return e};var eo=new to;to.empty=eo,to.removeOverlap=lo;var no=function(t){this.members=t};function ro(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Zr(o.from+e,o.to+e,o.type))}return n}function oo(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,a=void 0;i<t.length;i++)(a=t[i])&&a.from>n&&a.to<r&&((o||(o=[])).push(a),t[i]=null);return o}function io(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ao(t,e,n,r){var o=[],i=!1;e.forEach(function(e,a){var s=oo(t,e,a+n);if(s){i=!0;var l=ao(s,e,n+a+1,r);l!=eo&&o.push(a,a+e.nodeSize,l)}});for(var a=ro(i?io(t):t,-n).sort(so),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||o.length?new to(a,o):eo}function so(t,e){return t.from-e.from||t.to-e.to}function lo(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),co(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),co(e,o+1,i.copy(r.to,i.to)))}}return e}function co(t,e,n){for(;e<t.length&&so(n,t[e])>0;)e++;t.splice(e,0,n)}function uo(t){var e=[];return t.someProp("decorations",function(n){var r=n(t.state);r&&r!=eo&&e.push(r)}),t.cursorWrapper&&e.push(to.create(t.state.doc,[t.cursorWrapper.deco])),no.from(e)}no.prototype.forChild=function(t,e){if(e.isLeaf)return to.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=eo&&(o instanceof no?n=n.concat(o.members):n.push(o))}return no.from(n)},no.prototype.eq=function(t){if(!(t instanceof no)||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},no.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?lo(n?e:e.sort(so)):Qr},no.from=function(t){switch(t.length){case 0:return eo;case 1:return t[0];default:return new no(t)}};var po=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,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=vo(this),this.markCursor=null,this.cursorWrapper=null,mo(this),this.nodeViews=go(this),this.docView=kn(this.state.doc,ho(this),uo(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.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new kr(t,function(e,n,r,o){return function(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(a&&!t.state.selection.eq(a)){var s=t.state.tr.setSelection(a);"pointer"==i?s.setMeta("pointer",!0):"key"==i&&s.scrollIntoView(),t.dispatch(s)}}else{var c=t.state.doc.resolve(e),u=c.sharedDepth(n);e=c.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=t.root.getSelection(),u=null,p=c.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:c.anchorOffset}],Ue(c)||u.push({node:c.focusNode,offset:c.focusOffset})),De.chrome&&8===t.lastKeyCode)for(var d=a;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){a=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||st.fromSchema(t.state.schema),g=m.resolve(s),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:a,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:ar,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+s,head:k+s}}return{doc:b,sel:y,from:s,to:l}}(t,e,n);if(De.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(m=t.state.selection.to,v="end"):(m=t.state.selection.from,v="start"),t.lastKeyCode=null;var b=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var a=t.findDiffEnd(e,n+t.size,n+e.size),s=a.a,l=a.b;return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&t.size<e.size?(l=(i-=r<=i&&r>=s?i-r:0)+(l-s),s=i):l<i&&(s=(i-=r<=i&&r>=l?i-r:0)+(s-l),l=i),{start:i,endA:s,endB:l}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&p instanceof se&&!p.empty&&p.$head.sameParent(p.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((De.ios&&t.lastIOSEnter>Date.now()-225||De.android)&&o.some(function(t){return"DIV"==t.nodeName||"P"==t.nodeName})&&t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}))return void(t.lastIOSEnter=0);if(d.sel){var w=sr(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:p.from,endA:p.to,endB:p.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof se&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),De.ie&&De.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&"  "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((De.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some(function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))||!T&&x.pos<d.doc.content.size&&(k=oe.findFrom(d.doc.resolve(x.pos+1),1,!0))&&k.head==C.pos)&&t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}))t.lastIOSEnter=0;else if(t.state.selection.anchor>b.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||lr(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 a=t.resolve(lr(i,!0,!0));return!(!a.parent.isTextblock||a.pos>n||lr(a,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(g,b.start,b.endA,x,C)&&t.someProp("handleKeyDown",function(e){return e(t,$e(8,"Backspace"))}))De.android&&De.chrome&&t.domObserver.suppressSelectionUpdates();else{De.chrome&&De.android&&b.toB==b.from&&(t.lastAndroidDelete=Date.now()),De.android&&!T&&x.start()!=C.start()&&0==C.parentOffset&&x.depth==C.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==b.endA&&(b.endB-=2,C=d.doc.resolveNoCache(b.endB-d.from),setTimeout(function(){t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))})},20));var E,M,N,S,D=b.start,L=b.endA;if(T)if(x.pos==C.pos)De.ie&&De.ie_version<=11&&0==x.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout(function(){return qn(t)},20)),E=t.state.tr.delete(D,L),M=g.resolve(b.start).marksAcross(g.resolve(b.endA));else if(b.endA==b.endB&&(S=g.resolve(b.start))&&(N=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,s=i,c=a,u=0;u<a.length;u++)s=a[u].removeFromSet(s);for(var p=0;p<i.length;p++)c=i[p].removeFromSet(c);if(1==s.length&&0==c.length)r=s[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=s.length||1!=c.length)return null;r=c[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var d=[],f=0;f<e.childCount;f++)d.push(o(e.child(f)));if(l.from(d).eq(t))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,C.parentOffset),S.parent.content.cut(S.parentOffset,b.endA-S.start()))))E=t.state.tr,"add"==N.type?E.addMark(D,L,N.mark):E.removeMark(D,L,N.mark);else if(x.parent.child(x.index()).isText&&x.index()==C.index()-(C.textOffset?0:1)){var O=x.parent.textBetween(x.parentOffset,C.parentOffset);if(t.someProp("handleTextInput",function(e){return e(t,D,L,O)}))return;E=t.state.tr.insertText(O,D,L)}if(E||(E=t.state.tr.replace(D,L,d.doc.slice(b.start-d.from,b.endB-d.from))),d.sel){var A=sr(t,E.doc,d.sel);A&&!(De.chrome&&De.android&&t.composing&&A.empty&&(b.start!=b.endB||t.lastAndroidDelete<Date.now()-100)&&(A.head==D||A.head==E.mapping.map(L)-1)||De.ie&&A.empty&&A.head==D)&&E.setSelection(A)}M&&E.ensureMarks(M),t.dispatch(E.scrollIntoView())}}}(t,e,n,r,o)}),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=/* @__PURE__ */Object.create(null);var e=function(e){var n=Cr[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)||Nr(t,e)||!t.editable&&e.type in Tr||n(t,e)})};for(var n in Cr)e(n);De.safari&&t.dom.addEventListener("input",function(){return null}),Mr(t)}(this),this.pluginViews=[],this.updatePluginViews()},fo={props:{configurable:!0},root:{configurable:!0}};function ho(t){var e=/* @__PURE__ */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]))}),[Zr.node(0,t.state.doc.content.size,e)]}function mo(t){if(t.markCursor){var e=document.createElement("img");e.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:e,deco:Zr.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function vo(t){return!t.someProp("editable",function(e){return!1===e(t.state)})}function go(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}fo.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},po.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Mr(this),this._props=t,this.updateStateInner(t.state,!0)},po.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)},po.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},po.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1,i=!1;if(t.storedMarks&&this.composing&&(qr(this),i=!0),this.state=t,e){var a=go(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})(a,this.nodeViews)&&(this.nodeViews=a,o=!0),Mr(this)}this.editable=vo(this),mo(this);var s=uo(this),l=ho(this),c=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,l,s);!u&&t.selection.eq(r.selection)||(i=!0);var p="preserve"==c&&i&&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,a=o+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=t.root.elementFromPoint(i,a);if(s!=t.dom&&t.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=o-20){e=s,n=l.top;break}}}return{refDOM:e,refTop:n,stack:Ze(t.dom)}}(this);if(i){this.domObserver.stop();var d=u&&(De.ie||De.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){var n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(r.selection,t.selection);if(u){var f=De.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=kn(t.doc,l,s,this.dom,this)),f&&!this.trackWrites&&(d=!0)}d||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&function(t){var e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.root.getSelection();return qe(e.node,e.offset,n.anchorNode,n.anchorOffset)}(this))?qn(this,d):(Un(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var h=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",function(t){return t(n)})||(t.selection instanceof ce?Je(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),h):Je(this,this.coordsAtPos(t.selection.head,1),h))}else p&&function(t){var e=t.refDOM,n=t.refTop,r=t.stack,o=e?e.getBoundingClientRect().top:0;Xe(r,0==o?0:o-n)}(p)},po.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},po.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))}}},po.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 a=o[i].props[t];if(null!=a&&(n=e?e(a):a))return n}},po.prototype.hasFocus=function(){return this.root.activeElement==this.dom},po.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(Qe)return t.focus(Qe);var e=Ze(t);t.focus(null==Qe?{get preventScroll(){return Qe={preventScroll:!0},!0}}:void 0),Qe||(Qe=!1,Xe(e,0))}(this.dom),qn(this),this.domObserver.start()},fo.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},po.prototype.posAtCoords=function(t){return nn(this,t)},po.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),an(this,t,e)},po.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},po.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},po.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},po.prototype.endOfTextblock=function(t,e){return function(t,e,n){return pn==e&&dn==n?fn:(pn=e,dn=n,fn="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return cn(t,e,function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).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=an(t,o.pos,1),a=e.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=He(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<i.top+1:c.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,a=o==r.parent.content.size,s=getSelection();return un.test(r.parent.textContent)&&s.modify?cn(t,e,function(){var e=s.getRangeAt(0),o=s.focusNode,i=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||o==s.focusNode&&i==s.focusOffset;return s.removeAllRanges(),s.addRange(e),null!=a&&(s.caretBidiLevel=a),l}):"left"==n||"backward"==n?i:a}(t,e,n))}(this,e||this.state,t)},po.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),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],uo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},po.prototype.dispatchEvent=function(t){return function(t,e){Nr(t,e)||!Cr[e.type]||!t.editable&&e.type in Tr||Cr[e.type](t,e)}(this,t)},po.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(po.prototype,fo);for(var yo={__proto__:null,Decoration:Zr,DecorationSet:to,EditorView:po,__endComposition:zr,__parseFromClipboard:ur,__serializeForClipboard:cr},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:"'"},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:'"'},ko="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),xo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Co=0;Co<10;Co++)bo[48+Co]=bo[96+Co]=String(Co);for(Co=1;Co<=24;Co++)bo[Co+111]="F"+Co;for(Co=65;Co<=90;Co++)bo[Co]=String.fromCharCode(Co+32),wo[Co]=String.fromCharCode(Co);for(var To in bo)wo.hasOwnProperty(To)||(wo[To]=bo[To]);var Eo="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Mo(t){var e,n,r,o,i=t.split(/-(?!$)/),a=i[i.length-1];"Space"==a&&(a=" ");for(var s=0;s<i.length-1;s++){var l=i[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))e=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);Eo?o=!0:n=!0}}return e&&(a="Alt-"+a),n&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function No(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 So(t){return new Te({props:{handleKeyDown:Do(t)}})}function Do(t){var e=function(t){var e=/* @__PURE__ */Object.create(null);for(var n in t)e[Mo(n)]=t[n];return e}(t);return function(t,n){var r,o=function(t){var e=!(ko&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xo&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&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}(n),i=1==o.length&&" "!=o,a=e[No(o,n,!i)];if(a&&a(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=bo[n.keyCode])&&r!=o){var s=e[No(r,n,!0)];if(s&&s(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var l=e[No(o,n,!0)];if(l&&l(t.state,t.dispatch,t))return!0}return!1}}function Lo(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Oo(t,e,n){for(;t;t="start"==e?t.firstChild:t.lastChild){if(t.isTextblock)return!0;if(n&&1!=t.childCount)return!1}return!1}function Ao(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 Io(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=Ro(r);if(!o)return!1;var i=o.nodeAfter;if(qo(t,o,e))return!0;if(0==r.parent.content.size&&(Oo(i,"start")||ce.isSelectable(i))){if(e){var a=t.tr.deleteRange(r.before(),r.after());a.setSelection(Oo(i,"start")?oe.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):ce.create(a.doc,a.mapping.map(o.pos))),e(a.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 Ro(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 Po(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 Bo(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 Fo(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),a=r.indexAfter(-1),s=Bo(i.contentMatchAt(a));if(!i.canReplaceWith(a,a,s))return!1;if(e){var l=r.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(oe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0}function Ho(t,e){return e&&e(t.tr.setSelection(new pe(t.doc))),!0}function qo(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&&!Vt(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;var s=e.parent.canReplace(e.index(),e.index()+1);if(s&&(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,u=l.empty,p=r.length-1;p>=0;p--)u=l.from(r[p].create(null,u));u=l.from(i.copy(u));var d=t.tr.step(new Bt(e.pos-1,c,e.pos,c,new m(u,1,0),r.length,!0)),f=c+2*r.length;Vt(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=oe.findFrom(e,1),v=h&&h.$from.blockRange(h.$to),g=v&&qt(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(s&&Oo(a,"start",!0)&&Oo(i,"end")){for(var y=i,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;for(var w=a,k=1;!w.isTextblock;w=w.firstChild)k++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var x=l.empty,C=b.length-1;C>=0;C--)x=l.from(b[C].copy(x));n(t.tr.step(new Bt(e.pos-b.length,e.pos+a.nodeSize,e.pos+k,e.pos+a.nodeSize-k,new m(x,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function zo(t,e){return function(n,r){var o=n.selection,i=o.from,a=o.to,s=!1;return n.doc.nodesBetween(i,a,function(r,o){if(s)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)s=!0;else{var i=n.doc.resolve(o),a=i.index();s=i.parent.canReplaceWith(a,a+1,t)}}),!!s&&(r&&r(n.tr.setBlockType(i,a,t,e).scrollIntoView()),!0)}}function _o(t,e){return function(n,r){var o=n.selection,i=o.empty,a=o.$cursor,s=o.ranges;if(i&&!a||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,a=o.$to,s=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,a.pos,function(t){if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)}),s)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,s,t))return!1;if(r)if(a)t.isInSet(n.storedMarks||a.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var l=!1,c=n.tr,u=0;!l&&u<s.length;u++){var p=s[u],d=p.$from,f=p.$to;l=n.doc.rangeHasMark(d.pos,f.pos,t)}for(var h=0;h<s.length;h++){var m=s[h],v=m.$from,g=m.$to;if(l)c.removeMark(v.pos,g.pos,t);else{var y=v.pos,b=g.pos,w=v.nodeAfter,k=g.nodeBefore,x=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,C=k&&k.isText?/\s*$/.exec(k.text)[0].length:0;y+x<b&&(y+=x,b-=C),c.addMark(y,b,t.create(e))}}r(c.scrollIntoView())}return!0}}function jo(){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 Vo=jo(Lo,function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=Ao(r);if(!o){var i=r.blockRange(),a=i&&qt(i);return null!=a&&(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}var s=o.nodeBefore;if(!s.type.spec.isolating&&qo(t,o,e))return!0;if(0==r.parent.content.size&&(Oo(s,"end")||ce.isSelectable(s))){if(e){var l=t.tr.deleteRange(r.before(),r.after());l.setSelection(Oo(s,"end")?oe.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):ce.create(l.doc,o.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}return!(!s.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),0))},function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Ao(o)}var a=i&&i.nodeBefore;return!(!a||!ce.isSelectable(a)||(e&&e(t.tr.setSelection(ce.create(t.doc,i.pos-a.nodeSize)).scrollIntoView()),0))}),Uo=jo(Lo,Io,function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=Ro(o)}var a=i&&i.nodeAfter;return!(!a||!ce.isSelectable(a)||(e&&e(t.tr.setSelection(ce.create(t.doc,i.pos)).scrollIntoView()),0))}),$o={Enter:jo(Po,function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(n instanceof pe||r.parent.inlineContent||o.parent.inlineContent)return!1;var i=Bo(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(a,i.createAndFill());s.setSelection(se.create(s.doc,a+1)),e(s.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(jt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&qt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof ce&&t.selection.node.isBlock)return!(!r.parentOffset||!jt(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 se||t.selection instanceof pe)&&a.deleteSelection();var s=0==r.depth?null:Bo(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&s?[{type:s}]:null,c=jt(a.doc,a.mapping.map(r.pos),1,l);if(l||c||!jt(a.doc,a.mapping.map(r.pos),1,s&&[{type:s}])||(l=[{type:s}],c=!0),c&&(a.split(a.mapping.map(r.pos),1,l),!i&&!r.parentOffset&&r.parent.type!=s)){var u=a.mapping.map(r.before()),p=a.doc.resolve(u);r.node(-1).canReplaceWith(p.index(),p.index()+1,s)&&a.setNodeMarkup(a.mapping.map(r.before()),s)}e(a.scrollIntoView())}return!0}),"Mod-Enter":Fo,Backspace:Vo,"Mod-Backspace":Vo,"Shift-Backspace":Vo,Delete:Uo,"Mod-Delete":Uo,"Mod-a":Ho},Wo={"Ctrl-h":$o.Backspace,"Alt-Backspace":$o["Mod-Backspace"],"Ctrl-d":$o.Delete,"Ctrl-Alt-Backspace":$o["Mod-Delete"],"Alt-Delete":$o["Mod-Delete"],"Alt-d":$o["Mod-Delete"]};for(var Go in $o)Wo[Go]=$o[Go];var Ko=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Wo:$o,Jo=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 a=e[0].lastIndexOf(e[1]);i+=e[0].slice(a+e[1].length);var s=(r+=a)-o;s>0&&(i=e[0].slice(a-s,a)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Zo(t){var e=t.rules,n=new Te({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Xo(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout(function(){var r=t.state.selection.$cursor;r&&Xo(t,r.pos,r.pos,"",e,n)})}}},isInputRules:!0});return n}function Xo(t,e,n,r,o,i){if(t.composing)return!1;var a=t.state,s=a.doc.resolve(e);if(s.parent.type.spec.code)return!1;for(var l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<o.length;c++){var u=o[c].match.exec(l),p=u&&o[c].handler(a,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 Qo(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 a=t.tr,s=i.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(i.text){var c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else a.delete(i.from,i.to);e(a)}return!0}}return!1}var Yo=new Jo(/--$/,"—"),ti=new Jo(/\.\.\.$/,"…"),ei=new Jo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),ni=new Jo(/"$/,"”"),ri=new Jo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),oi=new Jo(/'$/,"’"),ii={__proto__:null,InputRule:Jo,closeDoubleQuote:ni,closeSingleQuote:oi,ellipsis:ti,emDash:Yo,inputRules:Zo,openDoubleQuote:ei,openSingleQuote:ri,smartQuotes:[ei,ni,ri,oi],textblockTypeInputRule:function(t,e,n){return new Jo(t,function(t,r,o,i){var a=t.doc.resolve(o),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,s):null})},undoInputRule:Qo,wrappingInputRule:function(t,e,n,r){return new Jo(t,function(t,o,i,a){var s=n instanceof Function?n(o):n,l=t.tr.delete(i,a),c=l.doc.resolve(i).blockRange(),u=c&&zt(c,e,s);if(!u)return null;l.wrap(c,u);var p=l.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&Vt(l.doc,i-1)&&(!r||r(o,p))&&l.join(i-1),l})}},ai=200,si=function(){};si.prototype.append=function(t){return t.length?(t=si.from(t),!this.length&&t||t.length<ai&&this.leafAppend(t)||this.length<ai&&t.leafPrepend(this)||this.appendInner(t)):this},si.prototype.prepend=function(t){return t.length?si.from(t).append(this):this},si.prototype.appendInner=function(t){return new ci(this,t)},si.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?si.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},si.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},si.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)},si.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},si.from=function(t){return t instanceof si?t:t&&t.length?new li(t):si.empty};var li=/* @__PURE__ */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<=ai)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=ai)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}(si);si.empty=new li([]);var ci=/* @__PURE__ */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}(si),ui=function(t,e){this.items=t,this.eventCount=e};ui.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 a,s,l=t.tr,c=[],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 pi(t.map));var p,d=t.step.map(r.slice(o));d&&l.maybeStep(d).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],c.push(new pi(p,null,null,c.length+u.length))),o--,p&&r.appendMap(p,o)}else l.maybeStep(t.step);return t.selection?(a=r?t.selection.map(r.slice(o)):t.selection,s=new ui(n.items.slice(0,i).append(u.reverse().concat(c)),n.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:l,selection:a}},ui.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,a=this.items,s=!r&&a.length?a.get(a.length-1):null,l=0;l<t.steps.length;l++){var c,u=t.steps[l].invert(t.docs[l]),p=new pi(t.mapping.maps[l],u,e);(c=s&&s.merge(p))&&(p=c,l?o.pop():a=a.slice(0,a.length-1)),o.push(p),e&&(i++,e=null),r||(s=p)}var d=i-n.depth;return d>fi&&(a=function(t,e){var n;return t.forEach(function(t,r){if(t.selection&&0==e--)return n=r,!1}),t.slice(n)}(a,d),i-=d),new ui(a.append(o),i)},ui.prototype.remapping=function(t,e){var n=new Nt;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},ui.prototype.addMaps=function(t){return 0==this.eventCount?this:new ui(this.items.append(t.map(function(t){return new pi(t)})),this.eventCount)},ui.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,a=this.eventCount;this.items.forEach(function(t){t.selection&&a--},r);var s=e;this.items.forEach(function(e){var r=o.getMirror(--s);if(null!=r){i=Math.min(i,r);var l=o.maps[r];if(e.step){var c=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(s+1,r));u&&a++,n.push(new pi(l,c,u))}else n.push(new pi(l))}},r);for(var l=[],c=e;c<i;c++)l.push(new pi(o.maps[c]));var u=this.items.slice(0,r).append(l).append(n),p=new ui(u,a);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},ui.prototype.emptyItemCount=function(){var t=0;return this.items.forEach(function(e){e.step||t++}),t},ui.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,a){if(a>=t)r.push(i),i.selection&&o++;else if(i.step){var s=i.step.map(e.slice(n)),l=s&&s.getMap();if(n--,l&&e.appendMap(l,n),s){var c=i.selection&&i.selection.map(e.slice(n));c&&o++;var u,p=new pi(l.invert(),s,c),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--},this.items.length,0),new ui(si.from(r.reverse()),o)},ui.empty=new ui(si.empty,0);var pi=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};pi.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new pi(e.getMap().invert(),e,this.selection)}};var di=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},fi=20;function hi(t){var e=[];return t.forEach(function(t,n,r,o){return e.push(r,o)}),e}function mi(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 vi(t,e,n,r){var o=bi(e),i=wi.get(e).spec.config,a=(r?t.undone:t.done).popEvent(e,o);if(a){var s=a.selection.resolve(a.transform.doc),l=(r?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,o),c=new di(r?l:a.remaining,r?a.remaining:l,null,0);n(a.transform.setSelection(s).setMeta(wi,{redo:r,historyState:c}).scrollIntoView())}}var gi=!1,yi=null;function bi(t){var e=t.plugins;if(yi!=e){gi=!1,yi=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){gi=!0;break}}return gi}var wi=new Ne("history"),ki=new Ne("closeHistory");function xi(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new Te({key:wi,state:{init:function(){return new di(ui.empty,ui.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(wi);if(i)return i.historyState;n.getMeta(ki)&&(t=new di(t.done,t.undone,null,0));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(a&&a.getMeta(wi))return a.getMeta(wi).redo?new di(t.done.addTransform(n,null,r,bi(e)),t.undone,hi(n.mapping.maps[n.steps.length-1]),t.prevTime):new di(t.done,t.undone.addTransform(n,null,r,bi(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new di(t.done.rebased(n,o),t.undone.rebased(n,o),mi(t.prevRanges,n.mapping),t.prevTime):new di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),mi(t.prevRanges,n.mapping),t.prevTime);var s=0==t.prevTime||!a&&(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)),l=a?mi(t.prevRanges,n.mapping):hi(n.mapping.maps[n.steps.length-1]);return new di(t.done.addTransform(n,s?e.selection.getBookmark():null,r,bi(e)),ui.empty,l,n.time)}(n,r,e,t)}},config:t})}function Ci(t,e){var n=wi.getState(t);return!(!n||0==n.done.eventCount||(e&&vi(n,t,e,!1),0))}function Ti(t,e){var n=wi.getState(t);return!(!n||0==n.undone.eventCount||(e&&vi(n,t,e,!0),0))}var Ei=function(t,e){return(Ei=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Mi(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Ei(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ni=function(){return Ni=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ni.apply(this,arguments)};function Si(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function Di(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var Li=function(t,e,n){var r;for(r in n=n||null,t)if(t.hasOwnProperty(r)&&!1===e.call(n,t[r],r,t))break},Oi=function(t,e){var n,r,o,i,a=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o<i;o+=1)for(r in n=arguments[o])a.call(n,r)&&(t[r]=n[r]);return t},Ai=function(t){return"string"==typeof t||t instanceof String},Ii=function(t){return t instanceof Array},Ri=function(t,e,n){var r=0,o=t.length;for(n=n||null;r<o&&!1!==e.call(n,t[r],r,t);r+=1);},Pi=Ii,Bi=Ri,Fi=Li,Hi=function(t,e,n){Pi(t)?Bi(t,e,n):Fi(t,e,n)},qi=Ai,zi=Hi,_i=function(t,e,n){var r=t.style;qi(e)?r[e]=n:zi(e,function(t,e){r[e]=t})},ji=Ii,Vi=function(t,e,n){var r,o;if(n=n||0,!ji(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(o=e.length,r=n;n>=0&&r<o;r+=1)if(e[r]===t)return r;return-1},Ui=function(t){return void 0===t},$i=Ui,Wi=function(t){return t&&t.className?$i(t.className.baseVal)?t.className:t.className.baseVal:""},Gi=Ii,Ki=Ui,Ji=function(t,e){e=(e=Gi(e)?e.join(" "):e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),Ki(t.className.baseVal)?t.className=e:t.className.baseVal=e},Zi=Hi,Xi=Vi,Qi=Wi,Yi=Ji,ta=function(t){var e,n=Array.prototype.slice.call(arguments,1),r=t.classList,o=[];r?Zi(n,function(e){t.classList.add(e)}):((e=Qi(t))&&(n=[].concat(e.split(/\s+/),n)),Zi(n,function(t){Xi(t,o)<0&&o.push(t)}),Yi(t,o))},ea=Ri,na=Vi,ra=Wi,oa=Ji,ia=function(t){var e,n,r=Array.prototype.slice.call(arguments,1),o=t.classList;o?ea(r,function(t){o.remove(t)}):(e=ra(t).split(/\s+/),n=[],ea(e,function(t){na(t,r)<0&&n.push(t)}),oa(t,n))},aa=function(t){return"number"==typeof t||t instanceof Number},sa=function(t){return null===t},la=Li,ca=Ui,ua=function(t,e){var n=document.createElement("img"),r="";return la(e,function(t,e){r+="&"+e+"="+t}),r=r.substring(1),n.src=t+"?"+r,n.style.display="none",document.body.appendChild(n),document.body.removeChild(n),n},pa=/[\u0020]+/g,da=/[>(){}[\]+-.!#|]/g,fa=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,ha=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,ma=/[*_~`]/g,va=/!\[.*\]\(.*\)/g,ga=/[[\]]/g,ya=/(?:^|[^\\])\\(?!\\)/g,ba=new RegExp('[&<>"]',"g");function wa(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return t}}function ka(t){return ba.test(t)?t.replace(ba,wa):t}function xa(t,e){return-1!==t.indexOf(e)}var Ca=["rel","target","hreflang","type"],Ta={codeblock:/(^ {4}[^\n]+\n*)+/,thematicBreak:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,atxHeading:/^(#{1,6}) +[\s\S]+/,seTextheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,fencedCodeblock:/^((`|~){3,})/};function Ea(t){if(!t)return null;var e={};return Ca.forEach(function(n){Ui(t[n])||(e[n]=t[n])}),e}function Ma(t,e){for(var n="",r=0;r<e;r+=1)n+=t;return n}function Na(t){for(var e=[],n=va.exec(t);n;)e.push([n.index,n.index+n[0].length]),n=va.exec(t);return t.replace(ga,function(t,n){return e.some(function(t){return n>t[0]&&n<t[1]})?t:"\\"+t})}function Sa(t){var e=function(t){return"\\"+t},n=t.replace(pa," ");return ha.test(n)&&(n=n.replace(ha,e)),ya.test(n)&&(n=n.replace(ya,function(t){return t+"\\"})),n=n.replace(ma,e),fa.test(n)&&(n=n.replace(fa,e)),function(t){var e=!1;return Li(Ta,function(n){return n.test(t)&&(e=!0),!e}),e}(n)&&(n=n.replace(da,e)),n}function Da(t){var e;return(e=-1===t.indexOf('"')?'""':-1===t.indexOf("'")?"''":"()")[0]+t+e[1]}function La(t){return sa(t)||Ui(t)}function Oa(t,e){if(null===t&&t===e)return!0;if("object"!=typeof t||"object"!=typeof e||La(t)||La(e))return t===e;for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function Aa(t){return t[t.length-1]}function Ia(t){return"object"==typeof t&&null!==t}function Ra(t,e){var n=Ni({},t);return t&&e&&Object.keys(e).forEach(function(t){Ia(n[t])?Array.isArray(e[t])?n[t]=Pa(e[t]):n.hasOwnProperty(t)?n[t]=Ra(n[t],e[t]):n[t]=Ba(e[t]):n[t]=e[t]}),n}function Pa(t){return t.map(function(t){return Ia(t)?Array.isArray(t)?Pa(t):Ba(t):t})}function Ba(t){var e=Object.keys(t);return e.length?e.reduce(function(e,n){return Ia(t[n])?e[n]=Array.isArray(t[n])?Pa(t[n]):Ba(t[n]):e[n]=t[n],e},{}):t}function Fa(t,e){return void 0===e&&(e={}),Object.keys(e).forEach(function(n){t.hasOwnProperty(n)&&"object"==typeof t[n]?Array.isArray(e[n])?t[n]=e[n]:Fa(t[n],e[n]):t[n]=e[n]}),t}function Ha(t,e){return t>e?[e,t]:[t,e]}var qa=Ri,za=function(t){var e;try{e=Array.prototype.slice.call(t)}catch(n){e=[],qa(t,function(t){e.push(t)})}return e};function _a(t,e){var n=t.nodes.paragraph;return e?n.create(null,Ai(e)?t.text(e):e):n.createAndFill()}function ja(t,e,n){return t.text(e,n)}function Va(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return se.create(t.doc,Math.min(e,o),Math.min(n,o))}function Ua(t,e,n){var r=e.pos;return t.replaceWith(r,r,_a(n)),t.setSelection(Va(t,r+1))}function $a(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,a=e.tr,s=e.doc,c=e.schema,u=r;u<=o;u+=1){var p=s.child(u),d=p.nodeSize,f=p.textContent,h=p.content,m=i(f),v=m?ja(c,m):l.empty,g=a.mapping.map(n),y=g+h.size;a.replaceWith(g,y,v),n+=d}return a}function Wa(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(Va(t,t.mapping.map(e)-o))}function Ga(t){return t.sourcepos[0][0]}function Ka(t){return t.sourcepos[1][0]}function Ja(t){return t.sourcepos[0][1]}function Za(t){return t.sourcepos[1][1]}function Xa(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Qa(t){return t&&("item"===t.type||"list"===t.type)}function Ya(t){return Qa(t)&&"ordered"===t.listData.type}function ts(t){return Qa(t)&&"ordered"!==t.listData.type}function es(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function ns(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function rs(t,e){return[t[0],t[1]+e]}function is(t,e){return[t[0],e]}function as(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function ss(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}function ls(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var cs=[],us={},ps=/\$\$widget\d+\s/;function ds(t){var e=t.search(ps);if(-1!==e){var n=t.substring(e).replace(ps,"").replace("$$","");t=t.substring(0,e),t+=ds(n)}return t}function fs(t,e){return"$$"+t+" "+e+"$$"}function hs(t,e){var n=us[t],r=n.rule,o=n.toDOM,i=ds(e).match(r);return i&&(e=i[0]),o(e)}function ms(t,e,n,r){return t.concat(vs(e,n,r))}function vs(t,e,n){void 0===n&&(n=0);var r=[],o=(cs[n]||{}).rule,i=n+1;if(t=ds(t),o&&o.test(t)){for(var a=void 0;-1!==(a=t.search(o));){var s=t.substring(0,a);s&&(r=ms(r,s,e,i));var l=(t=t.substring(a)).match(o)[0],c="widget"+n;r.push(e.nodes.widget.create({info:c},e.text(fs(c,l)))),t=t.substring(l.length)}t&&(r=ms(r,t,e,i))}else t&&(r=n<cs.length-1?ms(r,t,e,i):[e.text(t)]);return r}function gs(t){for(var e,n="",r=t.walker();e=r.next();){var o=e.node;e.entering&&(o!==t&&"text"!==o.type?(n+=as(o),r.resumeAt(t,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}function ys(){return{deleteSelection:function(){return Lo},selectAll:function(){return Ho},undo:function(){return Ci},redo:function(){return Ti}}}var bs=Vi,ws=Wi,ks=function(t,e){var n;return t.classList?t.classList.contains(e):(n=ws(t).split(/\s+/),bs(e,n)>-1)},xs=Vi,Cs=za,Ts=Element.prototype,Es=Ts.matches||Ts.webkitMatchesSelector||Ts.mozMatchesSelector||Ts.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return xs(this,Cs(e.querySelectorAll(t)))>-1},Ms="[A-Za-z][A-Za-z0-9-]*",Ns="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ss="<("+Ms+")("+Ns+")*\\s*/?>",Ds="(?:"+Ss+"|</("+Ms+")\\s*[>])",Ls=new RegExp("^"+Ds,"i"),Os=/<br\s*\/*>/i,As=/<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,Is="</p><p>";function Rs(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),a=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+a}var Ps="toastui-editor-";function Bs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,o=t;r<o.length;r++){var i,a=o[r];(i=Array.isArray(a)?a[0]?a[1]:null:a)&&n.push(""+Ps+i)}return n.join(" ")}function Fs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map(function(t){return Ps+"md-"+t}).join(" ")}function Hs(t){return t&&t.nodeType===Node.ELEMENT_NODE}function qs(t){t.parentNode&&t.parentNode.removeChild(t)}function zs(t,e,n){Ui(n)&&(n=!ks(t,e)),(n?ta:ia)(t,e)}function _s(t,e){var n=document.createElement("div");Ai(t)?n.innerHTML=t:n.appendChild(t);var r=n.firstChild;return e&&e.appendChild(r),r}function js(t){var e=window.getComputedStyle(t);return["margin-left","margin-right"].reduce(function(t,n){return t+parseInt(e.getPropertyValue(n),10)},0)+t.offsetWidth}function Vs(t,e){var n;for(n=Ai(e)?function(t){return n=t,r=e,Es.call(n,r);var n,r}:function(t){return t===e};t&&t!==document;){if(Hs(t)&&n(t))return t;t=t.parentNode}return null}function Us(t,e){for(var n=0,r=0;t&&t!==e&&(n+=t.offsetTop,r+=t.offsetLeft,t.offsetParent!==e.offsetParent);)t=t.offsetParent;return{offsetTop:n,offsetLeft:r}}function $s(t,e){Object.keys(t).forEach(function(n){La(t[n])?e.removeAttribute(n):e.setAttribute(n,t[n])})}var Ws=new Ne("widget"),Gs=function(){function t(t,e){var n=this;this.popup=null,this.removeWidget=function(){n.popup&&(n.rootEl.removeChild(n.popup),n.popup=null)},this.rootEl=t.dom.parentElement,this.eventEmitter=e,this.eventEmitter.listen("blur",this.removeWidget),this.eventEmitter.listen("loadUI",function(){n.rootEl=Vs(t.dom.parentElement,"."+Bs("defaultUI"))}),this.eventEmitter.listen("removePopupWidget",this.removeWidget)}return t.prototype.update=function(t){var e=Ws.getState(t.state);if(this.removeWidget(),e){var n=e.node,r=e.style,o=t.coordsAtPos(e.pos),i=o.top,a=o.left,s=o.bottom-i,l=this.rootEl.getBoundingClientRect(),c=i-l.top;_i(n,{opacity:"0"}),this.rootEl.appendChild(n),_i(n,{position:"absolute",left:a-l.left+5+"px",top:("bottom"===r?c+s-5:c-s)+"px",opacity:"1"}),this.popup=n,t.focus()}},t.prototype.destroy=function(){this.eventEmitter.removeEventHandler("blur",this.removeWidget)},t}();function Ks(t,e,n){t.emit("addImageBlobHook",e,function(n,r){t.emit("command","addImage",{imageUrl:n,altText:r||e.name||"image"})},n)}function Js(t){var e=za(t).filter(function(t){return-1!==t.type.indexOf("image")});if(1===e.length){var n=e[0];if(n)return n.getAsFile()}return null}function Zs(t){var e=t.eventEmitter;return new Te({props:{handleDOMEvents:{drop:function(t,n){var r,o=null===(r=n.dataTransfer)||void 0===r?void 0:r.files;return o&&Ri(o,function(t){return-1===t.type.indexOf("image")||(n.preventDefault(),n.stopPropagation(),Ks(e,t,n.type),!1)}),!0}}}})}var Xs=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"node"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function Qs(t){var e=document.createElement("span"),n=hs(t.attrs.info,t.textContent);return e.className="tui-widget",e.appendChild(n),{dom:e}}function Ys(t){return"widget"===t.type.name}var tl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"widget"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{info:{default:null}},group:"inline",inline:!0,content:"text*",selectable:!1,atom:!0,toDOM:function(){return["span",{class:"tui-widget"},0]},parseDOM:[{tag:"span.tui-widget",getAttrs:function(t){return{info:t.textContent.match(/\$\$(widget\d+)/)[1]}}}]}},enumerable:!1,configurable:!0}),e}(Xs),el=function(){function t(t){this.timer=null,this.el=document.createElement("div"),this.el.className="toastui-editor",this.eventEmitter=t,this.placeholder={text:""}}return t.prototype.createState=function(){return we.create({schema:this.schema,plugins:this.createPlugins()})},t.prototype.initEvent=function(){var t=this,e=t.eventEmitter,n=t.view,r=t.editorType;n.dom.addEventListener("focus",function(){return e.emit("focus",r)}),n.dom.addEventListener("blur",function(){return e.emit("blur",r)})},t.prototype.emitChangeEvent=function(t){this.eventEmitter.emit("caretChange",this.editorType),t.docChanged&&this.eventEmitter.emit("change",this.editorType)},Object.defineProperty(t.prototype,"defaultPlugins",{get:function(){var t,e,n=this.createInputRules(),r=Si(Si([],this.keymaps),[So(Ni({"Shift-Enter":Ko.Enter},Ko)),xi(),(e=this.placeholder,new Te({props:{decorations:function(t){var n=t.doc;if(e.text&&1===n.childCount&&n.firstChild.isTextblock&&0===n.firstChild.content.size){var r=document.createElement("span");return ta(r,"placeholder"),e.className&&ta(r,e.className),r.textContent=e.text,to.create(n,[Zr.widget(1,r)])}return null}}})),(t=this.eventEmitter,new Te({key:Ws,state:{init:function(){return null},apply:function(t){return t.getMeta("widget")}},view:function(e){return new Gs(e,t)}})),Zs(this.context)]);return n?r.concat(n):r},enumerable:!1,configurable:!0}),t.prototype.createInputRules=function(){var t=cs.map(function(t){var e=t.rule;return new Jo(e,function(t,n,r,o){var i=t.schema,a=t.tr,s=t.doc,l=n.input.match(new RegExp(e,"g")),c=s.resolve(r),u=c.parent,p=0;if(Ys(u)&&(u=c.node(c.depth-1)),u.forEach(function(t){return Ys(t)&&(p+=1)}),l.length>p){var d=Aa(l),f=vs(d,i);return a.replaceWith(o-d.length+1,o,f)}return null})});return t.length?Zo({rules:t}):null},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.createSchema=function(){return new it({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){var e=ys(),n=e.undo,r=e.redo,o=this.specs.keymaps(t),i={"Mod-z":n(),"Shift-Mod-z":r()};return t?o.concat(So(i)):o},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map(function(e){return e(t.eventEmitter)})},t.prototype.focus=function(){var t=this;this.clearTimer(),this.timer=setTimeout(function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())})},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.clearTimer(),this.view.destroy(),Object.keys(this).forEach(function(e){delete t[e]})},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(Va(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(Va(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){_i(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){_i(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),nl=function(t){return t instanceof Function},rl=["Enter","Shift-Enter","Mod-Enter","Tab","Shift-Tab","Delete","Backspace","Mod-Delete","Mod-Backspace","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Mod-d","Mod-D","Alt-ArrowUp","Alt-ArrowDown"];function ol(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var il=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter(function(t){return"node"===t.type}).reduce(function(t,e){var n,r=e.name,o=e.schema;return Ni(Ni({},t),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter(function(t){return"mark"===t.type}).reduce(function(t,e){var n,r=e.name,o=e.schema;return Ni(Ni({},t),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter(function(t){return t.commands}).reduce(function(e,n){var r={},o=n.commands();return nl(o)?r[n.name]=function(e){return ol(t,o,e)}:Object.keys(o).forEach(function(e){r[e]=function(n){return ol(t,o[e],n)}}),Ni(Ni({},e),r)},{}),r=ys();return Object.keys(r).forEach(function(e){n[e]=function(n){return ol(t,r[e],n)}}),e&&Object.keys(e).forEach(function(r){n[r]=function(n){return ol(t,e[r],n)}}),n},t.prototype.keymaps=function(t){return this.specs.filter(function(t){return t.keymaps}).map(function(t){return t.keymaps()}).map(function(e){return t||Object.keys(e).forEach(function(t){xa(rl,t)||delete e[t]}),So(e)})},t.prototype.setContext=function(t){this.specs.forEach(function(e){e.setContext(t)})},t}();function al(t){var e=t.from,n=t.to;return t instanceof pe?[e+1,n-1]:[e,n]}function sl(t){return t.index(0)+1}function ll(t,e,n){void 0===n&&(n=1);var r=0;return t.forEach(function(t,o){Ys(t)&&o+2<e&&(r+=2*n)}),r}function cl(t,e,n){void 0===n&&(n=e);var r=e===n,o=t.resolve(e),i=sl(o),a=i,s=o.start(1),l=s;if(!r){var c=t.resolve(n===t.content.size?n-1:n);l=c.start(1),a=sl(c),c.pos===t.content.size&&(n=t.content.size-2)}var u=Math.max(e-s+1,1),p=Math.max(n-l+1,1);return[[i,u+ll(t.child(i-1),u,-1)],[a,p+ll(t.child(a-1),p,-1)]]}function ul(t,e){for(var n=[],r=0,o=0;r<e;r+=1){var i=t.child(r);n[r]=o,o+=i.nodeSize}return n}function pl(t,e,n){var r=ul(t,n[0]),o=e[0]-1,i=n[0]-1,a=t.child(o),s=t.child(i),l=r[o],c=r[i];return l+=e[1]+ll(a,e[1]-1),c+=n[1]+ll(s,n[1]-1),[l,Math.min(c,t.content.size)]}function dl(t){var e=t.$from,n=t.$to,r=t.from,o=t.to,i=e.doc;return t instanceof pe&&(e=i.resolve(r+1),n=i.resolve(o-1)),0===e.depth&&(n=e=i.resolve(r-1)),{startFromOffset:e.start(1),endFromOffset:n.start(1),startToOffset:e.end(1),endToOffset:n.end(1),startIndex:e.index(0),endIndex:n.index(0),from:e.pos,to:n.pos}}function fl(t,e){for(var n=1,r=1,o=0,i=0;o<t.childCount;o+=1){var a=t.child(o).nodeSize;if(n=i+1,r=i+a-1,o===e)break;i+=a}return{startOffset:n,endOffset:r}}var hl="heading",ml="link",vl="code",gl="meta",yl="delimiter",bl="markedText",wl={strong:2,emph:1,strike:2};function kl(t,e,n,r){return{start:t,end:e,spec:{type:n,attrs:r}}}function xl(t,e,n){var r=t.type,o=rs(e,wl[r]),i=rs(n,-wl[r]);return[kl(o,i,r),kl(e,o,yl),kl(i,n,yl)]}function Cl(t,e,n,r){return[kl(t,e,ml),kl(is(t,n[1]+1),is(e,r),ml,{desc:!0}),kl(is(e,r+2),rs(e,-1),ml,{url:!0})]}function Tl(t,e,n,r){var o={start:e,end:n,spec:{attrs:{className:r+"-line-background",codeStart:e[0],codeEnd:n[0]}},lineBackground:!0};return"item"!==t.type&&"blockQuote"!==t.type?[Ni(Ni({},o),{end:e,spec:{attrs:{className:r+"-line-background start"}}}),Ni(Ni({},o),{start:[Math.min(e[0]+1,n[0]),e[1]]})]:null}function El(t,e){for(var n=[];t;){var r=t.type;"paragraph"!==r&&"codeBlock"!==r||n.push(kl([Ga(t),Ja(t)-1],[Ka(t),Za(t)+1],e)),t=t.next}return n}var Ml={heading:function(t,e,n){var r=t.level,o=t.headingType,i=[kl(e,n,hl,{level:r})];return"atx"===o?i.push(kl(e,rs(e,r),yl)):i.push(kl(is(n,0),n,hl,{seText:!0})),i},strong:xl,emph:xl,strike:xl,link:function(t,e,n){var r=t.lastChild,o=t.extendedAutolink,i=r?Za(r)+1:2;return o?[kl(e,n,ml,{desc:!0})]:Cl(e,n,e,i)},image:function(t,e,n){var r=t.lastChild,o=r?Za(r)+1:3,i=rs(e,1);return Si([kl(e,i,gl)],Cl(e,n,i,o))},code:function(t,e,n){var r=t.tickCount,o=rs(e,r),i=rs(n,-r);return[kl(e,n,vl),kl(e,o,vl,{start:!0}),kl(o,i,vl,{marked:!0}),kl(i,n,vl,{end:!0})]},codeBlock:function(t,e,n,r){var o=t.fenceOffset,i=t.fenceLength,a=t.fenceChar,s=t.info,l=t.infoPadding,c=t.parent,u=o+i,p=[kl(is(e,1),n,"codeBlock")];a&&p.push(kl(e,rs(e,u),yl)),s&&p.push(kl(rs(e,i),rs(e,i+l+s.length),gl)),new RegExp("^(\\s{0,4})("+a+"{"+i+",})").test(r)&&p.push(kl(is(n,1),n,yl));var d=Tl(c,e,n,"code-block");return d?p.concat(d):p},blockQuote:function(t,e,n){var r=t.parent&&"blockQuote"!==t.parent.type?[kl(e,n,"blockQuote")]:[];if(t.firstChild){var o=[];"paragraph"===t.firstChild.type?o=function(t){for(var e=[];t;)e.push(kl([Ga(t),Ja(t)],[Ka(t),Za(t)+1],bl)),t=t.next;return e}(t.firstChild.firstChild):"list"===t.firstChild.type&&(o=El(t.firstChild,bl)),r=Si(Si([],r),o)}return r},item:function(t,e){var n=t.listData,r=n.padding,o=n.task,i=function(t){for(var e=0;t.parent.parent&&"item"===t.parent.parent.type;)t=t.parent.parent,e+=1;return["listItem",Ni(Ni({},[{odd:!0},{even:!0}][e%2]),{listStyle:!0})]}(t),a=[kl.apply(void 0,Si([e,rs(e,r)],i))];return o&&(a.push(kl(rs(e,r),rs(e,r+3),"taskDelimiter")),a.push(kl(rs(e,r+1),rs(e,r+2),gl))),a.concat(El(t.firstChild,bl))},customBlock:function(t,e,n){var r=t,o=r.offset,i=r.syntaxLength,a=r.info,s=r.parent,l=o+i,c=[kl(is(e,1),n,"customBlock")];c.push(kl(e,rs(e,l),yl)),a&&c.push(kl(rs(e,l),rs(e,i+a.length),gl)),c.push(kl(is(n,1),n,yl));var u=Tl(s,e,n,"custom-block");return u?c.concat(u):c}},Nl={thematicBreak:"thematicBreak",table:"table",tableCell:"tableCell",htmlInline:"html"},Sl={};function Dl(t){var e=t.schema,n=t.toastMark;return new Te({appendTransaction:function(t,r,o){var i=t[0],a=o.tr;if(i.docChanged){var s=[];i.getMeta("editResult").forEach(function(t){var e=t.nodes,r=t.removedNodeRange;if(e.length){s=s.concat(function(t,e){var n=t.doc,r=e[0].sourcepos[0],o=Aa(e).sourcepos[1],i=[r[0],r[1]],a=[o[0],o[1]+1],s=[];return function(t,e,n){var r=[];Sl={};for(var o=e[0]-1;o<n[0];o+=1){var i=t.child(o),a=i.attrs.codeEnd,s=i.attrs.codeStart;if(s&&a&&!xa(r,s)){r.push(s),a=Math.min(a,t.childCount);for(var l=s-1,c=n[0],u=l;u<c;u+=1)Sl[u]=!0}}}(n,r,o),s.push({start:i,end:a}),s}(a,e));for(var o=0,i=e;o<i.length;o++)for(var l=i[o].walker(),c=l.next();c;){var u=c.node;c.entering&&(s=s.concat(Ol(u,n))),c=l.next()}}else if(r)for(var p=a.doc.childCount-1,d=r.line,f=d[0],h=d[1],m=Math.min(f,p),v=Math.min(h,p),g=m;g<=v;g+=1)Sl[g]=!0}),function(t,e,n){var r=t.doc,o=e.nodes.paragraph,i=ul(r,r.childCount);n.forEach(function(n){var a=n.start,s=n.end,l=n.spec,c=n.lineBackground,u=Math.min(a[0],r.childCount)-1,p=Math.min(s[0],r.childCount)-1,d=r.child(u),f=r.child(p),h=i[u],m=i[p];h+=a[1]+ll(d,a[1]-1),m+=s[1]+ll(f,s[1]-1),l?c?function(t,e,n,r,o){void 0===o&&(o={});for(var i=r.endIndex,a=r.from,s=r.to,l=!1,c=r.startIndex;c<=i;c+=1)delete Sl[c],l=Ll(e,c,o);l&&t.setBlockType(a,s,n,o)}(t,r,o,{from:h,to:m,startIndex:u,endIndex:p},l.attrs):t.addMark(h,m,e.mark(l.type,l.attrs)):t.removeMark(h,m)}),function(t,e,n){Object.keys(Sl).forEach(function(r){var o=Number(r),i=Math.min(Number(r)+1,t.doc.childCount-1),a=e[o],s=e[i]-1;o===i&&(s+=2),t.setBlockType(a,s,n)})}(t,i,o)}(a,e,s)}return a.setMeta("widget",i.getMeta("widget"))}})}function Ll(t,e,n){return Object.keys(n).some(function(r){return n[r]!==t.child(e).attrs[r]})}function Ol(t,e){var n=e.getLineTexts(),r=[Ga(t),Ja(t)],o=[Ka(t),Za(t)+1],i=function(t,e,n,r){var o=t.type;return nl(Ml[o])?Ml[o](t,e,n,r):Nl[o]?[kl(e,n,Nl[o])]:null}(t,r,o,n[o[0]-1]);return null!=i?i:[]}var Al=["taskList","orderedList","bulletList","table","strong","emph","strike","heading","thematicBreak","blockQuote","code","codeBlock","indent","outdent"];function Il(t){var e=t.toastMark,n=t.eventEmitter;return new Te({view:function(){return{update:function(t,r){var o=t.state,i=o.doc,a=o.selection;if(!(r&&r.doc.eq(i)&&r.selection.eq(a))){var s=a.from,l=o.doc.resolve(s).start(),c=s-l;s===l&&(c+=1);var u=[o.doc.content.findIndex(s).index+1,c],p=e.findNodeAtPosition(u),d=function(t){var e={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}},n=!0;return function(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;)e(t),t=t.parent}(t,function(t){var r=function(t){var e=t.type;return Qa(t)?t.listData.task?"taskList":"ordered"===t.listData.type?"orderedList":"bulletList":-1!==e.indexOf("table")?"table":xa(Al,e)?e:null}(t);r&&("bulletList"===r||"orderedList"===r?n&&(e[r]={active:!0},e.indent.disabled=!1,e.outdent.disabled=!1,n=!1):e[r]={active:!0})}),e}(p);n.emit("changeToolbarState",{cursorPos:u,mdNode:p,toolbarState:d}),n.emit("setFocusedNode",p)}}}}})}var Rl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),e}(Xs),Pl=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"mark"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function Bl(t,e){return Fl(t,e-1)}function Fl(t,e){return t.child(e).textContent}var Hl=/^\s*> ?/,ql=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("block-quote")},0]}}},enumerable:!1,configurable:!0}),e.prototype.createBlockQuoteText=function(t,e){return e?t.replace(Hl,"").trim():"> "+t.trim()},e.prototype.extendBlockQuote=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,a=e.schema,s=dl(r),l=s.endFromOffset,c=s.endToOffset,u=s.endIndex,p=s.to,d=Fl(o,u);if(Hl.test(d)&&p>l&&r.empty){if(d.replace(Hl,"").trim()){var f=d.slice(p-l).trim();Wa(i,c,f,ja(a,t.createBlockQuoteText(f)))}else i.deleteRange(l,c).split(i.mapping.map(c));return n(i),!0}return!1}},e.prototype.commands=function(){var t=this;return function(){return function(e,n){var r=e.selection,o=e.doc,i=dl(r),a=i.startFromOffset,s=i.endToOffset,l=i.startIndex,c=i.endIndex,u=Hl.test(Fl(o,l)),p=$a({state:e,startIndex:l,endIndex:c,from:a,createText:function(e){return t.createBlockQuoteText(e,u)}});return n(p.setSelection(Va(p,p.mapping.map(s)))),!0}}},e.prototype.keymaps=function(){var t=this.commands()();return{"alt-q":t,"alt-Q":t,Enter:this.extendBlockQuote()}},e}(Pl),zl=/(^\s*)([-*+] |[\d]+\. )/,_l=/(^\s*)([\d])+\.( \[[ xX]])? /,jl=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Vl=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Ul=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,$l=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Wl=/(^\s*)([-*+])( \[[ xX]]) /;function Gl(t){return _l.test(t)?"ordered":"bullet"}function Kl(t){for(var e=0;t&&"document"!==t.type;)"list"===t.type&&(e+=1),t=t.parent;return e}function Jl(t,e,n,r){for(var o=t.getLineTexts().length,i=[],a=e;r?a<o:a>1;){a=r?a+1:a-1;var s=t.findFirstNodeAtLine(a),l=Kl(s);if(l===n)i.push({line:a,depth:n,mdNode:s});else if(l<n)break}return i}function Zl(t,e,n,r){void 0===r&&(r=0);var o=Number.MAX_VALUE,i=0,a=e.map(function(e,a){var s=e.line;o=Math.min(s-1,o),i=Math.max(s-1,i);var l=Bl(t,s);return l="bullet"===n?function(t){if(!zl.test(t))return"* "+t;var e=Gl(t);return"bullet"===e&&Vl.test(t)?t=t.replace(Wl,"$1$2 "):"ordered"===e&&(t=t.replace(_l,"$1* ")),t}(l):function(t,e){if(!zl.test(t))return e+". "+t;var n=Gl(t);if("bullet"===n||"ordered"===n&&Vl.test(t))t=t.replace(Vl,"$1"+e+". ");else if("ordered"===n){var r=jl.exec(t)[3];Number(r)!==e&&(t=t.replace(_l,"$1"+e+". "))}return t}(l,a+1+r),{text:l,line:s}});return{changedResults:a,firstIndex:o,lastIndex:i}}function Xl(t,e){var n=function(t){var e=t.toastMark,n=t.mdNode,r=t.line,o=Kl(n),i=Jl(e,r,o,!1).reverse(),a=Jl(e,r,o,!0);return i.concat([{line:r,depth:o,mdNode:n}]).concat(a)}(e);return Zl(e.doc,n,t)}var Ql={bullet:function(t){return Xl("bullet",t)},ordered:function(t){return Xl("ordered",t)},task:function(t){var e=t.mdNode,n=t.doc,r=t.line,o=Bl(n,r);return e.listData.task?o=o.replace($l,"$1$2"):Qa(e)&&(o=o.replace(zl,"$1$2[ ] ")),{changedResults:[{text:o,line:r}]}}},Yl={bullet:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* "+Bl(e,n),line:n}]}},ordered:function(t){for(var e=t.toastMark,n=t.doc,r=t.line,o=t.startLine,i=Bl(n,r),a=1,s=o,l=0,c=o-1;c>0;c-=1){var u=e.findFirstNodeAtLine(c),p=Bl(n,c)&&!!ns(u,function(t){return Qa(t)}),d=jl.exec(Bl(n,c));if(!d&&!p)break;if(d||!p){var f=d,h=f[1],m=f[3];if(!h){a=Number(m),s=c;break}}else l+=1}return{changedResults:[{text:a+r-s-l+". "+i,line:r}]}},task:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* [ ] "+Bl(e,n),line:n}]}}},tc={bullet:function(t){var e=t.line,n=Bl(t.doc,e),r=Ul.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(t){var e=t.toastMark,n=t.line,r=t.mdNode,o=t.doc,i=Kl(r),a=Bl(o,n),s=jl.exec(a),l=s[1],c=s[3],u=s[4],p=Number(c)+1,d=""+l+p+u,f=Jl(e,n,i,!0).filter(function(t){var e=jl.exec(Bl(o,t.line));return e&&e[1].length===l.length&&!!ns(t.mdNode,function(t){return Ya(t)})});return Ni({listSyntax:d},Zl(o,f,"ordered",p))}};function ec(t,e,n,r,o){for(var i=[],a=Bl(t,n),s=jl.exec(a);s;){var l=s[1],c=s[4],u=s[5],p=l.length;if(p===o)i.push(ja(e,""+l+r+c+u)),r+=1,n+=1;else if(p>o){var d=ec(t,e,n,1,p);n=d.line,i=i.concat(d.nodes)}if(p<o||n>t.childCount)break;a=Bl(t,n),s=jl.exec(a)}return{nodes:i,line:n}}var nc=/(^\s{1,4})(.*)/;function rc(t,e,n){return t<e||zl.test(n)||Hl.test(n)}function oc(t,e,n){var r=n.$from;0===r.depth&&(r=t.resolve(r.pos-1));var o=r.node(1),i=r.start(1),a=o.content.size;return o.rangeHasMark(0,a,e.marks.table)&&r.pos-i!==a&&r.pos!==i}function ic(t,e){var n=e.from,r=e.to;if("indent"===e.type)n+=4,r+=4*(e.lineLen+1);else{var o=e.spaceLenList;n-=o[0];for(var i=0;i<o.length;i+=1)r-=o[i]}return Va(t,n,r)}var ac=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"inline*",attrs:{className:{default:null},codeStart:{default:null},codeEnd:{default:null}},selectable:!1,group:"block",parseDOM:[{tag:"div"}],toDOM:function(t){var e=t.attrs;return e.className?["div",{class:Fs(e.className)},0]:["div",0]}}},enumerable:!1,configurable:!0}),e.prototype.reorderList=function(t,e){for(var n=this.context,r=n.view,o=n.toastMark,i=n.schema,a=r.state,s=a.tr,l=a.selection,c=a.doc,u=o.findFirstNodeAtLine(t),p=u;u&&!ts(u)&&"document"!==u.parent.type;)if(Ya(u=u.parent)){p=u;break}p&&(t=p.sourcepos[0][0]);var d=jl.exec(Bl(c,t)),f=d[1],h=d[3],m=f.length,v=ec(c,i,t,Number(h),m),g=v.line,y=v.nodes;e=Math.max(e,g-1);for(var b=fl(c,t-1).startOffset,w=t-1;w<=e-1;w+=1){var k=c.child(w),x=k.nodeSize,C=k.content,T=s.mapping.map(b),E=T+C.size;s.replaceWith(T,E,y[w-t+1]),b+=x}var M=Va(s,l.from,l.to);r.dispatch(s.setSelection(M))},e.prototype.indent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.schema,i=n.selection,a=n.doc,s=dl(i),l=s.from,c=s.to,u=s.startFromOffset,p=s.startIndex,d=s.endIndex;if(t&&oc(a,o,i))return!1;var f=Fl(a,p);if(t&&rc(l,c,f)||!t&&zl.test(f)){var h=$a({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){return" "+t}}),m={type:"indent",from:l,to:c,lineLen:d-p};r(h.setSelection(ic(h,m))),jl.test(f)&&e.reorderList(p+1,d+1)}else t&&r(n.tr.insert(c,ja(o," ")));return!0}}},e.prototype.outdent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.selection,i=n.doc,a=n.schema,s=dl(o),l=s.from,c=s.to,u=s.startFromOffset,p=s.startIndex,d=s.endIndex;if(t&&oc(i,a,o))return!1;var f=Fl(i,p);if(t&&rc(l,c,f)||!t&&zl.test(f)){var h=[],m=$a({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){var e=nc.exec(t);return h.push(e?e[1].length:0),t.replace(nc,"$2")}}),v={type:"outdent",from:l,to:c,spaceLenList:h};r(m.setSelection(ic(m,v))),jl.test(f)&&e.reorderList(p+1,d+1)}else if(t){var g=f.slice(0,c-u),y=g.replace(/\s{1,4}$/,""),b=c-(g.length-y.length);r(n.tr.delete(b,c))}return!0}}},e.prototype.deleteLines=function(){var t=this;return function(e,n){var r=t.context.view,o=dl(e.selection),i=o.startFromOffset,a=o.endToOffset;return jo(function(){return n(e.tr.deleteRange(i,a)),!0},Io)(e,n,r)}},e.prototype.moveDown=function(){return function(t,e){var n=t.doc,r=t.tr,o=t.selection,i=t.schema,a=dl(o),s=a.startFromOffset,l=a.endToOffset,c=a.endIndex;if(c<n.content.childCount-1){var u=n.child(c+1),p=u.nodeSize,d=u.textContent;return r.delete(l,l+p).split(s).insert(r.mapping.map(s)-2,ja(i,d)),e(r),!0}return!1}},e.prototype.moveUp=function(){return function(t,e){var n=t.tr,r=t.doc,o=t.selection,i=t.schema,a=dl(o),s=a.startFromOffset,l=a.endToOffset,c=a.startIndex;if(c>0){var u=r.child(c-1),p=u.nodeSize,d=u.textContent;return n.delete(s-p,s).split(n.mapping.map(l)).insert(n.mapping.map(l),ja(i,d)),e(n),!0}return!1}},e.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},e.prototype.keymaps=function(){return{Tab:this.indent(!0)(),"Shift-Tab":this.outdent(!0)(),"Mod-d":this.deleteLines(),"Mod-D":this.deleteLines(),"Alt-ArrowUp":this.moveUp(),"Alt-ArrowDown":this.moveDown()}},e}(Xs),sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),e}(Xs),lc=/^#{1,6}\s/,cc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(t){var e=t.attrs,n="heading|heading"+e.level;return e.seText&&(n+="|delimiter|setext"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.createHeadingText=function(t,e,n){for(var r=e.replace(n,"").trim(),o="";t>0;)o+="#",t-=1;return o+" "+r},e.prototype.commands=function(){var t=this;return function(e){return function(n,r){var o=e.level,i=dl(n.selection),a=i.startFromOffset,s=i.endToOffset,l=$a({state:n,from:a,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(e){var n=e.match(lc),r=n?n[0]:"";return t.createHeadingText(o,e,r)}});return r(l.setSelection(Va(l,l.mapping.map(s)))),!0}}},e}(Pl),uc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("code-block")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=dl(n),a=i.startFromOffset,s=i.endToOffset,l=ja(r,"```");return o.insert(a,l).split(a+3),o.split(o.mapping.map(s)).insert(o.mapping.map(s),l),e(o.setSelection(Va(o,o.mapping.map(s)-5))),!0}}},e.prototype.keepIndentation=function(){var t=this;return function(e,n){var r,o=e.selection,i=e.tr,a=e.doc,s=e.schema,l=t.context.toastMark,c=dl(o),u=c.startFromOffset,p=c.endToOffset,d=c.endIndex,f=c.from,h=c.to,m=Fl(a,d);if(f===h&&m.trim()){var v=m.match(/^\s+/);if((r=l.findFirstNodeAtLine(d+1))&&"codeBlock"===r.type&&v){var g=v[0],y=m.slice(h-u);return Wa(i,p,y,ja(s,g+y)),n(i),!0}}return!1}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,Enter:this.keepIndentation()}},e}(Pl),pc=/\||\s/g;function dc(t,e){for(var n="|",r=0;r<t;r+=1)n+=e?" --- |":" |";return n}var fc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("table")},0]}}},enumerable:!1,configurable:!0}),e.prototype.extendTable=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,a=e.schema;if(!r.empty)return!1;var s=dl(r),l=s.endFromOffset,c=s.endToOffset,u=s.endIndex,p=s.to,d=Fl(o,u),f=[u+1,p-l+1],h=ns(t.context.toastMark.findNodeAtPosition(f),function(t){return es(t)&&("tableDelimRow"===t.parent.type||"tableBody"===t.parent.parent.type)});if(h){var m=!d.replace(pc,"").trim(),v=dc(h.parent.parent.parent.columns.length);return m?i.deleteRange(l,c).split(i.mapping.map(c)):i.split(c).insert(i.mapping.map(c),ja(a,v)).setSelection(Va(i,i.mapping.map(c)-2)),n(i),!0}return!1}},e.prototype.moveTableCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,a=dl(o),s=a.endFromOffset,l=[a.endIndex+1,a.to-s],c=ns(e.context.toastMark.findNodeAtPosition(l),function(t){return es(t)});if(c){var u=c.parent,p=function(t){return t?{type:"next",parentType:"tableHead",childType:"firstChild"}:{type:"prev",parentType:"tableBody",childType:"lastChild"}}(t),d=p.type,f=p.parentType,h=p.childType,m=Za(c);if(c[d])m=Za(c[d])-1;else{var v=u[d]||u.parent.type!==f?u[d]:u.parent[d][h];"next"===d?m+=(v?Za(v[h]):0)+2:"prev"===d&&(m=v?-4:0)}return r(i.setSelection(Va(i,s+m))),!0}return!1}},e.prototype.addTable=function(){return function(t){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=t,s=a.columnCount,l=a.rowCount,c=dl(r).endToOffset,u=function(t){return[dc(t),dc(t,!0)]}(s),p=function(t,e){for(var n=[],r=0;r<e;r+=1)n.push(dc(t));return n}(s,l-1);return Si(Si([],u),p).forEach(function(t){o.split(o.mapping.map(c)).insert(o.mapping.map(c),ja(i,t))}),n(o.setSelection(Va(o,c+4))),!0}}},e.prototype.commands=function(){return{addTable:this.addTable()}},e.prototype.keymaps=function(){return{Enter:this.extendTable(),Tab:this.moveTableCell(!0),"Shift-Tab":this.moveTableCell(!1)}},e}(Pl),hc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("thematic-break")},0]}}},enumerable:!1,configurable:!0}),e.prototype.hr=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=dl(n),a=i.from,s=i.to,l=i.endToOffset,c=ja(r,"***");return o.split(a).replaceWith(o.mapping.map(a),o.mapping.map(s),c).split(o.mapping.map(s)).setSelection(Va(o,o.mapping.map(l))),e(o),!0}}},e.prototype.commands=function(){return{hr:this.hr()}},e.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},e}(Pl);function mc(t,e){var n=t.type;return e<=t.sourcepos[0][0]&&("codeBlock"===n||"heading"===n||n.match("table"))}var vc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{odd:{default:!1},even:{default:!1},listStyle:{default:!1}},toDOM:function(t){var e=t.attrs,n=e.odd,r=e.even,o="list-item";return e.listStyle&&(o+="|list-item-style"),n&&(o+="|list-item-odd"),r&&(o+="|list-item-even"),["span",{class:Fs.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.extendList=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.schema,a=e.tr,s=t.context.toastMark,l=dl(r),c=l.to,u=l.startFromOffset,p=l.endFromOffset,d=l.endIndex,f=l.endToOffset,h=Fl(o,d);if(!zl.test(h)||r.from===u||!r.empty)return!1;if(h.replace(Vl,"").trim()){var m=Gl(h),v=s.findFirstNodeAtLine(d+1),g=h.slice(c-p),y={toastMark:s,mdNode:v,doc:o,line:d+1},b=tc[m](y),w=b.listSyntax,k=b.changedResults;if(null==k?void 0:k.length){a.split(c),k.unshift({text:w+g,line:d+1}),t.changeToListPerLine(a,k,{from:c,startLine:k[0].line,endLine:Aa(k).line});var x=a.mapping.map(f)-g.length;a.setSelection(Va(a,x))}else Wa(a,f,g,ja(i,w+g))}else a.deleteRange(p,f).split(a.mapping.map(f));return n(a),!0}},e.prototype.toList=function(t){var e=this;return function(){return function(n,r){for(var o=n.doc,i=n.tr,a=n.selection,s=e.context.toastMark,l=dl(a),c=l.startIndex+1,u=l.endIndex+1,p=l.endToOffset,d=[],f=c;f<=u;f+=1){var h=s.findFirstNodeAtLine(f);if(h&&mc(h,f))break;if(-1===d.indexOf(f)){var m={toastMark:s,mdNode:h,doc:o,line:f,startLine:c},v=(Qa(h)?Ql[t](m):Yl[t](m)).changedResults,g=e.changeToListPerLine(i,v,{from:fl(o,v[0].line-1).startOffset,startLine:v[0].line,endLine:Aa(v).line,indexDiff:1});p=Math.max(g,p),v&&(d=d.concat(v.map(function(t){return t.line})))}}return r(i.setSelection(Va(i,i.mapping.map(p)))),!0}}},e.prototype.changeToListPerLine=function(t,e,n){for(var r=n.from,o=n.startLine,i=n.endLine,a=n.indexDiff,s=void 0===a?0:a,l=0,c=function(n){var o=t.doc.child(n),i=o.nodeSize,a=o.content,c=t.mapping.map(r),p=c+a.size,d=e.filter(function(t){return t.line-s===n})[0];d&&(t.replaceWith(c,p,ja(u.context.schema,d.text)),l=Math.max(l,r+a.size)),r+=i},u=this,p=o-s;p<=i-s;p+=1)c(p);return l},e.prototype.toggleTask=function(){var t=this;return function(e,n){for(var r=e.selection,o=e.tr,i=e.doc,a=e.schema,s=t.context.toastMark,l=dl(r),c=l.startIndex,u=l.endIndex,p=null,d=c;d<=u;d+=1){var f=s.findFirstNodeAtLine(d+1);if(Qa(f)&&f.listData.task){var h=f.listData,m=h.checked,v=h.padding,g=m?" ":"x",y=f.sourcepos[0],b=fl(i,y[0]-1).startOffset;b+=y[1]+v,p=o.replaceWith(b,b+1,a.text(g))}}return!!p&&(n(p),!0)}},e.prototype.commands=function(){return{bulletList:this.toList("bullet"),orderedList:this.toList("ordered"),taskList:this.toList("task")}},e.prototype.keymaps=function(){var t=this.toList("bullet")(),e=this.toList("ordered")(),n=this.toList("task")(),r=this.toggleTask();return{"Mod-u":t,"Mod-U":t,"Mod-o":e,"Mod-O":e,"alt-t":n,"alt-T":n,"Shift-Ctrl-x":r,"Shift-Ctrl-X":r,Enter:this.extendList()}},e}(Pl);function gc(t,e){return function(){return function(n,r){var o=n.tr,i=n.selection,a=nl(t)?t:function(e){return t.test(e)},s=e.length,l=o.doc,c=al(i),u=c[0],p=c[1],d=Math.max(u-s,1),f=Math.min(p+s,l.content.size-1),h=i.content(),m=h.content.textBetween(0,h.content.size,"\n"),v=l.textBetween(d,u,"\n"),g=l.textBetween(p,f,"\n");if(m=""+v+m+g,v&&g&&a(m))o.delete(f-s,f).delete(d,d+s);else{o.insertText(e,p).insertText(e,u);var y=i.empty?Va(o,u+s):Va(o,u+s,p+s);o.setSelection(y)}return r(o),!0}}}var yc=/^(\*{2}|_{2}).*([\s\S]*)\1$/m,bc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("strong")},0]}}},enumerable:!1,configurable:!0}),e.prototype.bold=function(){return gc(yc,"**")},e.prototype.commands=function(){return{bold:this.bold()}},e.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},e}(Pl),wc=/^(~{2}).*([\s\S]*)\1$/m,kc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("strike")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return gc(wc,"~~")},e.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},e}(Pl),xc=/^(\*|_).*([\s\S]*)\1$/m,Cc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("emph")},0]}}},enumerable:!1,configurable:!0}),e.prototype.italic=function(){return gc(xc,"*")},e.prototype.commands=function(){return{italic:this.italic()}},e.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},e}(Pl),Tc=/^(`).*([\s\S]*)\1$/m,Ec=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{start:{default:!1},end:{default:!1},marked:{default:!1}},toDOM:function(t){var e=t.attrs,n="code";return e.start&&(n+="|delimiter|start"),e.end&&(n+="|delimiter|end"),e.marked&&(n+="|marked-text"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return gc(Tc,"`")},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},e}(Pl),Mc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(t){var e=t.attrs,n="link";return e.url&&(n+="|link-url|marked-text"),e.desc&&(n+="|link-desc|marked-text"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.addLinkOrImage=function(t){return function(e){return function(n,r){var o=n.selection,i=n.tr,a=n.schema,s=al(o),l=s[0],c=s[1],u=e,p=u.linkText,d=u.altText,f=u.linkUrl,h=u.imageUrl,m=p,v=f,g="";return"image"===t&&(m=d,v=h,g="!"),g+="["+(m=Na(m))+"]("+v+")",r(i.replaceWith(l,c,ja(a,g))),!0}}},e.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},e}(Pl),Nc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("delimiter")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Dc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("meta")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Lc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("marked-text")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Oc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("table-cell")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Ac=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("html")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Ic=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("custom-block")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,a=dl(r),s=a.startFromOffset,l=a.endToOffset;if(!(null==t?void 0:t.info))return!1;var c="$$"+t.info,u=ja(o,c),p=ja(o,"$$");return i.insert(s,u).split(s+c.length),i.split(i.mapping.map(l)).insert(i.mapping.map(l),p),n(i.setSelection(Va(i,i.mapping.map(l)-4))),!0}}},e}(Pl),Rc=/x|backspace/i,Pc=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;function Bc(t){var e=t.schema,n=t.toastMark;return new Te({props:{handleDOMEvents:{keyup:function(t,r){var o,i=t.state,a=i.doc,s=i.tr,l=i.selection;if(l.empty&&Rc.test(r.key)){var c=dl(l),u=c.startIndex,p=c.startFromOffset,d=[u+1,c.from-p+1],f=ns(n.findNodeAtPosition(d),function(t){var e;return"paragraph"===t.type&&"item"===(null===(e=t.parent)||void 0===e?void 0:e.type)});if(null===(o=null==f?void 0:f.firstChild)||void 0===o?void 0:o.literal){var h=f.firstChild,m=h.literal.match(Pc);if(m){var v=h.sourcepos[0],g=m[1],y=m[2],b=m[3],w=g.length+b.length,k=fl(a,v[0]-1).startOffset,x=v[1]+k;if(y){var C=w?w+1:0;s.replaceWith(x,C+x,e.text(y)),t.dispatch(s)}else w||(s.insertText(" ",x),t.dispatch(s))}}}return!1}}}})}var Fc="cut",Hc=/\r\n|\n|\r/,qc=function(t){function e(e,n){var r=t.call(this,e)||this,o=n.toastMark,i=n.useCommandShortcut,a=void 0===i||i,s=n.mdPlugins,l=void 0===s?[]:s;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=o,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(a),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Ni(Ni({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",function(t){return r.toggleActive(!0,t)}),r.eventEmitter.listen("changePreviewTabPreview",function(){return r.toggleActive(!1)}),r.initEvent(),r}return Mi(e,t),e.prototype.toggleActive=function(t,e){zs(this.el,"active",t),t?e||this.focus():this.blur()},e.prototype.createClipboard=function(){var t=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Bs("pseudo-clipboard"),this.clipboard.addEventListener("paste",function(e){var n=e.clipboardData||window.clipboardData,r=n&&n.items;if(r&&!za(r).some(function(t){return"string"===t.kind&&"text/rtf"===t.type})){var o=Js(r);o&&(e.preventDefault(),Ks(t.eventEmitter,o,e.type))}}),this.clipboard.addEventListener("input",function(e){var n=e.target.value;t.replaceSelection(n),e.preventDefault(),e.target.value=""}),this.el.insertBefore(this.clipboard,this.view.dom)},e.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},e.prototype.createSpecs=function(){return new il([new Rl,new ac,new tl,new sc,new cc,new ql,new uc,new Ic,new fc,new Oc,new hc,new vc,new bc,new kc,new Cc,new Ec,new Mc,new Sc,new Nc,new Lc,new Dc,new Ac])},e.prototype.createPlugins=function(){return Si([Dl(this.context),Il(this.context),Bc(this.context)],this.createPluginProps()).concat(this.defaultPlugins)},e.prototype.createView=function(){var t=this;return new po(this.el,{state:this.createState(),dispatchTransaction:function(e){t.updateMarkdown(e);var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e)},handleKeyDown:function(e,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&t.clipboard.focus(),t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{copy:function(e,n){return t.captureCopy(n)},cut:function(e,n){return t.captureCopy(n,Fc)},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1}},nodeViews:{widget:Qs}})},e.prototype.createCommands=function(){return this.specs.commands(this.view)},e.prototype.captureCopy=function(t,e){t.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return t.clipboardData?t.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),e===Fc&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",Fc)),!0},e.prototype.updateMarkdown=function(t){var e=this;t.docChanged&&t.steps.forEach(function(n,r){if(n.slice&&!(n instanceof Bt)){var o=t.docs[r],i=[n.from,n.to],a=cl(o,i[0],i[1]),s=a[0],l=a[1],c=e.getChanged(n.slice);s[0]===l[0]&&s[1]===l[1]&&""===c&&(c="\n");var u=e.toastMark.editMarkdown(s,l,c);e.eventEmitter.emit("updatePreview",u),t.setMeta("editResult",u).scrollIntoView()}})},e.prototype.getChanged=function(t){var e="",n=t.content.size;return t.content.nodesBetween(0,n,function(t,r){t.isText?e+=t.text.slice(Math.max(0,r)-r,n-r):t.isBlock&&r>0&&(e+="\n")}),e},e.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=pl(n.doc,t,e),o=r[0],i=r[1];this.view.dispatch(n.setSelection(Va(n,o,i)).scrollIntoView())},e.prototype.replaceSelection=function(t,e,n){var r,o=this.view.state,i=o.tr,a=o.schema,s=o.doc,c=t.split(Hc).map(function(t){return _a(a,vs(t,a))}),u=new m(l.from(c),1,1);if(this.focus(),e&&n){var p=pl(s,e,n),d=p[0],f=p[1];r=i.replaceRange(d,f,u)}else r=i.replaceSelection(u);this.view.dispatch(r.scrollIntoView())},e.prototype.deleteSelection=function(t,e){var n,r=this.view.state,o=r.tr,i=r.doc;if(t&&e){var a=pl(i,t,e),s=a[0],l=a[1];n=o.deleteRange(s,l)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},e.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,a=o.to;if(t&&e){var s=pl(r,t,e);i=s[0],a=s[1]}return r.textBetween(i,a,"\n")},e.prototype.getSelection=function(){var t=this.view.state.selection,e=t.from,n=t.to;return cl(this.view.state.tr.doc,e,n)},e.prototype.setMarkdown=function(t,e){void 0===e&&(e=!0);var n=t.split(Hc),r=this.view.state,o=r.tr,i=r.doc,a=r.schema,s=n.map(function(t){return _a(a,vs(t,a))});this.view.dispatch(o.replaceWith(0,i.content.size,s)),e&&this.moveCursorToEnd(!0)},e.prototype.addWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.doc,a=r.selection,s=n?pl(i,n,n)[0]:a.to;this.view.dispatch(o.setMeta("widget",{pos:s,node:t,style:e}))},e.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.schema,a=pl(r.doc,t,e),s=vs(n,i);this.view.dispatch(o.replaceWith(a[0],a[1],s))},e.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t||cl(n,r.from)[0],i=this.toastMark.findNodeAtPosition(o);return"text"===i.type&&"paragraph"!==i.parent.type&&(i=i.parent),i.sourcepos[1][1]+=1,{range:i.sourcepos,type:i.type}},e.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map(function(t){return ds(t)}).join("\n")},e.prototype.getToastMark=function(){return this.toastMark},e}(el),zc="_feEventKey",_c=function(t,e){var n,r=t[zc];return r||(r=t[zc]={}),(n=r[e])||(n=r[e]=[]),n},jc=Ai,Vc=Hi,Uc=_c;function $c(t,e,n){var r,o=Uc(t,e);n?(Vc(o,function(o,i){return n!==o.handler||(Wc(t,e,o.wrappedHandler),r=i,!1)}),o.splice(r,1)):(Vc(o,function(n){Wc(t,e,n.wrappedHandler)}),o.splice(0,o.length))}function Wc(t,e,n){"removeEventListener"in t?t.removeEventListener(e,n):"detachEvent"in t&&t.detachEvent("on"+e,n)}var Gc=function(t,e,n){jc(e)?Vc(e.split(/\s+/g),function(e){$c(t,e,n)}):Vc(e,function(e,n){$c(t,n,e)})},Kc=Ai,Jc=Hi,Zc=_c;function Xc(t,e,n,r){function o(e){n.call(r||t,e||window.event)}"addEventListener"in t?t.addEventListener(e,o):"attachEvent"in t&&t.attachEvent("on"+e,o),function(t,e,n,r){var o=Zc(t,e),i=!1;Jc(o,function(t){return t.handler!==n||(i=!0,!1)}),i||o.push({handler:n,wrappedHandler:r})}(t,e,n,o)}var Qc=function(t,e,n,r){Kc(e)?Jc(e.split(/\s+/g),function(e){Xc(t,e,n,r)}):Jc(e,function(e,r){Xc(t,r,e,n)})},Yc=function(t,e){return(Yc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function tu(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Yc(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var eu=function(){return eu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},eu.apply(this,arguments)};function nu(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var ru="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ou={};function iu(t,e,n){var r,o,i,a,s,l="";for("string"!=typeof e&&(n=e,e=iu.defaultChars),void 0===n&&(n=!0),s=function(t){var e,n,r=ou[t];if(r)return r;for(r=ou[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)r[t.charCodeAt(e)]=t[e];return r}(e),r=0,o=t.length;r<o;r++)if(i=t.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(r+1,r+3)))l+=t.slice(r,r+3),r+=2;else if(i<128)l+=s[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(a=t.charCodeAt(r+1))>=56320&&a<=57343){l+=encodeURIComponent(t[r]+t[r+1]),r++;continue}l+="%EF%BF%BD"}else l+=encodeURIComponent(t[r]);return l}iu.defaultChars=";/?:@&=+$,-_.!~*'()#",iu.componentChars="-_.!~*'()";var au=iu,su={},lu={},cu={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:"‌"},uu={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},pu={},du=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pu,"__esModule",{value:!0});var fu=du({0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}),hu=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+String.fromCharCode(t)};pu.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in fu.default&&(t=fu.default[t]),hu(t))};var mu=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lu,"__esModule",{value:!0}),lu.decodeHTML=lu.decodeHTMLStrict=lu.decodeXML=void 0;var vu=mu(cu),gu=mu({Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"}),yu=mu(uu),bu=mu(pu),wu=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function ku(t){var e=Cu(t);return function(t){return String(t).replace(wu,e)}}lu.decodeXML=ku(yu.default),lu.decodeHTMLStrict=ku(vu.default);var xu=function(t,e){return t<e?1:-1};function Cu(t){return function(e){if("#"===e.charAt(1)){var n=e.charAt(2);return"X"===n||"x"===n?bu.default(parseInt(e.substr(3),16)):bu.default(parseInt(e.substr(2),10))}return t[e.slice(1,-1)]||e}}lu.decodeHTML=function(){for(var t=Object.keys(gu.default).sort(xu),e=Object.keys(vu.default).sort(xu),n=0,r=0;n<e.length;n++)t[r]===e[n]?(e[n]+=";?",r++):e[n]+=";";var o=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=Cu(vu.default);function a(t){return";"!==t.substr(-1)&&(t+=";"),i(t)}return function(t){return String(t).replace(o,a)}}();var Tu={},Eu=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.escapeUTF8=Tu.escape=Tu.encodeNonAsciiHTML=Tu.encodeHTML=Tu.encodeXML=void 0;var Mu=Au(Eu(uu).default),Nu=Iu(Mu);Tu.encodeXML=Hu(Mu);var Su,Du,Lu=Au(Eu(cu).default),Ou=Iu(Lu);function Au(t){return Object.keys(t).sort().reduce(function(e,n){return e[t[n]]="&"+n+";",e},{})}function Iu(t){for(var e=[],n=[],r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];1===i.length?e.push("\\"+i):n.push(i)}e.sort();for(var a=0;a<e.length-1;a++){for(var s=a;s<e.length-1&&e[s].charCodeAt(1)+1===e[s+1].charCodeAt(1);)s+=1;var l=1+s-a;l<3||e.splice(a,l,e[a]+"-"+e[s])}return n.unshift("["+e.join("")+"]"),new RegExp(n.join("|"),"g")}Tu.encodeHTML=(Su=Lu,Du=Ou,function(t){return t.replace(Du,function(t){return Su[t]}).replace(Ru,Bu)}),Tu.encodeNonAsciiHTML=Hu(Lu);var Ru=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,Pu=null!=String.prototype.codePointAt?function(t){return t.codePointAt(0)}:function(t){return 1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)-56320+65536};function Bu(t){return"&#x"+(t.length>1?Pu(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var Fu=new RegExp(Nu.source+"|"+Ru.source,"g");function Hu(t){return function(e){return e.replace(Fu,function(e){return t[e]||Bu(e)})}}Tu.escape=function(t){return t.replace(Fu,Bu)},Tu.escapeUTF8=function(t){return t.replace(Nu,Bu)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=lu,n=Tu;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=Tu;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=lu;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(su);var qu="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",zu=/[\\&]/,_u="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",ju=new RegExp("\\\\"+_u+"|"+qu,"gi"),Vu=new RegExp('[&<>"]',"g"),Uu=function(t){return 92===t.charCodeAt(0)?t.charAt(1):su.decodeHTML(t)};function $u(t){return zu.test(t)?t.replace(ju,Uu):t}function Wu(t){try{return au(t)}catch(e){return t}}function Gu(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return t}}function Ku(t){return Vu.test(t)?t.replace(Vu,Gu):t}function Ju(t,e){for(var n=[],r=0;r<e;r++)n.push(t);return n.join("")}function Zu(t){return!t||!/[^ \t]+/.test(t)}var Xu=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.next=function(){var t=this.current,e=this.entering;if(null===t)return null;var n=Qu(t);return e&&n?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:null===t.next?(this.current=t.parent,this.entering=!1):(this.current=t.next,this.entering=!0),{entering:e,node:t}},t.prototype.resumeAt=function(t,e){this.current=t,this.entering=!0===e},t}();function Qu(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var Yu=1,tp={};function ep(t){delete tp[t]}var np=function(){function t(t,e){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===t?-1:Yu++,this.type=t,this.sourcepos=e,tp[this.id]=this}return t.prototype.isContainer=function(){return Qu(this)},t.prototype.unlink=function(){this.prev?this.prev.next=this.next:this.parent&&(this.parent.firstChild=this.next),this.next?this.next.prev=this.prev:this.parent&&(this.parent.lastChild=this.prev),this.parent=null,this.next=null,this.prev=null},t.prototype.replaceWith=function(t){this.insertBefore(t),this.unlink()},t.prototype.insertAfter=function(t){t.unlink(),t.next=this.next,t.next&&(t.next.prev=t),t.prev=this,this.next=t,this.parent&&(t.parent=this.parent,t.next||(t.parent.lastChild=t))},t.prototype.insertBefore=function(t){t.unlink(),t.prev=this.prev,t.prev&&(t.prev.next=t),t.next=this,this.prev=t,t.parent=this.parent,t.prev||(t.parent.firstChild=t)},t.prototype.appendChild=function(t){t.unlink(),t.parent=this,this.lastChild?(this.lastChild.next=t,t.prev=this.lastChild,this.lastChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.prependChild=function(t){t.unlink(),t.parent=this,this.firstChild?(this.firstChild.prev=t,t.next=this.firstChild,this.firstChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.walker=function(){return new Xu(this)},t}(),rp=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=e,r}return tu(e,t),e}(np),op=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.listData=null,e}return tu(e,t),e}(rp),ip=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.level=0,e.headingType="atx",e}return tu(e,t),e}(rp),ap=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isFenced=!1,e.fenceChar=null,e.fenceLength=0,e.fenceOffset=-1,e.info=null,e.infoPadding=0,e}return tu(e,t),e}(rp),sp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.columns=[],e}return tu(e,t),e}(rp),lp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.startIdx=0,e.endIdx=0,e.paddingLeft=0,e.paddingRight=0,e.ignored=!1,e}return tu(e,t),e}(rp),cp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="",e.dest="",e.label="",e}return tu(e,t),e}(rp),up=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.syntaxLength=0,e.offset=-1,e.info="",e}return tu(e,t),e}(rp),pp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.htmlBlockType=-1,e}return tu(e,t),e}(rp),dp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.destination=null,e.title=null,e.extendedAutolink=!1,e}return tu(e,t),e}(np),fp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.tickCount=0,e}return tu(e,t),e}(np),hp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.info="",e}return tu(e,t),e}(np);function mp(t,e){switch(t){case"heading":return new ip(t,e);case"list":case"item":return new op(t,e);case"link":case"image":return new dp(t,e);case"codeBlock":return new ap(t,e);case"htmlBlock":return new pp(t,e);case"table":return new sp(t,e);case"tableCell":return new lp(t,e);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new rp(t,e);case"code":return new fp(t,e);case"refDef":return new cp(t,e);case"customBlock":return new up(t,e);case"customInline":return new hp(t,e);default:return new np(t,e)}}function vp(t){return"codeBlock"===t.type}function gp(t){return"list"===t.type}function yp(t){return"refDef"===t.type}function bp(t){return"customBlock"===t.type}function wp(t,e){var n=mp("text",e);return n.literal=t,n}var kp,xp="[A-Za-z][A-Za-z0-9-]*",Cp="<"+xp+"(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Tp="</"+xp+"\\s*[>]",Ep=new RegExp("^(?:"+Cp+"|"+Tp+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)kp=function(t){try{return String.fromCodePoint(t)}catch(e){if(e instanceof RangeError)return String.fromCharCode(65533);throw e}};else{var Mp=String.fromCharCode,Np=Math.floor;kp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r,o=[],i=-1,a=t.length;if(!a)return"";for(var s="";++i<a;){var l=Number(t[i]);if(!isFinite(l)||l<0||l>1114111||Np(l)!==l)return String.fromCharCode(65533);l<=65535?o.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,o.push(n,r)),(i+1===a||o.length>16384)&&(s+=Mp.apply(void 0,o),o.length=0)}return s}}var Sp=kp;function Dp(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r<o.length;r++){var i=o[r];"("===i?n<0?n=1:n+=1:")"===i&&(n-=1)}if(n<0){var a=Math.min(-n,e[0].length);return t.substring(0,t.length-a)}}return t}function Lp(t){return t.replace(/&[A-Za-z0-9]+;$/,"")}function Op(t){return nu(nu([],function(t){for(var e,n=new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]","g"),r=[];e=n.exec(t);){var o=Lp(Dp(e[0])),i="www"===e[1]?"http://":"";r.push({text:o,range:[e.index,e.index+o.length-1],url:""+i+o})}return r}(t)),function(t){for(var e,n=new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+","g"),r=[];e=n.exec(t);){var o=e[0];/[_-]+$/.test(o)||r.push({text:o,range:[e.index,e.index+o.length-1],url:"mailto:"+o})}return r}(t)).sort(function(t,e){return t.range[0]-e.range[0]})}function Ap(t){return t[t.length-1]}function Ip(t){return t.slice(1,t.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function Rp(t,e){Object.keys(t).forEach(function(n){e(n,t[n])})}function Pp(t){return!Object.keys(t).length}var Bp=39,Fp=34,Hp=36,qp="\\\\"+_u,zp=new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\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\u0AF0\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-\u2E42\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]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),_p=new RegExp('^(?:"('+qp+'|[^"\\x00])*"|\'('+qp+"|[^'\\x00])*'|\\(("+qp+"|[^()\\x00])*\\))"),jp=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,Vp=new RegExp("^"+_u),Up=new RegExp("^"+qu,"i"),$p=/`+/,Wp=/^`+/,Gp=/\.\.\./g,Kp=/--+/g,Jp=/^<([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])?)*)>/,Zp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Xp=/^ *(?:\n *)?/,Qp=/^[ \t\n\x0b\x0c\x0d]/,Yp=/^\s/,td=/ *$/,ed=/^ */,nd=/^ *(?:\n|$)/,rd=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,od=/^[^\n`\[\]\\!<&*_'"~$]+/m,id=function(){function t(t){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},t.prototype.spnl=function(){return this.match(Xp),!0},t.prototype.parseBackticks=function(t){var e=this.pos+1,n=this.match(Wp);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match($p));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),a=this.sourcepos(e,this.pos),s=i.split("\n");if(s.length>1){var l=Ap(s);this.lineIdx+=s.length-1,this.linePosOffset=-(this.pos-l.length-n.length),a[1]=this.sourcepos(this.pos),i=s.join(" ")}var c=mp("code",a);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?c.literal=i.slice(1,i.length-1):c.literal=i,c.tickCount=n.length,t.appendChild(c),!0}return this.pos=o,t.appendChild(wp(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=mp("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):Vp.test(n.charAt(this.pos))?(t.appendChild(wp(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(wp("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Jp))?(n=e.slice(1,e.length-1),(r=mp("link",this.sourcepos(o,this.pos))).destination=Wu("mailto:"+n),r.title="",r.appendChild(wp(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Zp))&&(n=e.slice(1,e.length-1),(r=mp("link",this.sourcepos(o,this.pos))).destination=Wu(n),r.title="",r.appendChild(wp(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(Ep);if(null===n)return!1;var r=mp("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===Bp||t===Fp)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(126===t||t===Hp))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":Sp(i);var a,s,l=Yp.test(r),c=zp.test(r),u=Yp.test(o),p=zp.test(o),d=!l&&(!c||u||p),f=!u&&(!p||l||c);return 95===t?(a=d&&(!f||p),s=f&&(!d||c)):t===Bp||t===Fp?(a=d&&!f,s=f):t===Hp?(a=!l,s=!u):(a=d,s=f),this.pos=n,{numdelims:e,canOpen:a,canClose:s}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=wp(t===Bp?"’":t===Fp?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==Bp&&t!==Fp)&&(this.delimiters={cc:t,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,a,s,l=!1,c=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,s=!1;null!==n&&n!==t&&n!==c[u][p?r.origdelims%3:0];){if(l=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!l){s=!0;break}n=n.previous}if(o=r,p||126===u||u===Hp)if(s){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,a=r.node;var h=p?1===d?"emph":"strong":"strike";u===Hp&&(h="customInline");var m=mp(h),v=i.sourcepos[1],g=a.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,a.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),a.literal=a.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==a;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===Hp){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length<=x.length?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&a.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===Bp?(r.node.literal="’",s&&(n.node.literal="‘"),r=r.next):u===Fp&&(r.node.literal="”",s&&(n.node.literal="“"),r=r.next);s||(c[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(_p);return null===t?null:$u(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(jp);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&Vp.test(this.subject.charAt(this.pos+1)))this.pos+=1,-1!==this.peek()&&(this.pos+=1);else if(40===r)this.pos+=1,n+=1;else if(41===r){if(n<1)break;this.pos+=1,n-=1}else{if(null!==Qp.exec(Sp(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:Wu($u(t=this.subject.substr(e,this.pos-e)))}return Wu($u(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(rd);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=wp("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=wp("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else n=wp("!",this.sourcepos(this.pos,this.pos)),t.appendChild(n);return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(wp("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(wp("]",this.sourcepos(o,o))),this.removeBracket(),!0;var a=i.image,s=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(Qp.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=s);var l="";if(!r){var c=this.pos,u=this.parseLinkLabel();if(u>2?l=this.subject.slice(c,c+u):i.bracketAfter||(l=this.subject.slice(i.index,o)),0===u&&(this.pos=s),l){l=Ip(l);var p=this.refMap[l];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=mp(a?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!a)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0}return this.removeBracket(),this.pos=o,t.appendChild(wp("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(Up))&&(t.appendChild(wp(su.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(od)){if(this.options.smart){var r=e.replace(Gp,"…").replace(Kp,function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),Ju("—",n)+Ju("–",e)});t.appendChild(wp(r,this.sourcepos(n,this.pos)))}else{var o=wp(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(td,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild(mp(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild(mp("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(ed),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var a=this.parseLinkDestination();if(null===a)return this.pos=r,0;var s=this.pos;this.spnl(),this.pos!==s&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=s);var l=!0;if(null===this.match(nd)&&(""===n?l=!1:(n="",this.pos=s,l=null!==this.match(nd))),!l)return this.pos=r,0;var c=Ip(i);if(""===c)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=mp("refDef",u);return p.title=n,p.dest=a,p.label=c,t.insertBefore(p),e[c]?this.refDefCandidateMap[p.id]=p:e[c]=Jd(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],a=n[n.length-1];i.sourcepos&&a.sourcepos&&(i.sourcepos[1]=a.sourcepos[1]),i.next=a.next,i.next&&(i.next.prev=i);for(var s=1;s<n.length;s+=1)i.literal+=n[s].literal,n[s].unlink();n=[]}}},t.prototype.getReferenceDefSourcepos=function(t){for(var e=t.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<e.length;i+=1){var a=e[i];if(Qp.test(a))break;if(/\:/.test(a)&&0===r){if(n)break;var s=a.indexOf(":")===a.length-1?i+1:i;o={line:s,ch:e[s].length},n=!0}var l=a.match(/'|"/g);if(l&&(r+=l.length),2===r){o={line:i,ch:a.length};break}}return[[t.sourcepos[0][0],t.sourcepos[0][1]],[t.sourcepos[0][0]+o.line,o.ch]]},t.prototype.parseInline=function(t){var e,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(t);break;case 92:n=this.parseBackslash(t);break;case 96:n=this.parseBackticks(t);break;case 42:case 95:case 126:case Hp:n=this.handleDelim(r,t);break;case Bp:case Fp:n=!!(null===(e=this.options)||void 0===e?void 0:e.smart)&&this.handleDelim(r,t);break;case 91:n=this.parseOpenBracket(t);break;case 33:n=this.parseBang(t);break;case 93:n=this.parseCloseBracket(t);break;case 60:n=this.parseAutolink(t)||this.parseHtmlTag(t);break;case 38:t.disabledEntityParse||(n=this.parseEntity(t));break;default:n=this.parseString(t)}return n||(this.pos+=1,t.appendChild(wp(Sp(r),this.sourcepos(this.pos,this.pos+1)))),!0},t.prototype.parse=function(t){for(this.subject=t.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=t.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=t.sourcepos[0][0],function(t){return"heading"===t.type}(t)&&(this.lineOffsets[0]+=t.level+1);this.parseInline(t););t.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(t.walker());var e=this.options,n=e.extendedAutolinks,r=e.customParser;if(n&&function(t,e){var n;"boolean"==typeof e&&(e=Op);for(var r=function(){var t=n.entering,r=n.node;if(t&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=e(o);if(!i||!i.length)return"continue";for(var a=0,s=r.sourcepos[0],l=s[0],c=s[1],u=function(t,e){return[[l,c+t],[l,c+e]]},p=[],d=0,f=i;d<f.length;d++){var h=f[d],m=h.range,v=h.url,g=h.text;m[0]>a&&p.push(wp(o.substring(a,m[0]),u(a,m[0]-1)));var y=mp("link",u.apply(void 0,m));y.appendChild(wp(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),a=m[1]+1}a<o.length&&p.push(wp(o.substring(a),u(a,o.length-1)));for(var b=0,w=p;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=t.next();)r()}(t.walker(),n),r&&t.firstChild)for(var o,i=t.firstChild.walker();o=i.next();){var a=o.node,s=o.entering;r[a.type]&&r[a.type](a,{entering:s,options:this.options})}},t}(),ad=/^\[([ \txX])\][ \t]+/,sd=/[^ \t\f\v\r\n]/,ld=/^(?:`{3,}|~{3,})(?= *$)/;function cd(t){for(var e=t;e;){if(e.lastLineBlank)return!0;var n=e.type;if(e.lastLineChecked||"list"!==n&&"item"!==n){e.lastLineChecked=!0;break}e.lastLineChecked=!0,e=e.lastChild}return!1}function ud(t,e){return e<t.length?t.charCodeAt(e):-1}function pd(t){return!sd.test(t)}function dd(t){return 32===t||9===t}var fd=/^\$\$$/,hd={continue:function(t,e){var n=t.currentLine,r=n.match(fd);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&dd(ud(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),a=o.match(/^(\s*)(.*)/);e.info=$u(a[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},md={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},vd={continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(ld);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&dd(ud(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),a=r.slice(o+1),s=i.match(/^(\s*)(.*)/);e.infoPadding=s[1].length,e.info=$u(s[2].trim()),e.literal=a}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},gd={document:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},list:{continue:function(){return 0},finalize:function(t,e){for(var n=e.firstChild;n;){if(cd(n)&&n.next){e.listData.tight=!1;break}for(var r=n.firstChild;r;){if(cd(r)&&(n.next||r.next)){e.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(t){return"item"===t},acceptsLines:!1},blockQuote:{continue:function(t){var e=t.currentLine;return t.indented||62!==ud(e,t.nextNonspace)?1:(t.advanceNextNonspace(),t.advanceOffset(1,!1),dd(ud(e,t.offset))&&t.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},item:{continue:function(t,e){if(t.blank){if(null===e.firstChild)return 1;t.advanceNextNonspace()}else{if(!(t.indent>=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(ad);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:vd,htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===ud(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&pd(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:md,customBlock:hd,frontMatter:md};function yd(t){for(var e=0,n=0,r=[],o=0;o<t.length;o+=1)if("|"===t[o]&&"\\"!==t[o-1]){var i=t.substring(e,o);0===e&&Zu(i)?n=o+1:r.push(i),e=o+1}return e<t.length&&(Zu(i=t.substring(e,t.length))||r.push(i)),[n,r]}function bd(t,e,n,r){for(var o=[],i=0,a=e;i<a.length;i++){var s=a[i],l=s.match(/^[ \t]+/),c=l?l[0].length:0,u=void 0,p=void 0;if(c===s.length)c=0,u=0,p="";else{var d=s.match(/[ \t]+$/);u=d?d[0].length:0,p=s.slice(c,s.length-u)}var f=r+c,h=mp(t,[[n,r],[n,r+s.length-1]]);h.stringContent=p.replace(/\\\|/g,"|"),h.startIdx=o.length,h.endIdx=o.length,h.lineOffsets=[f-1],h.paddingLeft=c,h.paddingRight=u,o.push(h),r+=s.length+1}return o}function wd(t){var e=null,n=t.stringContent,r=n[0];return":"===n[n.length-1]?e=":"===r?"center":"right":":"===r&&(e="left"),{align:e}}var kd=/^(\$\$)(\s*[a-zA-Z])+/,xd=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,Cd=/^`{3,}(?!.*`)|^~{3,}/,Td=[/./,/^<(?:script|pre|style)(?:\s|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Z]/,/^<!\[CDATA\[/,/^<[/]?(?: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|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,new RegExp("^(?:"+Cp+"|"+Tp+")\\s*$","i")],Ed=/^(?:=+|-+)[ \t]*$/,Md=/^#{1,6}(?:[ \t]+|$)/,Nd=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,Sd=/^[*+-]/,Dd=/^(\d{1,9})([.)])/;function Ld(t,e){return t.options.disallowDeepHeading&&("blockQuote"===e.type||"item"===e.type)}var Od=[function(t){return t.indented||62!==ud(t.currentLine,t.nextNonspace)?0:(t.advanceNextNonspace(),t.advanceOffset(1,!1),dd(ud(t.currentLine,t.offset))&&t.advanceOffset(1,!0),t.closeUnmatchedBlocks(),t.addChild("blockQuote",t.nextNonspace),1)},function(t,e){var n;if(!t.indented&&!Ld(t,e)&&(n=t.currentLine.slice(t.nextNonspace).match(Md))){t.advanceNextNonspace(),t.advanceOffset(n[0].length,!1),t.closeUnmatchedBlocks();var r=t.addChild("heading",t.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=t.currentLine.slice(t.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),t.advanceOffset(t.currentLine.length-t.offset),2}return 0},function(t){var e;if(!t.indented&&(e=t.currentLine.slice(t.nextNonspace).match(Cd))){var n=e[0].length;t.closeUnmatchedBlocks();var r=t.addChild("codeBlock",t.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=e[0][0],r.fenceOffset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0},function(t,e){if(!t.indented&&60===ud(t.currentLine,t.nextNonspace)){var n=t.currentLine.slice(t.nextNonspace),r=t.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(Td[o]);if(i){if(7===o){if("paragraph"===e.type)return 0;if(r.length>0&&new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return t.closeUnmatchedBlocks(),t.addChild("htmlBlock",t.offset).htmlBlockType=o,2}}}return 0},function(t,e){var n;if(null!==e.stringContent&&!t.indented&&"paragraph"===e.type&&!Ld(t,e.parent)&&(n=t.currentLine.slice(t.nextNonspace).match(Ed))){t.closeUnmatchedBlocks();for(var r=void 0;91===ud(e.stringContent,0)&&(r=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(r);if(e.stringContent.length>0){var o=mp("heading",e.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=e.stringContent,e.insertAfter(o),e.unlink(),t.tip=o,t.advanceOffset(t.currentLine.length-t.offset,!1),2}return 0}return 0},function(t){return!t.indented&&Nd.test(t.currentLine.slice(t.nextNonspace))?(t.closeUnmatchedBlocks(),t.addChild("thematicBreak",t.nextNonspace),t.advanceOffset(t.currentLine.length-t.offset,!1),2):0},function(t,e){var n,r,o,i=e;return t.indented&&"list"!==e.type||!(n=function(t,e){var n,r,o=t.currentLine.slice(t.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:t.indent,task:!1,checked:!1};if(t.indent>=4)return null;if(n=o.match(Sd))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(Dd))||"paragraph"===e.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=ud(t.currentLine,t.nextNonspace+n[0].length))&&9!==r&&32!==r)return null;if("paragraph"===e.type&&!t.currentLine.slice(t.nextNonspace+n[0].length).match(sd))return null;t.advanceNextNonspace(),t.advanceOffset(n[0].length,!0);var a=t.column,s=t.offset;do{t.advanceOffset(1,!0),r=ud(t.currentLine,t.offset)}while(t.column-a<5&&dd(r));var l=-1===ud(t.currentLine,t.offset),c=t.column-a;return c>=5||c<1||l?(i.padding=n[0].length+1,t.column=a,t.offset=s,dd(ud(t.currentLine,t.offset))&&t.advanceOffset(1,!0)):i.padding=n[0].length+c,i}(t,i))?0:(t.closeUnmatchedBlocks(),"list"===t.tip.type&&(o=n,(r=i.listData).type===o.type&&r.delimiter===o.delimiter&&r.bulletChar===o.bulletChar)||((i=t.addChild("list",t.nextNonspace)).listData=n),(i=t.addChild("item",t.nextNonspace)).listData=n,1)},function(t){return t.indented&&"paragraph"!==t.tip.type&&!t.blank?(t.advanceOffset(4,!0),t.closeUnmatchedBlocks(),t.addChild("codeBlock",t.offset),2):0},function(t,e){var n=e.stringContent;if("paragraph"===e.type&&!t.indented&&!t.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),a=t.currentLine.slice(t.nextNonspace),s=yd(i),l=s[0],c=s[1],u=yd(a),p=u[0],d=u[1],f=/^[ \t]*:?-+:?[ \t]*$/;if(!c.length||!d.length||d.some(function(t){return!f.test(t)})||1===d.length&&0!==a.indexOf("|"))return 0;var h=e.lineOffsets,m=t.lineNumber-1,v=Ap(h)+1,g=mp("table",[[m,v],[t.lineNumber,t.offset]]);if(g.columns=d.map(function(){return{align:null}}),e.insertAfter(g),1===h.length)e.unlink();else{e.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;t.lastLineLength=h[h.length-2]+y,t.finalize(e,m-1)}t.advanceOffset(t.currentLine.length-t.offset,!1);var b=mp("tableHead",[[m,v],[t.lineNumber,t.offset]]);g.appendChild(b);var w=mp("tableRow",[[m,v],[m,v+i.length-1]]),k=mp("tableDelimRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.offset]]);b.appendChild(w),b.appendChild(k),bd("tableCell",c,m,v+l).forEach(function(t){w.appendChild(t)});var x=bd("tableDelimCell",d,t.lineNumber,t.nextNonspace+1+p);return x.forEach(function(t){k.appendChild(t)}),g.columns=x.map(wd),t.tip=g,2}return 0},function(t,e){if("table"!==e.type&&"tableBody"!==e.type||!t.blank&&-1===t.currentLine.indexOf("|"))return 0;if(t.advanceOffset(t.currentLine.length-t.offset,!1),t.blank){var n=e;return"tableBody"===e.type&&(n=e.parent,t.finalize(e,t.lineNumber-1)),t.finalize(n,t.lineNumber-1),0}var r=e;"table"===e.type&&((r=t.addChild("tableBody",t.nextNonspace)).stringContent=null);var o=mp("tableRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.currentLine.length]]);r.appendChild(o);var i=r.parent,a=yd(t.currentLine.slice(t.nextNonspace)),s=a[0];return bd("tableCell",a[1],t.lineNumber,t.nextNonspace+1+s).forEach(function(t,e){e>=i.columns.length&&(t.ignored=!0),o.appendChild(t)}),2},function(t){var e;if(!t.indented&&!xd.test(t.currentLine)&&(e=t.currentLine.match(kd))){var n=e[1].length;t.closeUnmatchedBlocks();var r=t.addChild("customBlock",t.nextNonspace);return r.syntaxLength=n,r.offset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0}],Ad=/^(-{3}|\+{3}|;{3})$/,Id=function(t,e){var n=t.currentLine,r=t.lineNumber,o=t.indented;return 1===r&&!o&&"document"===e.type&&Ad.test(n)?(t.closeUnmatchedBlocks(),t.addChild("frontMatter",t.nextNonspace).stringContent=n,t.advanceNextNonspace(),t.advanceOffset(n.length,!1),2):0},Rd={continue:function(t,e){var n=t.currentLine,r=n.match(Ad);return"frontMatter"===e.type&&r?(e.stringContent+=n,t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2):0},finalize:function(t,e){null!==e.stringContent&&(e.literal=e.stringContent,e.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},Pd=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],Bd=/^[#`~*+_=<>0-9-;$]/,Fd=/\r\n|\n|\r/;function Hd(){return mp("document",[[1,1],[0,0]])}var qd={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},zd=function(){function t(t){this.options=eu(eu({},qd),t),this.doc=Hd(),this.tip=this.doc,this.oldtip=this.doc,this.lineNumber=0,this.offset=0,this.column=0,this.nextNonspace=0,this.nextNonspaceColumn=0,this.indent=0,this.currentLine="",this.indented=!1,this.blank=!1,this.partiallyConsumedTab=!1,this.allClosed=!0,this.lastMatchedContainer=this.doc,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.lastLineLength=0,this.lines=[],this.options.frontMatter&&(gd.frontMatter=Rd,Od.unshift(Id)),this.inlineParser=new id(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=Ju(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!gd[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=mp(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],gd[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.entering,a=o.type;n&&n[a]&&n[a](o,{entering:i,options:this.options}),i||"paragraph"!==a&&"heading"!==a&&("tableCell"!==a||o.ignored)||this.inlineParser.parse(o)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),gd[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&gd[e.type].acceptsLines,i=Od.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!Bd.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var a=0;a<i;){var s=Od[a](this,e);if(1===s){e=this.tip;break}if(2===s){e=this.tip,o=!0;break}a++}if(a===i){this.advanceNextNonspace();break}}if(this.allClosed||this.blank||"paragraph"!==this.tip.type){this.closeUnmatchedBlocks(),this.blank&&e.lastChild&&(e.lastChild.lastLineBlank=!0);for(var l=e.type,c=this.blank&&!("blockQuote"===l||vp(e)&&e.isFenced||"item"===l&&!e.firstChild&&e.sourcepos[0][0]===this.lineNumber),u=e;u;)u.lastLineBlank=c,u=u.parent;gd[l].acceptsLines?(this.addLine(),"htmlBlock"===e.type&&e.htmlBlockType>=1&&e.htmlBlockType<=5&&Pd[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offset<t.length&&!this.blank&&(e=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=t.length},t.prototype.parse=function(t,e){this.doc=Hd(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=t.split(Fd),r=n.length;this.lines=e||n,this.options.referenceDefinition&&this.clearRefMaps(),10===t.charCodeAt(t.length-1)&&(r-=1);for(var o=0;o<r;o++)this.incorporateLine(n[o]);for(;this.tip;)this.finalize(this.tip,r);return this.processInlines(this.doc),this.doc},t.prototype.partialParseStart=function(t,e){this.doc=Hd(),this.tip=this.doc,this.lineNumber=t-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=e.length,r=0;r<n;r++)this.incorporateLine(e[r]);return this.doc},t.prototype.partialParseExtends=function(t){for(var e=0;e<t.length;e++)this.incorporateLine(t[e])},t.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},t.prototype.setRefMaps=function(t,e,n){this.refMap=t,this.refLinkCandidateMap=e,this.refDefCandidateMap=n},t.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){var e;e=t,Object.keys(e).forEach(function(t){delete e[t]})})},t}();function _d(t,e){return t[0]<e[0]?1:t[0]>e[0]?-1:t[1]<e[1]?1:t[1]>e[1]?-1:0}function jd(t,e){var n=t[0];return 1===_d(t[1],e)?1:-1===_d(n,e)?-1:0}function Vd(t,e){for(var n=0,r=e;n<r.length;n++){var o=r[n];t.insertBefore(o)}}function Ud(t,e){var n=t[0];return t[1][0]<e?1:n[0]>e?-1:0}function $d(t,e){for(var n=t.firstChild;n;){var r=Ud(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function Wd(t){return function(t){return tp[t]}(t)||null}function Gd(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var Kd=/\r\n|\n|\r/;function Jd(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var Zd=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new zd(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(Kd),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,o=t[0],i=t[1],a=e[0],s=e[1],l=n.split(Kd),c=l.length,u=this.lineTexts[o-1],p=this.lineTexts[a-1];l[0]=u.slice(0,i-1)+l[0],l[c-1]=l[c-1]+p.slice(s-1);var d=a-o+1;return(r=this.lineTexts).splice.apply(r,nu([o-1,d],l)),c-d},t.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?(Vd(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var a=i[o];n[a]&&(ep(n[a].id),n[a]=null)}n=r}t.next=e.next,e.next?e.next.prev=t:t.parent.lastChild=t}}(t,e),[t.id,e.id].forEach(function(t){return ep(t)}),t.unlink()):e?(Vd(e,n),ep(e.id),e.unlink()):function(t,e){for(var n=e.length-1;n>=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=$d(this.root,t[0]),r=$d(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach(function(t){t(e)})},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&(gp(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return Sd.test(n)||Dd.test(n)}(this.lineTexts[n-1])||"table"===t.prev.type&&!pd(o=this.lineTexts[n-1])&&-1!==o.indexOf("|"))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),a=this.parser.partialParseStart(n,i),s=e?e.next:this.root.firstChild,l=a.lastChild,c=l&&vp(l)&&l.open,u=l&&bp(l)&&l.open,p=l&&gp(l);(c||u)&&s||p&&s&&("list"===s.type||s.sourcepos[0][1]>=2);){var d=this.extendEndLine(s.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=s,r=d,s=s.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(a),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&yp(t)||e&&yp(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!Pp(this.refMap)){var r=function(t){if(yp(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&Gd(r,t.parent,e),e&&Gd(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!Pp(this.refMap)){var n=function(t){if(yp(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=Jd(t))}};t.forEach(function(t){Gd(n,t)})}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;Pp(this.refDefCandidateMap)||Rp(this.refDefCandidateMap,function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=Jd(n))})},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!Pp(this.refMap)){var i=$d(this.root,t-1),a=$d(this.root,e+1);i&&yp(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),a&&yp(a)&&a!==n&&a!==r&&(r=a,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],a=o?Math.min(o.sourcepos[0][0],t[0]):t[0],s=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),l=this.parseRange.apply(this,this.getRangeWithRefDef(a,s,o,i,n)),c=l.newNodes,u=l.extStartNode,p=l.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,c),this.replaceWithNewRefDefState(c)):this.replaceRangeNodes(u,p,c),{nodes:c,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return Pp(this.refMap)||Rp(this.refMap,function(n,r){r.unlinked&&delete t.refMap[n],Rp(t.refLinkCandidateMap,function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))})}),e},t.prototype.removeUnlinkedCandidate=function(){Pp(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){Rp(t,function(e){(function(t){var e=Wd(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]})})},t.prototype.editMarkdown=function(t,e,n){var r=this.updateLineTexts(t,e,n),o=this.parse(t,e,r),i=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=eu({},t);return e.forEach(function(t){delete r[t]}),r}(o,"nextNode");!function(t,e){if(t&&t.parent&&0!==e){var n,r=t.parent.walker();for(r.resumeAt(t,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=e,o.sourcepos[1][0]+=e)}}}(o.nextNode,r),this.updateRootNodeState();var a=[i];return this.referenceDefinition&&(this.removeUnlinkedCandidate(),this.replaceWithRefDefCandidate(),a=a.concat(this.parseRefLink())),this.trigger("change",a),a},t.prototype.getLineTexts=function(){return this.lineTexts},t.prototype.getRootNode=function(){return this.root},t.prototype.findNodeAtPosition=function(t){var e=function(t,e){for(var n=t,r=null;n;){var o=jd(n.sourcepos,e);if(0===o){if(!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)return r;if(!n.next)return r;n=n.next}}return n}(this.root,t);return e&&e!==this.root?e:null},t.prototype.findFirstNodeAtLine=function(t){return function(t,e){for(var n=t.firstChild,r=null;n;){var o=Ud(n.sourcepos,e);if(0===o){if(n.sourcepos[0][0]===e||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(t){for(;t.parent&&"document"!==t.parent.type&&t.parent.sourcepos[0][0]===t.sourcepos[0][0];)t=t.parent;return t}(function(t){for(;t.lastChild;)t=t.lastChild;return t}(r)):null}(this.root,t)},t.prototype.on=function(t,e){this.eventHandlerMap[t].push(e)},t.prototype.off=function(t,e){var n=this.eventHandlerMap[t],r=n.indexOf(e);n.splice(r,1)},t.prototype.findNodeById=function(t){return Wd(t)},t.prototype.removeAllNode=function(){tp={}},t}(),Xd=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function Qd(t){return Xd.test(t)?t.replace(Xd,function(t,e){return"&lt;"+e}):t}var Yd={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.listData,o=r.type,i=r.start,a="bullet"===o?"ul":"ol",s={};return"ol"===a&&null!==i&&1!==i&&(s.start=i.toString()),{type:n?"openTag":"closeTag",tagName:a,attributes:s,outerNewLine:!0}},item:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?Qd(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?Qd(t.literal):t.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+Ku(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:eu({href:Ku(o)},r&&{title:Ku(r)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,r=e.skipChildren,o=t,i=o.title,a=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:eu({src:Ku(a),alt:n(t)},i&&{title:Ku(i)})}},customBlock:function(t,e,n){var r=n[t.info.trim().toLowerCase()];if(r)try{return r(t,e)}catch(o){}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.info,i=r.firstChild,a=n[o.trim().toLowerCase()],s=e.entering;if(a)try{return a(t,e)}catch(l){}return s?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+o+(i?" ":"")}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},tf={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,r=t.listData,o=r.checked,i=r.task;if(n){var a={type:"openTag",tagName:"li",outerNewLine:!0};return i?[a,{type:"openTag",tagName:"input",selfClose:!0,attributes:eu(eu({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:a}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;o<r;o+=1)n.push({type:"openTag",tagName:"td",outerNewLine:!0},{type:"closeTag",tagName:"td",outerNewLine:!0});return n.push({type:"closeTag",tagName:"tr",outerNewLine:!0}),n},tableCell:function(t,e){var n=e.entering;if(t.ignored)return{type:"text",content:""};var r=t.parent.parent,o="tableHead"===r.type?"th":"td",i=r.parent.columns[t.startIdx],a=(null==i?void 0:i.align)?{align:i.align}:null;return n?eu({type:"openTag",tagName:o,outerNewLine:!0},a&&{attributes:a}):{type:"closeTag",tagName:o,outerNewLine:!0}}},ef={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function nf(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var rf=function(){function t(t){this.buffer=[],this.options=eu(eu({},ef),t),this.convertors=this.createConvertors(),delete this.options.convertors}return t.prototype.createConvertors=function(){var t=eu({},Yd);if(this.options.gfm&&(t=eu(eu({},t),tf)),this.options.convertors){var e=this.options.convertors,n=Object.keys(e),r=eu(eu({},Yd),tf);n.forEach(function(n){var o=t[n],i=e[n],a=-1===Object.keys(r).indexOf(n)?n.toLowerCase():n;t[a]=o?function(t,e,n){return e.origin=function(){return o(t,e,n)},i(t,e)}:i})}return t},t.prototype.getConvertors=function(){return this.convertors},t.prototype.getOptions=function(){return this.options},t.prototype.render=function(t){var e=this;this.buffer=[];for(var n=t.walker(),r=null,o=function(){var t=r.node,o=r.entering,a=i.convertors[t.type];if(!a)return"continue";var s=!1,l={entering:o,leaf:!Qu(t),options:i.options,getChildrenText:nf,skipChildren:function(){s=!0}},c=bp(t)||function(t){return"customInline"===t.type}(t)?a(t,l,i.convertors):a(t,l);c&&((Array.isArray(c)?c:[c]).forEach(function(n,r){"openTag"===n.type&&e.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(t.id)),e.renderHTMLNode(n)}),s&&(n.resumeAt(t,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},t.prototype.renderHTMLNode=function(t){switch(t.type){case"openTag":case"closeTag":this.renderElementNode(t);break;case"text":this.renderTextNode(t);break;case"html":this.renderRawHtmlNode(t)}},t.prototype.generateOpenTagString=function(t){var e=this,n=t.tagName,r=t.classNames,o=t.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach(function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')}),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push("</"+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==Ap(Ap(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(Ku(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),of=Object.hasOwnProperty,af=Object.setPrototypeOf,sf=Object.isFrozen,lf=Object.getPrototypeOf,cf=Object.getOwnPropertyDescriptor,uf=Object.freeze,pf=Object.seal,df=Object.create,ff="undefined"!=typeof Reflect&&Reflect,hf=ff.apply,mf=ff.construct;hf||(hf=function(t,e,n){return t.apply(e,n)}),uf||(uf=function(t){return t}),pf||(pf=function(t){return t}),mf||(mf=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var vf,gf=Nf(Array.prototype.forEach),yf=Nf(Array.prototype.pop),bf=Nf(Array.prototype.push),wf=Nf(String.prototype.toLowerCase),kf=Nf(String.prototype.match),xf=Nf(String.prototype.replace),Cf=Nf(String.prototype.indexOf),Tf=Nf(String.prototype.trim),Ef=Nf(RegExp.prototype.test),Mf=(vf=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return mf(vf,e)});function Nf(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return hf(t,e,r)}}function Sf(t,e){af&&af(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var o=wf(r);o!==r&&(sf(e)||(e[n]=o),r=o)}t[r]=!0}return t}function Df(t){var e=df(null),n=void 0;for(n in t)hf(of,t,[n])&&(e[n]=t[n]);return e}function Lf(t,e){for(;null!==t;){var n=cf(t,e);if(n){if(n.get)return Nf(n.get);if("function"==typeof n.value)return Nf(n.value)}t=lf(t)}return function(t){return null}}var Of=uf(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Af=uf(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),If=uf(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Rf=uf(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Pf=uf(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Bf=uf(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ff=uf(["#text"]),Hf=uf(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),qf=uf(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),zf=uf(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_f=uf(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jf=pf(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Vf=pf(/<%[\s\S]*|[\s\S]*%>/gm),Uf=pf(/^data-[\-\w.\u00B7-\uFFFF]/),$f=pf(/^aria-[\-\w]+$/),Wf=pf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gf=pf(/^(?:\w+script|data):/i),Kf=pf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jf="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};function Zf(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var Xf=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,n=function(e){return t(e)};if(n.version="2.3.3",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,o=e.document,i=e.DocumentFragment,a=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap,p=void 0===u?e.NamedNodeMap||e.MozNamedAttrMap:u,d=e.Text,f=e.Comment,h=e.DOMParser,m=e.trustedTypes,v=l.prototype,g=Lf(v,"cloneNode"),y=Lf(v,"nextSibling"),b=Lf(v,"childNodes"),w=Lf(v,"parentNode");if("function"==typeof a){var k=o.createElement("template");k.content&&k.content.ownerDocument&&(o=k.content.ownerDocument)}var x=function(t,e){if("object"!==(void 0===t?"undefined":Jf(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:function(t){return t}})}catch(i){return null}}(m,r),C=x&&et?x.createHTML(""):"",T=o,E=T.implementation,M=T.createNodeIterator,N=T.createDocumentFragment,S=T.getElementsByTagName,D=r.importNode,L={};try{L=Df(o).documentMode?o.documentMode:{}}catch(Ft){}var O={};n.isSupported="function"==typeof w&&E&&void 0!==E.createHTMLDocument&&9!==L;var A=jf,I=Vf,R=Uf,P=$f,B=Gf,F=Kf,H=Wf,q=null,z=Sf({},[].concat(Zf(Of),Zf(Af),Zf(If),Zf(Pf),Zf(Ff))),_=null,j=Sf({},[].concat(Zf(Hf),Zf(qf),Zf(zf),Zf(_f))),V=null,U=null,$=!0,W=!0,G=!1,K=!1,J=!1,Z=!1,X=!1,Q=!1,Y=!1,tt=!0,et=!1,nt=!0,rt=!0,ot=!1,it={},at=null,st=Sf({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),lt=null,ct=Sf({},["audio","video","img","source","image","track"]),ut=null,pt=Sf({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),dt="http://www.w3.org/1998/Math/MathML",ft="http://www.w3.org/2000/svg",ht="http://www.w3.org/1999/xhtml",mt=ht,vt=!1,gt=void 0,yt=["application/xhtml+xml","text/html"],bt=void 0,wt=null,kt=o.createElement("form"),xt=function(t){wt&&wt===t||(t&&"object"===(void 0===t?"undefined":Jf(t))||(t={}),t=Df(t),q="ALLOWED_TAGS"in t?Sf({},t.ALLOWED_TAGS):z,_="ALLOWED_ATTR"in t?Sf({},t.ALLOWED_ATTR):j,ut="ADD_URI_SAFE_ATTR"in t?Sf(Df(pt),t.ADD_URI_SAFE_ATTR):pt,lt="ADD_DATA_URI_TAGS"in t?Sf(Df(ct),t.ADD_DATA_URI_TAGS):ct,at="FORBID_CONTENTS"in t?Sf({},t.FORBID_CONTENTS):st,V="FORBID_TAGS"in t?Sf({},t.FORBID_TAGS):{},U="FORBID_ATTR"in t?Sf({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,$=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,K=t.SAFE_FOR_TEMPLATES||!1,J=t.WHOLE_DOCUMENT||!1,Q=t.RETURN_DOM||!1,Y=t.RETURN_DOM_FRAGMENT||!1,tt=!1!==t.RETURN_DOM_IMPORT,et=t.RETURN_TRUSTED_TYPE||!1,X=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,rt=!1!==t.KEEP_CONTENT,ot=t.IN_PLACE||!1,H=t.ALLOWED_URI_REGEXP||H,mt=t.NAMESPACE||ht,gt=gt=-1===yt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,bt="application/xhtml+xml"===gt?function(t){return t}:wf,K&&(W=!1),Y&&(Q=!0),it&&(q=Sf({},[].concat(Zf(Ff))),_=[],!0===it.html&&(Sf(q,Of),Sf(_,Hf)),!0===it.svg&&(Sf(q,Af),Sf(_,qf),Sf(_,_f)),!0===it.svgFilters&&(Sf(q,If),Sf(_,qf),Sf(_,_f)),!0===it.mathMl&&(Sf(q,Pf),Sf(_,zf),Sf(_,_f))),t.ADD_TAGS&&(q===z&&(q=Df(q)),Sf(q,t.ADD_TAGS)),t.ADD_ATTR&&(_===j&&(_=Df(_)),Sf(_,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&Sf(ut,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(at===st&&(at=Df(at)),Sf(at,t.FORBID_CONTENTS)),rt&&(q["#text"]=!0),J&&Sf(q,["html","head","body"]),q.table&&(Sf(q,["tbody"]),delete V.tbody),uf&&uf(t),wt=t)},Ct=Sf({},["mi","mo","mn","ms","mtext"]),Tt=Sf({},["foreignobject","desc","title","annotation-xml"]),Et=Sf({},Af);Sf(Et,If),Sf(Et,Rf);var Mt=Sf({},Pf);Sf(Mt,Bf);var Nt=function(t){bf(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(Ft){try{t.outerHTML=C}catch(e){t.remove()}}},St=function(t,e){try{bf(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(Ft){bf(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!_[t])if(Q||Y)try{Nt(e)}catch(Ft){}else try{e.setAttribute(t,"")}catch(Ft){}},Dt=function(t){var e=void 0,n=void 0;if(X)t="<remove></remove>"+t;else{var r=kf(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=x?x.createHTML(t):t;if(mt===ht)try{e=(new h).parseFromString(i,gt)}catch(Ft){}if(!e||!e.documentElement){e=E.createDocument(mt,"template",null);try{e.documentElement.innerHTML=vt?"":i}catch(Ft){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),mt===ht?S.call(e,J?"html":"body")[0]:J?e.documentElement:a},Lt=function(t){return M.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ot=function(t){return"object"===(void 0===s?"undefined":Jf(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":Jf(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},At=function(t,e,r){O[t]&&gf(O[t],function(t){t.call(n,e,r,wt)})},It=function(t){var e,r=void 0;if(At("beforeSanitizeElements",t,null),!((e=t)instanceof d||e instanceof f||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof p&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore))return Nt(t),!0;if(kf(t.nodeName,/[\u0080-\uFFFF]/))return Nt(t),!0;var o=bt(t.nodeName);if(At("uponSanitizeElement",t,{tagName:o,allowedTags:q}),!Ot(t.firstElementChild)&&(!Ot(t.content)||!Ot(t.content.firstElementChild))&&Ef(/<[/\w]/g,t.innerHTML)&&Ef(/<[/\w]/g,t.textContent))return Nt(t),!0;if("select"===o&&Ef(/<template/i,t.innerHTML))return Nt(t),!0;if(!q[o]||V[o]){if(rt&&!at[o]){var i=w(t)||t.parentNode,a=b(t)||t.childNodes;if(a&&i)for(var s=a.length-1;s>=0;--s)i.insertBefore(g(a[s],!0),y(t))}return Nt(t),!0}return t instanceof l&&!function(t){var e=w(t);e&&e.tagName||(e={namespaceURI:ht,tagName:"template"});var n=wf(t.tagName),r=wf(e.tagName);if(t.namespaceURI===ft)return e.namespaceURI===ht?"svg"===n:e.namespaceURI===dt?"svg"===n&&("annotation-xml"===r||Ct[r]):Boolean(Et[n]);if(t.namespaceURI===dt)return e.namespaceURI===ht?"math"===n:e.namespaceURI===ft?"math"===n&&Tt[r]:Boolean(Mt[n]);if(t.namespaceURI===ht){if(e.namespaceURI===ft&&!Tt[r])return!1;if(e.namespaceURI===dt&&!Ct[r])return!1;var o=Sf({},["title","style","font","a","script"]);return!Mt[n]&&(o[n]||!Et[n])}return!1}(t)?(Nt(t),!0):"noscript"!==o&&"noembed"!==o||!Ef(/<\/no(script|embed)/i,t.innerHTML)?(K&&3===t.nodeType&&(r=t.textContent,r=xf(r,A," "),r=xf(r,I," "),t.textContent!==r&&(bf(n.removed,{element:t.cloneNode()}),t.textContent=r)),At("afterSanitizeElements",t,null),!1):(Nt(t),!0)},Rt=function(t,e,n){if(nt&&("id"===e||"name"===e)&&(n in o||n in kt))return!1;if(W&&!U[e]&&Ef(R,e));else if($&&Ef(P,e));else{if(!_[e]||U[e])return!1;if(ut[e]);else if(Ef(H,xf(n,F,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Cf(n,"data:")||!lt[t])if(G&&!Ef(B,xf(n,F,"")));else if(n)return!1}return!0},Pt=function(t){var e=void 0,r=void 0,o=void 0,i=void 0;At("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_};for(i=a.length;i--;){var l=e=a[i],c=l.name,u=l.namespaceURI;if(r=Tf(e.value),o=bt(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,At("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(St(c,t),s.keepAttr))if(Ef(/\/>/i,r))St(c,t);else{K&&(r=xf(r,A," "),r=xf(r,I," "));var p=bt(t.nodeName);if(Rt(p,o,r))try{u?t.setAttributeNS(u,c,r):t.setAttribute(c,r),yf(n.removed)}catch(Ft){}}}At("afterSanitizeAttributes",t,null)}},Bt=function t(e){var n=void 0,r=Lt(e);for(At("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)At("uponSanitizeShadowNode",n,null),It(n)||(n.content instanceof i&&t(n.content),Pt(n));At("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,o){var a=void 0,l=void 0,c=void 0,u=void 0,p=void 0;if((vt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ot(t)){if("function"!=typeof t.toString)throw Mf("toString is not a function");if("string"!=typeof(t=t.toString()))throw Mf("dirty is not a string, aborting")}if(!n.isSupported){if("object"===Jf(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(Ot(t))return e.toStaticHTML(t.outerHTML)}return t}if(Z||xt(o),n.removed=[],"string"==typeof t&&(ot=!1),ot);else if(t instanceof s)1===(l=(a=Dt("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!Q&&!K&&!J&&-1===t.indexOf("<"))return x&&et?x.createHTML(t):t;if(!(a=Dt(t)))return Q?null:C}a&&X&&Nt(a.firstChild);for(var d=Lt(ot?t:a);c=d.nextNode();)3===c.nodeType&&c===u||It(c)||(c.content instanceof i&&Bt(c.content),Pt(c),u=c);if(u=null,ot)return t;if(Q){if(Y)for(p=N.call(a.ownerDocument);a.firstChild;)p.appendChild(a.firstChild);else p=a;return tt&&(p=D.call(r,p,!0)),p}var f=J?a.outerHTML:a.innerHTML;return K&&(f=xf(f,A," "),f=xf(f,I," ")),x&&et?x.createHTML(f):f},n.setConfig=function(t){xt(t),Z=!0},n.clearConfig=function(){wt=null,Z=!1},n.isValidAttribute=function(t,e,n){wt||xt({});var r=bt(t),o=bt(e);return Rt(r,o,n)},n.addHook=function(t,e){"function"==typeof e&&(O[t]=O[t]||[],bf(O[t],e))},n.removeHook=function(t){O[t]&&yf(O[t])},n.removeHooks=function(t){O[t]&&(O[t]=[])},n.removeAllHooks=function(){O={}},n}(),Qf=["iframe","embed"],Yf=[];function th(t){xa(Qf,t)&&Yf.push(t.toLowerCase())}function eh(t,e){return Xf.sanitize(t,Ni({ADD_TAGS:Yf,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},e))}function nh(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]*>)|(</"+e+"\\s*[>])","ig"),"").trim()}function rh(t){var e=(t=t.match(Ls)[0]).match(new RegExp(Ns,"g"));return e?e.reduce(function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t},{}):{}}function oh(t){return za(t.attributes).reduce(function(t,e){return t[e.nodeName]=e.nodeValue,t},{})}function ih(t,e,n,r){var o=r.getToDOMNode(e)(t),i=n(o.outerHTML),a=document.createElement("div");return a.innerHTML=i,{dom:o=a.firstChild,htmlAttrs:oh(o)}}var ah={htmlBlock:function(t,e,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:oh(t),childrenHTML:t.innerHTML}}}],toDOM:function(r){var o=ih(r,t,e,n),i=o.dom,a=o.htmlAttrs;return a.class=a.class?a.class+" html-block":"html-block",Si([t,a],za(i.childNodes))}}},htmlInline:function(t,e,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:oh(t)}}}],toDOM:function(r){var o=ih(r,t,e,n).htmlAttrs;return[t,o,0]}}}},sh=/^\s*<\s*\//,lh={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/<br ?\/?>/.test(t.prev.literal)?"\n":"<br>\n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.info,o=r?r.split(/\s+/):[],i=[],a={};if(n>3&&(a["data-backticks"]=n),o.length>0&&o[0].length>0){var s=o[0];i.push("lang-"+s),a["data-language"]=s}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:a},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:hs(i,gs(t)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function ch(t,e){var n=Ni({},lh);return t&&(n.link=function(e,n){var r=n.entering,o=(0,n.origin)();return r&&(o.attributes=Ni(Ni({},o.attributes),t)),o}),e&&Object.keys(e).forEach(function(t){var r=n[t],o=e[t];r&&nl(o)?n[t]=function(t,e){var n=Ni({},e);return n.origin=function(){return r(t,e)},o(t,n)}:xa(["htmlBlock","htmlInline"],t)&&!nl(o)?n[t]=function(t,e){var n=t.literal.match(Ls);if(n){var r=n[0],i=n[1],a=n[3],s=(i||a).toLowerCase(),l=o[s],c=nh(t,s);if(l){var u=Ni({},t);return u.attrs=rh(r),u.childrenHTML=c,u.type=s,e.entering=!sh.test(t.literal),l(u,e)}}return e.origin()}:n[t]=o}),n}var uh=["list","item","blockQuote"],ph=["UL","OL","BLOCKQUOTE"];function dh(t,e){var n,r=t.child(e);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function fh(t,e,n){var r=Ga(e)-1,o=Ka(e)-1,i=n[r].getBoundingClientRect(),a=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:a<=0?n[r].clientHeight:a+hh(t,n,Math.min(o+1,t.childCount-1)),rect:i}}function hh(t,e,n){for(var r=t.childCount-1,o=0;n<=r&&dh(t,n);)o+=e[n].clientHeight,n+=1;return o}function mh(t,e){for(var n=0;t&&t!==e&&(xa(ph,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function vh(t,e,n){return t&&e>n+t.offsetTop?vh(t.nextElementSibling,e,n)||t:null}function gh(t,e){for(var n=t.querySelector('[data-nodeid="'+e.id+'"]');!n||Xa(e);)e=e.parent,n=t.querySelector('[data-nodeid="'+e.id+'"]');return function(t){for(var e=t.mdNode,n=t.el;(xa(uh,e.type)||"table"===e.type)&&e.firstChild;)e=e.firstChild,n=n.firstElementChild;return{mdNode:e,el:n}}({mdNode:e,el:n})}var yh={};function bh(t){t&&(delete yh[Number(t.getAttribute("data-nodeid"))],za(t.children).forEach(function(t){bh(t)}))}var wh=Bs("md-preview-highlight"),kh=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=Bs("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,a=e.highlight,s=void 0!==a&&a;this.renderer=new rf({gfm:!0,nodeId:!0,convertors:ch(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(s),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return t.prototype.initContentSection=function(){this.previewContent=_s('<div class="'+Bs("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){zs(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(t&&(this.eventEmitter.listen("changeToolbarState",function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)}),this.eventEmitter.listen("blur",function(){e.removeHighlight()})),Qc(this.el,"scroll",function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=vh(o,t,mh(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return e.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return e.toggleActive(!1)}))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&ia(t,wh)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=ns(t,function(t){return!function(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(t)})).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(Ja(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&ia(r,wh),o&&ta(o,wh),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach(function(t){return e.replaceRangeNodes(t)}),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map(function(t){return e.renderer.render(t)}).join("")));if(r){var a=r.id,s=a[0],l=a[1],c=this.getElementByNodeId(s),u=this.getElementByNodeId(l);if(c){c.insertAdjacentHTML("beforebegin",i);for(var p=c;p&&p!==u;){var d=p.nextElementSibling;qs(p),bh(p),p=d}(null==p?void 0:p.parentNode)&&(qs(p),bh(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){Gc(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){_i(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){_i(this.el,{minHeight:t+"px"})},t}();function xh(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r,n))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}function Ch(t){return!!xh(t,function(t){var e=t.type;return"listItem"===e.name||"bulletList"===e.name||"orderedList"===e.name})}function Th(t){return!!xh(t,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})}function Eh(t){return xh(t,function(t){return"listItem"===t.type.name})}function Mh(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}}function Nh(t){return Object.keys(t).reduce(function(e,n){return"rawHTML"!==n&&t[n]&&(e[n="className"===n?"class":n]=t[n]),e},{})}function Sh(t){return{tag:t,getAttrs:function(t){return["rawHTML","colspan","rowspan","extended"].reduce(function(e,n){var r="rawHTML"===n?"data-raw-html":n,o=t.getAttribute(r);return o&&(e[n]=xa(["rawHTML","extended"],n)?o:Number(o)),e},{})}}}function Dh(t){var e=t.htmlAttrs,n=t.classNames;return Ni(Ni({},e),{class:n?n.join(" "):null})}function Lh(t,e,n,r){var o=e.$from,i=e.$to,a=e.depth,s=e,c=!1;if(a>=2&&o.node(a-1).type.compatibleContent(n)&&0===e.startIndex&&o.index(a-1)){var u=t.doc.resolve(e.start-2);s=new I(u,u,a),e.endIndex<e.parent.childCount&&(e=new I(o,t.doc.resolve(i.end(a)),a)),c=!0}var p=function(t,e,n,r){var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(i){var a=i.length?i[0]:e;return n.canReplaceWith(r,o,a)?i:null}return null}(t,n),i=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),a=e.contentMatch.findWrapping(i.type);if(a){for(var s=(a.length?a[a.length-1]:e).contentMatch,l=r;s&&l<o;l+=1)s=s.matchType(n.child(l).type);if(s&&s.validEnd)return a}return null}(e,n);if(o&&i){var a=o.map(function(t){return{type:t}}),s=i.map(function(t){return{type:t,attrs:r}});return a.concat({type:n}).concat(s)}return null}(s,e,n,r);return p?function(t,e,n,r,o){for(var i=e.start,a=e.end,s=e.startIndex,c=e.endIndex,u=e.parent,p=l.empty,d=n.length-1;d>=0;d-=1)p=l.from(n[d].type.create(n[d].attrs,p));t.step(new Bt(i-(r?2:0),a,i,a,new m(p,0,0),n.length,!0));var f=0;for(d=0;d<n.length;d+=1)if(n[d].type===o){f=d+1;break}for(var h=n.length-f,v=i+n.length-(r?2:0),g=(d=s,c);d<g;d+=1)!(d===s)&&jt(t.doc,v,h)&&(t.split(v,h),v+=2*h),v+=u.child(d).nodeSize;return t}(t,e,p,c,n):t}function Oh(t,e){for(var n=t.resolve(e);"paragraph"!==n.node().type.name;)e-=2,n=t.resolve(e);return Eh(n)}function Ah(t){return function(e,n){var r=e.selection,o=e.tr,i=r.$from,a=r.$to,s=i.blockRange(a);if(s){var l=Ch(i)?function(t,e,n){var r=e.$from,o=e.$to,i=Eh(r),a=Eh(o);if(i&&a)for(;a;){var s=a.offset,l=a.node,c=a.depth;l.attrs.task&&t.setNodeMarkup(s,null,{task:!1,checked:!1});var u=t.doc.resolve(s);if(u.parent.type!==n){var p=u.before(c-1);t.setNodeMarkup(p,n)}if(s===i.offset)break;a=Oh(t.doc,s)}return t}(o,s,t):Lh(o,s,t);return n(l),!0}return!1}}function Ih(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,a=n.$to,s=i.blockRange(a);if(s){var l=Ch(i)?function(t,e){var n=e.$from,r=e.$to,o=Eh(n),i=Eh(r);if(o&&i)for(;i;){var a=i.offset,s={task:!i.node.attrs.task,checked:!1};if(t.setNodeMarkup(a,null,s),a===o.offset)break;i=Oh(t.doc,a)}return t}(r,s):Lh(r,s,o.nodes.bulletList,{task:!0});return e(l),!0}return!1}}function Rh(){return{indent:function(){return function(t,e){var n,r=t.selection,o=t.schema,i=r.$from,a=r.$to;return!(!i.blockRange(a)||!Ch(i))&&(n=o.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to,s=i.blockRange(a,function(t){var e=t.childCount,r=t.firstChild;return!!e&&r.type===n});if(s&&s.startIndex>0){var c=s.parent,u=c.child(s.startIndex-1);if(u.type!==n)return!1;var p=u.lastChild&&u.lastChild.type===c.type,d=p?l.from(n.create()):null,f=new m(l.from(n.create(null,l.from(c.type.create(null,d)))),p?3:1,0),h=s.start,v=s.end;return r.step(new Bt(h-(p?3:1),v,h,v,f,1,!0)),e(r),!0}return!1})(t,e)}},outdent:function(){return function(t,e){var n,r=t.selection,o=t.schema,i=r.$from,a=r.$to;return!(!i.blockRange(a)||!Ch(i))&&(n=o.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to,s=i.blockRange(a,function(t){var e=t.childCount,r=t.firstChild;return!!e&&r.type===n});if(s){var c=i.node(s.depth-1).type===n?function(t,e,n){var r=e.$from,o=e.$to,i=e.end,a=e.depth,s=e.parent,c=o.end(a);return i<c&&(t.step(new Bt(i-1,c,i,c,new m(l.from(n.create(null,s.copy())),1,0),1,!0)),e=new I(t.doc.resolve(r.pos),t.doc.resolve(c),a)),t.lift(e,qt(e)),t}(r,s,n):function(t,e){for(var n=e.parent,r=e.end,o=e.endIndex-1,i=e.startIndex;o>i;o-=1)r-=n.child(o).nodeSize,t.delete(r-1,r+1);var a=t.doc.resolve(e.start),s=a.nodeAfter,c=0===e.startIndex,u=e.endIndex===n.childCount,p=a.node(-1),d=a.index(-1),f=p.canReplace(d+(c?0:1),d+1,null==s?void 0:s.content.append(u?l.empty:l.from(n)));if(s&&f){var h=a.pos,v=h+s.nodeSize;t.step(new Bt(h-(c?1:0),v+(u?1:0),h+1,v-1,new m((c?l.empty:l.from(n.copy(l.empty))).append(u?l.empty:l.from(n.copy(l.empty))),c?0:1,u?0:1),c?0:1))}return t}(r,s);return e(c),!0}return!1})(t,e)}}}}var Ph=/* @__PURE__ */new Map,Bh=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=xh(e,function(t){return"table"===t.type.name});if(n){var r=n.node,o=n.depth,i=n.offset,a=Ph.get(r);if((null==a?void 0:a.tableStartPos)===i+1)return a;var s=[],l=e.start(o),c=r.child(0),u=r.child(1),p=Fh(c,l),d=Fh(u,l+c.nodeSize);c.forEach(function(t){return s.push(t)}),u.forEach(function(t){return s.push(t)});var f=new t(r,s,l,p.concat(d));return Ph.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},t.prototype.getNodeAndPos=function(t,e){var n=this.rowInfo[t][e];return{node:this.table.nodeAt(n.offset-this.tableStartOffset),pos:n.offset}},t.prototype.extendedRowspan=function(t,e){return!1},t.prototype.extendedColspan=function(t,e){return!1},t.prototype.getRowspanCount=function(t,e){return 0},t.prototype.getColspanCount=function(t,e){return 0},t.prototype.decreaseColspanCount=function(t,e){return 0},t.prototype.decreaseRowspanCount=function(t,e){return 0},t.prototype.getColspanStartInfo=function(t,e){return null},t.prototype.getRowspanStartInfo=function(t,e){return null},t.prototype.getCellStartOffset=function(t,e){var n=this.rowInfo[t][e].offset;return this.extendedRowspan(t,e)?this.posAt(t,e):n},t.prototype.getCellEndOffset=function(t,e){var n=this.rowInfo[t][e],r=n.offset,o=n.nodeSize;return this.extendedRowspan(t,e)?this.posAt(t,e):r+o},t.prototype.getCellIndex=function(t){for(var e=0;e<this.totalRowCount;e+=1)for(var n=this.rowInfo[e],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>t.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),a=i[0],s=i[1],l=this.getCellIndex(e),c=l[0],u=l[1];return a=(r=Ha(a,c))[0],c=r[1],s=(o=Ha(s,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:a,startColIdx:s,endRowIdx:c,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),Fh=function(t,e){var n=[];return t.forEach(function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach(function(t,n){for(var i=t.nodeSize,a=0;o[a];)a+=1;o[a]={offset:e+r+n+2,nodeSize:i},o.length+=1}),n.push(o)}),n};function Hh(t,e){return Fa(Bh.prototype,t),Fh=e,Bh}var qh=function(t){function e(e,n){void 0===n&&(n=e);var r=this,o=e.node(0),i=Bh.create(e),a=i.getRectOffsets(e,n),s=function(t,e,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,a=n.endColIdx,s=[],l=r;l<=i;l+=1)for(var c=o;c<=a;c+=1){var u=e.getCellInfo(l,c),p=u.offset,d=u.nodeSize;s.push(new ae(t.resolve(p+1),t.resolve(p+d-1)))}return s}(o,i,a);return(r=t.call(this,s[0].$from,s[0].$to,s)||this).startCell=e,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return Mi(e,t),e.prototype.map=function(t,n){var r=this.startCell.pos,o=this.endCell.pos,i=t.resolve(n.map(r)),a=t.resolve(n.map(o)),s=Bh.create(i);if(this.offsetMap.totalColumnCount>s.totalColumnCount||this.offsetMap.totalRowCount>s.totalRowCount){var l={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[a.parent.type.name],c=a.end(a.depth-l),u=Math.min(c-4,a.pos);return se.create(t,u)}return new e(i,a)},e.prototype.eq=function(t){return t instanceof e&&t.startCell.pos===this.startCell.pos&&t.endCell.pos===this.endCell.pos},e.prototype.content=function(){for(var t=this.startCell.node(-2),e=this.startCell.start(-2),n=t.child(1).firstChild,r=t.child(0).type.create(),o=t.child(1).type.create(),i=Bh.create(this.startCell),a=i.getRectOffsets(this.startCell,this.endCell),s=a.startRowIdx,c=a.startColIdx,u=a.endRowIdx,p=a.endColIdx,d=!1,f=s;f<=u;f+=1){for(var h=[],v=c;v<=p;v+=1){var g=i.getCellInfo(f,v).offset,y=t.nodeAt(g-e);y&&(d="tableHeadCell"===y.type.name,i.extendedRowspan(f,v)||i.extendedColspan(f,v)?h.push(y.type.create({extended:!0})):h.push(y.copy(y.content)))}var b=n.copy(l.from(h)),w=d?r:o;w.content=w.content.append(l.from(b))}return new m(function(t,e){var n=[];return t.childCount&&n.push(t),e.childCount&&n.push(e),l.from(n)}(r,o),1,1)},e}(oe);function zh(t,e,n,r){for(var o=n.nodes,i=o.tableRow,a=o.tableBodyCell,s=o.paragraph,l=[],c=0;c<t;c+=1){for(var u=[],p=0;p<e;p+=1){var d=r&&r[c*e+p],f=s.create(null,d?n.text(d):[]);u.push(a.create(null,f))}l.push(i.create(null,u))}return l}function _h(t,e,n,r){void 0===r&&(r=null);for(var o=n.nodes,i=o.tableHeadCell,a=o.tableBodyCell,s=o.paragraph,l=0===e?i:a,c=[],u=0;u<t;u+=1)c.push(l.create(r,s.create()));return c}function jh(t,e){for(;t&&t!==e;){if("TD"===t.nodeName||"TH"===t.nodeName)return t;t=t.parentNode}return null}function Vh(t){return xh(t,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})}function Uh(t){if(t instanceof se){var e=t.$anchor,n=Vh(e);if(n){var r=e.node(0).resolve(e.before(n.depth));return{anchor:r,head:r}}}var o=t;return{anchor:o.startCell,head:o.endCell}}function $h(t){var e;if(t.size){var n=t.content,r=t.openStart,o=t.openEnd;if(1!==n.childCount)return null;for(;1===n.childCount&&(r>0&&o>0||"table"===(null===(e=n.firstChild)||void 0===e?void 0:e.type.name));)r-=1,o-=1,n=n.firstChild.content;if("tableHead"===n.firstChild.type.name||"tableBody"===n.firstChild.type.name)return n}return null}function Wh(t){var e=t.startRowIdx,n=t.startColIdx;return{rowCount:t.endRowIdx-e+1,columnCount:t.endColIdx-n+1}}function Gh(t,e){return Ni(Ni({},t.attrs),e)}var Kh=new Ne("cellSelection"),Jh=function(){function t(t){this.view=t,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return t.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},t.prototype.handleMousedown=function(t){var e=jh(t.target,this.view.dom);if(2!==t.button){if(e){var n=this.getCellPos(t);n&&(this.startCellPos=n),this.bindEvent()}}else t.preventDefault()},t.prototype.handleMousemove=function(t){var e,n=Kh.getState(this.view.state),r=this.getCellPos(t),o=this.startCellPos;n?e=this.view.state.doc.resolve(n):o!==r&&(e=o),e&&o&&r&&this.setCellSelection(o,r)},t.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==Kh.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(Kh,-1))},t.prototype.bindEvent=function(){var t=this.view.dom;t.addEventListener("mousemove",this.handlers.mousemove),t.addEventListener("mouseup",this.handlers.mouseup)},t.prototype.unbindEvent=function(){var t=this.view.dom;t.removeEventListener("mousemove",this.handlers.mousemove),t.removeEventListener("mouseup",this.handlers.mouseup)},t.prototype.getCellPos=function(t){var e=t.clientX,n=t.clientY,r=this.view.posAtCoords({left:e,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),a=Vh(i);if(a){var s=i.before(a.depth);return o.resolve(s)}}return null},t.prototype.setCellSelection=function(t,e){var n=this.view.state,r=n.selection,o=n.tr,i=null===Kh.getState(this.view.state),a=new qh(t,e);if(i||!r.eq(a)){var s=o.setSelection(a);i&&s.setMeta(Kh,e.pos),this.view.dispatch(s)}},t.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},t}(),Zh=Bs("cell-selected");function Xh(t){var e=t.selection,n=t.doc;if(e instanceof qh){var r=[];return e.ranges.forEach(function(t){var e=t.$from,n=t.$to;r.push(Zr.node(e.pos-1,n.pos+1,{class:Zh}))}),to.create(n,r)}return null}var Qh=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return Vi(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach(function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)})},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),Yh="en-US",tm=function(){function t(){this.code=Yh,this.langs=new Qh}return t.prototype.setCode=function(t){this.code=t||Yh},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach(function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,Oi(r,e))}else n.langs.set(t,e)})},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(Yh));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}(),em=new tm,nm=[[{action:"Add row to up",command:"addRowToUp",disableInThead:!0,className:"add-row-up"},{action:"Add row to down",command:"addRowToDown",disableInThead:!0,className:"add-row-down"},{action:"Remove row",command:"removeRow",disableInThead:!0,className:"remove-row"}],[{action:"Add column to left",command:"addColumnToLeft",className:"add-column-left"},{action:"Add column to right",command:"addColumnToRight",className:"add-column-right"},{action:"Remove column",command:"removeColumn",className:"remove-column"}],[{action:"Align column to left",command:"alignColumn",payload:{align:"left"},className:"align-column-left"},{action:"Align column to center",command:"alignColumn",payload:{align:"center"},className:"align-column-center"},{action:"Align column to right",command:"alignColumn",payload:{align:"right"},className:"align-column-right"}],[{action:"Remove table",command:"removeTable",className:"remove-table"}]];function rm(t,e){return nm.map(function(n){return n.map(function(n){var r=n.action,o=n.command,i=n.payload,a=n.disableInThead,s=n.className;return{label:em.get(r),onClick:function(){t.emit("command",o,i)},disabled:e&&!!a,className:s}})}).concat()}var om=["image","link","customBlock","frontMatter"],im=["strong","strike","emph","code"],am=["bulletList","orderedList","taskList"];function sm(t,e,n){var r=t.$from,o=t.$to,i=t.from,a=t.to,s={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}};return e.nodesBetween(i,a,function(t,e,i){var a=function(t,e){var n=t.type.name;return"listItem"===n?t.attrs.task?"taskList":e.type.name:-1!==n.indexOf("table")?"table":n}(t,i);xa(om,a)||(xa(am,a)?(function(t,e){e[t]={active:!0},am.filter(function(e){return e!==t}).forEach(function(t){e[t]&&delete e[t]})}(a,s),s.indent.disabled=!1,s.outdent.disabled=!1):"paragraph"===a||"text"===a?function(t,e,n,r){im.forEach(function(o){var i=n.marks[o],a=t.marksAcross(e)||[];i.isInSet(a)&&(r[o]={active:!0})})}(r,o,n,s):s[a]={active:!0})}),s}function lm(t){return new Te({view:function(){return{update:function(e){var n=e.state,r=n.selection,o=n.doc,i=n.schema;t.emit("changeToolbarState",{toolbarState:sm(r,o,i)})}}}})}var cm=function(){function t(t,e,n,r){var o=this;this.openEditor=function(){if(o.innerEditorView)throw new Error("The editor is already opened.");o.dom.draggable=!1,o.wrapper.style.display="none",o.innerViewContainer.style.display="block",o.innerEditorView=new po(o.innerViewContainer,{state:we.create({doc:o.node,plugins:[So({"Mod-z":function(){return Ci(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return Ti(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(t,e){return e(t.tr.insertText("\t")),!0},Enter:Po,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),xi()]}),dispatchTransaction:function(t){return o.dispatchInner(t)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=t,this.editorView=e,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Bs("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Bs("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return t.prototype.renderToolArea=function(){var t=this,e=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");e.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",function(){return t.openEditor()}),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e)},t.prototype.renderCustomBlock=function(){var t=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(t){for(var e=t(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);e&&this.wrapper.appendChild(e),this.renderToolArea()}},t.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Bs("custom-block-editor"),this.innerViewContainer.style.display="none"},t.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},t.prototype.saveAndFinishEditing=function(){var t=this.editorView.state.selection.to,e=this.editorView.state;this.editorView.dispatch(e.tr.setSelection(Va(e.tr,t))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},t.prototype.cancelEditing=function(){var t=function(t){var e=wi.getState(t);return e?e.done.eventCount:0}(this.innerEditorView.state);for(this.canceled=!0;t--;)Ci(this.innerEditorView.state,this.innerEditorView.dispatch),Ci(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var e=this.editorView.state.selection.to,n=this.editorView.state;this.editorView.dispatch(n.tr.setSelection(se.create(n.doc,e))),this.editorView.focus(),this.closeEditor()},t.prototype.dispatchInner=function(t){var e=this.innerEditorView.state.applyTransaction(t),n=e.state,r=e.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&nl(this.getPos)){for(var o=this.editorView.state.tr,i=Mt.offset(this.getPos()+1),a=0;a<r.length;a+=1)for(var s=r[a].steps,l=0;l<s.length;l+=1)o.step(s[l].map(i));o.docChanged&&this.editorView.dispatch(o)}},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,this.innerEditorView||this.renderCustomBlock(),!0)},t.prototype.stopEvent=function(t){return!!this.innerEditorView&&!!t.target&&this.innerEditorView.dom.contains(t.target)},t.prototype.ignoreMutation=function(){return!0},t.prototype.destroy=function(){this.dom.removeEventListener("dblclick",this.openEditor),this.closeEditor()},t}(),um="image-link",pm=function(){function t(t,e,n,r){var o,i=this;this.handleMousedown=function(t){t.preventDefault();var e=t.target,n=t.offsetX,r=t.offsetY;if(i.imageLink&&nl(i.getPos)&&ks(e,um)){var o=getComputedStyle(e,":before");if(t.stopPropagation(),Rs(o,n,r)){var a=i.view.state.tr,s=i.getPos();a.setSelection(Va(a,s,s+1)),i.view.dispatch(a),i.eventEmitter.emit("openPopup","link",i.imageLink.attrs)}}},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.imageLink=null!==(o=t.marks.filter(function(t){return"link"===t.type.name})[0])&&void 0!==o?o:null,this.dom=this.createElement(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.createImageElement(this.node);if(this.imageLink){var e=document.createElement("span");return e.className=um,e.appendChild(t),e}return t},t.prototype.createImageElement=function(t){var e=document.createElement("img"),n=t.attrs,r=n.imageUrl,o=n.altText,i=Dh(t.attrs);return e.src=r,o&&(e.alt=o),$s(i,e),e},t.prototype.bindEvent=function(){this.imageLink&&this.dom.addEventListener("mousedown",this.handleMousedown)},t.prototype.stopEvent=function(){return!0},t.prototype.destroy=function(){this.imageLink&&this.dom.removeEventListener("mousedown",this.handleMousedown)},t}(),dm=function(){function t(t,e,n,r){var o=this;this.dom=null,this.contentDOM=null,this.input=null,this.timer=null,this.handleMousedown=function(t){var e=t.target;if("none"!==getComputedStyle(e,":after").backgroundImage&&nl(o.getPos)){var n=o.view.coordsAtPos(o.getPos()),r=n.top,i=n.right;o.createLanguageEditor({top:r,right:i})}},this.handleKeydown=function(t){"Enter"===t.key&&o.input&&(t.preventDefault(),o.changeLanguage())},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.createElement(),this.bindDOMEvent(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.node.attrs.language,e=document.createElement("div");e.setAttribute("data-language",t||"text"),e.className="toastui-editor-ww-code-block";var n=this.createCodeBlockElement(),r=n.firstChild;e.appendChild(n),this.dom=e,this.contentDOM=r},t.prototype.createCodeBlockElement=function(){var t=document.createElement("pre"),e=document.createElement("code"),n=this.node.attrs.language,r=Dh(this.node.attrs);return n&&e.setAttribute("data-language",n),$s(r,t),t.appendChild(e),t},t.prototype.createLanguageEditor=function(t){var e=this,n=t.top,r=t.right,o=document.createElement("span");o.className="toastui-editor-ww-code-block-language";var i=document.createElement("input");i.type="text",i.value=this.node.attrs.language,o.appendChild(i),this.view.dom.parentElement.appendChild(o);var a=o.clientWidth;_i(o,{top:n+10+"px",left:r-a-10+"px",width:a+"px"}),this.input=i,this.input.addEventListener("blur",function(){return e.changeLanguage()}),this.input.addEventListener("keydown",this.handleKeydown),this.clearTimer(),this.timer=setTimeout(function(){e.input.focus()})},t.prototype.bindDOMEvent=function(){this.dom&&this.dom.addEventListener("click",this.handleMousedown)},t.prototype.bindEvent=function(){var t=this;this.eventEmitter.listen("scroll",function(){t.input&&t.reset()})},t.prototype.changeLanguage=function(){if(this.input&&nl(this.getPos)){var t=this.input.value;this.reset();var e=this.getPos(),n=this.view.state.tr;n.setNodeMarkup(e,null,{language:t}),this.view.dispatch(n)}},t.prototype.reset=function(){var t;if(null===(t=this.input)||void 0===t?void 0:t.parentElement){var e=this.input.parentElement;this.input=null,qs(e)}},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.stopEvent=function(){return!0},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,!0)},t.prototype.destroy=function(){this.reset(),this.clearTimer(),this.dom&&this.dom.removeEventListener("click",this.handleMousedown)},t}(),fm=/MsoListParagraph/,hm=/style=(.|\n)*mso-/,mm=/mso-list:(.*)/,vm=/O:P/,gm=/^(n|u|l)/;function ym(t){for(var e=[],n=document.createTreeWalker(t,1,null,!1);n.nextNode();){var r=n.currentNode;if(Hs(r)){var o=r,i=o.outerHTML,a=o.textContent,s=hm.test(i),l=mm.test(i);s&&!l&&a?e.push([r,!0]):(vm.test(r.nodeName)||s&&!a||l)&&e.push([r,!1])}}return e.forEach(function(t){var e=t[0];t[1]?function(t){for(var e=[];t.firstChild;)e.push(t.firstChild),t.parentNode&&t.parentNode.insertBefore(t.firstChild,t);qs(t)}(e):qs(e)}),t.innerHTML.trim()}function bm(t){var e=t[0].unordered?"ul":"ol",n=document.createElement(e);return t.forEach(function(t){var e=t.children,r=t.contents,o=document.createElement("li");o.innerHTML=r,n.appendChild(o),e.length&&n.appendChild(bm(e))}),n}function wm(t){return bm(function(t){var e=[];return t.forEach(function(t,n){var r=e[n-1],o=function(t,e){var n=t.getAttribute("style");if(n){var r=n.match(mm)[1].trim().split(" ")[1];return{id:e,level:parseInt(r.replace("level",""),10),prev:null,parent:null,children:[],unordered:gm.test(t.textContent||""),contents:ym(t)}}return null}(t,n);o&&(r&&function(t,e){if(e.level<t.level)e.children.push(t),t.parent=e;else{for(;e&&e.level!==t.level;)e=e.parent;e&&(t.prev=e,t.parent=e.parent,t.parent&&t.parent.children.push(t))}}(o,r),e.push(o))}),e}(t).filter(function(t){return!t.parent}))}function km(t){return function(t){return hm.test(t)}(t=function(t){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(t)&&(t="<tr>"+t+"</tr>"),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(t)&&(t="<table>"+t+"</table>"),t}(t=function(t){var e=t.indexOf("\x3c!--StartFragment--\x3e"),n=t.lastIndexOf("\x3c!--EndFragment--\x3e");return e>-1&&n>-1&&(t=t.slice(e+20,n)),t.replace(/<br[^>]*>/g,Is)}(t)))&&(t=function(t){var e=document.createElement("div");e.innerHTML=t;var n=[],r=function(t){var e=za(t.querySelectorAll("p.MsoListParagraph"));return e.length?e:[]}(e);return r.forEach(function(t){var r,o,i=function(t){for(;t&&!Hs(t);)t=t.nextSibling;return!t||!fm.test(t.className)}(t.nextSibling);if(n.push(t),i){var a=wm(n),s=t.nextSibling;s?(r=a,(o=s).parentNode&&o.parentNode.insertBefore(r,o)):function(t,e){(e=Ii(e)?za(e):[e]).forEach(function(e){t.appendChild(e)})}(e,a),n=[]}qs(t)}),(r.length?"<p></p>":"")+e.innerHTML}(t)),t}function xm(t,e,n){for(var r=[],o=t.childCount,i=0;i<o;i+=1)if(!t.child(i).attrs.extended){var a=i<o?n.create(t.child(i).attrs,t.child(i).content):n.createAndFill();r.push(a)}return r}function Cm(t,e,n){var r=n.nodes,o=r.tableRow,i=xm(t,0,r.tableHeadCell);return o.create(null,i)}function Tm(t,e,n){var r=n.nodes,o=r.tableRow,i=xm(t,0,r.tableBodyCell);return o.create(null,i)}function Em(t){var e=[],n=[];return"tableHead"===t.firstChild.type.name&&t.firstChild.forEach(function(t){return e.push(t)}),"tableBody"===t.lastChild.type.name&&t.lastChild.forEach(function(t){return n.push(t)}),Si(Si([],e),n)}function Mm(t,e,n){var r=Cm(t,0,n);return n.nodes.tableHead.create(null,r)}function Nm(t,e,n){var r=t.map(function(t){return Tm(t,0,n)});if(!t.length){var o=function(t,e){for(var n=e.nodes,r=n.tableRow,o=n.tableBodyCell,i=[],a=0;a<t;a+=1){var s=o.createAndFill();i.push(s)}return r.create({dummyRowForPasting:!0},i)}(e,n);r.push(o)}return n.nodes.tableBody.create(null,r)}function Sm(t){return 4*t}var Dm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),e}(Xs),Lm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"inline*",group:"block",attrs:Ni({},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"p"}],toDOM:function(t){return["p",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Om=/\s{1,4}$/,Am=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),e.prototype.addSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to;return!(!o.blockRange(i)||Ch(o)||Th(o)||(e(r.insertText(" ",o.pos,i.pos)),0))}},e.prototype.removeSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to,a=n.from;if(o.blockRange(i)&&!Ch(o)&&!Th(o)){var s=o.nodeBefore;if(s&&s.isText){var l=s.text,c=l.replace(Om,""),u=l.length-c.length;return e(r.delete(a-u,a)),!0}}return!1}},e.prototype.keymaps=function(){return{Tab:this.addSpaces(),"Shift-Tab":this.removeSpaces()}},e}(Xs),Im=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return[1,2,3,4,5,6]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=this.levels.map(function(t){return{tag:"h"+t,getAttrs:function(e){var n=e.getAttribute("data-raw-html");return Ni({level:t},n&&{rawHTML:n})}}});return{attrs:Ni({level:{default:1},headingType:{default:"atx"},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"inline*",group:"block",defining:!0,parseDOM:t,toDOM:function(t){var e=t.attrs;return["h"+e.level,Dh(e),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){return zo(e.schema.nodes[t.level?"heading":"paragraph"],t)(e,n)}}},e}(Xs),Rm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:Ni({language:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),code:!0,defining:!0,marks:"",parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){var e=t.getAttribute("data-raw-html"),n=t.firstElementChild;return Ni({language:(null==n?void 0:n.getAttribute("data-language"))||null},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"pre",["code",Ni({"data-language":e.language},Dh(e)),0]]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return zo(t.schema.nodes.codeBlock)(t,e)}}},e.prototype.moveCursor=function(t){var e=this;return function(n,r){var o,i=n.tr,a=n.doc,s=n.schema,l=n.selection.$from;if(e.context.view.endOfTextblock(t)&&"codeBlock"===l.node().type.name){var c=l.parent.textContent.split("\n"),u="up"===t?l.start():l.end(),p="up"===t?[u,c[0].length+u]:[u-Aa(c).length,u],d=a.resolve("up"===t?l.before():l.after()),f="up"===t?d.nodeBefore:d.nodeAfter;if((o=l.pos)>=p[0]&&o<=p[1]&&!f){var h=Ua(i,d,s);if(h)return r(h),!0}}return!1}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},e}(Xs),Pm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("ul")],toDOM:function(t){return["ul",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.changeList=function(){return function(t,e){return Ah(t.schema.nodes.bulletList)(t,e)}},e.prototype.commands=function(){return{bulletList:this.changeList,taskList:Ih}},e.prototype.keymaps=function(){var t=this.changeList(),e=Rh(),n=e.indent,r=e.outdent;return{"Mod-u":t,"Mod-U":t,Tab:n(),"Shift-Tab":r()}},e}(Xs),Bm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Ni({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(t){var e=t.getAttribute("start"),n=t.getAttribute("data-raw-html");return Ni({order:t.hasAttribute("start")?Number(e):1},n&&{rawHTML:n})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"ol",Ni({start:1===e.order?null:e.order},Dh(e)),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return Ah(t.schema.nodes.orderedList)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()(),e=Rh(),n=e.indent,r=e.outdent;return{"Mod-o":t,"Mod-O":t,Tab:n(),"Shift-Tab":r()}},e}(Xs),Fm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"paragraph block*",selectable:!1,attrs:{task:{default:!1},checked:{default:!1},rawHTML:{default:null}},defining:!0,parseDOM:[{tag:"li",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({task:t.hasAttribute("data-task"),checked:t.hasAttribute("data-task-checked")},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs,n=e.task,r=e.checked;if(!n)return[e.rawHTML||"li",0];var o=["task-list-item"];return r&&o.push("checked"),[e.rawHTML||"li",Ni({class:o.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),e.prototype.liftToPrevListItem=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,a=n.empty,s=o.nodes.listItem,l=i.parent,c=i.node(-1);if(a&&!l.childCount&&c.type===s){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),e(r),!0;if(i.node(-3).type===s)return r.delete(i.start(-2)-1,i.end(-1)),e(r),!0}return!1}},e.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(t,e){return(n=t.schema.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to;if(i.depth<2||!i.sameParent(a))return!1;var s=i.node(-1);if(s.type!==n)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==n||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,u=l.empty,p=i.depth-(c?1:2);p>=i.depth-3;p-=1)u=l.from(i.node(p).copy(u));return u=u.append(l.from(n.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new m(u,c?3:2,2)),r.setSelection(oe.near(r.doc.resolve(i.pos+(c?3:2)))),e(r),!0}var d=a.pos===i.end()?s.contentMatchAt(0).defaultType:null,f=d&&[null,{type:d}];return r.delete(i.pos,a.pos),!!jt(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),e(r),!0)})(t,e);var n}}},e}(Xs),Hm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[Mh("blockquote")],toDOM:function(t){return["blockquote",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return(n=t.schema.nodes.blockQuote,function(t,e){var r=t.selection,o=r.$from,i=r.$to,a=o.blockRange(i),s=a&&zt(a,n,undefined);return!!s&&(e&&e(t.tr.wrap(a,s).scrollIntoView()),!0)})(t,e);var n}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Alt-q":t,"Alt-Q":t}},e}(Xs),qm={left:function(t,e){var n=t[0],r=t[1],o=e.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var a=e.getCellInfo(n,r);return a.offset+a.nodeSize-2}return null},right:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount,i=e.totalColumnCount,a=r===i-1;if(n!==o-1||!a){var s=r+1,l=e.getColspanStartInfo(n,r);return(null==l?void 0:l.count)>1&&(s+=l.count-1),(a||s===i)&&(n+=1,s=0),e.getCellInfo(n,s).offset+2}return null},up:function(t,e){var n=t[0],r=t[1];if(n>0){var o=e.getCellInfo(n-1,r);return o.offset+o.nodeSize-2}return null},down:function(t,e){var n=t[0],r=t[1];if(n<e.totalRowCount-1){var o=n+1,i=e.getRowspanStartInfo(n,r);return(null==i?void 0:i.count)>1&&(o+=i.count-1),e.getCellInfo(o,r).offset+2}return null}};function zm(t,e,n){var r=n[0],o=n[1],i=e.getRowspanStartInfo(r,o),a="up"===t&&0===r,s="down"===t&&((null==i?void 0:i.count)>1?r+i.count-1:r)===e.totalRowCount-1;return a||s}function _m(t,e,n,r){void 0===r&&(r=!1);var o=t.doc.resolve(e.tableEndOffset);return r||!o.nodeAfter?Ua(t,o,n):t.setSelection(oe.near(o,1))}function jm(t,e,n,r){var o=(0,qm[t])(n,r);if(o){var i="right"===t||"down"===t?1:-1;return e.setSelection(oe.near(e.doc.resolve(o),i))}return null}function Vm(t,e,n){var r=t.getCellInfo(e,0).offset,o=t.getCellInfo(e,n-1);return{from:r,to:o.offset+o.nodeSize}}var Um=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("table")],toDOM:function(t){return["table",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.addTable=function(){return function(t){return void 0===t&&(t={rowCount:2,columnCount:1,data:[]}),function(e,n){var r=t.rowCount,o=t.columnCount,i=t.data,a=e.schema,s=e.selection,l=e.tr,c=s.from,u=s.to,p=s.$from;if(c===u&&!Th(p)){var d=a.nodes,f=d.tableHead,h=d.tableBody,m=null==i?void 0:i.slice(0,o),v=null==i?void 0:i.slice(o,i.length),g=function(t,e,n){for(var r=e.nodes,o=r.tableRow,i=r.tableHeadCell,a=r.paragraph,s=[],l=0;l<t;l+=1){var c=n&&n[l],u=a.create(null,c?e.text(c):[]);s.push(i.create(null,u))}return[o.create(null,s)]}(o,a,m),y=zh(r-1,o,a,v),b=a.nodes.table.create(null,[f.create(null,g),h.create(null,y)]);return n(l.replaceSelectionWith(b)),!0}return!1}}},e.prototype.removeTable=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Bh.create(n.$anchor);if(o){var i=o.tableStartOffset,a=o.tableEndOffset,s=i-1,l=Va(r.delete(s,a),s);return e(r.setSelection(l)),!0}return!1}}},e.prototype.addColumn=function(t){return function(){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){for(var c=Bh.create(s),u=c.getRectOffsets(s,l),p="left"===t?u.startColIdx:u.endColIdx+1,d=Wh(u).columnCount,f=c.totalRowCount,h=0;h<f;h+=1){var m=_h(d,h,i);o.insert(o.mapping.map(c.posAt(h,p)),m)}return n(o),!0}return!1}}},e.prototype.removeColumn=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Uh(n),i=o.anchor,a=o.head;if(i&&a){var s=Bh.create(i),l=s.getRectOffsets(i,a),c=s.totalColumnCount,u=s.totalRowCount;if(Wh(l).columnCount===c)return!1;for(var p=l.startColIdx,d=l.endColIdx,f=r.mapping.maps.length,h=0;h<u;h+=1)for(var m=d;m>=p;m-=1){var v=s.getCellInfo(h,m),g=v.offset,y=v.nodeSize,b=r.mapping.slice(f).map(g),w=b+y;r.delete(b,w)}return e(r),!0}return!1}}},e.prototype.addRow=function(t){return function(){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c=Bh.create(s),u=c.totalColumnCount,p=c.getRectOffsets(s,l),d=Wh(p).rowCount,f=function(t,e,n){var r,o,i;return"up"===t?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=e.totalColumnCount-1,i=e.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(t,c,p),h=f.targetRowIdx,m=f.insertColIdx,v=f.nodeSize;if(0!==h){for(var g=[],y=i.mapping.map(c.posAt(h,m))+v,b=[],w=0;w<u;w+=1)b=b.concat(_h(1,h,o));for(var k=0;k<d;k+=1)g.push(o.nodes.tableRow.create(null,b));return n(i.insert(y,g)),!0}}return!1}}},e.prototype.removeRow=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Uh(n),i=o.anchor,a=o.head;if(i&&a){var s=Bh.create(i),l=s.totalRowCount,c=s.totalColumnCount,u=s.getRectOffsets(i,a),p=Wh(u).rowCount,d=u.startRowIdx,f=u.endRowIdx;if(p===l-1||0===d)return!1;for(var h=f;h>=d;h-=1){var m=Vm(s,h,c),v=m.from,g=m.to;r.delete(v-1,g+1)}return e(r),!0}return!1}}},e.prototype.alignColumn=function(){return function(t){return void 0===t&&(t={align:"center"}),function(e,n){var r=t.align,o=e.selection,i=e.tr,a=Uh(o),s=a.anchor,l=a.head;if(s&&l){for(var c=Bh.create(s),u=c.totalRowCount,p=c.getRectOffsets(s,l),d=p.startColIdx,f=p.endColIdx,h=0;h<u;h+=1)for(var m=d;m<=f;m+=1)if(!c.extendedRowspan(h,m)&&!c.extendedColspan(h,m)){var v=c.getNodeAndPos(h,m),g=v.node,y=v.pos,b=Gh(g,{align:r});i.setNodeMarkup(y,null,b)}return n(i),!0}return!1}}},e.prototype.moveToCell=function(t){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c,u=Bh.create(s),p=u.getCellIndex(s);if(c=zm(t,u,p)?_m(o,u,i):jm(t,o,p,u))return n(c),!0}return!1}},e.prototype.moveInCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,a=n.doc,s=n.schema,l=o.$from;if(!e.context.view.endOfTextblock(t))return!1;var c=xh(l,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name});if(c){var u=xh(l,function(t){return"paragraph"===t.type.name}),p=c.depth;if(u&&function(t,e,n,r){var o=e[0],i=e[1],a=o+3,s=i>=a,l=s?o+1:i,c=function(t,e,n,r,o){var i=e[2];if("left"===t||"up"===t){if(o&&!function(t,e,n){var r=n[0],o=n[1],i=e.resolve(t.before(r-1));return o===r&&!i.nodeBefore}(n,r,[e[0],e[1]]))return!1;var a=n.before(i);if(r.resolve(a).nodeBefore)return!1}return!0}(t,[i,a,l],n,r,s),u=function(t,e,n,r,o){if("right"===t||"down"===t){if(o&&!function(t){for(var e,n,r=t.depth;r&&"tableBodyCell"!==(n=t.node(r)).type.name;){if("listItem"===n.type.name){var o=t.node(r-1).lastChild===n,i="paragraph"!==(null===(e=n.lastChild)||void 0===e?void 0:e.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(e);if(r.resolve(i).nodeAfter)return!1}return!0}(t,l,n,r,s);return c&&u}(t,[p,u.depth],l,a)){var d=Uh(o).anchor,f=Bh.create(d),h=f.getCellIndex(d),m=void 0;if(function(t,e,n){var r=n[0],o=n[1];if("up"===t||"down"===t)return!1;var i=e.tableStartOffset,a=e.tableEndOffset,s=e.getCellInfo(r,o),l=s.offset,c=s.nodeSize;return("left"===t?i:a)===("left"===t?l-2:l+c+3)}(t,f,h)?m=function(t,e,n){var r=t.doc.resolve(e.before(n-3));return t.setSelection(new ce(r))}(i,l,p):zm(t,f,h)?"up"===t?m=function(t,e,n){var r=t.doc.resolve(e.tableStartOffset-1);return r.nodeBefore?t.setSelection(oe.near(r,-1)):Ua(t,r,n)}(i,f,s):"down"===t&&(m=_m(i,f,s)):m=jm(t,i,h,f),m)return r(m),!0}}return!1}},e.prototype.deleteCells=function(){return function(t,e){var n=t.schema,r=t.selection,o=t.tr,i=Uh(r),a=i.anchor,s=i.head;if(a&&s&&!(r instanceof se)){for(var l=Bh.create(a),c=l.getRectOffsets(a,s),u=c.startRowIdx,p=c.startColIdx,d=c.endRowIdx,f=c.endColIdx,h=u;h<=d;h+=1)for(var m=p;m<=f;m+=1)if(!l.extendedRowspan(h,m)&&!l.extendedColspan(h,m)){var v=l.getNodeAndPos(h,m),g=v.node,y=v.pos,b=_h(1,h,n,g.attrs);o.replaceWith(o.mapping.map(y),o.mapping.map(y+g.nodeSize),b)}return e(o),!0}return!1}},e.prototype.exitTable=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from;if(xh(i,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})&&xh(i,function(t){return"paragraph"===t.type.name})){var a=Uh(n).anchor;return e(_m(r,Bh.create(a),o,!0)),!0}return!1}},e.prototype.commands=function(){return{addTable:this.addTable(),removeTable:this.removeTable(),addColumnToLeft:this.addColumn("left"),addColumnToRight:this.addColumn("right"),removeColumn:this.removeColumn(),addRowToUp:this.addRow("up"),addRowToDown:this.addRow("down"),removeRow:this.removeRow(),alignColumn:this.alignColumn()}},e.prototype.keymaps=function(){var t=this.deleteCells();return{Tab:this.moveToCell("right"),"Shift-Tab":this.moveToCell("left"),ArrowUp:this.moveInCell("up"),ArrowDown:this.moveInCell("down"),ArrowLeft:this.moveInCell("left"),ArrowRight:this.moveInCell("right"),Backspace:t,"Mod-Backspace":t,Delete:t,"Mod-Delete":t,"Mod-Enter":this.exitTable()}},e}(Xs),$m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableHead"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableRow{1}",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("thead")],toDOM:function(t){return["thead",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Wm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableBody"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableRow+",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tbody",getAttrs:function(t){var e=t.querySelectorAll("tr")[0].children.length,n=t.getAttribute("data-raw-html");return!!e&&Ni({},n&&{rawHTML:n})}}],toDOM:function(t){return["tbody",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Gm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableRow"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"(tableHeadCell | tableBodyCell)*",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tr",getAttrs:function(t){var e=t.children.length,n=t.getAttribute("data-raw-html");return!!e&&Ni({},n&&{rawHTML:n})}}],toDOM:function(t){return["tr",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Km=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableHeadCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"paragraph+",attrs:Ni({align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},extended:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),isolating:!0,parseDOM:[Sh("th")],toDOM:function(t){var e=t.attrs,n=Nh(e);return["th",Ni(Ni({},n),Dh(e)),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Jm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableBodyCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"(paragraph | bulletList | orderedList)+",attrs:{align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},rowspan:{default:null},extended:{default:null}},isolating:!0,parseDOM:[Sh("td")],toDOM:function(t){return["td",Nh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Zm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"image"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{inline:!0,attrs:Ni({imageUrl:{default:""},altText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"img[src]",getAttrs:function(t){var e=eh(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("src")||"",r=e.getAttribute("data-raw-html"),o=e.getAttribute("alt");return Ni({imageUrl:n,altText:o},r&&{rawHTML:r})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"img",Ni(Ni({src:ka(e.imageUrl)},e.altText&&{alt:e.altText}),Dh(e))]}}},enumerable:!1,configurable:!0}),e.prototype.addImage=function(){return function(t){return function(e,n){var r=e.schema,o=e.tr,i=t,a=i.imageUrl,s=i.altText;if(!a)return!1;var l=r.nodes.image.createAndFill(Ni({imageUrl:a},s&&{altText:s}));return n(o.replaceSelectionWith(l).scrollIntoView()),!0}}},e.prototype.commands=function(){return{addImage:this.addImage()}},e}(Xs),Xm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"block",parseDOM:[{tag:"hr"}],selectable:!1,toDOM:function(t){var e=t.attrs;return["div",Dh(e),[e.rawHTML||"hr"]]}}},enumerable:!1,configurable:!0}),e.prototype.hr=function(){var t=this;return function(){return function(e,n){var r,o=e.selection,i=o.$from;if(i===o.$to){var a=e.doc,s=e.schema.nodes,l=s.thematicBreak,c=s.paragraph,u=[l.create()],p=i.node(1),d=a.child(a.childCount-1)===p,f=a.resolve(i.after(1)),h=(null===(r=i.nodeAfter)||void 0===r?void 0:r.type.name)===t.name;return(d||h)&&u.push(c.create()),n(e.tr.insert(f.pos,u).scrollIntoView()),!0}return!1}}},e.prototype.commands=function(){return{hr:this.hr()}},e.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},e}(Xs),Qm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["b","strong"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"strong",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.bold=function(){return function(){return function(t,e){return _o(t.schema.marks.strong)(t,e)}}},e.prototype.commands=function(){return{bold:this.bold()}},e.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},e}(Pl),Ym=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["i","em"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"em",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.italic=function(){return function(){return function(t,e){return _o(t.schema.marks.emph)(t,e)}}},e.prototype.commands=function(){return{italic:this.italic()}},e.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},e}(Pl),tv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["s","del"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"del",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return _o(t.schema.marks.strike)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},e}(Pl),ev=function(t){function e(e){var n=t.call(this)||this;return n.linkAttributes=e,n}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=this;return{attrs:Ni({linkUrl:{default:""},title:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){var e=eh(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("href")||"",r=e.getAttribute("title")||"",o=e.getAttribute("data-raw-html");return Ni({linkUrl:n,title:r},o&&{rawHTML:o})}}],toDOM:function(e){var n=e.attrs;return[n.rawHTML||"a",Ni(Ni({href:ka(n.linkUrl)},t.linkAttributes),Dh(n))]}}},enumerable:!1,configurable:!0}),e.prototype.addLink=function(){return function(t){return function(e,n){var r=t,o=r.linkUrl,i=r.linkText,a=void 0===i?"":i,s=e.schema,l=e.tr,c=e.selection,u=c.empty,p=c.from,d=c.to;if(p&&d&&o){var f={linkUrl:o},h=s.mark("link",f);if(u&&a){var m=ja(s,a,h);l.replaceRangeWith(p,d,m)}else l.addMark(p,d,h);return n(l.scrollIntoView()),!0}return!1}}},e.prototype.toggleLink=function(){return function(t){return function(e,n){return _o(e.schema.marks.link,t)(e,n)}}},e.prototype.commands=function(){return{addLink:this.addLink(),toggleLink:this.toggleLink()}},e}(Pl),nv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"code",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"code",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return _o(t.schema.marks.code)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},e}(Pl),rv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:{info:{default:null}},atom:!0,code:!0,defining:!0,parseDOM:[{tag:"div[data-custom-info]",getAttrs:function(t){return{info:t.getAttribute("data-custom-info")}}}],toDOM:function(t){return["div",{"data-custom-info":t.attrs.info||null},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){return!!(null==t?void 0:t.info)&&zo(e.schema.nodes.customBlock,t)(e,n)}}},e}(Xs),ov=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"frontMatter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-front-matter]"}],toDOM:function(){return["div",{"data-front-matter":"true"},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e,n){var r=t.selection.$from;return!(!n.endOfTextblock("down")||"frontMatter"!==r.node().type.name)&&Fo(t,e)}}},e.prototype.keymaps=function(){return{Enter:this.commands()()}},e}(Xs),iv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"htmlComment"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-html-comment]"}],toDOM:function(){return["div",{"data-html-comment":"true"},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e,n){var r=t.selection.$from;return!(!n.endOfTextblock("down")||"htmlComment"!==r.node().type.name)&&Fo(t,e)}}},e.prototype.keymaps=function(){return{Enter:this.commands()()}},e}(Xs),av=Bs("contents"),sv=function(t){function e(e,n){var r=t.call(this,e)||this,o=n.toDOMAdaptor,i=n.htmlSchemaMap,a=void 0===i?{}:i,s=n.linkAttributes,l=void 0===s?{}:s,c=n.useCommandShortcut,u=void 0===c||c,p=n.wwPlugins,d=void 0===p?[]:p,f=n.wwNodeViews,h=void 0===f?{}:f;return r.editorType="wysiwyg",r.el.classList.add("ww-mode"),r.toDOMAdaptor=o,r.linkAttributes=l,r.extraPlugins=d,r.pluginNodeViews=h,r.specs=r.createSpecs(),r.schema=r.createSchema(a),r.context=r.createContext(),r.keymaps=r.createKeymaps(u),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Ni(Ni({},r.context),{view:r.view})),r.initEvent(),r}return Mi(e,t),e.prototype.createSpecs=function(){return t=this.linkAttributes,new il([new Dm,new Lm,new Am,new Im,new Rm,new Pm,new Bm,new Fm,new Hm,new Um,new $m,new Wm,new Gm,new Km,new Jm,new Zm,new Xm,new Qm,new Ym,new tv,new ev(t),new nv,new rv,new ov,new tl,new iv]);var t},e.prototype.createContext=function(){return{schema:this.schema,eventEmitter:this.eventEmitter}},e.prototype.createSchema=function(t){return new it({nodes:Ni(Ni({},this.specs.nodes),t.nodes),marks:Ni(Ni({},this.specs.marks),t.marks)})},e.prototype.createPlugins=function(){return Si([new Te({key:Kh,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(Kh);if(n)return-1===n?null:n;if(sa(e)||!t.docChanged)return e;var r=t.mapping.mapResult(e),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:Xh,createSelectionBetween:function(t){var e=t.state;return sa(Kh.getState(e))?null:e.selection}},view:function(t){return new Jh(t)}}),(t=this.eventEmitter,new Te({props:{handleDOMEvents:{contextmenu:function(e,n){var r=jh(n.target,e.dom);if(r){n.preventDefault();var o=n,i=o.clientX,a=o.clientY,s=e.dom.parentNode.getBoundingClientRect(),l=s.left,c=s.top,u="TH"===r.nodeName;return t.emit("contextmenu",{pos:{left:i-l+10+"px",top:a-c+30+"px"},menuGroups:rm(t,u),tableCell:r}),!0}return!1}}}})),new Te({props:{handleDOMEvents:{mousedown:function(t,e){var n=e,r=n.clientX,o=n.clientY,i=t.posAtCoords({left:r,top:o});if(i){var a=t.state,s=a.doc,l=a.tr,c=s.resolve(i.pos),u=Eh(c),p=e.target,d=getComputedStyle(p,":before"),f=e,h=f.offsetX,m=f.offsetY;if(!u||!Rs(d,h,m))return!1;e.preventDefault();var v=c.before(u.depth),g=u.node.attrs;return l.setNodeMarkup(v,null,Ni(Ni({},g),{checked:!g.checked})),t.dispatch(l),!0}return!1}}}}),lm(this.eventEmitter)],this.createPluginProps()).concat(this.defaultPlugins);var t},e.prototype.createPluginNodeViews=function(){var t=this.eventEmitter,e=this.pluginNodeViews,n={};return e&&Object.keys(e).forEach(function(r){n[r]=function(n,o,i){return e[r](n,o,i,t)}}),n},e.prototype.createView=function(){var t=this,e=this.toDOMAdaptor,n=this.eventEmitter;return new po(this.el,{state:this.createState(),attributes:{class:av},nodeViews:Ni({customBlock:function(t,n,r){return new cm(t,n,r,e)},image:function(t,e,r){return new pm(t,e,r,n)},codeBlock:function(t,e,r){return new dm(t,e,r,n)},widget:Qs},this.createPluginNodeViews()),dispatchTransaction:function(e){var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e.scrollIntoView()),t.eventEmitter.emit("setFocusedNode",n.selection.$from.node(1))},transformPastedHTML:km,transformPasted:function(e){return function(t,e,n){var r=[],o=t.content,i=t.openStart,a=t.openEnd;return o.forEach(function(t){if("table"===t.type.name){var o=$h(new m(l.from(t),0,0));if(o){var i=Em(o),a="tableBody"===o.firstChild.type.name,s=function(t,e,n,r){var o=function(t){return t.reduce(function(t,e){return t.childCount>e.childCount?t:e}).childCount}(t);if(n&&r)return e.nodes.table.create(null,[Nm(t,o,e)]);var i=t[0],a=t.slice(1),s=[Mm(i,0,e)];return a.length&&s.push(Nm(a,o,e)),e.nodes.table.create(null,s)}(i,e,a,n);r.push(s)}}else r.push(t)}),new m(l.from(r),i,a)}(e,t.schema,Th(t.view.state.selection.$from))},handlePaste:function(t,e,n){return function(t,e){var n=t.state,r=n.selection,o=n.schema,i=n.tr,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c=$h(e);if(!c)return!1;var u=Bh.create(s),p=u.getRectOffsets(s,l),d=function(t,e,n){var r=[],o=Em(t),i=(o[0].childCount,o.length),a=0===e.startRowIdx,s=o.slice(0,i);if(a){var l=s.shift();if(l){var c=Cm(l,0,n).content;r.push(c)}}return s.forEach(function(t){if(!t.attrs.dummyRowForPasting){var e=Tm(t,0,n).content;r.push(e)}}),r}(c,p,o),f=function(t,e,n){for(var r=e.startRowIdx,o=e.startColIdx,i=n.length,a=0,s=function(t){var e=n[t].childCount;n[t].forEach(function(t){var n=t.attrs.colspan;n>1&&(e+=n-1)}),a=Math.max(a,e)},l=0;l<i;l+=1)s(l);var c=r+i-1,u=o+a-1;return{startRowIdx:r,startColIdx:o,endRowIdx:c,endColIdx:u,addedRowCount:Math.max(c+1-t.totalRowCount,0),addedColumnCount:Math.max(u+1-t.totalColumnCount,0)}}(u,p,d),h=[];return function(t,e){var n=Wh(t.getSpannedOffsets(e)),r=n.rowCount,o=n.columnCount,i=Wh(e),a=i.rowCount,s=i.columnCount;return r===a&&o===s}(u,f)&&(function(t,e){for(var n=t.startRowIdx,r=t.startColIdx,o=t.endRowIdx,i=t.endColIdx,a=t.addedRowCount,s=t.addedColumnCount,l=n;l<=o-a;l+=1)e.push({rowIdx:l,startColIdx:r,endColIdx:i-s})}(f,h),f.addedColumnCount&&function(t,e,n,r,o){for(var i=r.startRowIdx,a=r.startColIdx,s=r.endRowIdx,l=r.endColIdx,c=r.addedRowCount,u=r.addedColumnCount,p=n.totalRowCount,d=0,f=0;f<p;f+=1){var h=n.getCellInfo(f,l-u),m=h.offset,v=h.nodeSize,g=t.mapping.map(m+v),y=_h(u,f,e);if(t.insert(g,y),f>=i&&f<=s-c){var b=n.getCellInfo(f,l-u),w=t.mapping.map(b.offset),k=g+Sm(u);o[d]={rowIdx:f,startColIdx:a,endColIdx:l,dummyOffsets:[w,k]},d+=1}}}(i,o,u,f,h),f.addedRowCount&&function(t,e,n,r,o){var i=r.addedRowCount,a=r.addedColumnCount,s=r.startColIdx,l=r.endColIdx,c=t.mapping.maps.length,u=n.tableEndOffset-2,p=zh(i,n.totalColumnCount+a,e),d=u;t.insert(t.mapping.slice(c).map(d),p);for(var f=0;f<i;f+=1){var h=d+Sm(s)+1,m=d+Sm(l+1)+1,v=d+Sm(n.totalColumnCount+a)+2;o.push({rowIdx:f+n.totalRowCount,startColIdx:s,endColIdx:l,dummyOffsets:[h,m]}),d=v}}(i,o,u,f,h),function(t,e,n,r){var o=t.mapping.maps.length;n.forEach(function(n,i){var a=n.rowIdx,s=n.startColIdx,l=n.endColIdx,c=n.dummyOffsets,u=t.mapping.slice(o),p=new m(e[i],0,0),d=c?c[0]:r.getCellStartOffset(a,s),f=c?c[1]:r.getCellEndOffset(a,l);t.replace(u.map(d),u.map(f),p)})}(i,d,h,u),t.dispatch(i),function(t,e,n){var r=t.state,o=r.tr,i=r.doc,a=Bh.create(i.resolve(n)),s=e[0],l=s.rowIdx,c=s.startColIdx,u=Aa(e),p=u.rowIdx,d=u.endColIdx,f=a.getCellInfo(l,c).offset,h=a.getCellInfo(p,d).offset;t.dispatch(o.setSelection(new qh(i.resolve(f),i.resolve(h))))}(t,h,u.getCellInfo(0,0).offset)),!0}return!1}(t,n)},handleKeyDown:function(e,n){return t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{paste:function(e,n){var r=n.clipboardData||window.clipboardData,o=null==r?void 0:r.items;if(o&&!za(o).some(function(t){return"string"===t.kind&&"text/rtf"===t.type})){var i=Js(o);i&&(n.preventDefault(),Ks(t.eventEmitter,i,n.type))}return!1},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0}}})},e.prototype.createCommands=function(){return this.specs.commands(this.view,Rh())},e.prototype.getHTML=function(){return this.view.dom.innerHTML},e.prototype.getModel=function(){return this.view.state.doc},e.prototype.getSelection=function(){var t=this.view.state.selection;return[t.from,t.to]},e.prototype.getSchema=function(){return this.view.state.schema},e.prototype.replaceSelection=function(t,e,n){var r=this.view.state,o=r.schema,i=r.tr,a=t.split("\n").map(function(t){return _a(o,vs(t,o))}),s=new m(l.from(a),1,1),c=aa(e)&&aa(n)?i.replaceRange(e,n,s):i.replaceSelection(s);this.view.dispatch(c),this.focus()},e.prototype.deleteSelection=function(t,e){var n=this.view.state.tr,r=aa(t)&&aa(e)?n.deleteRange(t,e):n.deleteSelection();this.view.dispatch(r.scrollIntoView())},e.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,a=o.to;return aa(t)&&aa(e)&&(i=t,a=e),r.textBetween(i,a,"\n")},e.prototype.setModel=function(t,e){void 0===e&&(e=!1);var n=this.view.state,r=n.tr,o=n.doc;this.view.dispatch(r.replaceWith(0,o.content.size,t)),e&&this.moveCursorToEnd(!0)},e.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=Va(n,t,e);this.view.dispatch(n.setSelection(r).scrollIntoView())},e.prototype.addWidget=function(t,e,n){var r=this.view,o=r.dispatch,i=r.state;o(i.tr.setMeta("widget",{pos:null!=n?n:i.selection.to,node:t,style:e}))},e.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=vs(n,r.schema);this.view.dispatch(o.replaceWith(t,e,i))},e.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t?n.resolve(t):r.$from,i=o.marks(),a=o.node(),s=o.start(),l=o.end(),c=a.type.name;if(i.length||"paragraph"===c){var u=i[i.length-1];c=u?u.type.name:"text",a.forEach(function(t,e){var n=t.isText,r=t.nodeSize,i=t.marks,a=o.pos-s;n&&e<=a&&e+r>=a&&function(t){return!t.length||xa(t,u)}(i)&&(l=(s+=e)+r)})}return{range:[s,l],type:c}},e}(el),lv=Ui,cv=sa,uv=function(t){return!(e=t,lv(e)||cv(e)||!1===t);var e},pv=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],dv=function(){function t(){var t=this;this.events=new Qh,this.eventTypes=pv.reduce(function(t,e){return Ni(Ni({},t),{type:e})},{}),this.hold=!1,pv.forEach(function(e){t.addEventType(e)})}return t.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this.getTypeInfo(t),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach(function(t){var n=t.apply(void 0,e);Ui(n)||i.push(n)}),i},t.prototype.emitReduce=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(t);return!this.hold&&o&&o.forEach(function(t){var r=t.apply(void 0,Si([e],n));!uv(r)||(e=r)}),e},t.prototype.getTypeInfo=function(t){var e=t.split(".");return{type:e[0],namespace:e[1]}},t.prototype.hasEventType=function(t){return!Ui(this.eventTypes[this.getTypeInfo(t).type])},t.prototype.addEventType=function(t){if(this.hasEventType(t))throw new Error("There is already have event type "+t);this.eventTypes[t]=t},t.prototype.removeEventHandler=function(t,e){var n=this,r=this.getTypeInfo(t),o=r.type,i=r.namespace;o&&e?this.removeEventHandlerWithHandler(o,e):o&&!i?this.events.delete(o):!o&&i?this.events.forEach(function(t,e){n.removeEventHandlerWithTypeInfo(e,i)}):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},t.prototype.removeEventHandlerWithHandler=function(t,e){var n=this.events.get(t);if(n){var r=n.indexOf(e);n.indexOf(e)>=0&&n.splice(r,1)}},t.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map(function(t){return t.namespace!==e&&n.push(t),null}),this.events.set(t,n))},t.prototype.getEvents=function(){return this.events},t.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},t}(),fv=function(){function t(t,e,n,r){this.eventEmitter=t,this.mdCommands=e,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return t.prototype.initEvent=function(){var t=this;this.eventEmitter.listen("command",function(e,n){t.exec(e,n)})},t.prototype.addCommand=function(t,e,n){"markdown"===t?this.mdCommands[e]=n:this.wwCommands[e]=n},t.prototype.deleteCommand=function(t,e){"markdown"===t?delete this.mdCommands[e]:delete this.wwCommands[e]},t.prototype.exec=function(t,e){"markdown"===this.getEditorType()?this.mdCommands[t](e):this.wwCommands[t](e)},t}();function hv(t){return"\n"===t[t.length-1]?t.slice(0,t.length-1):t}function mv(t,e){var n=t.schema,r=e.literal.match(Ls);if(r){var o=r[1],i=r[3],a=(o||i).toLowerCase();return"htmlInline"===e.type&&!(!n.marks[a]&&!n.nodes[a])}return!1}function vv(t){return xa(["text","strong","emph","strike","image","link","code"],t.type)}function gv(t){return"softbreak"===(null==t?void 0:t.type)}function yv(t){var e=t.type,n=t.literal,r="htmlInline"===e&&n.match(Ls);if(r){var o=r[1],i=r[3],a=o||i;if(a)return xa(["ul","ol","li"],a.toLowerCase())}return!1}function bv(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=document.createElement("div");r.innerHTML=eh(t);var o=r.firstChild;return e.map(function(t){return o.getAttribute(t)||""})}var wv=function(t){var e={};return Object.keys(t).forEach(function(n){n.split(", ").forEach(function(r){var o=r.toLowerCase();e[o]=t[n]})}),e}({"b, strong":function(t,e,n){var r=t.schema.marks.strong;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"i, em":function(t,e,n){var r=t.schema.marks.emph;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"s, del":function(t,e,n){var r=t.schema.marks.strike;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},code:function(t,e,n){var r=t.schema.marks.code;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},a:function(t,e,n){var r=e.literal,o=t.schema.marks.link;if(n){var i=bv(r,"href")[0];t.openMark(o.create({linkUrl:i,rawHTML:n}))}else t.closeMark(o)},img:function(t,e,n){var r=e.literal;if(n){var o=bv(r,"src","alt"),i=o[0],a=o[1],s=t.schema.nodes.image;t.addNode(s,Ni({rawHTML:n,imageUrl:i},a&&{altText:a}))}},hr:function(t,e,n){t.addNode(t.schema.nodes.thematicBreak,{rawHTML:n})},br:function(t,e){var n=t.schema.nodes.paragraph,r=e.parent,o=e.prev,i=e.next;"paragraph"===(null==r?void 0:r.type)?(gv(o)&&t.openNode(n),gv(i)?t.closeNode():i&&(t.closeNode(),t.openNode(n))):"tableCell"===(null==r?void 0:r.type)&&(o&&(vv(o)||mv(t,o))&&t.closeNode(),i&&(vv(i)||mv(t,i))&&t.openNode(n))},pre:function(t,e,n){var r,o,i=document.createElement("div");i.innerHTML=e.literal;var a=null===(o=null===(r=i.firstChild)||void 0===r?void 0:r.firstChild)||void 0===o?void 0:o.textContent;t.openNode(t.schema.nodes.codeBlock,{rawHTML:n}),t.addText(hv(a)),t.closeNode()},"ul, ol":function(t,e,n){if("tableCell"===e.parent.type){var r=t.schema.nodes,o=r.bulletList,i=r.orderedList,a=r.paragraph,s="ul"===n?o:i;n?(e.prev&&!yv(e.prev)&&t.closeNode(),t.openNode(s,{rawHTML:n})):(t.closeNode(),e.next&&!yv(e.next)&&t.openNode(a))}},li:function(t,e,n){var r;if("tableCell"===(null===(r=e.parent)||void 0===r?void 0:r.type)){var o=t.schema.nodes,i=o.listItem,a=o.paragraph;if(n){var s=function(t){var e=t.literal;return{task:/data-task/.test(e),checked:/data-task-checked/.test(e)}}(e);e.prev&&!yv(e.prev)&&t.closeNode(),t.openNode(i,Ni({rawHTML:n},s)),e.next&&!yv(e.next)&&t.openNode(a)}else e.prev&&!yv(e.prev)&&t.closeNode(),t.closeNode()}}});function kv(t){return"htmlInline"===t.type&&Os.test(t.literal)}function xv(t){za(t.childNodes).forEach(function(t){if(Hs(t)){var e=t.nodeName.toLowerCase();t.setAttribute("data-raw-html",e),t.childNodes&&xv(t)}})}var Cv={text:function(t,e){t.addText(e.literal||"")},paragraph:function(t,e,n,r){var o;if(n.entering){var i=t.schema.nodes.paragraph;"paragraph"===(null===(o=e.prev)||void 0===o?void 0:o.type)&&(t.openNode(i,r),t.closeNode()),t.openNode(i,r)}else t.closeNode()},heading:function(t,e,n,r){if(n.entering){var o=e,i=o.level,a=o.headingType;t.openNode(t.schema.nodes.heading,Ni({level:i,headingType:a},r))}else t.closeNode()},codeBlock:function(t,e,n){var r=t.schema.nodes.codeBlock,o=e,i=o.info,a=o.literal;t.openNode(r,Ni({language:i},n)),t.addText(hv(a||"")),t.closeNode()},list:function(t,e,n,r){if(n.entering){var o=t.schema.nodes,i=o.bulletList,a=o.orderedList,s=e.listData,l=s.type,c=s.start;"bullet"===l?t.openNode(i,r):t.openNode(a,Ni({order:c},r))}else t.closeNode()},item:function(t,e,n,r){var o=n.entering,i=t.schema.nodes.listItem,a=e.listData,s=a.task,l=a.checked;if(o){var c=Ni(Ni(Ni({},s&&{task:s}),l&&{checked:l}),r);t.openNode(i,c)}else t.closeNode()},blockQuote:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.blockQuote,r):t.closeNode()},image:function(t,e,n,r){var o=n.entering,i=n.skipChildren,a=t.schema.nodes.image,s=e,l=s.destination,c=s.firstChild;o&&i&&i(),t.addNode(a,Ni(Ni({imageUrl:l},c&&{altText:c.literal}),r))},thematicBreak:function(t,e,n,r){t.addNode(t.schema.nodes.thematicBreak,r)},strong:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strong;o?t.openMark(i.create(r)):t.closeMark(i)},emph:function(t,e,n,r){var o=n.entering,i=t.schema.marks.emph;o?t.openMark(i.create(r)):t.closeMark(i)},link:function(t,e,n,r){var o=n.entering,i=t.schema.marks.link,a=e,s=a.destination,l=a.title;if(o){var c=Ni({linkUrl:s,title:l},r);t.openMark(i.create(c))}else t.closeMark(i)},softbreak:function(t,e){if("paragraph"===e.parent.type){var n=e.prev,r=e.next;n&&!kv(n)&&t.closeNode(),r&&!kv(r)&&t.openNode(t.schema.nodes.paragraph)}},table:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.table,r):t.closeNode()},tableHead:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableHead,r):t.closeNode()},tableBody:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableBody,r):t.closeNode()},tableRow:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableRow,r):t.closeNode()},tableCell:function(t,e,n){var r=n.entering;if(!e.ignored){var o=function(e){return e&&(vv(e)||mv(t,e))};if(r){var i=t.schema.nodes,a=i.tableHeadCell,s=i.tableBodyCell,l=i.paragraph,c=e.parent.parent,u="tableHead"===c.type?a:s,p=(c.parent.columns[e.startIdx]||{}).align,d=Ni({},e.attrs);p&&(d.align=p),t.openNode(u,d),o(e.firstChild)&&t.openNode(l)}else o(e.lastChild)&&t.closeNode(),t.closeNode()}},strike:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strike;o?t.openMark(i.create(r)):t.closeMark(i)},code:function(t,e,n,r){var o=t.schema.marks.code;t.openMark(o.create(r)),t.addText(hv(e.literal||"")),t.closeMark(o)},customBlock:function(t,e){var n=t.schema.nodes,r=n.customBlock,o=n.paragraph,i=e,a=i.info,s=i.literal;t.openNode(r,{info:a}),t.addText(hv(s||"")),t.closeNode(),e.next||(t.openNode(o),t.closeNode())},frontMatter:function(t,e){t.openNode(t.schema.nodes.frontMatter),t.addText(e.literal),t.closeNode()},htmlInline:function(t,e){var n=e.literal,r=n.match(Ls),o=r[1],i=r[3],a=(o||i).toLowerCase(),s=t.schema.marks[a],l=eh(n);if(null==s?void 0:s.spec.attrs.htmlInline)if(o){var c=rh(l);t.openMark(s.create({htmlAttrs:c}))}else t.closeMark(s);else{var u=wv[a];u&&u(t,e,o)}},htmlBlock:function(t,e){var n=e.literal,r=document.createElement("div");if(As.test(n))t.openNode(t.schema.nodes.htmlComment),t.addText(e.literal),t.closeNode();else{var o=n.match(Ls),i=o[1],a=o[3],s=(i||a).toLowerCase(),l=t.schema.nodes[s],c=eh(n);if(null==l?void 0:l.spec.attrs.htmlBlock){var u=rh(c),p=nh(e,s);t.addNode(l,{htmlAttrs:u,childrenHTML:p})}else r.innerHTML=c,xv(r),t.convertByDOMParser(r)}},customInline:function(t,e,n){var r=n.entering,o=n.skipChildren,i=e,a=i.info,s=i.firstChild,l=t.schema;if(-1!==a.indexOf("widget")&&r){var c=gs(e);o(),t.addNode(l.nodes.widget,{info:a},[l.text(fs(a,c))])}else{var u="$$";r&&(u+=s?a+" ":a),t.addText(u)}}},Tv=function(){function t(t,e){this.schema=t,this.convertors=e,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=f.none}return t.prototype.top=function(){return Aa(this.stack)},t.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},t.prototype.addText=function(t){if(t){var e=this.top().content,n=Aa(e),r=this.schema.text(t,this.marks),o=n&&(a=r,!!((i=n).isText&&a.isText&&f.sameSet(i.marks,a.marks))&&i.withText(i.text+a.text));o?e[e.length-1]=o:e.push(r)}var i,a},t.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},t.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},t.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},t.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},t.prototype.closeNode=function(){this.marks.length&&(this.marks=f.none);var t=this.stack.pop(),e=t.type,n=t.attrs,r=t.content;return this.addNode(e,n,r)},t.prototype.convertByDOMParser=function(t){var e=this;st.fromSchema(this.schema).parse(t).content.forEach(function(t){return e.push(t)})},t.prototype.closeUnmatchedHTMLInline=function(t,e){var n;if(!e&&"htmlInline"!==t.type)for(var r=this.stack.length-1;r>=0;r-=1){var o=this.stack[r];if(!(null===(n=o.attrs)||void 0===n?void 0:n.rawHTML))break;o.content.length?this.closeNode():this.stack.pop()}},t.prototype.convert=function(t,e){for(var n=t.walker(),r=n.next(),o=function(){var t=r.node,o=r.entering,a=i.convertors[t.type],s=!1;if(a){var l={entering:o,leaf:!ss(t),getChildrenText:ls,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){s=!0}};if(i.closeUnmatchedHTMLInline(t,o),a(i,t,l),(null==e?void 0:e.node)===t){var c=i.stack.reduce(function(t,e){return t+e.content.reduce(function(t,e){return t+e.nodeSize},0)},0)+1;e.setMappedPos(c)}}s&&(n.resumeAt(t,!1),n.next()),r=n.next()},i=this;r;)o()},t.prototype.convertNode=function(t,e){return this.convert(t,e),this.stack.length?this.closeNode():null},t}(),Ev={text:function(t,e){var n,r=e.node,o=null!==(n=r.text)&&void 0!==n?n:"";(r.marks||[]).some(function(t){return"link"===t.type.name})?t.text(Na(o),!1):t.text(o)},paragraph:function(t,e){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o;if(t.stopNewline)t.convertInline(n);else{var a=0===i,s=!a&&r.child(i-1),l=s&&0===s.childCount,c=i<r.childCount-1&&r.child(i+1),u=c&&"paragraph"===c.type.name,p=0===n.childCount;if(p&&l)t.write("<br>\n");else if(!p||l||a)t.convertInline(n),u?t.write("\n"):t.closeBlock(n);else{if("listItem"===(null==r?void 0:r.type.name)){var d=t.getDelim();t.setDelim(""),t.write("<br>"),t.setDelim(d)}t.write("\n")}}},heading:function(t,e,n){var r=e.node,o=n.delim;"atx"===r.attrs.headingType?(t.write(o+" "),t.convertInline(r),t.closeBlock(r)):(t.convertInline(r),t.ensureNewLine(),t.write(o),t.closeBlock(r))},codeBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,a=o,s=a[0],l=a[1];t.write(s),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(l),t.closeBlock(r)},blockQuote:function(t,e,n){var r=e.node,o=e.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&t.flushClose(1),t.wrapBlock(i,null,r,function(){return t.convertNode(r)})},bulletList:function(t,e,n){var r=e.node,o=n.delim;t.convertList(r,Ma(" ",4),function(){return o+" "})},orderedList:function(t,e){var n=e.node,r=n.attrs.order||1;t.convertList(n,Ma(" ",4),function(t){return String(r+t)+". "})},listItem:function(t,e){var n=e.node,r=n.attrs,o=r.task,i=r.checked;o&&t.write("["+(i?"x":" ")+"] "),t.convertNode(n)},image:function(t,e,n){var r=n.attrs;t.write("!["+(null==r?void 0:r.altText)+"]("+(null==r?void 0:r.imageUrl)+")")},thematicBreak:function(t,e,n){var r=e.node,o=n.delim;t.write(o),t.closeBlock(r)},table:function(t,e){var n=e.node;t.convertNode(n),t.closeBlock(n)},tableHead:function(t,e,n){var r=e.node,o=n.delim,i=r.firstChild;t.convertNode(r);var a=null!=o?o:"";!o&&i&&i.forEach(function(t){var e=function(t,e){var n=t.length,r="",o="";return"left"===e?(r=":",n-=1):"right"===e?(o=":",n-=1):"center"===e&&(r=":",o=":",n-=2),""+r+Ma("-",Math.max(n,3))+o}(t.textContent,t.attrs.align);a+="| "+e+" "}),t.write(a+"|"),t.ensureNewLine()},tableBody:function(t,e){var n=e.node;t.convertNode(n)},tableRow:function(t,e){var n=e.node;t.convertNode(n),t.write("|"),t.ensureNewLine()},tableHeadCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},tableBodyCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},customBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,a=o,s=a[0],l=a[1];t.write(s),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(l),t.closeBlock(r)},frontMatter:function(t,e,n){var r=e.node,o=n.text;t.text(o,!1),t.closeBlock(r)},widget:function(t,e,n){var r=n.text;t.write(r)},html:function(t,e,n){var r=e.node,o=n.text;t.write(o),r.attrs.htmlBlock&&t.closeBlock(r)},htmlComment:function(t,e,n){var r=e.node,o=n.text;t.write(o),t.closeBlock(r)}};function Mv(t,e){var n=t.text,r=/`+/g,o=0;if(t.isText&&n)for(var i=r.exec(n);i;)o=Math.max(o,i[0].length),i=r.exec(n);for(var a=o>0&&e>0?" `":"`",s=0;s<o;s+=1)a+="`";return o>0&&e<0&&(a+=" "),a}function Nv(t){return t?["<"+t+">","</"+t+">"]:null}function Sv(t){return t?"<"+t+">":null}function Dv(t){return t?"</"+t+">":null}var Lv={heading:function(t){var e=t.node.attrs,n=e.level,r=Ma("#",n);return"setext"===e.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:Nv(e.rawHTML)}},codeBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:Nv(n.rawHTML),text:r}},blockQuote:function(t){return{delim:"> ",rawHTML:Nv(t.node.attrs.rawHTML)}},bulletList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:Nv(o)}},orderedList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:Nv(o)}},listItem:function(t,e){var n=t.node,r=e.inTable,o=n.attrs,i=o.task,a=o.checked,s=n.attrs.rawHTML;return r&&(s=s||"li"),{rawHTML:s?["<"+s+(i?' class="task-list-item'+(a?" checked":"")+'"':"")+(i?" data-task"+(a?" data-task-checked":""):"")+">","</"+s+">"]:null}},table:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableHead:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableBody:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableRow:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableHeadCell:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableBodyCell:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},image:function(t){var e=t.node.attrs,n=e.rawHTML,r=e.altText,o=e.imageUrl.replace(/&amp;/g,"&"),i=r?' alt="'+ka(r)+'"':"";return{rawHTML:n?"<"+n+' src="'+ka(o)+'"'+i+">":null,attrs:{altText:Na(r||""),imageUrl:o}}},thematicBreak:function(t){return{delim:"***",rawHTML:Sv(t.node.attrs.rawHTML)}},customBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(t){return{text:t.node.textContent}},widget:function(t){return{text:t.node.textContent}},strong:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="**";return n||(a=o?"<strong>":"</strong>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},emph:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="*";return n||(a=o?"<em>":"</em>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},strike:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="~~";return n||(a=o?"<del>":"</del>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},link:function(t,e){var n=t.node,r=e.entering,o=n.attrs,i=o.title,a=o.rawHTML,s=o.linkUrl.replace(/&amp;/g,"&"),l=i?' title="'+ka(i)+'"':"";return r?{delim:"[",rawHTML:a?"<"+a+' href="'+ka(s)+'"'+l+">":null}:{delim:"]("+s+(i?" "+Da(Na(i)):"")+")",rawHTML:Dv(a)}},code:function(t,e){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o,a=e.entering;return{delim:a?Mv(r.child(i),-1):Mv(r.child(i-1),1),rawHTML:a?Sv(n.attrs.rawHTML):Dv(n.attrs.rawHTML)}},htmlComment:function(t){return{text:t.node.textContent}},html:function(t,e){var n=t.node,r=e.entering,o=n.type.name,i=n.attrs.htmlAttrs,a="<"+o,s="</"+o+">";return Object.keys(i).forEach(function(t){a+=" "+t+'="'+i[t].replace(/"/g,"'")+'"'}),a+=">",n.attrs.htmlInline?{rawHTML:r?a:s}:{text:""+a+n.attrs.childrenHTML+s}}},Ov={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Av(t){var e={};return Object.keys(Ev).forEach(function(n){e[n]=function(e,r){if(Ev[n]){var o=t[n],i=o?o(r,{inTable:e.inTable}):{};!function(t,e){var n=e.state,r=e.nodeInfo,o=e.params,i=o.rawHTML;i?Vi(t,["heading","codeBlock"])>-1?function(t,e,n){var r=n[0],o=n[1];t.write(r),t.convertInline(e),t.write(o)}(n,r.node,i):Vi(t,["image","thematicBreak"])>-1?n.write(i):function(t,e,n){var r=e.node,o=e.parent,i=n[0],a=n[1];t.stopNewline=!0,t.write(i),t.convertNode(r),t.write(a),"doc"===(null==o?void 0:o.type.name)&&(t.closeBlock(r),t.stopNewline=!1)}(n,r,i):Ev[t](n,r,o)}(n,{state:e,nodeInfo:r,params:i})}}}),e}var Iv=function(){function t(t){var e=t.nodeTypeConvertors,n=t.markTypeConvertors;this.nodeTypeConvertors=e,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return t.prototype.getMarkConvertor=function(t){var e=t.attrs.htmlInline?"html":t.type.name;return this.markTypeConvertors[e]},t.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},t.prototype.isBetweenSpaces=function(t,e){var n,r,o,i=t.content,a=0===e||(o=null!==(n=i.child(e-1).text)&&void 0!==n?n:"a",/(\S*)\s$/g.test(o)),s=e>=i.childCount-1||function(t){return/^\s(\S*)/g.test(t)}(null!==(r=i.child(e+1).text)&&void 0!==r?r:"a");return a&&s},t.prototype.markText=function(t,e,n,r){var o=this.getMarkConvertor(t);if(o){var i=o({node:t,parent:n,index:r},e,this.isBetweenSpaces(n,e?r:r-1)),a=i.delim;return i.rawHTML||a}return""},t.prototype.setDelim=function(t){this.delim=t},t.prototype.getDelim=function(){return this.delim},t.prototype.flushClose=function(t){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),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+=1)this.result+=e+"\n"}this.closed=!1}},t.prototype.wrapBlock=function(t,e,n,r){var o=this.getDelim();this.write(e||t),this.setDelim(this.getDelim()+t),r(),this.setDelim(o),this.closeBlock(n)},t.prototype.ensureNewLine=function(){this.isInBlank()||(this.result+="\n")},t.prototype.write=function(t){void 0===t&&(t=""),this.flushClose(),this.delim&&this.isInBlank()&&(this.result+=this.delim),t&&(this.result+=t)},t.prototype.closeBlock=function(t){this.closed=t},t.prototype.text=function(t,e){void 0===e&&(e=!0);for(var n=t.split("\n"),r=0;r<n.length;r+=1)this.write(),this.result+=e?Sa(n[r]):n[r],r!==n.length-1&&(this.result+="\n")},t.prototype.convertBlock=function(t,e,n){var r=t.type.name,o=this.nodeTypeConvertors[r],i={node:t,parent:e,index:n};t.attrs.htmlBlock?this.nodeTypeConvertors.html(this,i):o&&o(this,i)},t.prototype.convertInline=function(t){var e=this,n=[],r="",o=function(o,i,a){var s=o?o.marks:[],l=r;if(r="",o&&o.isText&&s.some(function(t){var n=e.getMarkConvertor(t),r=n&&n();return r&&r.removedEnclosingWhitespace})&&o&&o.text){var c=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=c[1],p=c[2],d=c[3];l+=u,r=d,(u||d)&&((o=p?o.withText(p):null)||(s=n))}for(var f=s.length&&Aa(s),h=f&&e.getMarkConvertor(f),m=h&&h(),v=m&&!1===m.escape,g=s.length-(v?1:0),y=0;y<g&&(p=s[y],!m||m.mixable);y+=1)for(var b=0;b<n.length;b+=1){var w=n[b];if(m&&!m.mixable)break;if(p.eq(w)){y>b?s=s.slice(0,b).concat(p).concat(s.slice(b,y)).concat(s.slice(y+1,g)):b>y&&(s=s.slice(0,y).concat(s.slice(y+1,b)).concat(p).concat(s.slice(b,g)));break}}for(var k=0;k<Math.min(n.length,g)&&s[k].eq(n[k]);)k+=1;for(;k<n.length;){var x=n.pop();x&&e.text(e.markText(x,!1,t,a),!1)}if(l&&e.text(l),o){for(;n.length<g;)p=s[n.length],n.push(p),e.text(e.markText(p,!0,t,a),!1);v&&o.isText?e.text(e.markText(f,!0,t,a)+o.text+e.markText(f,!1,t,a+1),!1):e.convertBlock(o,t,a)}};t.forEach(o),o(null,0,t.childCount)},t.prototype.convertList=function(t,e,n){var r,o=this;this.closed&&this.closed.type===t.type?this.flushClose(3):this.tightList&&this.flushClose(1);var i=null===(r=t.attrs.tight)||void 0===r||r,a=this.tightList;this.tightList=i,t.forEach(function(r,a,s){s&&i&&o.flushClose(1),o.wrapBlock(e,n(s),t,function(){return o.convertBlock(r,t,s)})}),this.tightList=a},t.prototype.convertTableCell=function(t){var e=this;this.stopNewline=!0,this.inTable=!0,t.forEach(function(n,r,o){xa(["bulletList","orderedList"],n.type.name)?(e.convertBlock(n,t,o),e.closed=!1):(e.convertInline(n),o<t.childCount-1&&"paragraph"===t.child(o+1).type.name&&e.write("<br>"))}),this.stopNewline=!1,this.inTable=!1},t.prototype.convertNode=function(t,e){var n=this;return t.forEach(function(r,o,i){if(n.convertBlock(r,t,i),(null==e?void 0:e.node)===r){var a=n.result.split("\n");e.setMappedPos([a.length,Aa(a).length+1])}}),this.result},t}(),Rv=function(){function t(t,e,n,r){var o,i=this;this.setMappedPos=function(t){i.mappedPosWhenConverting=t},this.schema=t,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(t){var e=Object.keys(t),n=Ni({},Cv),r=new rf({gfm:!0,nodeId:!0,convertors:t}).getConvertors();return e.forEach(function(e){var o=Cv[e];o&&!xa(["htmlBlock","htmlInline"],e)&&(n[e]=function(n,i,a){a.origin=function(){return r[e](i,a,r)};var s,l=t[e](i,a);if(l){var c=Array.isArray(l)?l[0]:l;s={htmlAttrs:c.attributes,classNames:c.classNames}}o(n,i,a,s)})}),n}(n),this.toMdConvertors=(o=e||{},Object.keys(o).forEach(function(t){var e=Lv[t],n=o[t];Lv[t]=e?function(t,r){return r.origin=function(){return e(t,r)},n(t,r)}:n,delete o[t]}),{nodeTypeConvertors:Av(Lv),markTypeConvertors:function(t){var e={};return Object.keys(Ov).forEach(function(n){e[n]=function(e,r,o){var i=Ov[n],a=t[n],s=a&&e&&!Ui(r)?a(e,{entering:r},o):{};return Ni(Ni({},s),i)}}),e}(Lv)}),this.eventEmitter.listen("setFocusedNode",function(t){return i.focusedNode=t})}return t.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},t.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},t.prototype.toWysiwygModel=function(t){return new Tv(this.schema,this.toWwConvertors).convertNode(t,this.getInfoForPosSync())},t.prototype.toMarkdownText=function(t){var e=new Iv(this.toMdConvertors).convertNode(t,this.getInfoForPosSync());return this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",e)},t}();function Pv(t,e,n){return e.listen("mixinTableOffsetMapPrototype",Hh),(null!=t?t:[]).reduce(function(t,r){var o=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:Te,PluginKey:Ne,Selection:oe,TextSelection:se},pmView:{Decoration:Zr,DecorationSet:to},pmModel:{Fragment:l},pmRules:{InputRule:Jo,inputRules:Zo,undoInputRule:Qo},i18n:em};if(Ii(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(r,e,n);if(!o)throw new Error("The return value of the executed plugin is empty.");var i=o.markdownParsers,a=o.toHTMLRenderers,s=o.toMarkdownRenderers,c=o.markdownPlugins,u=o.wysiwygPlugins,p=o.wysiwygNodeViews,d=o.markdownCommands,f=o.wysiwygCommands,h=o.toolbarItems;return a&&(t.toHTMLRenderers=Ra(t.toHTMLRenderers,a)),s&&(t.toMarkdownRenderers=Ra(t.toMarkdownRenderers,s)),c&&(t.mdPlugins=t.mdPlugins.concat(c)),u&&(t.wwPlugins=t.wwPlugins.concat(u)),p&&(t.wwNodeViews=Ni(Ni({},t.wwNodeViews),p)),d&&(t.mdCommands=Ni(Ni({},t.mdCommands),d)),f&&(t.wwCommands=Ni(Ni({},t.wwCommands),f)),h&&(t.toolbarItems=t.toolbarItems.concat(h)),i&&(t.markdownParsers=Ni(Ni({},t.markdownParsers),i)),t},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Bv=function(){function t(t){var e=this;this.options=Oi({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},t),this.eventEmitter=new dv;var n,r=Ea(this.options.linkAttributes),o=Pv(this.options.plugins,this.eventEmitter,this.options.usageStatistics)||{},i=o.toHTMLRenderers,a=o.markdownParsers,s=this.options,l=s.customHTMLRenderer,c=s.extendedAutolinks,u=s.referenceDefinition,p=s.frontMatter,d=s.customHTMLSanitizer,f={linkAttributes:r,customHTMLRenderer:Ni(Ni({},i),l),extendedAutolinks:c,referenceDefinition:u,frontMatter:p,sanitizer:d||eh};n=f.customHTMLRenderer,["htmlBlock","htmlInline"].forEach(function(t){n[t]&&Object.keys(n[t]).forEach(function(t){return th(t)})}),this.options.events&&Li(this.options.events,function(t,n){e.on(n,t)});var h=this.options,m=h.el,v=h.initialValue,g=h.theme,y=m.innerHTML;"light"!==g&&m.classList.add(Bs(g)),m.innerHTML="",this.toastMark=new Zd("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:c,referenceDefinition:u,disallowDeepHeading:!0,frontMatter:p,customParser:a}),this.preview=new kh(this.eventEmitter,Ni(Ni({},f),{isViewer:!0})),Qc(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),v?this.setMarkdown(v):y&&this.preview.setHTML(y),m.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return t.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&Rs(n,t.offsetX,t.offsetY)&&(zs(e,"checked"),this.eventEmitter.emit("change",{source:"viewer",date:t}))},t.prototype.setMarkdown=function(t){var e=this.toastMark.getLineTexts(),n=[e.length,Aa(e).length+1],r=this.toastMark.editMarkdown([1,1],n,t||"");this.eventEmitter.emit("updatePreview",r)},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.destroy=function(){Gc(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},t.prototype.isViewer=function(){return!0},t.prototype.isMarkdownMode=function(){return!1},t.prototype.isWysiwygMode=function(){return!1},t}();function Fv(t){return t instanceof B}function Hv(t){return xa(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],t)}var qv={openTag:function(t,e){var n=t,r=n.tagName,o=n.classNames,i=n.attributes,a=document.createElement(r),s={};o&&(a.className=o.join(" ")),i&&(s=Ni(Ni({},s),i)),$s(s,a),e.push(a)},closeTag:function(t,e){if(e.length>1){var n=e.pop();Aa(e).appendChild(n)}},html:function(t,e){Aa(e).insertAdjacentHTML("beforeend",t.content)},text:function(t,e){var n=document.createTextNode(t.content);Aa(e).appendChild(n)}},zv=function(){function t(t,e){var n=ch(t,e),r=Ni(Ni({},e.htmlBlock),e.htmlInline);this.customConvertorKeys=Object.keys(e).concat(Object.keys(r)),this.renderer=new rf({gfm:!0,convertors:Ni(Ni({},n),r)}),this.convertors=this.renderer.getConvertors()}return t.prototype.generateTokens=function(t){var e=function(t){var e=t.attrs,n=t.type.name,r={type:n,wysiwygNode:!0,literal:!Hv(n)&&Fv(t)?t.textContent:null},o={heading:{level:e.level},link:{destination:e.linkUrl,title:e.title},image:{destination:e.imageUrl},codeBlock:{info:e.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:e.order}},listItem:{type:"item",listData:{task:e.task,checked:e.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:e.align},tableBodyCell:{type:"tableCell",cellType:"body",align:e.align},customBlock:{info:e.info}}[n],i=Ni(Ni({},r),o),a=t.attrs,s=a.htmlAttrs,l=a.childrenHTML;return s?Ni(Ni({},i),{attrs:s,childrenHTML:l}):i}(t),n={entering:!0,leaf:!!Fv(t)&&t.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Fv(t)?t.textContent:""},skipChildren:function(){return!1}},r=this.convertors[t.type.name],o=r(e,n,this.convertors),i=Ii(o)?o:[o];return(Hv(t.type.name)||t.attrs.htmlInline)&&(n.entering=!1,i.push({type:"text",content:Fv(t)?t.textContent:""}),i=i.concat(r(e,n,this.convertors))),i},t.prototype.toDOMNode=function(t){var e=this.generateTokens(t),n=[];return e.forEach(function(t){return qv[t.type](t,n)}),n[0]},t.prototype.getToDOMNode=function(t){return xa(this.customConvertorKeys,t)?this.toDOMNode.bind(this):null},t}(),_v=null,jv=null;function Vv(t,e){var n=e.syncScrollTop,r=e.releaseEventBlock;jv&&clearTimeout(jv),n(t),jv=setTimeout(function(){r()},15)}var Uv=function(){function t(t,e,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0,this.timer=null;var r=e.previewContent,o=e.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=t,this.editorView=t.view,this.toastMark=t.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return t.prototype.addScrollSyncEvent=function(){var t=this;this.eventEmitter.listen("afterPreviewRender",function(){t.clearTimer(),t.timer=setTimeout(function(){t.syncPreviewScrollTop(!0)},200)}),this.eventEmitter.listen("scroll",function(e,n){t.active&&("editor"===e&&"editor"!==t.blockedScroll?t.syncPreviewScrollTop():"preview"===e&&"preview"!==t.blockedScroll&&t.syncEditorScrollTop(n))}),this.eventEmitter.listen("toggleScrollSync",function(e){t.active=e})},t.prototype.getMdNodeAtPos=function(t,e){var n=t.content.findIndex(e.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},t.prototype.getScrollTopByCaretPos=function(){var t=this.mdEditor.getSelection(),e=this.toastMark.findFirstNodeAtLine(t[0][0]),n=this.previewEl.clientHeight,r=gh(this.previewRoot,e).el,o=(mh(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().top<n?null:o},t.prototype.syncPreviewScrollTop=function(t){void 0===t&&(t=!1);var e=this,n=e.editorView,r=e.previewEl,o=e.previewRoot,i=n.dom.getBoundingClientRect(),a=i.left,s=i.top,l=n.posAtCoords({left:a,top:s}),c=n.state.doc,u=this.getMdNodeAtPos(c,l);if(u&&!function(t){var e=t.type;return"htmlBlock"===e||"htmlInline"===e}(u)){var p=r.scrollTop,d=n.dom,f=d.scrollTop,h=d.scrollHeight,m=d.clientHeight,v=d.children,g=h-f<=m+18,y=g?r.scrollHeight:0;if(f&&!g){if(t){var b=this.getScrollTopByCaretPos();if(!b)return;y=b}else{var w=gh(this.previewRoot,u),k=w.el,x=fh(c,w.mdNode,v),C=x.height,T=x.rect;y=(mh(k,o)||k.offsetTop)+k.clientHeight*(s>T.top?Math.min((s-T.top)/C,1):0)}y=this.getResolvedScrollTop("editor",f,y,p),this.latestEditorScrollTop=f}y!==p&&this.run("editor",y,p)}},t.prototype.syncEditorScrollTop=function(t){var e=this,n=e.toastMark,r=e.editorView,o=e.previewRoot,i=e.previewEl,a=r.dom,s=r.state,l=i.scrollTop,c=i.clientHeight,u=i.scrollHeight-l<=c,p=a.scrollTop,d=u?a.scrollHeight:0;if(l&&t&&!u){if(t=function(t,e){for(;!t.getAttribute("data-nodeid")&&t.parentElement!==e;)t=t.parentElement;return t}(t,o),!t.getAttribute("data-nodeid"))return;var f=a.children,h=Number(t.getAttribute("data-nodeid")),m=gh(this.previewRoot,n.findNodeById(h)),v=m.mdNode,g=m.el;d=f[Ga(v)-1].offsetTop;var y=fh(s.doc,v,f).height,b=function(t,e,n){var r,o=yh[r=n]&&yh[r].height,i=function(t){return yh[t]&&yh[t].offsetTop}(n),a=o||t.clientHeight,s=i||mh(t,e)||t.offsetTop;return o||function(t,e){yh[t]=yh[t]||{},yh[t].height=e}(n,a),i||function(t,e){yh[t]=yh[t]||{},yh[t].offsetTop=e}(n,s),{nodeHeight:a,offsetTop:s}}(g,o,h),w=b.nodeHeight;d+=function(t,e,n,r){return Math.min((t-e)/n,1)*r}(l,b.offsetTop,w,y),d=this.getResolvedScrollTop("preview",l,d,p),this.latestPreviewScrollTop=l}d!==p&&this.run("preview",d,p)},t.prototype.getResolvedScrollTop=function(t,e,n,r){var o="editor"===t?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o<e?Math.max(n,r):Math.min(n,r)},t.prototype.run=function(t,e,n){var r,o=this;"editor"===t?(r=this.previewEl,this.blockedScroll="preview"):(r=this.editorView.dom,this.blockedScroll="editor"),function(t,e,n){var r=e-t,o=Date.now(),i=function(){var a,s=(Date.now()-o)/100;_v&&clearTimeout(_v),s<1?(a=t+r*Math.cos((1-s)*Math.PI/2),Vv(Math.ceil(a),n),_v=setTimeout(i,1)):(Vv(e,n),_v=null)};i()}(n,e,{syncScrollTop:function(t){return r.scrollTop=t},releaseEventBlock:function(){return o.blockedScroll=null}})},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.destroy=function(){this.clearTimer(),this.eventEmitter.removeEventHandler("scroll"),this.eventEmitter.removeEventHandler("afterPreviewRender")},t}(),$v={getPopupInitialValues:function(t,e){return"link"===e.popupName?{linkText:t.getSelectedText()}:{}}},Wv=function(){function t(t){var e=this;this.initialHTML=t.el.innerHTML,t.el.innerHTML="",this.options=Oi({previewStyle:"tab",previewHighlight:!0,initialEditType:"markdown",height:"300px",minHeight:"200px",language:"en-US",useCommandShortcut:!0,usageStatistics:!0,toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","image","link"],["code","codeblock"],["scrollSync"]],hideModeSwitch:!1,linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,customMarkdownRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,widgetRules:[],theme:"light",autofocus:!0},t);var n=this.options,r=n.customHTMLRenderer,o=n.extendedAutolinks,i=n.referenceDefinition,a=n.frontMatter,s=n.customMarkdownRenderer,l=n.useCommandShortcut,c=n.initialEditType,u=n.widgetRules,p=n.customHTMLSanitizer;this.mode=c||"markdown",this.mdPreviewStyle=this.options.previewStyle,this.i18n=em,this.i18n.setCode(this.options.language),this.eventEmitter=new dv,(cs=u).forEach(function(t,e){us["widget"+e]=t});var d=Ea(this.options.linkAttributes);this.pluginInfo=Pv(this.options.plugins,this.eventEmitter,this.options.usageStatistics);var f,h=this.pluginInfo,m=h.toHTMLRenderers,v=h.toMarkdownRenderers,g=h.mdPlugins,y=h.wwPlugins,b=h.wwNodeViews,w=h.mdCommands,k=h.wwCommands,x=h.markdownParsers,C={linkAttributes:d,customHTMLRenderer:Ra(m,r),extendedAutolinks:o,referenceDefinition:i,frontMatter:a,sanitizer:p||eh},T=new zv(d,C.customHTMLRenderer),E=function(t,e,n){var r={nodes:{},marks:{}};return["htmlBlock","htmlInline"].forEach(function(o){t[o]&&Object.keys(t[o]).forEach(function(t){var i="htmlBlock"===o?"nodes":"marks";th(t),r[i][t]=ah[o](t,e,n)})}),r}(C.customHTMLRenderer,C.sanitizer,T);this.toastMark=new Zd("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:o,referenceDefinition:i,disallowDeepHeading:!0,frontMatter:a,customParser:x}),this.mdEditor=new qc(this.eventEmitter,{toastMark:this.toastMark,useCommandShortcut:l,mdPlugins:g}),this.preview=new kh(this.eventEmitter,Ni(Ni({},C),{isViewer:!1,highlight:this.options.previewHighlight})),this.wwEditor=new sv(this.eventEmitter,{toDOMAdaptor:T,useCommandShortcut:l,htmlSchemaMap:E,linkAttributes:d,wwPlugins:y,wwNodeViews:b}),this.convertor=new Rv(this.wwEditor.getSchema(),Ni(Ni({},v),s),ch(d,C.customHTMLRenderer),this.eventEmitter),this.setMinHeight(this.options.minHeight),this.setHeight(this.options.height),this.setMarkdown(this.options.initialValue,!1),this.options.placeholder&&this.setPlaceholder(this.options.placeholder),this.options.initialValue||this.setHTML(this.initialHTML,!1),this.commandManager=new fv(this.eventEmitter,this.mdEditor.commands,this.wwEditor.commands,function(){return e.mode}),this.options.usageStatistics&&function(t,e){var n=location.hostname,r="TOAST UI "+t+" for "+n+": Statistics",o=window.localStorage.getItem(r);(ca(window.tui)||!1!==window.tui.usageStatistics)&&(o&&!function(t){/* @__PURE__ */
1
+ "use strict";var t=require("./index-Ch4YhLU3.js"),e=require("react"),n=require("./DefaultPropsProvider-C8GxU9me.js");function r(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=/* @__PURE__ */Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e}var o=/* @__PURE__ */r(e);function i(t){this.content=t}function a(t,e,n){for(var r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;var o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var l=a(o.content,i.content,n+1);if(null!=l)return l}n+=o.nodeSize}else n+=o.nodeSize}}function s(t,e,n,r){for(var o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var a=t.child(--o),l=e.child(--i),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){for(var u=0,p=Math.min(a.text.length,l.text.length);u<p&&a.text[a.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){var d=s(a.content,l.content,n-1,r-1);if(d)return d}n-=c,r-=c}else n-=c,r-=c}}i.prototype={constructor:i,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 r=n&&n!=t?this.remove(n):this,o=r.find(t),a=r.content.slice();return-1==o?a.push(n||t,e):(a[o+1]=e,n&&(a[o]=n)),new i(a)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new i(n)},addToStart:function(t,e){return new i([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new i(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),a=r.find(t);return o.splice(-1==a?o.length:a,0,e,n),new i(o)},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=i.from(t)).size?new i(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=i.from(t)).size?new i(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=i.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}},i.from=function(t){if(t instanceof i)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new i(e)};var l=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},c={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};l.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,a=0;a<e;i++){var s=this.content[i],l=a+s.nodeSize;if(l>t&&!1!==n(s,r+a,o,i)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,t-c),Math.min(s.content.size,e-c),n,r+c)}a=l}},l.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},l.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,function(a,s){a.isText?(o+=a.text.slice(Math.max(t,s)-s,e-s),i=!n):a.isLeaf&&r?(o+=r,i=!n):!i&&a.isBlock&&(o+=n,i=!0)},0),o},l.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 l(r,this.size+t.size)},l.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],s=i+a.nodeSize;s>t&&((i<t||s>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=s}return new l(n,r)},l.prototype.cutByIndex=function(t,e){return t==e?l.empty:0==t&&e==this.content.length?this:new l(this.content.slice(t,e))},l.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 l(r,o)},l.prototype.addToStart=function(t){return new l([t].concat(this.content),this.size+t.nodeSize)},l.prototype.addToEnd=function(t){return new l(this.content.concat(t),this.size+t.nodeSize)},l.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},c.firstChild.get=function(){return this.content.length?this.content[0]:null},c.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},c.childCount.get=function(){return this.content.length},l.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},l.prototype.maybeChild=function(t){return this.content[t]},l.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}},l.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),a(this,t,e)},l.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),s(this,t,e,n)},l.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return p(0,t);if(t==this.size)return p(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?p(n+1,o):p(n,r);r=o}},l.prototype.toString=function(){return"<"+this.toStringInner()+">"},l.prototype.toStringInner=function(){return this.content.join(", ")},l.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},l.fromJSON=function(t,e){if(!e)return l.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new l(e.map(t.nodeFromJSON))},l.fromArray=function(t){if(!t.length)return l.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 l(e||t,n)},l.from=function(t){if(!t)return l.empty;if(t instanceof l)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new l([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(l.prototype,c);var u={index:0,offset:0};function p(t,e){return u.index=t,u.offset=e,u}function d(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof 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(!d(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!d(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}l.empty=new l([],0);var f=function(t,e){this.type=t,this.attrs=e};function h(t){var e=Error.call(this,t);return e.__proto__=h.prototype,e}f.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},f.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},f.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},f.prototype.eq=function(t){return this==t||this.type==t.type&&d(this.attrs,t.attrs)},f.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},f.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)},f.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},f.setFrom=function(t){if(!t||0==t.length)return f.none;if(t instanceof f)return[t];var e=t.slice();return e.sort(function(t,e){return t.type.rank-e.type.rank}),e},f.none=[],h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="ReplaceError";var m=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},v={size:{configurable:!0}};function g(t,e,n){var r=t.findIndex(e),o=r.index,i=r.offset,a=t.maybeChild(o),s=t.findIndex(n),l=s.index,c=s.offset;if(i==e||a.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(o,a.copy(g(a.content,e-i-1,n-i-1)))}function y(t,e,n,r){var o=t.findIndex(e),i=o.index,a=o.offset,s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));var l=y(s.content,e-a-1,n);return l&&t.replaceChild(i,s.copy(l))}function b(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 w(t,e,n,0)}function w(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){var a=w(t,e,n,r+1);return i.copy(i.content.replaceChild(o,a))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){var s=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(l.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return E(i,M(t,s.start,s.end,e,r))}var c=t.parent,u=c.content;return E(c,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}return E(i,N(t,e,r))}function k(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function x(t,e,n){var r=t.node(n);return k(r,e.node(n)),r}function C(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 T(t,e,n,r){var o=(e||t).node(n),i=0,a=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(C(t.nodeAfter,r),i++));for(var s=i;s<a;s++)C(o.child(s),r);e&&e.depth==n&&e.textOffset&&C(e.nodeBefore,r)}function E(t,e){if(!t.type.validContent(e))throw new h("Invalid content for node "+t.type.name);return t.copy(e)}function M(t,e,n,r,o){var i=t.depth>o&&x(t,e,o+1),a=r.depth>o&&x(n,r,o+1),s=[];return T(null,t,o,s),i&&a&&e.index(o)==n.index(o)?(k(i,a),C(E(i,M(t,e,n,r,o+1)),s)):(i&&C(E(i,N(t,e,o+1)),s),T(e,n,o,s),a&&C(E(a,N(n,r,o+1)),s)),T(r,null,o,s),new l(s)}function N(t,e,n){var r=[];return T(null,t,n,r),t.depth>n&&C(E(x(t,e,n+1),N(t,e,n+1)),r),T(e,null,n,r),new l(r)}v.size.get=function(){return this.content.size-this.openStart-this.openEnd},m.prototype.insertAt=function(t,e){var n=y(this.content,t+this.openStart,e,null);return n&&new m(n,this.openStart,this.openEnd)},m.prototype.removeBetween=function(t,e){return new m(g(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},m.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},m.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},m.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},m.fromJSON=function(t,e){if(!e)return m.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 m(l.fromJSON(t,e.content),n,r)},m.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 m(t,n,r)},Object.defineProperties(m.prototype,v),m.empty=new m(l.empty,0,0);var S=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},D={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};S.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},D.parent.get=function(){return this.node(this.depth)},D.doc.get=function(){return this.node(0)},S.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},S.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},S.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},S.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},S.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},S.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]},S.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},D.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},D.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},D.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)},S.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},S.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return f.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,a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i},S.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},S.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},S.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 I(this,t,n)},S.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},S.prototype.max=function(t){return t.pos>this.pos?t:this},S.prototype.min=function(t){return t.pos<this.pos?t:this},S.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},S.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 a=i.content.findIndex(o),s=a.index,l=a.offset,c=o-l;if(n.push(i,s,r+l),!c)break;if((i=i.child(s)).isText)break;o=c-1,r+=l+1}return new S(e,n,o)},S.resolveCached=function(t,e){for(var n=0;n<L.length;n++){var r=L[n];if(r.pos==e&&r.doc==t)return r}var o=L[O]=S.resolve(t,e);return O=(O+1)%A,o},Object.defineProperties(S.prototype,D);var L=[],O=0,A=12,I=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},R={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};R.start.get=function(){return this.$from.before(this.depth+1)},R.end.get=function(){return this.$to.after(this.depth+1)},R.parent.get=function(){return this.$from.node(this.depth)},R.startIndex.get=function(){return this.$from.index(this.depth)},R.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(I.prototype,R);var P=/* @__PURE__ */Object.create(null),B=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||l.empty,this.marks=r||f.none},F={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}};F.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},F.childCount.get=function(){return this.content.childCount},B.prototype.child=function(t){return this.content.child(t)},B.prototype.maybeChild=function(t){return this.content.maybeChild(t)},B.prototype.forEach=function(t){this.content.forEach(t)},B.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},B.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},F.textContent.get=function(){return this.textBetween(0,this.content.size,"")},B.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},F.firstChild.get=function(){return this.content.firstChild},F.lastChild.get=function(){return this.content.lastChild},B.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},B.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},B.prototype.hasMarkup=function(t,e,n){return this.type==t&&d(this.attrs,e||t.defaultAttrs||P)&&f.sameSet(this.marks,n||f.none)},B.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},B.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},B.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},B.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return m.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),a=r.start(i),s=r.node(i).content.cut(r.pos-a,o.pos-a);return new m(s,r.depth-i,o.depth-i)},B.prototype.replace=function(t,e,n){return b(this.resolve(t),this.resolve(e),n)},B.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}},B.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}},B.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}},B.prototype.resolve=function(t){return S.resolveCached(this,t)},B.prototype.resolveNoCache=function(t){return S.resolve(this,t)},B.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},F.isBlock.get=function(){return this.type.isBlock},F.isTextblock.get=function(){return this.type.isTextblock},F.inlineContent.get=function(){return this.type.inlineContent},F.isInline.get=function(){return this.type.isInline},F.isText.get=function(){return this.type.isText},F.isLeaf.get=function(){return this.type.isLeaf},F.isAtom.get=function(){return this.type.isAtom},B.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()+")"),q(this.marks,t)},B.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},B.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=l.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 s=r;s<o;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0},B.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},B.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},B.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=f.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!f.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map(function(t){return t.type.name}));this.content.forEach(function(t){return t.check()})},B.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},B.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=l.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(B.prototype,F);var H=/* @__PURE__ */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):q(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}(B);function q(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var z=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},_={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};z.parse=function(t,e){var n=new j(t,e);if(null==n.next)return z.empty;var r=U(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=/* @__PURE__ */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),a=i>-1&&o[i+1];Z(t,r).forEach(function(t){a||o.push(n,a=[]),-1==a.indexOf(t)&&a.push(t)})}})});for(var i=e[r.join(",")]=new z(r.indexOf(t.length-1)>-1),a=0;a<o.length;a+=2){var s=o[a+1].sort(J);i.next.push(o[a],e[s.join(",")]||n(s))}return i}(Z(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 a=0;;a++){var s=t(e.exprs[a],i);if(a==e.exprs.length-1)return s;o(s,i=n())}else{if("star"==e.type){var l=n();return r(i,l),o(t(e.expr,l),l),[r(l)]}if("plus"==e.type){var c=n();return o(t(e.expr,i),c),o(t(e.expr,c),c),[r(c)]}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 d=n();o(t(e.expr,u),d),u=d}if(-1==e.max)o(t(e.expr,u),u);else for(var f=e.min;f<e.max;f++){var h=n();r(u,h),o(t(e.expr,u),h),u=h}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,a=[],s=0;s<o.next.length;s+=2){var l=o.next[s],c=o.next[s+1];a.push(l.name),!i||l.isText||l.hasRequiredAttrs()||(i=!1),-1==r.indexOf(c)&&r.push(c)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},z.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},z.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},_.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},_.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}},z.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},z.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 s=i.matchFragment(t,n);if(s&&(!e||s.validEnd))return l.from(a.map(function(t){return t.createAndFill()}));for(var c=0;c<i.next.length;c+=2){var u=i.next[c],p=i.next[c+1];if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(p)){r.push(p);var d=o(p,a.concat(u));if(d)return d}}}(this,[])},z.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},z.prototype.computeWrapping=function(t){for(var e=/* @__PURE__ */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=[],a=r;a.type;a=a.via)i.push(a.type);return i.reverse()}for(var s=0;s<o.next.length;s+=2){var l=o.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in e||r.type&&!o.next[s+1].validEnd||(n.push({match:l.contentMatch,type:l,via:r}),e[l.name]=!0)}}},_.edgeCount.get=function(){return this.next.length>>1},z.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]}},z.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(z.prototype,_),z.empty=new z(!0);var j=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.shift()},V={next:{configurable:!0}};function U(t){var e=[];do{e.push($(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function $(t){var e=[];do{e.push(W(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function W(t){for(var e=function(t){if(t.eat("(")){var e=U(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 a=n[i];a.groups.indexOf(e)>-1&&o.push(a)}return 0==o.length&&t.err("No node type or group '"+e+"' found"),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=K(t,e)}return e}function G(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function K(t,e){var n=G(t),r=n;return t.eat(",")&&(r="}"!=t.next?G(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 Z(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 a=o[i],s=a.term,l=a.to;s||-1!=n.indexOf(l)||e(l)}}(e),n.sort(J)}function X(t){var e=/* @__PURE__ */Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Q(t,e){var n=/* @__PURE__ */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 Y(t){var e=/* @__PURE__ */Object.create(null);if(t)for(var n in t)e[n]=new nt(t[n]);return e}V.next.get=function(){return this.tokens[this.pos]},j.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},j.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(j.prototype,V);var tt=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=Y(n.attrs),this.defaultAttrs=X(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},et={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};et.isInline.get=function(){return!this.isBlock},et.isTextblock.get=function(){return this.isBlock&&this.inlineContent},et.isLeaf.get=function(){return this.contentMatch==z.empty},et.isAtom.get=function(){return this.isLeaf||this.spec.atom},tt.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},tt.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},tt.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:Q(this.attrs,t)},tt.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new B(this,this.computeAttrs(t),l.from(e),f.setFrom(n))},tt.prototype.createChecked=function(t,e,n){if(e=l.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new B(this,this.computeAttrs(t),e,f.setFrom(n))},tt.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=l.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(l.empty,!0);return o?new B(this,t,e.append(o),f.setFrom(n)):null},tt.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},tt.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},tt.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},tt.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:f.empty:t},tt.compile=function(t,e){var n=/* @__PURE__ */Object.create(null);t.forEach(function(t,r){return n[t]=new tt(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(tt.prototype,et);var nt=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},rt={isRequired:{configurable:!0}};rt.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(nt.prototype,rt);var ot=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=Y(r.attrs),this.rank=e,this.excluded=null;var o=X(this.attrs);this.instance=o&&new f(this,o)};ot.prototype.create=function(t){return!t&&this.instance?this.instance:new f(this,Q(this.attrs,t))},ot.compile=function(t,e){var n=/* @__PURE__ */Object.create(null),r=0;return t.forEach(function(t,o){return n[t]=new ot(t,r++,e,o)}),n},ot.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},ot.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},ot.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var it=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=i.from(t.nodes),this.spec.marks=i.from(t.marks),this.nodes=tt.compile(this.spec.nodes,this),this.marks=ot.compile(this.spec.marks,this);var n=/* @__PURE__ */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 o=this.nodes[r],a=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[a]||(n[a]=z.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?at(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],u=c.spec.excludes;c.excluded=null==u?[c]:""==u?[]:at(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=/* @__PURE__ */Object.create(null),this.cached.wrappings=/* @__PURE__ */Object.create(null)};function at(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],a=i;if(i)n.push(i);else for(var s in t.marks){var l=t.marks[s];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}it.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof tt))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)},it.prototype.text=function(t,e){var n=this.nodes.text;return new H(n,n.defaultAttrs,t,f.setFrom(e))},it.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},it.prototype.nodeFromJSON=function(t){return B.fromJSON(this,t)},it.prototype.markFromJSON=function(t){return f.fromJSON(this,t)},it.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var st=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)}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})};st.prototype.parse=function(t,e){void 0===e&&(e={});var n=new ft(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},st.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new ft(this,e,!0);return n.addAll(t,null,e.from,e.to),m.maxOpen(n.finish())},st.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(mt(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},st.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var a=i.getAttrs(e);if(!1===a)continue;i.attrs=a}return i}}},st.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=vt(t)),t.mark=e})};for(var o in t.marks)r(o);var i=function(e){var r=t.nodes[a].spec.parseDOM;r&&r.forEach(function(t){n(t=vt(t)),t.node=a})};for(var a in t.nodes)i();return e},st.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new st(t,st.schemaRules(t)))};var lt={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},ct={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ut={ol:!0,ul:!0};function pt(t){return(t?1:0)|("full"===t?2:0)}var dt=function(t,e,n,r,o,i,a){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&a?null:t.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=f.none,this.pendingMarks=r,this.stashMarks=[]};dt.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(l.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)},dt.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=l.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(l.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},dt.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},dt.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):gt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}},dt.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lt.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var ft=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=pt(e.preserveWhitespace)|(n?4:0);r=o?new dt(o.type,o.attrs,f.none,f.none,!0,e.topMatch||o.type.contentMatch,i):new dt(n?null:t.schema.topNodeType,null,f.none,f.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},ht={top:{configurable:!0},currentPos:{configurable:!0}};function mt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vt(t){var e={};for(var n in t)e[n]=t[n];return e}function gt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],a=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,s=r.next;if(o==e)return!0;if(i.indexOf(s)<0&&a(s))return!0}};return a(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}ht.top.get=function(){return this.nodes[this.open]},ft.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){for(var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];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)}},ft.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):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)},ft.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();ut.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&ut.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:ct.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,a=this.top,s=this.needsBlock;if(lt.hasOwnProperty(r))i=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(a),this.needsBlock=s}else this.addElementByRule(t,o,!1===o.consuming?n:null)},ft.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},ft.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},ft.prototype.readStyles=function(t){var e=f.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},ft.prototype.addElementByRule=function(t,e,n){var r,o,i,a=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(function(t){return a.insertNode(t)});else{var l=e.contentElement;"string"==typeof l?l=t.querySelector(l):"function"==typeof l&&(l=l(t)),l||(l=t),this.findAround(t,l,!0),this.addAll(l,r)}r&&(this.sync(s),this.open--),i&&this.removePendingMark(i,s)},ft.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,a=null==r?null:t.childNodes[r];i!=a;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&lt.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},ft.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 a=0;a<e.length;a++)this.enterInner(e[a],null,!1);return!0},ft.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},ft.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},ft.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:pt(r);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new dt(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},ft.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}},ft.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},ft.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},ht.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},ft.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)},ft.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)},ft.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++)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)},ft.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))},ft.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),a=function(t,s){for(;t>=0;t--){var l=n[t];if(""==l){if(t==n.length-1||0==t)continue;for(;s>=i;s--)if(a(t-1,s))return!0;return!1}var c=s>0||0==s&&o?e.nodes[s].type:r&&s>=i?r.node(s-i).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;s--}return!0};return a(n.length-1,this.open)},ft.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}},ft.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},ft.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);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(ft.prototype,ht);var yt=function(t,e){this.nodes=t||{},this.marks=e||{}};function bt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function wt(t){return t.document||window.document}yt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=wt(e).createDocumentFragment());var o=n,i=null;return t.forEach(function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,a=0;n<i.length&&a<t.marks.length;){var s=t.marks[a];if(r.marks[s.type.name]){if(!s.eq(i[n])||!1===s.type.spec.spanning)break;n+=2,a++}else a++}for(;n<i.length;)o=i.pop(),i.pop();for(;a<t.marks.length;){var l=t.marks[a++],c=r.serializeMark(l,t.isInline,e);c&&(i.push(l,o),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(r.serializeNodeInner(t,e))}),n},yt.prototype.serializeNodeInner=function(t,e){void 0===e&&(e={});var n=yt.renderSpec(wt(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},yt.prototype.serializeNode=function(t,e){void 0===e&&(e={});for(var n=this.serializeNodeInner(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},yt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&yt.renderSpec(wt(n),r(t,e))},yt.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};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,a=n?t.createElementNS(n,r):t.createElement(r),s=e[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s))for(var c in l=2,s)if(null!=s[c]){var u=c.indexOf(" ");u>0?a.setAttributeNS(c.slice(0,u),c.slice(u+1),s[c]):a.setAttribute(c,s[c])}for(var p=l;p<e.length;p++){var d=e[p];if(0===d){if(p<e.length-1||p>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var f=yt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(a.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:a,contentDOM:i}},yt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new yt(this.nodesFromSchema(t),this.marksFromSchema(t)))},yt.nodesFromSchema=function(t){var e=bt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},yt.marksFromSchema=function(t){return bt(t.marks)};var kt={__proto__:null,ContentMatch:z,DOMParser:st,DOMSerializer:yt,Fragment:l,Mark:f,MarkType:ot,Node:B,NodeRange:I,NodeType:tt,ReplaceError:h,ResolvedPos:S,Schema:it,Slice:m},xt=Math.pow(2,16);function Ct(t,e){return t+e*xt}function Tt(t){return 65535&t}var Et=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},Mt=function t(e,n){if(void 0===n&&(n=!1),!e.length&&t.empty)return t.empty;this.ranges=e,this.inverted=n};Mt.prototype.recover=function(t){var e=0,n=Tt(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))/xt}(t)},Mt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},Mt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},Mt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>t)break;var l=this.ranges[a+o],c=this.ranges[a+i],u=s+l;if(t<=u){var p=s+r+((l?t==s?-1:t==u?1:e:e)<0?0:c);if(n)return p;var d=t==(e<0?s:u)?null:Ct(a/3,t-s);return new Et(p,e<0?t!=s:t!=u,d)}r+=c-l}return n?t+r:new Et(t+r)},Mt.prototype.touches=function(t,e){for(var n=0,r=Tt(e),o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>t)break;var l=this.ranges[a+o];if(t<=s+l&&a==3*r)return!0;n+=this.ranges[a+i]-l}return!1},Mt.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],a=i-(this.inverted?o:0),s=i+(this.inverted?0:o),l=this.ranges[r+e],c=this.ranges[r+n];t(a,a+l,s,s+c),o+=c-l}},Mt.prototype.invert=function(){return new Mt(this.ranges,!this.inverted)},Mt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},Mt.offset=function(t){return 0==t?Mt.empty:new Mt(t<0?[0,-t,0]:[0,0,t])},Mt.empty=new Mt([]);var Nt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function St(t){var e=Error.call(this,t);return e.__proto__=St.prototype,e}Nt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new Nt(this.maps,this.mirror,t,e)},Nt.prototype.copy=function(){return new Nt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},Nt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},Nt.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)}},Nt.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)]},Nt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},Nt.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)}},Nt.prototype.invert=function(){var t=new Nt;return t.appendMappingInverted(this),t},Nt.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},Nt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},Nt.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,t=this.maps[a].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new Et(t,r)},St.prototype=Object.create(Error.prototype),St.prototype.constructor=St,St.prototype.name="TransformError";var Dt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Nt},Lt={before:{configurable:!0},docChanged:{configurable:!0}};function Ot(){throw new Error("Override me")}Lt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},Dt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new St(e.failed);return this},Dt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},Lt.docChanged.get=function(){return this.steps.length>0},Dt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(Dt.prototype,Lt);var At=/* @__PURE__ */Object.create(null),It=function(){};It.prototype.apply=function(t){return Ot()},It.prototype.getMap=function(){return Mt.empty},It.prototype.invert=function(t){return Ot()},It.prototype.map=function(t){return Ot()},It.prototype.merge=function(t){return null},It.prototype.toJSON=function(){return Ot()},It.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=At[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},It.jsonID=function(t,e){if(t in At)throw new RangeError("Duplicate use of step JSON ID "+t);return At[t]=e,e.prototype.jsonID=t,e};var Rt=function(t,e){this.doc=t,this.failed=e};Rt.ok=function(t){return new Rt(t,null)},Rt.fail=function(t){return new Rt(null,t)},Rt.fromReplace=function(t,e,n,r){try{return Rt.ok(t.replace(e,n,r))}catch(o){if(o instanceof h)return Rt.fail(o.message);throw o}};var Pt=/* @__PURE__ */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&&Ft(t,this.from,this.to)?Rt.fail("Structure replace would overwrite content"):Rt.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new Mt([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?m.empty:new m(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?m.empty:new m(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,m.fromJSON(t,n.slice),!!n.structure)},e}(It);It.jsonID("replace",Pt);var Bt=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=a,this.structure=!!s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Ft(t,this.from,this.gapFrom)||Ft(t,this.gapTo,this.to)))return Rt.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Rt.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Rt.fromReplace(t,this.from,this.to,n):Rt.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new Mt([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,m.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(It);function Ft(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 a=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}return!1}function Ht(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function qt(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||!Ht(r,o,i))break}}function zt(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 a=i.length?i[0]:e;return n.canReplaceWith(r,o,a)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),a=e.contentMatch.findWrapping(i.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:e).contentMatch,l=r;s&&l<o;l++)s=s.matchType(n.child(l).type);return s&&s.validEnd?a:null}(r,e);return i?o.map(_t).concat({type:e,attrs:n}).concat(i.map(_t)):null}function _t(t){return{type:t,attrs:null}}function jt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,a=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var s=o.depth-1,l=n-2;s>i;s--,l--){var c=o.node(s),u=o.index(s);if(c.type.spec.isolating)return!1;var p=c.content.cutByIndex(u,c.childCount),d=r&&r[l]||c;if(d!=c&&(p=p.replaceChild(0,d.type.create(d.attrs))),!c.canReplace(u+1,c.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Vt(t,e){var n,r,o=t.resolve(e),i=o.index();return n=o.nodeBefore,r=o.nodeAfter,n&&r&&!n.isLeaf&&n.canAppend(r)&&o.parent.canReplace(i,i+1)}function Ut(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var i=t.child(o);i.content.size&&(i=i.copy(Ut(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return l.fromArray(r)}It.jsonID("replaceAround",Bt),Dt.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),s=i,c=a,u=l.empty,p=0,d=o,f=!1;d>e;d--)f||n.index(d)>0?(f=!0,u=l.from(n.node(d).copy(u)),p++):s--;for(var h=l.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,h=l.from(r.node(g).copy(h)),v++):c++;return this.step(new Bt(s,c,i,a,new m(u.append(h),p,v),u.size-p,!0))},Dt.prototype.wrap=function(t,e){for(var n=l.empty,r=e.length-1;r>=0;r--){if(n.size){var o=e[r].type.contentMatch.matchFragment(n);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=l.from(e[r].type.create(e[r].attrs,n))}var i=t.start,a=t.end;return this.step(new Bt(i,a,i,a,new m(n,0,0),e.length,!0))},Dt.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),s=a.map(e,1),c=a.map(e+t.nodeSize,1);return o.step(new Bt(s,c,s+1,c-1,new m(l.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}}),this},Dt.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 Bt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new m(l.from(i),0,0),1,!0))},Dt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=l.empty,i=l.empty,a=r.depth,s=r.depth-e,c=e-1;a>s;a--,c--){o=l.from(r.node(a).copy(o));var u=n&&n[c];i=l.from(u?u.type.create(u.attrs,i):r.node(a).copy(i))}return this.step(new Pt(t,t,new m(o.append(i),e,e),!0))},Dt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Pt(t-e,t+e,m.empty,!0);return this.step(n)};var $t=/* @__PURE__ */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 m(Ut(n.content,function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t},o),n.openStart,n.openEnd);return Rt.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Wt(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}(It);It.jsonID("addMark",$t);var Wt=/* @__PURE__ */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 m(Ut(n.content,function(t){return t.mark(e.mark.removeFromSet(t.marks))}),n.openStart,n.openEnd);return Rt.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new $t(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}(It);function Gt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}It.jsonID("removeMark",Wt),Dt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],a=null,s=null;return this.doc.nodesBetween(t,e,function(r,l,c){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&c.type.allowsMarkType(n.type)){for(var p=Math.max(l,t),d=Math.min(l+r.nodeSize,e),f=n.addToSet(u),h=0;h<u.length;h++)u[h].isInSet(f)||(a&&a.to==p&&a.mark.eq(u[h])?a.to=d:o.push(a=new Wt(p,d,u[h])));s&&s.to==p?s.to=d:i.push(s=new $t(p,d,n))}}}),o.forEach(function(t){return r.step(t)}),i.forEach(function(t){return r.step(t)}),this},Dt.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,a){if(r.isInline){i++;var s=null;if(n instanceof ot)for(var l,c=r.marks;l=n.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else n?n.isInSet(r.marks)&&(s=[n]):s=r.marks;if(s&&s.length)for(var u=Math.min(a+r.nodeSize,e),p=0;p<s.length;p++){for(var d=s[p],f=void 0,h=0;h<o.length;h++){var m=o[h];m.step==i-1&&d.eq(o[h].style)&&(f=m)}f?(f.to=u,f.step=i):o.push({style:d,from:Math.max(a,t),to:u,step:i})}}}),o.forEach(function(t){return r.step(new Wt(t.from,t.to,t.style))}),this},Dt.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 s=r.child(a),c=i+s.nodeSize,u=n.matchType(s.type,s.attrs);if(u){n=u;for(var p=0;p<s.marks.length;p++)e.allowsMarkType(s.marks[p].type)||this.step(new Wt(i,c,s.marks[p]))}else o.push(new Pt(i,c,m.empty));i=c}if(!n.validEnd){var d=n.fillBefore(l.empty,!0);this.replace(i,i,new m(d,0,0))}for(var f=o.length-1;f>=0;f--)this.step(o[f]);return this},Dt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=m.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=m.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Gt(o,i,r)?new Pt(e,n,r):new Kt(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},Dt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new m(l.from(n),0,0))},Dt.prototype.delete=function(t,e){return this.replace(t,e,m.empty)},Dt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Kt=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=l.empty;for(var i=t.depth;i>0;i--)this.placed=l.from(t.node(i).copy(this.placed))},Jt={depth:{configurable:!0}};function Zt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Zt(t.firstChild.content,e-1,n)))}function Xt(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xt(t.lastChild.content,e-1,n)))}function Qt(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function Yt(t,e,n){if(e<=0)return t;var r=t.content;return e>1&&(r=r.replaceChild(0,Yt(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(l.empty,!0)))),t.copy(r)}function te(t,e,n,r,o){var i=t.node(e),a=o?t.indexAfter(e):t.index(e);if(a==i.childCount&&!n.compatibleContent(i.type))return null;var s=r.fillBefore(i.content,!0,a);return s&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,a)?s:null}function ee(t,e,n,r,o){if(e<n){var i=t.firstChild;t=t.replaceChild(0,i.copy(ee(i.content,e+1,n,r,i)))}if(e>r){var a=o.contentMatchAt(0),s=a.fillBefore(t).append(t);t=s.append(a.matchFragment(s).fillBefore(l.empty,!0))}return t}function ne(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)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}Jt.depth.get=function(){return this.frontier.length-1},Kt.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,a=r.depth,s=o.depth;a&&s&&1==i.childCount;)i=i.firstChild.content,a--,s--;var l=new m(i,a,s);return e>-1?new Bt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Pt(r.pos,o.pos,l):void 0},Kt.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Qt(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],a=i.type,s=i.match,c=void 0,u=void 0;if(1==t&&(r?s.matchType(r.type)||(u=s.fillBefore(l.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:u};if(2==t&&r&&(c=s.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&s.matchType(n.type))break}},Kt.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Qt(e,n);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new m(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),0))},Kt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Qt(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new m(Zt(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new m(Zt(e,n,1),n,r)},Kt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var a=0;a<i.length;a++)this.openFrontierNode(i[a]);var s=this.unplaced,c=r?r.content:s.content,u=s.openStart-e,p=0,d=[],f=this.frontier[n],h=f.match,v=f.type;if(o){for(var g=0;g<o.childCount;g++)d.push(o.child(g));h=h.matchFragment(o)}for(var y=c.size+e-(s.content.size-s.openEnd);p<c.childCount;){var b=c.child(p),w=h.matchType(b.type);if(!w)break;(++p>1||0==u||b.content.size)&&(h=w,d.push(Yt(b.mark(v.allowedMarks(b.marks)),1==p?u:0,p==c.childCount?y:-1)))}var k=p==c.childCount;k||(y=-1),this.placed=Xt(this.placed,n,l.from(d)),this.frontier[n].match=h,k&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x<y;x++){var T=C.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),C=T.content}this.unplaced=k?0==e?m.empty:new m(Zt(s.content,e-1,1),e-1,y<0?s.openEnd:e-1):new m(Zt(s.content,e,p),s.openStart,s.openEnd)},Kt.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!te(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},Kt.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),a=te(t,e,o,r,i);if(a){for(var s=e-1;s>=0;s--){var l=this.frontier[s],c=l.match,u=te(t,s,l.type,c,!0);if(!u||u.childCount)continue t}return{depth:e,fit:a,move:i?t.doc.resolve(t.after(e+1)):t}}}},Kt.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Xt(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},Kt.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Xt(this.placed,this.depth,l.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Kt.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(l.empty,!0);t.childCount&&(this.placed=Xt(this.placed,this.frontier.length,t))},Object.defineProperties(Kt.prototype,Jt),Dt.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(Gt(r,o,n))return this.step(new Pt(t,e,n));var i=ne(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var a=-(r.depth+1);i.unshift(a);for(var s=r.depth,l=r.pos-1;s>0;s--,l--){var c=r.node(s).type.spec;if(c.defining||c.isolating)break;i.indexOf(s)>-1?a=s:r.before(s)==l&&i.splice(1,0,-s)}for(var u=i.indexOf(a),p=[],d=n.openStart,f=n.content,h=0;;h++){var v=f.firstChild;if(p.push(v),h==n.openStart)break;f=v.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var g=n.openStart;g>=0;g--){var y=(g+d+1)%(n.openStart+1),b=p[y];if(b)for(var w=0;w<i.length;w++){var k=i[(w+u)%i.length],x=!0;k<0&&(x=!1,k=-k);var C=r.node(k-1),T=r.index(k-1);if(C.canReplaceWith(T,T,b.type,b.marks))return this.replace(r.before(k),x?o.after(k):e,new m(ee(n.content,0,n.openStart,y),y,n.openEnd))}}for(var E=this.steps.length,M=i.length-1;M>=0&&(this.replace(t,e,n),!(this.steps.length>E));M--){var N=i[M];N<0||(t=r.before(N),e=o.after(N))}return this},Dt.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 a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}}(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new m(l.from(n),0,0))},Dt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=ne(n,r),i=0;i<o.length;i++){var a=o[i],s=i==o.length-1;if(s&&0==a||n.node(a).type.contentMatch.validEnd)return this.delete(n.start(a),r.end(a));if(a>0&&(s||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return this.delete(n.before(a),r.after(a))}for(var l=1;l<=n.depth&&l<=r.depth;l++)if(t-n.start(l)==n.depth-l&&e>n.end(l)&&r.end(l)-e!=r.depth-l)return this.delete(n.before(l),e);return this.delete(t,e)};var re=/* @__PURE__ */Object.create(null),oe=function(t,e,n){this.ranges=n||[new ae(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ie={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ie.anchor.get=function(){return this.$anchor.pos},ie.head.get=function(){return this.$head.pos},ie.from.get=function(){return this.$from.pos},ie.to.get=function(){return this.$to.pos},ie.$from.get=function(){return this.ranges[0].$from},ie.$to.get=function(){return this.ranges[0].$to},ie.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},oe.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},oe.prototype.replace=function(t,e){void 0===e&&(e=m.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,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,u=l.$to,p=t.mapping.slice(i);t.replaceRange(p.map(c.pos),p.map(u.pos),s?m.empty:e),0==s&&he(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},oe.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],a=i.$from,s=i.$to,l=t.mapping.slice(n),c=l.map(a.pos),u=l.map(s.pos);o?t.deleteRange(c,u):(t.replaceRangeWith(c,u,e),he(t,n,e.isInline?-1:1))}},oe.findFrom=function(t,e,n){var r=t.parent.inlineContent?new se(t):fe(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?fe(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):fe(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},oe.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new pe(t.node(0))},oe.atStart=function(t){return fe(t,t,0,0,1)||new pe(t)},oe.atEnd=function(t){return fe(t,t,t.content.size,t.childCount,-1)||new pe(t)},oe.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=re[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},oe.jsonID=function(t,e){if(t in re)throw new RangeError("Duplicate use of selection JSON ID "+t);return re[t]=e,e.prototype.jsonID=t,e},oe.prototype.getBookmark=function(){return se.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(oe.prototype,ie),oe.prototype.visible=!0;var ae=function(t,e){this.$from=t,this.$to=e},se=/* @__PURE__ */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=m.empty),t.prototype.replace.call(this,e,n),n==m.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 le(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 a=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!a)return t.near(r,o);r=a.$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}(oe);oe.jsonID("text",se);var le=function(t,e){this.anchor=t,this.head=e};le.prototype.map=function(t){return new le(t.map(this.anchor),t.map(this.head))},le.prototype.resolve=function(t){return se.between(t.resolve(this.anchor),t.resolve(this.head))};var ce=/* @__PURE__ */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,a=o.pos,s=n.resolve(a);return i?t.near(s):new e(s)},e.prototype.content=function(){return new m(l.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 ue(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}(oe);ce.prototype.visible=!1,oe.jsonID("node",ce);var ue=function(t){this.anchor=t};ue.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new le(r,r):new ue(r)},ue.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&ce.isSelectable(n)?new ce(e):oe.near(e)};var pe=/* @__PURE__ */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.replace=function(e,n){if(void 0===n&&(n=m.empty),n==m.empty){e.delete(0,e.doc.content.size);var r=t.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else t.prototype.replace.call(this,e,n)},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 de},e}(oe);oe.jsonID("all",pe);var de={map:function(){return this},resolve:function(t){return new pe(t)}};function fe(t,e,n,r,o,i){if(e.inlineContent)return se.create(t,n);for(var a=r-(o>0?0:1);o>0?a<e.childCount:a>=0;a+=o){var s=e.child(a);if(s.isAtom){if(!i&&ce.isSelectable(s))return ce.create(t,n-(o<0?s.nodeSize:0))}else{var l=fe(t,s,n+o,o<0?s.childCount:0,o,i);if(l)return l}n+=s.nodeSize*o}}function he(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];(i instanceof Pt||i instanceof Bt)&&(t.mapping.maps[r].forEach(function(t,e,n,r){null==o&&(o=r)}),t.setSelection(oe.near(t.doc.resolve(o),n)))}}var me=/* @__PURE__ */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=/* @__PURE__ */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&this.updated|1,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 f.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)||f.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(oe.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}(Dt);function ve(t,e){return e&&t?t.bind(e):t}var ge=function(t,e,n){this.name=t,this.init=ve(e.init,n),this.apply=ve(e.apply,n)},ye=[new ge("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ge("selection",{init:function(t,e){return t.selection||oe.atStart(e.doc)},apply:function(t){return t.selection}}),new ge("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ge("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],be=function(t,e){var n=this;this.schema=t,this.fields=ye.concat(),this.plugins=[],this.pluginsByKey=/* @__PURE__ */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 ge(t.key,t.spec.state,t))})},we=function(t){this.config=t},ke={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ke.schema.get=function(){return this.config.schema},ke.plugins.get=function(){return this.config.plugins},we.prototype.apply=function(t){return this.applyTransaction(t).state},we.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},we.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 a=this.config.plugins[i];if(a.spec.appendTransaction){var s=r?r[i].n:0,l=r?r[i].state:this,c=s<e.length&&a.spec.appendTransaction.call(a,s?e.slice(s):e,l,n);if(c&&n.filterTransaction(c,i)){if(c.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(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},we.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new we(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<xe.length;i++)xe[i](this,t,e);return e},ke.tr.get=function(){return new me(this)},we.create=function(t){for(var e=new be(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new we(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},we.prototype.reconfigure=function(t){for(var e=new be(this.schema,t.plugins),n=e.fields,r=new we(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},we.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"==typeof 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},we.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 be(t.schema,t.plugins),o=new we(r);return r.fields.forEach(function(r){if("doc"==r.name)o.doc=B.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=oe.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 a=n[i],s=a.spec.state;if(a.key==r.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=s.fromJSON.call(a,t,e[i],o))}o[r.name]=r.init(t,o)}}),o},we.addApplyListener=function(t){xe.push(t)},we.removeApplyListener=function(t){var e=xe.indexOf(t);e>-1&&xe.splice(e,1)},Object.defineProperties(we.prototype,ke);var xe=[];function Ce(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Ce(o,e,{})),n[r]=o}return n}var Te=function(t){this.props={},t.props&&Ce(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Me("plugin")};Te.prototype.getState=function(t){return t[this.key]};var Ee=/* @__PURE__ */Object.create(null);function Me(t){return t in Ee?t+"$"+ ++Ee[t]:(Ee[t]=0,t+"$")}var Ne=function(t){void 0===t&&(t="key"),this.key=Me(t)};Ne.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Ne.prototype.getState=function(t){return t[this.key]};var Se={__proto__:null,AllSelection:pe,EditorState:we,NodeSelection:ce,Plugin:Te,PluginKey:Ne,Selection:oe,SelectionRange:ae,TextSelection:se,Transaction:me},De={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Le=/Edge\/(\d+)/.exec(navigator.userAgent),Oe=/MSIE \d/.test(navigator.userAgent),Ae=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);De.mac=/Mac/.test(navigator.platform);var Ie=De.ie=!!(Oe||Ae||Le);De.ie_version=Oe?document.documentMode||6:Ae?+Ae[1]:Le?+Le[1]:null,De.gecko=!Ie&&/gecko\/(\d+)/i.test(navigator.userAgent),De.gecko_version=De.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Re=!Ie&&/Chrome\/(\d+)/.exec(navigator.userAgent);De.chrome=!!Re,De.chrome_version=Re&&+Re[1],De.safari=!Ie&&/Apple Computer/.test(navigator.vendor),De.ios=De.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),De.android=/Android \d/.test(navigator.userAgent),De.webkit="webkitFontSmoothing"in document.documentElement.style,De.webkit_version=De.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Pe=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Be=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Fe=null,He=function(t,e,n){var r=Fe||(Fe=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},qe=function(t,e,n,r){return n&&(_e(t,e,n,r,-1)||_e(t,e,n,r,1))},ze=/^(img|br|input|textarea|hr)$/i;function _e(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:je(t))){var i=t.parentNode;if(1!=i.nodeType||Ve(t)||ze.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Pe(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?je(t):0}}}function je(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Ve(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 Ue=function(t){var e=t.isCollapsed;return e&&De.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function $e(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function We(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ge(t,e){return"number"==typeof t?t:t[e]}function Ke(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Je(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,a=n||t.dom;a;a=Be(a))if(1==a.nodeType){var s=a==i.body||1!=a.nodeType,l=s?We(i):Ke(a),c=0,u=0;if(e.top<l.top+Ge(r,"top")?u=-(l.top-e.top+Ge(o,"top")):e.bottom>l.bottom-Ge(r,"bottom")&&(u=e.bottom-l.bottom+Ge(o,"bottom")),e.left<l.left+Ge(r,"left")?c=-(l.left-e.left+Ge(o,"left")):e.right>l.right-Ge(r,"right")&&(c=e.right-l.right+Ge(o,"right")),c||u)if(s)i.defaultView.scrollBy(c,u);else{var p=a.scrollLeft,d=a.scrollTop;u&&(a.scrollTop+=u),c&&(a.scrollLeft+=c);var f=a.scrollLeft-p,h=a.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(s)break}}function Ze(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=Be(t));return e}function Xe(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,a=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=a&&(o.scrollLeft=a)}}var Qe=null;function Ye(t,e){for(var n,r,o=2e8,i=0,a=e.top,s=e.top,l=t.firstChild,c=0;l;l=l.nextSibling,c++){var u=void 0;if(1==l.nodeType)u=l.getClientRects();else{if(3!=l.nodeType)continue;u=He(l).getClientRects()}for(var p=0;p<u.length;p++){var d=u[p];if(d.top<=a&&d.bottom>=s){a=Math.max(d.bottom,a),s=Math.min(d.top,s);var f=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(f<o){n=l,o=f,r=f&&3==n.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==l.nodeType&&f&&(i=c+(e.left>=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=c+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=rn(r,1);if(i.top!=i.bottom&&tn(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}:Ye(n,r)}function tn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function en(t,e,n){var r=t.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var a=t.childNodes[i];if(1==a.nodeType)for(var s=a.getClientRects(),l=0;l<s.length;l++){var c=s[l];if(tn(e,c))return en(a,e,c)}if((i=(i+1)%r)==o)break}return t}function nn(t,e){var n,r,o,i,a=t.root;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(e.left,e.top);s&&(o=(n=s).offsetNode,i=n.offset)}catch(v){}if(!o&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(e.left,e.top);l&&(o=(r=l).startContainer,i=r.startOffset)}var c,u=a.elementFromPoint(e.left,e.top+1);if(!u||!t.dom.contains(1!=u.nodeType?u.parentNode:u)){var p=t.dom.getBoundingClientRect();if(!tn(e,p))return null;if(!(u=en(t.dom,e,p)))return null}if(De.safari)for(var d=u;o&&d;d=Be(d))d.draggable&&(o=i=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(De.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var f,h=o.childNodes[i];"IMG"==h.nodeName&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(c=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>r.left||s.top>r.top)o=a.posBefore;else{if(!(s.right<r.left||s.bottom<r.top))break;o=a.posAfter}}i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==c&&(c=function(t,e,n){var r=Ye(e,n),o=r.node,i=r.offset,a=-1;if(1==o.nodeType&&!o.firstChild){var s=o.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,i,a)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function rn(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var on=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function an(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,a=De.webkit||De.gecko;if(3==o.nodeType){if(!a||!on.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var s=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==o.nodeValue.length?(s--,c=1):n<0?s--:l++,sn(rn(He(o,s,l),c),c<0)}var u=rn(He(o,i,i),n);if(De.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var p=rn(He(o,i-1,i-1),-1);if(p.top==u.top){var d=rn(He(o,i,i+1),-1);if(d.top!=u.top)return sn(d,d.left<p.left)}}return u}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==je(o))){var f=o.childNodes[i-1];if(1==f.nodeType)return ln(f.getBoundingClientRect(),!1)}if(i<je(o)){var h=o.childNodes[i];if(1==h.nodeType)return ln(h.getBoundingClientRect(),!0)}return ln(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==je(o))){var m=o.childNodes[i-1],v=3==m.nodeType?He(m,je(m)-(a?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return sn(rn(v,1),!1)}if(i<je(o)){var g=o.childNodes[i],y=3==g.nodeType?He(g,0,a?0:1):1==g.nodeType?g:null;if(y)return sn(rn(y,-1),!0)}return sn(rn(3==o.nodeType?He(o):o,-n),n>=0)}function sn(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 ln(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}}function cn(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&&o.focus()}}var un=/[\u0590-\u08ac]/,pn=null,dn=null,fn=!1;var hn=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},mn={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};hn.prototype.matchesWidget=function(){return!1},hn.prototype.matchesMark=function(){return!1},hn.prototype.matchesNode=function(){return!1},hn.prototype.matchesHack=function(t){return!1},mn.beforePosition.get=function(){return!1},hn.prototype.parseRule=function(){return null},hn.prototype.stopEvent=function(){return!1},mn.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},mn.border.get=function(){return 0},hn.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()},hn.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}},mn.posBefore.get=function(){return this.parent.posBeforeChild(this)},mn.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},mn.posAfter.get=function(){return this.posBefore+this.size},mn.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},hn.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,a;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(a=i.pmViewDesc)||a.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}var s;if(t==this.dom&&this.contentDOM)s=e>Pe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var l=t;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&e==t.childNodes.length)for(var c=t;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},hn.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(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},hn.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},hn.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},hn.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}},hn.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=!0;;r++,o=!1){for(;r<this.children.length&&(this.children[r].beforePosition||this.children[r].dom.parentNode!=this.contentDOM);)n+=this.children[r++].size;var i=r==this.children.length?null:this.children[r];if(n==t&&(0==e||!i||!i.size||i.border||e<0&&o)||i&&i.domAtom&&t<n+i.size)return{node:this.contentDOM,offset:i?Pe(i.dom):this.contentDOM.childNodes.length};if(!i)throw new Error("Invalid position "+t);var a=n+i.size;if(!i.domAtom&&(e<0&&!i.border?a>=t:a>t)&&(a>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=a}},hn.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,a=0;;a++){var s=this.children[a],l=i+s.size;if(-1==r&&t<=l){var c=i+s.border;if(t>=c&&e<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,e,c);t=i;for(var u=a;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Pe(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(l>e||a==this.children.length-1)){e=l;for(var d=a+1;d<this.children.length;d++){var f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Pe(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},hn.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)},hn.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),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]},hn.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(o>s&&i<c)return l.setSelection(t-s-l.border,e-s-l.border,n,r);s=c}var u=this.domFromPos(t,t?-1:1),p=e==t?u:this.domFromPos(e,e?-1:1),d=n.getSelection(),f=!1;if((De.gecko||De.safari)&&t==e){var h=u.node,m=u.offset;if(3==h.nodeType){if((f=m&&"\n"==h.nodeValue[m-1])&&m==h.nodeValue.length)for(var v=h,g=void 0;v;v=v.parentNode){if(g=v.nextSibling){"BR"==g.nodeName&&(u=p={node:g.parentNode,offset:Pe(g)+1});break}var y=v.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{var b=h.childNodes[m-1];f=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(De.gecko&&d.focusNode&&d.focusNode!=p.node&&1==d.focusNode.nodeType){var w=d.focusNode.childNodes[d.focusOffset];w&&"false"==w.contentEditable&&(r=!0)}if(r||f&&De.safari||!qe(u.node,u.offset,d.anchorNode,d.anchorOffset)||!qe(p.node,p.offset,d.focusNode,d.focusOffset)){var k=!1;if((d.extend||t==e)&&!f){d.collapse(u.node,u.offset);try{t!=e&&d.extend(p.node,p.offset),k=!0}catch(T){if(!(T instanceof DOMException))throw T}}if(!k){if(t>e){var x=u;u=p,p=x}var C=document.createRange();C.setEnd(p.node,p.offset),C.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(C)}}},hn.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},mn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},hn.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 a=n+o.border,s=i-o.border;if(t>=a&&e<=s)return this.dirty=t==n||e==i?2:1,void(t!=a||e!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-a,e-a):o.dirty=3);o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM?2:3}n=i}this.dirty=2},hn.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},mn.domAtom.get=function(){return!1},Object.defineProperties(hn.prototype,mn);var vn=[],gn=/* @__PURE__ */function(t){function e(e,n,r,o){var i,a=n.type.toDOM;if("function"==typeof a&&(a=a(r,function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o})),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}t.call(this,e,vn,a,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},domAtom:{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},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(hn),yn=/* @__PURE__ */function(t){function e(e,n,r,o){t.call(this,e,vn,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}(hn),bn=/* @__PURE__ */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],a=i&&i(n,o,r);return a&&a.dom||(a=yt.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,a.dom,a.contentDOM||a.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,a=this.size;n<a&&(i=Bn(i,n,a,r)),t>0&&(i=Bn(i,0,t,r));for(var s=0;s<i.length;s++)i[s].parent=o;return o.children=i,o},e}(hn),wn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s,l,c){t.call(this,e,n.isLeaf?vn:[],i,a),this.nodeDOM=s,this.node=n,this.outerDeco=r,this.innerDeco=o,a&&this.updateChildren(l,c)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,r,o,i,a){var s,l,c=i.nodeViews[n.type.name],u=c&&c(n,i,function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a},r,o),p=u&&u.dom,d=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=(s=yt.renderSpec(document,n.type.spec.toDOM(n))).dom,d=s.contentDOM);d||n.isText||"BR"==p.nodeName||(p.hasAttribute("contenteditable")||(p.contentEditable=!1),n.type.spec.draggable&&(p.draggable=!0));var f=p;return p=On(p,r,n),u?l=new Tn(t,n,r,o,p,d,f,u,i,a+1):n.isText?new xn(t,n,r,o,p,f,i):new e(t,n,r,o,p,d,f,i,a+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?l.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&An(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=t.composing&&this.localCompositionInfo(t,e),a=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new Rn(this,a&&a.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0!=o.length)for(var a=0,s=[],l=null,c=0;;){if(a<o.length&&o[a].to==i){for(var u=o[a++],p=void 0;a<o.length&&o[a].to==i;)(p||(p=[u])).push(o[a++]);if(p){p.sort(Pn);for(var d=0;d<p.length;d++)n(p[d],c,!!l)}else n(u,c,!!l)}var f=void 0,h=void 0;if(l)h=-1,f=l,l=null;else{if(!(c<t.childCount))break;h=c,f=t.child(c++)}for(var m=0;m<s.length;m++)s[m].to<=i&&s.splice(m--,1);for(;a<o.length&&o[a].from<=i&&o[a].to>i;)s.push(o[a++]);var v=i+f.nodeSize;if(f.isText){var g=v;a<o.length&&o[a].from<g&&(g=o[a].from);for(var y=0;y<s.length;y++)s[y].to<g&&(g=s[y].to);g<v&&(l=f.cut(g-i),f=f.cut(0,g-i),v=g,h=-1)}r(f,s.length?f.isInline&&!f.isLeaf?s.filter(function(t){return!t.inline}):s.slice():vn,e.forChild(i,f),h),i=v}else for(var b=0;b<t.childCount;b++){var w=t.child(b);r(w,o,e.forChild(i,w),b),i+=w.nodeSize}}(this.node,this.innerDeco,function(e,i,a){e.spec.marks?l.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!a&&l.syncToMarks(i==n.node.childCount?f.none:n.node.child(i).marks,r,t),l.placeWidget(e,t,o)},function(e,n,a,c){var u;l.syncToMarks(e.marks,r,t),l.findNodeMatch(e,n,a,c)||s&&t.state.selection.from>o&&t.state.selection.to<o+e.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,n,a,u,t)||l.updateNextNode(e,n,a,t,c)||l.addNode(e,n,a,t,o),o+=e.nodeSize}),l.syncToMarks(vn,r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(a&&this.protectLocalComposition(t,a),En(this.contentDOM,this.children,t),De.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.localCompositionInfo=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof se)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),a=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];e=je(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(a&&this.dom.contains(a.parentNode)){if(this.node.inlineContent){var s=a.nodeValue,l=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var a=t.child(o++),s=i;if(i+=a.nodeSize,a.isText){for(var l=a.text;o<t.childCount;){var c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){var u=l.lastIndexOf(e,r-s);if(u>=0&&u+e.length+s>=n)return s+u}}}return-1}(this.node.content,s,r-e,o-e);return l<0?null:{node:a,pos:l,text:s}}return{node:a,pos:-1}}}},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 a=new yn(this,i,n,o);t.compositionNodes.push(a),this.children=Bn(this.children,r,r+o.length,t,a)}},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(!An(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Dn(this.dom,this.nodeDOM,Sn(this.outerDeco,this.node,e),Sn(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.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(hn);function kn(t,e,n,r,o){return On(r,e,t),new wn(null,t,e,n,r,r,r,o,0)}var xn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s){t.call(this,e,n,r,o,i,null,a,s)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){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,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),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.prototype.markDirty=function(e,n){t.prototype.markDirty.call(this,e,n),this.dom==this.nodeDOM||0!=e&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(wn),Cn=/* @__PURE__ */function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(t){return 0==this.dirty&&this.dom.nodeName==t},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(hn),Tn=/* @__PURE__ */function(t){function e(e,n,r,o,i,a,s,l,c,u){t.call(this,e,n,r,o,i,a,s,c,u),this.spec=l}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,r);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}(wn);function En(t,e,n){for(var r=t.firstChild,o=!1,i=0;i<e.length;i++){var a=e[i],s=a.dom;if(s.parentNode==t){for(;s!=r;)r=In(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(s,r);if(a instanceof bn){var l=r?r.previousSibling:t.lastChild;En(a.contentDOM,a.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=In(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}function Mn(t){t&&(this.nodeName=t)}Mn.prototype=/* @__PURE__ */Object.create(null);var Nn=[new Mn];function Sn(t,e,n){if(0==t.length)return Nn;for(var r=n?Nn[0]:new Mn,o=[r],i=0;i<t.length;i++){var a=t[i].type.attrs;if(a)for(var s in a.nodeName&&o.push(r=new Mn(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==o.length&&o.push(r=new Mn(e.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return o}function Dn(t,e,n,r){if(n==Nn&&r==Nn)return e;for(var o=e,i=0;i<r.length;i++){var a=r[i],s=n[i];if(i){var l=void 0;s&&s.nodeName==a.nodeName&&o!=t&&(l=o.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(o),s=Nn[0]),o=l}Ln(o,s||Nn[0],a)}return o}function Ln(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(" ").filter(Boolean):vn,a=n.class?n.class.split(" ").filter(Boolean):vn,s=0;s<i.length;s++)-1==a.indexOf(i[s])&&t.classList.remove(i[s]);for(var l=0;l<a.length;l++)-1==i.indexOf(a[l])&&t.classList.add(a[l])}if(e.style!=n.style){if(e.style)for(var c,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=u.exec(e.style);)t.style.removeProperty(c[1]);n.style&&(t.style.cssText+=n.style)}}function On(t,e,n){return Dn(t,t,Nn,Sn(e,n,1!=t.nodeType))}function An(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 In(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var Rn=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){for(var n=t.childCount,r=e.length,o=/* @__PURE__ */new Map;n>0&&r>0;r--){var i=e[r-1],a=i.node;if(a){if(a!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Pn(t,e){return t.type.side-e.type.side}function Bn(t,e,n,r,o){for(var i=[],a=0,s=0;a<t.length;a++){var l=t[a],c=s,u=s+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=null),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Fn(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,a=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=r.resolve(a);if(Ue(n)){for(s=c;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&ce.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==je(t);r||o;){if(t==n)return!0;var i=Pe(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==je(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;l=new ce(a==u?c:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;s=r.resolve(p)}return l||(l=Wn(t,s,c,"pointer"==e||t.state.selection.head<c.pos&&!i?1:-1)),l}function Hn(t){return t.editable?t.hasFocus():Gn(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qn(t,e){var n=t.state.selection;if(Un(t,n),Hn(t)){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,Pe(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&De.ie&&De.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var r,o,i=n.anchor,a=n.head;!zn||n instanceof se||(n.$from.parent.inlineContent||(r=_n(t,n.from)),n.empty||n.$from.parent.inlineContent||(o=_n(t,n.to))),t.docView.setSelection(i,a,t.root,e),zn&&(r&&Vn(r),o&&Vn(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(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),setTimeout(function(){Hn(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")},20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}Rn.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}},Rn.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},Rn.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 a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(t[o])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=bn.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}},Rn.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var a=this.index;a<o.length;a++)if(o[a].matchesNode(t,e,n)){i=a;break}}else for(var s=this.index,l=Math.min(o.length,s+1);s<l;s++){var c=o[s];if(c.matchesNode(t,e,n)&&!this.preMatch.matched.has(c)){i=s;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))},Rn.prototype.updateNodeAt=function(t,e,n,r,o){return!!this.top.children[r].update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index=r+1,!0)},Rn.prototype.findIndexWithChild=function(t){for(;;){var e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){var n=t.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}t=e}},Rn.prototype.updateNextNode=function(t,e,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var a=this.top.children[i];if(a instanceof wn){var s=this.preMatch.matched.get(a);if(null!=s&&s!=o)return!1;var l=a.dom;if((!this.lock||!(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))||t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&3!=a.dirty&&An(e,a.outerDeco))&&a.update(t,e,n,r))return this.destroyBetween(this.index,i),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},Rn.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,wn.create(this.top,t,e,n,r,o)),this.changed=!0},Rn.prototype.placeWidget=function(t,e,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var o=new gn(this.top,t,e,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},Rn.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof bn;)t=t.children[t.children.length-1];t&&t instanceof xn&&!/\n$/.test(t.node.text)||(De.safari&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},Rn.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var e=document.createElement(t);this.top.children.splice(this.index++,0,new Cn(this.top,vn,e,null)),this.changed=!0}};var zn=De.safari||De.chrome&&De.chrome_version<63;function _n(t,e){var n=t.docView.domFromPos(e,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(De.safari&&i&&"false"==i.contentEditable)return jn(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return jn(i);if(a)return jn(a)}}function jn(t){return t.contentEditable="true",De.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Vn(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Un(t,e){if(e instanceof ce){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&($n(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else $n(t)}function $n(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Wn(t,e,n,r){return t.someProp("createSelectionBetween",function(r){return r(t,e,n)})||se.between(e,n,r)}function Gn(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(n){return!1}}function Kn(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&oe.findFrom(a,e)}function Jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Zn(t,e,n){var r=t.state.selection;if(!(r instanceof se)){if(r instanceof ce&&r.node.isInline)return Jn(t,new se(e>0?r.$to:r.$from));var o=Kn(t.state,e);return!!o&&Jn(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=Kn(t.state,e);return!!(i&&i instanceof ce)&&Jn(t,i)}if(!(De.mac&&n.indexOf("m")>-1)){var a,s=r.$head,l=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=e<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=t.docView.descAt(c))&&!a.contentDOM)&&(ce.isSelectable(l)?Jn(t,new ce(e<0?t.state.doc.resolve(s.pos-l.nodeSize):s)):!!De.webkit&&Jn(t,new se(t.state.doc.resolve(e<0?c:c+l.nodeSize))))}}function Xn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Qn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Yn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,a=!1;for(De.gecko&&1==n.nodeType&&r<Xn(n)&&Qn(n.childNodes[r])&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Qn(s))o=n,i=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(er(n))break;for(var l=n.previousSibling;l&&Qn(l);)o=n.parentNode,i=Pe(l),l=l.previousSibling;if(l)r=Xn(n=l);else{if((n=n.parentNode)==t.dom)break;r=0}}a?nr(t,e,n,r):o&&nr(t,e,o,i)}}function tr(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,a=Xn(n);;)if(r<a){if(1!=n.nodeType)break;if(!Qn(n.childNodes[r]))break;o=n,i=++r}else{if(er(n))break;for(var s=n.nextSibling;s&&Qn(s);)o=s.parentNode,i=Pe(s)+1,s=s.nextSibling;if(s)r=0,a=Xn(n=s);else{if((n=n.parentNode)==t.dom)break;r=a=0}}o&&nr(t,e,o,i)}}function er(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function nr(t,e,n,r){if(Ue(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();var i=t.state;setTimeout(function(){t.state==i&&qn(t)},50)}function rr(t,e,n){var r=t.state.selection;if(r instanceof se&&!r.empty||n.indexOf("s")>-1)return!1;if(De.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var a=Kn(t.state,e);if(a&&a instanceof ce)return Jn(t,a)}if(!o.parent.inlineContent){var s=e<0?o:i,l=r instanceof pe?oe.near(s,e):oe.findFrom(s,e);return!!l&&Jn(t,l)}return!1}function or(t,e){if(!(t.state.selection instanceof se))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 a=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=t.state.tr;return e<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),t.dispatch(s),!0}return!1}function ir(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ar(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(De.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||De.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function sr(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Wn(t,e.resolve(n.anchor),e.resolve(n.head))}function lr(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 cr(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 a=r.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),r=a.content}var s=t.someProp("clipboardSerializer")||yt.fromSchema(t.state.schema),l=gr(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));for(var u,p=c.firstChild;p&&1==p.nodeType&&(u=mr[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=l.createElement(u[d]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f)}p=c.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:c,text:t.someProp("clipboardTextSerializer",function(t){return t(e)})||e.content.textBetween(0,e.content.size,"\n\n")}}function ur(t,e,n,r,o){var i,a,s=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",function(t){e=t(e,s||r)}),s)return new m(l.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var u=t.someProp("clipboardTextParser",function(t){return t(e,o,r)});if(u)a=u;else{var p=o.marks(),d=t.state.schema,f=yt.fromSchema(d);i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach(function(t){i.appendChild(document.createElement("p")).appendChild(f.serializeNode(d.text(t,p)))})}}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=gr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);if((n=o&&mr[o[1].toLowerCase()])&&(t=n.map(function(t){return"<"+t+">"}).join("")+t+n.map(function(t){return"</"+t+">"}).reverse().join("")),r.innerHTML=t,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),De.webkit&&function(t){for(var e=t.querySelectorAll(De.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<e.length;n++){var r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(i);var h=i&&i.querySelector("[data-pm-slice]"),v=h&&/^(\d+) (\d+) (.*)/.exec(h.getAttribute("data-pm-slice"));if(!a){var g=t.someProp("clipboardParser")||t.someProp("domParser")||st.fromSchema(t.state.schema);a=g.parseSlice(i,{preserveWhitespace:!(!c&&!v),context:o})}return a=v?function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(u){return t}for(var o=t.content,i=t.openStart,a=t.openEnd,s=n.length-2;s>=0;s-=2){var c=r.nodes[n[s]];if(!c||c.hasRequiredAttrs())break;o=l.from(c.create(n[s+1],o)),i++,a++}return new m(o,i,a)}(function(t,e,n){return e<t.openStart&&(t=new m(hr(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new m(hr(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}(a,+v[1],+v[2]),v[3]):m.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&&dr(n,o,t,i[i.length-1],0))i[i.length-1]=e;else{i.length&&(i[i.length-1]=fr(i[i.length-1],o.length));var a=pr(t,n);i.push(a),r=r.matchType(a.type,a.attrs),o=n}}}),i)return{v:l.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 pr(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,l.from(t));return t}function dr(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){var i=dr(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(l.from(pr(n,t,o+1))))}}function fr(t,e){if(0==e)return t;var n=t.content.replaceChild(t.childCount-1,fr(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(l.empty,!0);return t.copy(n.append(r))}function hr(t,e,n,r,o,i){var a=e<0?t.firstChild:t.lastChild,s=a.content;return o<r-1&&(s=hr(s,e,n,r,o+1,i)),o>=n&&(s=e<0?a.contentMatchAt(0).fillBefore(s,t.childCount>1||i<=o).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(l.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(s))}var mr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},vr=null;function gr(){return vr||(vr=document.implementation.createHTMLDocument("title"))}var yr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},br=De.ie&&De.ie_version<=11,wr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};wr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},wr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var kr=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]);De.ie&&De.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 wr,br&&(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};kr.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))},kr.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},kr.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,yr),br&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},kr.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()}br&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},kr.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},kr.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},kr.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return t.suppressingSelectionUpdates=!1},50)},kr.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Gn(t)){var t;if(this.suppressingSelectionUpdates)return qn(this.view);if(De.ie&&De.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&qe(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},kr.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},kr.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},kr.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){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)&&Gn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,a=[];if(this.view.editable)for(var s=0;s<t.length;s++){var l=this.registerMutation(t[s],a);l&&(r=r<0?l.from:Math.min(l.from,r),o=o<0?l.to:Math.max(l.to,o),l.typeOver&&(i=!0))}if(De.gecko&&a.length>1){var c=a.filter(function(t){return"BR"==t.nodeName});if(2==c.length){var u=c[0],p=c[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),d=this.view,xr||(xr=!0,getComputedStyle(d.dom).whiteSpace)),this.handleDOMChange(r,o,i,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||qn(this.view),this.currentSelection.set(e))}var d},kr.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){for(var r=0;r<t.addedNodes.length;r++)e.push(t.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var o=t.previousSibling,i=t.nextSibling;if(De.ie&&De.ie_version<=11&&t.addedNodes.length)for(var a=0;a<t.addedNodes.length;a++){var s=t.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(o=l),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(i=c)}var u=o&&o.parentNode==t.target?Pe(o)+1:0,p=n.localPosFromDOM(t.target,u,-1),d=i&&i.parentNode==t.target?Pe(i):t.target.childNodes.length;return{from:p,to:n.localPosFromDOM(t.target,d,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 xr=!1,Cr={},Tr={};function Er(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function Mr(t){t.someProp("handleDOMEvents",function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return Nr(t,e)})})}function Nr(t,e){return t.someProp("handleDOMEvents",function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)})}function Sr(t){return{left:t.clientX,top:t.clientY}}function Dr(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),a=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}},s=i.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function Lr(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Or(t,e,n,r){return Dr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",function(n){return n(t,e,r)})}function Ar(t,e,n,r){return Dr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",function(n){return n(t,e,r)})||function(t,e,n){if(0!=n.button)return!1;var r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Lr(t,se.create(r,0,r.content.size)),!0);for(var o=r.resolve(e),i=o.depth+1;i>0;i--){var a=i>o.depth?o.nodeAfter:o.node(i),s=o.before(i);if(a.inlineContent)Lr(t,se.create(r,s+1,s+1+a.content.size));else{if(!ce.isSelectable(a))continue;Lr(t,ce.create(r,s))}return!0}}(t,n,r)}function Ir(t){return zr(t)}Tr.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!Br(t,e))if(229!=e.keyCode&&t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!De.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",function(n){return n(t,e)})||function(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||De.mac&&72==n&&"c"==r?or(t,-1)||Yn(t):46==n||De.mac&&68==n&&"c"==r?or(t,1)||tr(t):13==n||27==n||(37==n?Zn(t,-1,r)||Yn(t):39==n?Zn(t,1,r)||tr(t):38==n?rr(t,-1,r)||Yn(t):40==n?function(t){if(De.safari&&!(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;ir(t,o,!0),setTimeout(function(){return ir(t,o,!1)},20)}}}(t)||rr(t,1,r)||tr(t):r==(De.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}(t,e)?e.preventDefault():Er(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout(function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}),t.lastIOSEnter=0)},200)}},Tr.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},Tr.keypress=function(t,e){if(!(Br(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||De.mac&&e.metaKey))if(t.someProp("handleKeyPress",function(n){return n(t,e)}))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof se&&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 Rr=De.mac?"metaKey":"ctrlKey";Cr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=Ir(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[Rr]&&("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(Sr(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Pr(t,i,e,n)):("doubleClick"==o?Or:Ar)(t,i.pos,i.inside,e)?e.preventDefault():Er(t,"pointer"))};var Pr=function(t,e,n,r){var o,i,a=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Rr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var s=t.state.doc.resolve(e.pos);o=s.parent,i=s.depth?s.before():0}this.mightDrag=null;var l=r?null:n.target,c=l?t.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null;var u=t.state.selection;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof ce&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&De.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Er(t,"pointer")};function Br(t,e){return!!t.composing||!!(De.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Pr.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Pr.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(Sr(t))),this.allowDefault||!e?Er(this.view,"pointer"):function(t,e,n,r,o){return Dr(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 ce&&(n=o.node);for(var i=t.state.doc.resolve(e),a=i.depth+1;a>0;a--){var s=a>i.depth?i.nodeAfter:i.node(a);if(ce.isSelectable(s)){r=n&&o.$from.depth>0&&a>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(a);break}}return null!=r&&(Lr(t,ce.create(t.state.doc,r)),!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&&ce.isSelectable(r))&&(Lr(t,new ce(n)),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||De.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||De.chrome&&!(this.view.state.selection instanceof se)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Lr(this.view,oe.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Er(this.view,"pointer")}},Pr.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),Er(this.view,"pointer"),0==t.buttons&&this.done()},Cr.touchdown=function(t){Ir(t),Er(t,"pointer")},Cr.contextmenu=function(t){return Ir(t)};var Fr=De.android?5e3:-1;function Hr(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout(function(){return zr(t)},e))}function qr(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function zr(t,e){if(t.domObserver.forceFlush(),qr(t),e||t.docView.dirty){var n=Fn(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}Tr.compositionstart=Tr.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(),zr(t,!0),t.markCursor=null;else if(zr(t),De.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 a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){r.collapse(a,a.nodeValue.length);break}o=a,i=-1}t.composing=!0}Hr(t,Fr)},Tr.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Hr(t,20))};var _r=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function jr(t,e,n,r){var o=ur(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",function(e){return e(t,r,o||m.empty)}))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),a=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Cr.copy=Tr.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=_r?null:e.clipboardData,i=cr(t,n.content()),a=i.dom,s=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",s)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}}(t,a),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},Tr.paste=function(t,e){var n=_r?null:e.clipboardData;n&&jr(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,e):jr(t,r.textContent,r.innerHTML,e)},50)}}(t,e)};var Vr=function(t,e){this.slice=t,this.move=e},Ur=De.mac?"altKey":"ctrlKey";for(var $r in Cr.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(Sr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof ce?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ce.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);i&&i.node.type.spec.draggable&&i!=t.docView&&t.dispatch(t.state.tr.setSelection(ce.create(t.state.doc,i.posBefore)))}var a=t.state.selection.content(),s=cr(t,a),l=s.dom,c=s.text;e.dataTransfer.clearData(),e.dataTransfer.setData(_r?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",_r||e.dataTransfer.setData("text/plain",c),t.dragging=new Vr(a,!e[Ur])}},Cr.dragend=function(t){var e=t.dragging;window.setTimeout(function(){t.dragging==e&&(t.dragging=null)},50)},Tr.dragover=Tr.dragenter=function(t,e){return e.preventDefault()},Tr.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(Sr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",function(t){i=t(i)}):i=ur(t,e.dataTransfer.getData(_r?"Text":"text/plain"),_r?null:e.dataTransfer.getData("text/html"),!1,o);var a=n&&!e[Ur];if(t.someProp("handleDrop",function(n){return n(t,e,i||m.empty,a)}))e.preventDefault();else if(i){e.preventDefault();var s=i?function(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 a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),u=r.node(s),p=!1;if(1==a)p=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);p=d&&u.canReplaceWith(c,c,d[0])}if(p)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}(t.state.doc,o.pos,i):o.pos;null==s&&(s=o.pos);var l=t.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),!l.doc.eq(p)){var d=l.doc.resolve(c);if(u&&ce.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new ce(d));else{var f=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach(function(t,e,n,r){return f=r}),l.setSelection(Wn(t,d,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}}}}}},Cr.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())&&qn(t)},20))},Cr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},Cr.beforeinput=function(t,e){if(De.chrome&&De.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,$e(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)}},Tr)Cr[$r]=Tr[$r];function Wr(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 Gr=function(t,e){this.spec=e||Yr,this.side=this.spec.side||0,this.toDOM=t};Gr.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 Zr(i-n,i-n,this)},Gr.prototype.valid=function(){return!0},Gr.prototype.eq=function(t){return this==t||t instanceof Gr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Wr(this.spec,t.spec))};var Kr=function(t,e){this.spec=e||Yr,this.attrs=t};Kr.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 Zr(o,i,this)},Kr.prototype.valid=function(t,e){return e.from<e.to},Kr.prototype.eq=function(t){return this==t||t instanceof Kr&&Wr(this.attrs,t.attrs)&&Wr(this.spec,t.spec)},Kr.is=function(t){return t.type instanceof Kr};var Jr=function(t,e){this.spec=e||Yr,this.attrs=t};Jr.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 Zr(o.pos-n,i.pos-n,this)},Jr.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},Jr.prototype.eq=function(t){return this==t||t instanceof Jr&&Wr(this.attrs,t.attrs)&&Wr(this.spec,t.spec)};var Zr=function(t,e,n){this.from=t,this.to=e,this.type=n},Xr={spec:{configurable:!0},inline:{configurable:!0}};Zr.prototype.copy=function(t,e){return new Zr(t,e,this.type)},Zr.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Zr.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Zr.widget=function(t,e,n){return new Zr(t,t,new Gr(e,n))},Zr.inline=function(t,e,n,r){return new Zr(t,e,new Kr(n,r))},Zr.node=function(t,e,n,r){return new Zr(t,e,new Jr(n,r))},Xr.spec.get=function(){return this.type.spec},Xr.inline.get=function(){return this.type instanceof Kr},Object.defineProperties(Zr.prototype,Xr);var Qr=[],Yr={},to=function(t,e){this.local=t&&t.length?t:Qr,this.children=e&&e.length?e:Qr};to.create=function(t,e){return e.length?ao(e,t,0,Yr):eo},to.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},to.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var a=this.local[i];a.from<=e&&a.to>=t&&(!o||o(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){var l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,n,r+l,o)}},to.prototype.map=function(t,e,n){return this==eo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Yr)},to.prototype.mapInner=function(t,e,n,r,o){for(var i,a=0;a<this.local.length;a++){var s=this.local[a].map(t,n,r);s&&s.type.valid(e,s)?(i||(i=[])).push(s):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?function(t,e,n,r,o,i,a){for(var s=t.slice(),l=function(t,e,n,r){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||t>l+i||(e>=s[a]+i?s[a+1]=-1:n>=o&&(c=r-n-(e-t))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var u=!1,p=0;p<s.length;p+=3)if(-1==s[p+1]){var d=n.map(t[p]+i),f=d-o;if(f<0||f>=r.content.size){u=!0;continue}var h=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==h){var b=s[p+2].mapInner(n,y,d+1,t[p]+i+1,a);b!=eo?(s[p]=f,s[p+1]=h,s[p+2]=b):(s[p+1]=-2,u=!0)}else u=!0}if(u){var w=function(t,e,n,r,o,i,a){function s(t,e){for(var i=0;i<t.local.length;i++){var l=t.local[i].map(r,o,e);l?n.push(l):a.onRemove&&a.onRemove(t.local[i].spec)}for(var c=0;c<t.children.length;c+=3)s(t.children[c+2],t.children[c]+e+1)}for(var l=0;l<t.length;l+=3)-1==t[l+1]&&s(t[l+2],e[l]+i+1);return n}(s,t,e||[],n,o,i,a),k=ao(w,r,0,a);e=k.local;for(var x=0;x<s.length;x+=3)s[x+1]<0&&(s.splice(x,3),x-=3);for(var C=0,T=0;C<k.children.length;C+=3){for(var E=k.children[C];T<s.length&&s[T]<E;)T+=3;s.splice(T,0,k.children[C],k.children[C+1],k.children[C+2])}}return new to(e&&e.sort(so),s)}(this.children,i,t,e,n,r,o):i?new to(i.sort(so)):eo},to.prototype.add=function(t,e){return e.length?this==eo?to.create(t,e):this.addInner(t,e,0):this},to.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach(function(t,a){var s,l=a+n;if(s=oo(e,t,l)){for(r||(r=o.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(t,s,l+1):r.splice(i,0,a,a+t.nodeSize,ao(s,t,l+1,Yr)),i+=3}});for(var a=ro(i?io(e):e,-n),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||a.splice(s--,1);return new to(a.length?this.local.concat(a).sort(so):this.local,r||this.children)},to.prototype.remove=function(t){return 0==t.length||this==eo?this:this.removeInner(t,0)},to.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,a=n[o]+e,s=n[o+1]+e,l=0,c=void 0;l<t.length;l++)(c=t[l])&&c.from>a&&c.to<s&&(t[l]=null,(i||(i=[])).push(c));if(i){n==this.children&&(n=this.children.slice());var u=n[o+2].removeInner(i,a+1);u!=eo?n[o+2]=u:(n.splice(o,3),o-=3)}}if(r.length)for(var p=0,d=void 0;p<t.length;p++)if(d=t[p])for(var f=0;f<r.length;f++)r[f].eq(d,e)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new to(r,n):eo},to.prototype.forChild=function(t,e){if(this==eo)return this;if(e.isLeaf)return to.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,a=i+e.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>i&&l.type instanceof Kr){var c=Math.max(i,l.from)-i,u=Math.min(a,l.to)-i;c<u&&(r||(r=[])).push(l.copy(c,u))}}if(r){var p=new to(r.sort(so));return n?new no([p,n]):p}return n||eo},to.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof to)||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},to.prototype.locals=function(t){return lo(this.localsInner(t))},to.prototype.localsInner=function(t){if(this==eo)return Qr;if(t.inlineContent||!this.local.some(Kr.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Kr||e.push(this.local[n]);return e};var eo=new to;to.empty=eo,to.removeOverlap=lo;var no=function(t){this.members=t};function ro(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Zr(o.from+e,o.to+e,o.type))}return n}function oo(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,a=void 0;i<t.length;i++)(a=t[i])&&a.from>n&&a.to<r&&((o||(o=[])).push(a),t[i]=null);return o}function io(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ao(t,e,n,r){var o=[],i=!1;e.forEach(function(e,a){var s=oo(t,e,a+n);if(s){i=!0;var l=ao(s,e,n+a+1,r);l!=eo&&o.push(a,a+e.nodeSize,l)}});for(var a=ro(i?io(t):t,-n).sort(so),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||o.length?new to(a,o):eo}function so(t,e){return t.from-e.from||t.to-e.to}function lo(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),co(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),co(e,o+1,i.copy(r.to,i.to)))}}return e}function co(t,e,n){for(;e<t.length&&so(n,t[e])>0;)e++;t.splice(e,0,n)}function uo(t){var e=[];return t.someProp("decorations",function(n){var r=n(t.state);r&&r!=eo&&e.push(r)}),t.cursorWrapper&&e.push(to.create(t.state.doc,[t.cursorWrapper.deco])),no.from(e)}no.prototype.forChild=function(t,e){if(e.isLeaf)return to.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=eo&&(o instanceof no?n=n.concat(o.members):n.push(o))}return no.from(n)},no.prototype.eq=function(t){if(!(t instanceof no)||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},no.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?lo(n?e:e.sort(so)):Qr},no.from=function(t){switch(t.length){case 0:return eo;case 1:return t[0];default:return new no(t)}};var po=function(t,e){this._props=e,this.state=e.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,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=vo(this),this.markCursor=null,this.cursorWrapper=null,mo(this),this.nodeViews=go(this),this.docView=kn(this.state.doc,ho(this),uo(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.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new kr(t,function(e,n,r,o){return function(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Fn(t,i);if(a&&!t.state.selection.eq(a)){var s=t.state.tr.setSelection(a);"pointer"==i?s.setMeta("pointer",!0):"key"==i&&s.scrollIntoView(),t.dispatch(s)}}else{var c=t.state.doc.resolve(e),u=c.sharedDepth(n);e=c.before(u+1),n=t.state.doc.resolve(n).after(u+1);var p=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,a=r.toOffset,s=r.from,l=r.to,c=t.root.getSelection(),u=null,p=c.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:c.anchorOffset}],Ue(c)||u.push({node:c.focusNode,offset:c.focusOffset})),De.chrome&&8===t.lastKeyCode)for(var d=a;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){a=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||st.fromSchema(t.state.schema),g=m.resolve(s),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:a,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:ar,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+s,head:k+s}}return{doc:b,sel:y,from:s,to:l}}(t,e,n);if(De.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(m=t.state.selection.to,v="end"):(m=t.state.selection.from,v="start"),t.lastKeyCode=null;var b=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var a=t.findDiffEnd(e,n+t.size,n+e.size),s=a.a,l=a.b;return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&t.size<e.size?(l=(i-=r<=i&&r>=s?i-r:0)+(l-s),s=i):l<i&&(s=(i-=r<=i&&r>=l?i-r:0)+(s-l),l=i),{start:i,endA:s,endB:l}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&p instanceof se&&!p.empty&&p.$head.sameParent(p.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((De.ios&&t.lastIOSEnter>Date.now()-225||De.android)&&o.some(function(t){return"DIV"==t.nodeName||"P"==t.nodeName})&&t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}))return void(t.lastIOSEnter=0);if(d.sel){var w=sr(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:p.from,endA:p.to,endB:p.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof se&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),De.ie&&De.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&"  "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((De.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some(function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))||!T&&x.pos<d.doc.content.size&&(k=oe.findFrom(d.doc.resolve(x.pos+1),1,!0))&&k.head==C.pos)&&t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))}))t.lastIOSEnter=0;else if(t.state.selection.anchor>b.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||lr(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 a=t.resolve(lr(i,!0,!0));return!(!a.parent.isTextblock||a.pos>n||lr(a,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(g,b.start,b.endA,x,C)&&t.someProp("handleKeyDown",function(e){return e(t,$e(8,"Backspace"))}))De.android&&De.chrome&&t.domObserver.suppressSelectionUpdates();else{De.chrome&&De.android&&b.toB==b.from&&(t.lastAndroidDelete=Date.now()),De.android&&!T&&x.start()!=C.start()&&0==C.parentOffset&&x.depth==C.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==b.endA&&(b.endB-=2,C=d.doc.resolveNoCache(b.endB-d.from),setTimeout(function(){t.someProp("handleKeyDown",function(e){return e(t,$e(13,"Enter"))})},20));var E,M,N,S,D=b.start,L=b.endA;if(T)if(x.pos==C.pos)De.ie&&De.ie_version<=11&&0==x.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout(function(){return qn(t)},20)),E=t.state.tr.delete(D,L),M=g.resolve(b.start).marksAcross(g.resolve(b.endA));else if(b.endA==b.endB&&(S=g.resolve(b.start))&&(N=function(t,e){for(var n,r,o,i=t.firstChild.marks,a=e.firstChild.marks,s=i,c=a,u=0;u<a.length;u++)s=a[u].removeFromSet(s);for(var p=0;p<i.length;p++)c=i[p].removeFromSet(c);if(1==s.length&&0==c.length)r=s[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=s.length||1!=c.length)return null;r=c[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var d=[],f=0;f<e.childCount;f++)d.push(o(e.child(f)));if(l.from(d).eq(t))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,C.parentOffset),S.parent.content.cut(S.parentOffset,b.endA-S.start()))))E=t.state.tr,"add"==N.type?E.addMark(D,L,N.mark):E.removeMark(D,L,N.mark);else if(x.parent.child(x.index()).isText&&x.index()==C.index()-(C.textOffset?0:1)){var O=x.parent.textBetween(x.parentOffset,C.parentOffset);if(t.someProp("handleTextInput",function(e){return e(t,D,L,O)}))return;E=t.state.tr.insertText(O,D,L)}if(E||(E=t.state.tr.replace(D,L,d.doc.slice(b.start-d.from,b.endB-d.from))),d.sel){var A=sr(t,E.doc,d.sel);A&&!(De.chrome&&De.android&&t.composing&&A.empty&&(b.start!=b.endB||t.lastAndroidDelete<Date.now()-100)&&(A.head==D||A.head==E.mapping.map(L)-1)||De.ie&&A.empty&&A.head==D)&&E.setSelection(A)}M&&E.ensureMarks(M),t.dispatch(E.scrollIntoView())}}}(t,e,n,r,o)}),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=/* @__PURE__ */Object.create(null);var e=function(e){var n=Cr[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)||Nr(t,e)||!t.editable&&e.type in Tr||n(t,e)})};for(var n in Cr)e(n);De.safari&&t.dom.addEventListener("input",function(){return null}),Mr(t)}(this),this.pluginViews=[],this.updatePluginViews()},fo={props:{configurable:!0},root:{configurable:!0}};function ho(t){var e=/* @__PURE__ */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]))}),[Zr.node(0,t.state.doc.content.size,e)]}function mo(t){if(t.markCursor){var e=document.createElement("img");e.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:e,deco:Zr.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function vo(t){return!t.someProp("editable",function(e){return!1===e(t.state)})}function go(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}fo.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},po.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Mr(this),this._props=t,this.updateStateInner(t.state,!0)},po.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)},po.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},po.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1,i=!1;if(t.storedMarks&&this.composing&&(qr(this),i=!0),this.state=t,e){var a=go(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})(a,this.nodeViews)&&(this.nodeViews=a,o=!0),Mr(this)}this.editable=vo(this),mo(this);var s=uo(this),l=ho(this),c=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,l,s);!u&&t.selection.eq(r.selection)||(i=!0);var p="preserve"==c&&i&&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,a=o+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=t.root.elementFromPoint(i,a);if(s!=t.dom&&t.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=o-20){e=s,n=l.top;break}}}return{refDOM:e,refTop:n,stack:Ze(t.dom)}}(this);if(i){this.domObserver.stop();var d=u&&(De.ie||De.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){var n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(r.selection,t.selection);if(u){var f=De.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=kn(t.doc,l,s,this.dom,this)),f&&!this.trackWrites&&(d=!0)}d||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&function(t){var e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.root.getSelection();return qe(e.node,e.offset,n.anchorNode,n.anchorOffset)}(this))?qn(this,d):(Un(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var h=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",function(t){return t(n)})||(t.selection instanceof ce?Je(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),h):Je(this,this.coordsAtPos(t.selection.head,1),h))}else p&&function(t){var e=t.refDOM,n=t.refTop,r=t.stack,o=e?e.getBoundingClientRect().top:0;Xe(r,0==o?0:o-n)}(p)},po.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},po.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))}}},po.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 a=o[i].props[t];if(null!=a&&(n=e?e(a):a))return n}},po.prototype.hasFocus=function(){return this.root.activeElement==this.dom},po.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(Qe)return t.focus(Qe);var e=Ze(t);t.focus(null==Qe?{get preventScroll(){return Qe={preventScroll:!0},!0}}:void 0),Qe||(Qe=!1,Xe(e,0))}(this.dom),qn(this),this.domObserver.start()},fo.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},po.prototype.posAtCoords=function(t){return nn(this,t)},po.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),an(this,t,e)},po.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},po.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},po.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},po.prototype.endOfTextblock=function(t,e){return function(t,e,n){return pn==e&&dn==n?fn:(pn=e,dn=n,fn="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return cn(t,e,function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).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=an(t,o.pos,1),a=e.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=He(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top&&("up"==n?c.bottom<i.top+1:c.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,a=o==r.parent.content.size,s=getSelection();return un.test(r.parent.textContent)&&s.modify?cn(t,e,function(){var e=s.getRangeAt(0),o=s.focusNode,i=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||o==s.focusNode&&i==s.focusOffset;return s.removeAllRanges(),s.addRange(e),null!=a&&(s.caretBidiLevel=a),l}):"left"==n||"backward"==n?i:a}(t,e,n))}(this,e||this.state,t)},po.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),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],uo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},po.prototype.dispatchEvent=function(t){return function(t,e){Nr(t,e)||!Cr[e.type]||!t.editable&&e.type in Tr||Cr[e.type](t,e)}(this,t)},po.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(po.prototype,fo);for(var yo={__proto__:null,Decoration:Zr,DecorationSet:to,EditorView:po,__endComposition:zr,__parseFromClipboard:ur,__serializeForClipboard:cr},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:"'"},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:'"'},ko="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),xo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Co=0;Co<10;Co++)bo[48+Co]=bo[96+Co]=String(Co);for(Co=1;Co<=24;Co++)bo[Co+111]="F"+Co;for(Co=65;Co<=90;Co++)bo[Co]=String.fromCharCode(Co+32),wo[Co]=String.fromCharCode(Co);for(var To in bo)wo.hasOwnProperty(To)||(wo[To]=bo[To]);var Eo="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Mo(t){var e,n,r,o,i=t.split(/-(?!$)/),a=i[i.length-1];"Space"==a&&(a=" ");for(var s=0;s<i.length-1;s++){var l=i[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))e=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);Eo?o=!0:n=!0}}return e&&(a="Alt-"+a),n&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function No(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 So(t){return new Te({props:{handleKeyDown:Do(t)}})}function Do(t){var e=function(t){var e=/* @__PURE__ */Object.create(null);for(var n in t)e[Mo(n)]=t[n];return e}(t);return function(t,n){var r,o=function(t){var e=!(ko&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xo&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&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}(n),i=1==o.length&&" "!=o,a=e[No(o,n,!i)];if(a&&a(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=bo[n.keyCode])&&r!=o){var s=e[No(r,n,!0)];if(s&&s(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var l=e[No(o,n,!0)];if(l&&l(t.state,t.dispatch,t))return!0}return!1}}function Lo(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Oo(t,e,n){for(;t;t="start"==e?t.firstChild:t.lastChild){if(t.isTextblock)return!0;if(n&&1!=t.childCount)return!1}return!1}function Ao(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 Io(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=Ro(r);if(!o)return!1;var i=o.nodeAfter;if(qo(t,o,e))return!0;if(0==r.parent.content.size&&(Oo(i,"start")||ce.isSelectable(i))){if(e){var a=t.tr.deleteRange(r.before(),r.after());a.setSelection(Oo(i,"start")?oe.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):ce.create(a.doc,a.mapping.map(o.pos))),e(a.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 Ro(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 Po(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 Bo(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 Fo(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),a=r.indexAfter(-1),s=Bo(i.contentMatchAt(a));if(!i.canReplaceWith(a,a,s))return!1;if(e){var l=r.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(oe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0}function Ho(t,e){return e&&e(t.tr.setSelection(new pe(t.doc))),!0}function qo(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&&!Vt(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;var s=e.parent.canReplace(e.index(),e.index()+1);if(s&&(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,u=l.empty,p=r.length-1;p>=0;p--)u=l.from(r[p].create(null,u));u=l.from(i.copy(u));var d=t.tr.step(new Bt(e.pos-1,c,e.pos,c,new m(u,1,0),r.length,!0)),f=c+2*r.length;Vt(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=oe.findFrom(e,1),v=h&&h.$from.blockRange(h.$to),g=v&&qt(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(s&&Oo(a,"start",!0)&&Oo(i,"end")){for(var y=i,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;for(var w=a,k=1;!w.isTextblock;w=w.firstChild)k++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var x=l.empty,C=b.length-1;C>=0;C--)x=l.from(b[C].copy(x));n(t.tr.step(new Bt(e.pos-b.length,e.pos+a.nodeSize,e.pos+k,e.pos+a.nodeSize-k,new m(x,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function zo(t,e){return function(n,r){var o=n.selection,i=o.from,a=o.to,s=!1;return n.doc.nodesBetween(i,a,function(r,o){if(s)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)s=!0;else{var i=n.doc.resolve(o),a=i.index();s=i.parent.canReplaceWith(a,a+1,t)}}),!!s&&(r&&r(n.tr.setBlockType(i,a,t,e).scrollIntoView()),!0)}}function _o(t,e){return function(n,r){var o=n.selection,i=o.empty,a=o.$cursor,s=o.ranges;if(i&&!a||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,a=o.$to,s=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,a.pos,function(t){if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)}),s)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,s,t))return!1;if(r)if(a)t.isInSet(n.storedMarks||a.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var l=!1,c=n.tr,u=0;!l&&u<s.length;u++){var p=s[u],d=p.$from,f=p.$to;l=n.doc.rangeHasMark(d.pos,f.pos,t)}for(var h=0;h<s.length;h++){var m=s[h],v=m.$from,g=m.$to;if(l)c.removeMark(v.pos,g.pos,t);else{var y=v.pos,b=g.pos,w=v.nodeAfter,k=g.nodeBefore,x=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,C=k&&k.isText?/\s*$/.exec(k.text)[0].length:0;y+x<b&&(y+=x,b-=C),c.addMark(y,b,t.create(e))}}r(c.scrollIntoView())}return!0}}function jo(){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 Vo=jo(Lo,function(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=Ao(r);if(!o){var i=r.blockRange(),a=i&&qt(i);return null!=a&&(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}var s=o.nodeBefore;if(!s.type.spec.isolating&&qo(t,o,e))return!0;if(0==r.parent.content.size&&(Oo(s,"end")||ce.isSelectable(s))){if(e){var l=t.tr.deleteRange(r.before(),r.after());l.setSelection(Oo(s,"end")?oe.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):ce.create(l.doc,o.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}return!(!s.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),0))},function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Ao(o)}var a=i&&i.nodeBefore;return!(!a||!ce.isSelectable(a)||(e&&e(t.tr.setSelection(ce.create(t.doc,i.pos-a.nodeSize)).scrollIntoView()),0))}),Uo=jo(Lo,Io,function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=Ro(o)}var a=i&&i.nodeAfter;return!(!a||!ce.isSelectable(a)||(e&&e(t.tr.setSelection(ce.create(t.doc,i.pos)).scrollIntoView()),0))}),$o={Enter:jo(Po,function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(n instanceof pe||r.parent.inlineContent||o.parent.inlineContent)return!1;var i=Bo(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(a,i.createAndFill());s.setSelection(se.create(s.doc,a+1)),e(s.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(jt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&qt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof ce&&t.selection.node.isBlock)return!(!r.parentOffset||!jt(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 se||t.selection instanceof pe)&&a.deleteSelection();var s=0==r.depth?null:Bo(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&s?[{type:s}]:null,c=jt(a.doc,a.mapping.map(r.pos),1,l);if(l||c||!jt(a.doc,a.mapping.map(r.pos),1,s&&[{type:s}])||(l=[{type:s}],c=!0),c&&(a.split(a.mapping.map(r.pos),1,l),!i&&!r.parentOffset&&r.parent.type!=s)){var u=a.mapping.map(r.before()),p=a.doc.resolve(u);r.node(-1).canReplaceWith(p.index(),p.index()+1,s)&&a.setNodeMarkup(a.mapping.map(r.before()),s)}e(a.scrollIntoView())}return!0}),"Mod-Enter":Fo,Backspace:Vo,"Mod-Backspace":Vo,"Shift-Backspace":Vo,Delete:Uo,"Mod-Delete":Uo,"Mod-a":Ho},Wo={"Ctrl-h":$o.Backspace,"Alt-Backspace":$o["Mod-Backspace"],"Ctrl-d":$o.Delete,"Ctrl-Alt-Backspace":$o["Mod-Delete"],"Alt-Delete":$o["Mod-Delete"],"Alt-d":$o["Mod-Delete"]};for(var Go in $o)Wo[Go]=$o[Go];var Ko=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Wo:$o,Jo=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 a=e[0].lastIndexOf(e[1]);i+=e[0].slice(a+e[1].length);var s=(r+=a)-o;s>0&&(i=e[0].slice(a-s,a)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Zo(t){var e=t.rules,n=new Te({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Xo(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout(function(){var r=t.state.selection.$cursor;r&&Xo(t,r.pos,r.pos,"",e,n)})}}},isInputRules:!0});return n}function Xo(t,e,n,r,o,i){if(t.composing)return!1;var a=t.state,s=a.doc.resolve(e);if(s.parent.type.spec.code)return!1;for(var l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<o.length;c++){var u=o[c].match.exec(l),p=u&&o[c].handler(a,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 Qo(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 a=t.tr,s=i.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(i.text){var c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else a.delete(i.from,i.to);e(a)}return!0}}return!1}var Yo=new Jo(/--$/,"—"),ti=new Jo(/\.\.\.$/,"…"),ei=new Jo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),ni=new Jo(/"$/,"”"),ri=new Jo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),oi=new Jo(/'$/,"’"),ii={__proto__:null,InputRule:Jo,closeDoubleQuote:ni,closeSingleQuote:oi,ellipsis:ti,emDash:Yo,inputRules:Zo,openDoubleQuote:ei,openSingleQuote:ri,smartQuotes:[ei,ni,ri,oi],textblockTypeInputRule:function(t,e,n){return new Jo(t,function(t,r,o,i){var a=t.doc.resolve(o),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,s):null})},undoInputRule:Qo,wrappingInputRule:function(t,e,n,r){return new Jo(t,function(t,o,i,a){var s=n instanceof Function?n(o):n,l=t.tr.delete(i,a),c=l.doc.resolve(i).blockRange(),u=c&&zt(c,e,s);if(!u)return null;l.wrap(c,u);var p=l.doc.resolve(i-1).nodeBefore;return p&&p.type==e&&Vt(l.doc,i-1)&&(!r||r(o,p))&&l.join(i-1),l})}},ai=200,si=function(){};si.prototype.append=function(t){return t.length?(t=si.from(t),!this.length&&t||t.length<ai&&this.leafAppend(t)||this.length<ai&&t.leafPrepend(this)||this.appendInner(t)):this},si.prototype.prepend=function(t){return t.length?si.from(t).append(this):this},si.prototype.appendInner=function(t){return new ci(this,t)},si.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?si.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},si.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},si.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)},si.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},si.from=function(t){return t instanceof si?t:t&&t.length?new li(t):si.empty};var li=/* @__PURE__ */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<=ai)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=ai)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}(si);si.empty=new li([]);var ci=/* @__PURE__ */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}(si),ui=function(t,e){this.items=t,this.eventCount=e};ui.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 a,s,l=t.tr,c=[],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 pi(t.map));var p,d=t.step.map(r.slice(o));d&&l.maybeStep(d).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],c.push(new pi(p,null,null,c.length+u.length))),o--,p&&r.appendMap(p,o)}else l.maybeStep(t.step);return t.selection?(a=r?t.selection.map(r.slice(o)):t.selection,s=new ui(n.items.slice(0,i).append(u.reverse().concat(c)),n.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:l,selection:a}},ui.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,a=this.items,s=!r&&a.length?a.get(a.length-1):null,l=0;l<t.steps.length;l++){var c,u=t.steps[l].invert(t.docs[l]),p=new pi(t.mapping.maps[l],u,e);(c=s&&s.merge(p))&&(p=c,l?o.pop():a=a.slice(0,a.length-1)),o.push(p),e&&(i++,e=null),r||(s=p)}var d=i-n.depth;return d>fi&&(a=function(t,e){var n;return t.forEach(function(t,r){if(t.selection&&0==e--)return n=r,!1}),t.slice(n)}(a,d),i-=d),new ui(a.append(o),i)},ui.prototype.remapping=function(t,e){var n=new Nt;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},ui.prototype.addMaps=function(t){return 0==this.eventCount?this:new ui(this.items.append(t.map(function(t){return new pi(t)})),this.eventCount)},ui.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,a=this.eventCount;this.items.forEach(function(t){t.selection&&a--},r);var s=e;this.items.forEach(function(e){var r=o.getMirror(--s);if(null!=r){i=Math.min(i,r);var l=o.maps[r];if(e.step){var c=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(s+1,r));u&&a++,n.push(new pi(l,c,u))}else n.push(new pi(l))}},r);for(var l=[],c=e;c<i;c++)l.push(new pi(o.maps[c]));var u=this.items.slice(0,r).append(l).append(n),p=new ui(u,a);return p.emptyItemCount()>500&&(p=p.compress(this.items.length-n.length)),p},ui.prototype.emptyItemCount=function(){var t=0;return this.items.forEach(function(e){e.step||t++}),t},ui.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,a){if(a>=t)r.push(i),i.selection&&o++;else if(i.step){var s=i.step.map(e.slice(n)),l=s&&s.getMap();if(n--,l&&e.appendMap(l,n),s){var c=i.selection&&i.selection.map(e.slice(n));c&&o++;var u,p=new pi(l.invert(),s,c),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--},this.items.length,0),new ui(si.from(r.reverse()),o)},ui.empty=new ui(si.empty,0);var pi=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};pi.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new pi(e.getMap().invert(),e,this.selection)}};var di=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},fi=20;function hi(t){var e=[];return t.forEach(function(t,n,r,o){return e.push(r,o)}),e}function mi(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 vi(t,e,n,r){var o=bi(e),i=wi.get(e).spec.config,a=(r?t.undone:t.done).popEvent(e,o);if(a){var s=a.selection.resolve(a.transform.doc),l=(r?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,o),c=new di(r?l:a.remaining,r?a.remaining:l,null,0);n(a.transform.setSelection(s).setMeta(wi,{redo:r,historyState:c}).scrollIntoView())}}var gi=!1,yi=null;function bi(t){var e=t.plugins;if(yi!=e){gi=!1,yi=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){gi=!0;break}}return gi}var wi=new Ne("history"),ki=new Ne("closeHistory");function xi(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new Te({key:wi,state:{init:function(){return new di(ui.empty,ui.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(wi);if(i)return i.historyState;n.getMeta(ki)&&(t=new di(t.done,t.undone,null,0));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(a&&a.getMeta(wi))return a.getMeta(wi).redo?new di(t.done.addTransform(n,null,r,bi(e)),t.undone,hi(n.mapping.maps[n.steps.length-1]),t.prevTime):new di(t.done,t.undone.addTransform(n,null,r,bi(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new di(t.done.rebased(n,o),t.undone.rebased(n,o),mi(t.prevRanges,n.mapping),t.prevTime):new di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),mi(t.prevRanges,n.mapping),t.prevTime);var s=0==t.prevTime||!a&&(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)),l=a?mi(t.prevRanges,n.mapping):hi(n.mapping.maps[n.steps.length-1]);return new di(t.done.addTransform(n,s?e.selection.getBookmark():null,r,bi(e)),ui.empty,l,n.time)}(n,r,e,t)}},config:t})}function Ci(t,e){var n=wi.getState(t);return!(!n||0==n.done.eventCount||(e&&vi(n,t,e,!1),0))}function Ti(t,e){var n=wi.getState(t);return!(!n||0==n.undone.eventCount||(e&&vi(n,t,e,!0),0))}var Ei=function(t,e){return(Ei=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Mi(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Ei(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ni=function(){return Ni=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ni.apply(this,arguments)};function Si(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function Di(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var Li=function(t,e,n){var r;for(r in n=n||null,t)if(t.hasOwnProperty(r)&&!1===e.call(n,t[r],r,t))break},Oi=function(t,e){var n,r,o,i,a=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o<i;o+=1)for(r in n=arguments[o])a.call(n,r)&&(t[r]=n[r]);return t},Ai=function(t){return"string"==typeof t||t instanceof String},Ii=function(t){return t instanceof Array},Ri=function(t,e,n){var r=0,o=t.length;for(n=n||null;r<o&&!1!==e.call(n,t[r],r,t);r+=1);},Pi=Ii,Bi=Ri,Fi=Li,Hi=function(t,e,n){Pi(t)?Bi(t,e,n):Fi(t,e,n)},qi=Ai,zi=Hi,_i=function(t,e,n){var r=t.style;qi(e)?r[e]=n:zi(e,function(t,e){r[e]=t})},ji=Ii,Vi=function(t,e,n){var r,o;if(n=n||0,!ji(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(o=e.length,r=n;n>=0&&r<o;r+=1)if(e[r]===t)return r;return-1},Ui=function(t){return void 0===t},$i=Ui,Wi=function(t){return t&&t.className?$i(t.className.baseVal)?t.className:t.className.baseVal:""},Gi=Ii,Ki=Ui,Ji=function(t,e){e=(e=Gi(e)?e.join(" "):e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),Ki(t.className.baseVal)?t.className=e:t.className.baseVal=e},Zi=Hi,Xi=Vi,Qi=Wi,Yi=Ji,ta=function(t){var e,n=Array.prototype.slice.call(arguments,1),r=t.classList,o=[];r?Zi(n,function(e){t.classList.add(e)}):((e=Qi(t))&&(n=[].concat(e.split(/\s+/),n)),Zi(n,function(t){Xi(t,o)<0&&o.push(t)}),Yi(t,o))},ea=Ri,na=Vi,ra=Wi,oa=Ji,ia=function(t){var e,n,r=Array.prototype.slice.call(arguments,1),o=t.classList;o?ea(r,function(t){o.remove(t)}):(e=ra(t).split(/\s+/),n=[],ea(e,function(t){na(t,r)<0&&n.push(t)}),oa(t,n))},aa=function(t){return"number"==typeof t||t instanceof Number},sa=function(t){return null===t},la=Li,ca=Ui,ua=function(t,e){var n=document.createElement("img"),r="";return la(e,function(t,e){r+="&"+e+"="+t}),r=r.substring(1),n.src=t+"?"+r,n.style.display="none",document.body.appendChild(n),document.body.removeChild(n),n},pa=/[\u0020]+/g,da=/[>(){}[\]+-.!#|]/g,fa=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,ha=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,ma=/[*_~`]/g,va=/!\[.*\]\(.*\)/g,ga=/[[\]]/g,ya=/(?:^|[^\\])\\(?!\\)/g,ba=new RegExp('[&<>"]',"g");function wa(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return t}}function ka(t){return ba.test(t)?t.replace(ba,wa):t}function xa(t,e){return-1!==t.indexOf(e)}var Ca=["rel","target","hreflang","type"],Ta={codeblock:/(^ {4}[^\n]+\n*)+/,thematicBreak:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,atxHeading:/^(#{1,6}) +[\s\S]+/,seTextheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,fencedCodeblock:/^((`|~){3,})/};function Ea(t){if(!t)return null;var e={};return Ca.forEach(function(n){Ui(t[n])||(e[n]=t[n])}),e}function Ma(t,e){for(var n="",r=0;r<e;r+=1)n+=t;return n}function Na(t){for(var e=[],n=va.exec(t);n;)e.push([n.index,n.index+n[0].length]),n=va.exec(t);return t.replace(ga,function(t,n){return e.some(function(t){return n>t[0]&&n<t[1]})?t:"\\"+t})}function Sa(t){var e=function(t){return"\\"+t},n=t.replace(pa," ");return ha.test(n)&&(n=n.replace(ha,e)),ya.test(n)&&(n=n.replace(ya,function(t){return t+"\\"})),n=n.replace(ma,e),fa.test(n)&&(n=n.replace(fa,e)),function(t){var e=!1;return Li(Ta,function(n){return n.test(t)&&(e=!0),!e}),e}(n)&&(n=n.replace(da,e)),n}function Da(t){var e;return(e=-1===t.indexOf('"')?'""':-1===t.indexOf("'")?"''":"()")[0]+t+e[1]}function La(t){return sa(t)||Ui(t)}function Oa(t,e){if(null===t&&t===e)return!0;if("object"!=typeof t||"object"!=typeof e||La(t)||La(e))return t===e;for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function Aa(t){return t[t.length-1]}function Ia(t){return"object"==typeof t&&null!==t}function Ra(t,e){var n=Ni({},t);return t&&e&&Object.keys(e).forEach(function(t){Ia(n[t])?Array.isArray(e[t])?n[t]=Pa(e[t]):n.hasOwnProperty(t)?n[t]=Ra(n[t],e[t]):n[t]=Ba(e[t]):n[t]=e[t]}),n}function Pa(t){return t.map(function(t){return Ia(t)?Array.isArray(t)?Pa(t):Ba(t):t})}function Ba(t){var e=Object.keys(t);return e.length?e.reduce(function(e,n){return Ia(t[n])?e[n]=Array.isArray(t[n])?Pa(t[n]):Ba(t[n]):e[n]=t[n],e},{}):t}function Fa(t,e){return void 0===e&&(e={}),Object.keys(e).forEach(function(n){t.hasOwnProperty(n)&&"object"==typeof t[n]?Array.isArray(e[n])?t[n]=e[n]:Fa(t[n],e[n]):t[n]=e[n]}),t}function Ha(t,e){return t>e?[e,t]:[t,e]}var qa=Ri,za=function(t){var e;try{e=Array.prototype.slice.call(t)}catch(n){e=[],qa(t,function(t){e.push(t)})}return e};function _a(t,e){var n=t.nodes.paragraph;return e?n.create(null,Ai(e)?t.text(e):e):n.createAndFill()}function ja(t,e,n){return t.text(e,n)}function Va(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return se.create(t.doc,Math.min(e,o),Math.min(n,o))}function Ua(t,e,n){var r=e.pos;return t.replaceWith(r,r,_a(n)),t.setSelection(Va(t,r+1))}function $a(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,a=e.tr,s=e.doc,c=e.schema,u=r;u<=o;u+=1){var p=s.child(u),d=p.nodeSize,f=p.textContent,h=p.content,m=i(f),v=m?ja(c,m):l.empty,g=a.mapping.map(n),y=g+h.size;a.replaceWith(g,y,v),n+=d}return a}function Wa(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(Va(t,t.mapping.map(e)-o))}function Ga(t){return t.sourcepos[0][0]}function Ka(t){return t.sourcepos[1][0]}function Ja(t){return t.sourcepos[0][1]}function Za(t){return t.sourcepos[1][1]}function Xa(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Qa(t){return t&&("item"===t.type||"list"===t.type)}function Ya(t){return Qa(t)&&"ordered"===t.listData.type}function ts(t){return Qa(t)&&"ordered"!==t.listData.type}function es(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function ns(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function rs(t,e){return[t[0],t[1]+e]}function is(t,e){return[t[0],e]}function as(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function ss(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}function ls(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var cs=[],us={},ps=/\$\$widget\d+\s/;function ds(t){var e=t.search(ps);if(-1!==e){var n=t.substring(e).replace(ps,"").replace("$$","");t=t.substring(0,e),t+=ds(n)}return t}function fs(t,e){return"$$"+t+" "+e+"$$"}function hs(t,e){var n=us[t],r=n.rule,o=n.toDOM,i=ds(e).match(r);return i&&(e=i[0]),o(e)}function ms(t,e,n,r){return t.concat(vs(e,n,r))}function vs(t,e,n){void 0===n&&(n=0);var r=[],o=(cs[n]||{}).rule,i=n+1;if(t=ds(t),o&&o.test(t)){for(var a=void 0;-1!==(a=t.search(o));){var s=t.substring(0,a);s&&(r=ms(r,s,e,i));var l=(t=t.substring(a)).match(o)[0],c="widget"+n;r.push(e.nodes.widget.create({info:c},e.text(fs(c,l)))),t=t.substring(l.length)}t&&(r=ms(r,t,e,i))}else t&&(r=n<cs.length-1?ms(r,t,e,i):[e.text(t)]);return r}function gs(t){for(var e,n="",r=t.walker();e=r.next();){var o=e.node;e.entering&&(o!==t&&"text"!==o.type?(n+=as(o),r.resumeAt(t,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}function ys(){return{deleteSelection:function(){return Lo},selectAll:function(){return Ho},undo:function(){return Ci},redo:function(){return Ti}}}var bs=Vi,ws=Wi,ks=function(t,e){var n;return t.classList?t.classList.contains(e):(n=ws(t).split(/\s+/),bs(e,n)>-1)},xs=Vi,Cs=za,Ts=Element.prototype,Es=Ts.matches||Ts.webkitMatchesSelector||Ts.mozMatchesSelector||Ts.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return xs(this,Cs(e.querySelectorAll(t)))>-1},Ms="[A-Za-z][A-Za-z0-9-]*",Ns="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ss="<("+Ms+")("+Ns+")*\\s*/?>",Ds="(?:"+Ss+"|</("+Ms+")\\s*[>])",Ls=new RegExp("^"+Ds,"i"),Os=/<br\s*\/*>/i,As=/<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,Is="</p><p>";function Rs(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),a=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+a}var Ps="toastui-editor-";function Bs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,o=t;r<o.length;r++){var i,a=o[r];(i=Array.isArray(a)?a[0]?a[1]:null:a)&&n.push(""+Ps+i)}return n.join(" ")}function Fs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map(function(t){return Ps+"md-"+t}).join(" ")}function Hs(t){return t&&t.nodeType===Node.ELEMENT_NODE}function qs(t){t.parentNode&&t.parentNode.removeChild(t)}function zs(t,e,n){Ui(n)&&(n=!ks(t,e)),(n?ta:ia)(t,e)}function _s(t,e){var n=document.createElement("div");Ai(t)?n.innerHTML=t:n.appendChild(t);var r=n.firstChild;return e&&e.appendChild(r),r}function js(t){var e=window.getComputedStyle(t);return["margin-left","margin-right"].reduce(function(t,n){return t+parseInt(e.getPropertyValue(n),10)},0)+t.offsetWidth}function Vs(t,e){var n;for(n=Ai(e)?function(t){return n=t,r=e,Es.call(n,r);var n,r}:function(t){return t===e};t&&t!==document;){if(Hs(t)&&n(t))return t;t=t.parentNode}return null}function Us(t,e){for(var n=0,r=0;t&&t!==e&&(n+=t.offsetTop,r+=t.offsetLeft,t.offsetParent!==e.offsetParent);)t=t.offsetParent;return{offsetTop:n,offsetLeft:r}}function $s(t,e){Object.keys(t).forEach(function(n){La(t[n])?e.removeAttribute(n):e.setAttribute(n,t[n])})}var Ws=new Ne("widget"),Gs=function(){function t(t,e){var n=this;this.popup=null,this.removeWidget=function(){n.popup&&(n.rootEl.removeChild(n.popup),n.popup=null)},this.rootEl=t.dom.parentElement,this.eventEmitter=e,this.eventEmitter.listen("blur",this.removeWidget),this.eventEmitter.listen("loadUI",function(){n.rootEl=Vs(t.dom.parentElement,"."+Bs("defaultUI"))}),this.eventEmitter.listen("removePopupWidget",this.removeWidget)}return t.prototype.update=function(t){var e=Ws.getState(t.state);if(this.removeWidget(),e){var n=e.node,r=e.style,o=t.coordsAtPos(e.pos),i=o.top,a=o.left,s=o.bottom-i,l=this.rootEl.getBoundingClientRect(),c=i-l.top;_i(n,{opacity:"0"}),this.rootEl.appendChild(n),_i(n,{position:"absolute",left:a-l.left+5+"px",top:("bottom"===r?c+s-5:c-s)+"px",opacity:"1"}),this.popup=n,t.focus()}},t.prototype.destroy=function(){this.eventEmitter.removeEventHandler("blur",this.removeWidget)},t}();function Ks(t,e,n){t.emit("addImageBlobHook",e,function(n,r){t.emit("command","addImage",{imageUrl:n,altText:r||e.name||"image"})},n)}function Js(t){var e=za(t).filter(function(t){return-1!==t.type.indexOf("image")});if(1===e.length){var n=e[0];if(n)return n.getAsFile()}return null}function Zs(t){var e=t.eventEmitter;return new Te({props:{handleDOMEvents:{drop:function(t,n){var r,o=null===(r=n.dataTransfer)||void 0===r?void 0:r.files;return o&&Ri(o,function(t){return-1===t.type.indexOf("image")||(n.preventDefault(),n.stopPropagation(),Ks(e,t,n.type),!1)}),!0}}}})}var Xs=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"node"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function Qs(t){var e=document.createElement("span"),n=hs(t.attrs.info,t.textContent);return e.className="tui-widget",e.appendChild(n),{dom:e}}function Ys(t){return"widget"===t.type.name}var tl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"widget"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{info:{default:null}},group:"inline",inline:!0,content:"text*",selectable:!1,atom:!0,toDOM:function(){return["span",{class:"tui-widget"},0]},parseDOM:[{tag:"span.tui-widget",getAttrs:function(t){return{info:t.textContent.match(/\$\$(widget\d+)/)[1]}}}]}},enumerable:!1,configurable:!0}),e}(Xs),el=function(){function t(t){this.timer=null,this.el=document.createElement("div"),this.el.className="toastui-editor",this.eventEmitter=t,this.placeholder={text:""}}return t.prototype.createState=function(){return we.create({schema:this.schema,plugins:this.createPlugins()})},t.prototype.initEvent=function(){var t=this,e=t.eventEmitter,n=t.view,r=t.editorType;n.dom.addEventListener("focus",function(){return e.emit("focus",r)}),n.dom.addEventListener("blur",function(){return e.emit("blur",r)})},t.prototype.emitChangeEvent=function(t){this.eventEmitter.emit("caretChange",this.editorType),t.docChanged&&this.eventEmitter.emit("change",this.editorType)},Object.defineProperty(t.prototype,"defaultPlugins",{get:function(){var t,e,n=this.createInputRules(),r=Si(Si([],this.keymaps),[So(Ni({"Shift-Enter":Ko.Enter},Ko)),xi(),(e=this.placeholder,new Te({props:{decorations:function(t){var n=t.doc;if(e.text&&1===n.childCount&&n.firstChild.isTextblock&&0===n.firstChild.content.size){var r=document.createElement("span");return ta(r,"placeholder"),e.className&&ta(r,e.className),r.textContent=e.text,to.create(n,[Zr.widget(1,r)])}return null}}})),(t=this.eventEmitter,new Te({key:Ws,state:{init:function(){return null},apply:function(t){return t.getMeta("widget")}},view:function(e){return new Gs(e,t)}})),Zs(this.context)]);return n?r.concat(n):r},enumerable:!1,configurable:!0}),t.prototype.createInputRules=function(){var t=cs.map(function(t){var e=t.rule;return new Jo(e,function(t,n,r,o){var i=t.schema,a=t.tr,s=t.doc,l=n.input.match(new RegExp(e,"g")),c=s.resolve(r),u=c.parent,p=0;if(Ys(u)&&(u=c.node(c.depth-1)),u.forEach(function(t){return Ys(t)&&(p+=1)}),l.length>p){var d=Aa(l),f=vs(d,i);return a.replaceWith(o-d.length+1,o,f)}return null})});return t.length?Zo({rules:t}):null},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.createSchema=function(){return new it({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){var e=ys(),n=e.undo,r=e.redo,o=this.specs.keymaps(t),i={"Mod-z":n(),"Shift-Mod-z":r()};return t?o.concat(So(i)):o},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map(function(e){return e(t.eventEmitter)})},t.prototype.focus=function(){var t=this;this.clearTimer(),this.timer=setTimeout(function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())})},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.clearTimer(),this.view.destroy(),Object.keys(this).forEach(function(e){delete t[e]})},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(Va(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(Va(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){_i(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){_i(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),nl=function(t){return t instanceof Function},rl=["Enter","Shift-Enter","Mod-Enter","Tab","Shift-Tab","Delete","Backspace","Mod-Delete","Mod-Backspace","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Mod-d","Mod-D","Alt-ArrowUp","Alt-ArrowDown"];function ol(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var il=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter(function(t){return"node"===t.type}).reduce(function(t,e){var n,r=e.name,o=e.schema;return Ni(Ni({},t),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter(function(t){return"mark"===t.type}).reduce(function(t,e){var n,r=e.name,o=e.schema;return Ni(Ni({},t),((n={})[r]=o,n))},{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter(function(t){return t.commands}).reduce(function(e,n){var r={},o=n.commands();return nl(o)?r[n.name]=function(e){return ol(t,o,e)}:Object.keys(o).forEach(function(e){r[e]=function(n){return ol(t,o[e],n)}}),Ni(Ni({},e),r)},{}),r=ys();return Object.keys(r).forEach(function(e){n[e]=function(n){return ol(t,r[e],n)}}),e&&Object.keys(e).forEach(function(r){n[r]=function(n){return ol(t,e[r],n)}}),n},t.prototype.keymaps=function(t){return this.specs.filter(function(t){return t.keymaps}).map(function(t){return t.keymaps()}).map(function(e){return t||Object.keys(e).forEach(function(t){xa(rl,t)||delete e[t]}),So(e)})},t.prototype.setContext=function(t){this.specs.forEach(function(e){e.setContext(t)})},t}();function al(t){var e=t.from,n=t.to;return t instanceof pe?[e+1,n-1]:[e,n]}function sl(t){return t.index(0)+1}function ll(t,e,n){void 0===n&&(n=1);var r=0;return t.forEach(function(t,o){Ys(t)&&o+2<e&&(r+=2*n)}),r}function cl(t,e,n){void 0===n&&(n=e);var r=e===n,o=t.resolve(e),i=sl(o),a=i,s=o.start(1),l=s;if(!r){var c=t.resolve(n===t.content.size?n-1:n);l=c.start(1),a=sl(c),c.pos===t.content.size&&(n=t.content.size-2)}var u=Math.max(e-s+1,1),p=Math.max(n-l+1,1);return[[i,u+ll(t.child(i-1),u,-1)],[a,p+ll(t.child(a-1),p,-1)]]}function ul(t,e){for(var n=[],r=0,o=0;r<e;r+=1){var i=t.child(r);n[r]=o,o+=i.nodeSize}return n}function pl(t,e,n){var r=ul(t,n[0]),o=e[0]-1,i=n[0]-1,a=t.child(o),s=t.child(i),l=r[o],c=r[i];return l+=e[1]+ll(a,e[1]-1),c+=n[1]+ll(s,n[1]-1),[l,Math.min(c,t.content.size)]}function dl(t){var e=t.$from,n=t.$to,r=t.from,o=t.to,i=e.doc;return t instanceof pe&&(e=i.resolve(r+1),n=i.resolve(o-1)),0===e.depth&&(n=e=i.resolve(r-1)),{startFromOffset:e.start(1),endFromOffset:n.start(1),startToOffset:e.end(1),endToOffset:n.end(1),startIndex:e.index(0),endIndex:n.index(0),from:e.pos,to:n.pos}}function fl(t,e){for(var n=1,r=1,o=0,i=0;o<t.childCount;o+=1){var a=t.child(o).nodeSize;if(n=i+1,r=i+a-1,o===e)break;i+=a}return{startOffset:n,endOffset:r}}var hl="heading",ml="link",vl="code",gl="meta",yl="delimiter",bl="markedText",wl={strong:2,emph:1,strike:2};function kl(t,e,n,r){return{start:t,end:e,spec:{type:n,attrs:r}}}function xl(t,e,n){var r=t.type,o=rs(e,wl[r]),i=rs(n,-wl[r]);return[kl(o,i,r),kl(e,o,yl),kl(i,n,yl)]}function Cl(t,e,n,r){return[kl(t,e,ml),kl(is(t,n[1]+1),is(e,r),ml,{desc:!0}),kl(is(e,r+2),rs(e,-1),ml,{url:!0})]}function Tl(t,e,n,r){var o={start:e,end:n,spec:{attrs:{className:r+"-line-background",codeStart:e[0],codeEnd:n[0]}},lineBackground:!0};return"item"!==t.type&&"blockQuote"!==t.type?[Ni(Ni({},o),{end:e,spec:{attrs:{className:r+"-line-background start"}}}),Ni(Ni({},o),{start:[Math.min(e[0]+1,n[0]),e[1]]})]:null}function El(t,e){for(var n=[];t;){var r=t.type;"paragraph"!==r&&"codeBlock"!==r||n.push(kl([Ga(t),Ja(t)-1],[Ka(t),Za(t)+1],e)),t=t.next}return n}var Ml={heading:function(t,e,n){var r=t.level,o=t.headingType,i=[kl(e,n,hl,{level:r})];return"atx"===o?i.push(kl(e,rs(e,r),yl)):i.push(kl(is(n,0),n,hl,{seText:!0})),i},strong:xl,emph:xl,strike:xl,link:function(t,e,n){var r=t.lastChild,o=t.extendedAutolink,i=r?Za(r)+1:2;return o?[kl(e,n,ml,{desc:!0})]:Cl(e,n,e,i)},image:function(t,e,n){var r=t.lastChild,o=r?Za(r)+1:3,i=rs(e,1);return Si([kl(e,i,gl)],Cl(e,n,i,o))},code:function(t,e,n){var r=t.tickCount,o=rs(e,r),i=rs(n,-r);return[kl(e,n,vl),kl(e,o,vl,{start:!0}),kl(o,i,vl,{marked:!0}),kl(i,n,vl,{end:!0})]},codeBlock:function(t,e,n,r){var o=t.fenceOffset,i=t.fenceLength,a=t.fenceChar,s=t.info,l=t.infoPadding,c=t.parent,u=o+i,p=[kl(is(e,1),n,"codeBlock")];a&&p.push(kl(e,rs(e,u),yl)),s&&p.push(kl(rs(e,i),rs(e,i+l+s.length),gl)),new RegExp("^(\\s{0,4})("+a+"{"+i+",})").test(r)&&p.push(kl(is(n,1),n,yl));var d=Tl(c,e,n,"code-block");return d?p.concat(d):p},blockQuote:function(t,e,n){var r=t.parent&&"blockQuote"!==t.parent.type?[kl(e,n,"blockQuote")]:[];if(t.firstChild){var o=[];"paragraph"===t.firstChild.type?o=function(t){for(var e=[];t;)e.push(kl([Ga(t),Ja(t)],[Ka(t),Za(t)+1],bl)),t=t.next;return e}(t.firstChild.firstChild):"list"===t.firstChild.type&&(o=El(t.firstChild,bl)),r=Si(Si([],r),o)}return r},item:function(t,e){var n=t.listData,r=n.padding,o=n.task,i=function(t){for(var e=0;t.parent.parent&&"item"===t.parent.parent.type;)t=t.parent.parent,e+=1;return["listItem",Ni(Ni({},[{odd:!0},{even:!0}][e%2]),{listStyle:!0})]}(t),a=[kl.apply(void 0,Si([e,rs(e,r)],i))];return o&&(a.push(kl(rs(e,r),rs(e,r+3),"taskDelimiter")),a.push(kl(rs(e,r+1),rs(e,r+2),gl))),a.concat(El(t.firstChild,bl))},customBlock:function(t,e,n){var r=t,o=r.offset,i=r.syntaxLength,a=r.info,s=r.parent,l=o+i,c=[kl(is(e,1),n,"customBlock")];c.push(kl(e,rs(e,l),yl)),a&&c.push(kl(rs(e,l),rs(e,i+a.length),gl)),c.push(kl(is(n,1),n,yl));var u=Tl(s,e,n,"custom-block");return u?c.concat(u):c}},Nl={thematicBreak:"thematicBreak",table:"table",tableCell:"tableCell",htmlInline:"html"},Sl={};function Dl(t){var e=t.schema,n=t.toastMark;return new Te({appendTransaction:function(t,r,o){var i=t[0],a=o.tr;if(i.docChanged){var s=[];i.getMeta("editResult").forEach(function(t){var e=t.nodes,r=t.removedNodeRange;if(e.length){s=s.concat(function(t,e){var n=t.doc,r=e[0].sourcepos[0],o=Aa(e).sourcepos[1],i=[r[0],r[1]],a=[o[0],o[1]+1],s=[];return function(t,e,n){var r=[];Sl={};for(var o=e[0]-1;o<n[0];o+=1){var i=t.child(o),a=i.attrs.codeEnd,s=i.attrs.codeStart;if(s&&a&&!xa(r,s)){r.push(s),a=Math.min(a,t.childCount);for(var l=s-1,c=n[0],u=l;u<c;u+=1)Sl[u]=!0}}}(n,r,o),s.push({start:i,end:a}),s}(a,e));for(var o=0,i=e;o<i.length;o++)for(var l=i[o].walker(),c=l.next();c;){var u=c.node;c.entering&&(s=s.concat(Ol(u,n))),c=l.next()}}else if(r)for(var p=a.doc.childCount-1,d=r.line,f=d[0],h=d[1],m=Math.min(f,p),v=Math.min(h,p),g=m;g<=v;g+=1)Sl[g]=!0}),function(t,e,n){var r=t.doc,o=e.nodes.paragraph,i=ul(r,r.childCount);n.forEach(function(n){var a=n.start,s=n.end,l=n.spec,c=n.lineBackground,u=Math.min(a[0],r.childCount)-1,p=Math.min(s[0],r.childCount)-1,d=r.child(u),f=r.child(p),h=i[u],m=i[p];h+=a[1]+ll(d,a[1]-1),m+=s[1]+ll(f,s[1]-1),l?c?function(t,e,n,r,o){void 0===o&&(o={});for(var i=r.endIndex,a=r.from,s=r.to,l=!1,c=r.startIndex;c<=i;c+=1)delete Sl[c],l=Ll(e,c,o);l&&t.setBlockType(a,s,n,o)}(t,r,o,{from:h,to:m,startIndex:u,endIndex:p},l.attrs):t.addMark(h,m,e.mark(l.type,l.attrs)):t.removeMark(h,m)}),function(t,e,n){Object.keys(Sl).forEach(function(r){var o=Number(r),i=Math.min(Number(r)+1,t.doc.childCount-1),a=e[o],s=e[i]-1;o===i&&(s+=2),t.setBlockType(a,s,n)})}(t,i,o)}(a,e,s)}return a.setMeta("widget",i.getMeta("widget"))}})}function Ll(t,e,n){return Object.keys(n).some(function(r){return n[r]!==t.child(e).attrs[r]})}function Ol(t,e){var n=e.getLineTexts(),r=[Ga(t),Ja(t)],o=[Ka(t),Za(t)+1],i=function(t,e,n,r){var o=t.type;return nl(Ml[o])?Ml[o](t,e,n,r):Nl[o]?[kl(e,n,Nl[o])]:null}(t,r,o,n[o[0]-1]);return null!=i?i:[]}var Al=["taskList","orderedList","bulletList","table","strong","emph","strike","heading","thematicBreak","blockQuote","code","codeBlock","indent","outdent"];function Il(t){var e=t.toastMark,n=t.eventEmitter;return new Te({view:function(){return{update:function(t,r){var o=t.state,i=o.doc,a=o.selection;if(!(r&&r.doc.eq(i)&&r.selection.eq(a))){var s=a.from,l=o.doc.resolve(s).start(),c=s-l;s===l&&(c+=1);var u=[o.doc.content.findIndex(s).index+1,c],p=e.findNodeAtPosition(u),d=function(t){var e={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}},n=!0;return function(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;)e(t),t=t.parent}(t,function(t){var r=function(t){var e=t.type;return Qa(t)?t.listData.task?"taskList":"ordered"===t.listData.type?"orderedList":"bulletList":-1!==e.indexOf("table")?"table":xa(Al,e)?e:null}(t);r&&("bulletList"===r||"orderedList"===r?n&&(e[r]={active:!0},e.indent.disabled=!1,e.outdent.disabled=!1,n=!1):e[r]={active:!0})}),e}(p);n.emit("changeToolbarState",{cursorPos:u,mdNode:p,toolbarState:d}),n.emit("setFocusedNode",p)}}}}})}var Rl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),e}(Xs),Pl=function(){function t(){}return Object.defineProperty(t.prototype,"type",{get:function(){return"mark"},enumerable:!1,configurable:!0}),t.prototype.setContext=function(t){this.context=t},t}();function Bl(t,e){return Fl(t,e-1)}function Fl(t,e){return t.child(e).textContent}var Hl=/^\s*> ?/,ql=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("block-quote")},0]}}},enumerable:!1,configurable:!0}),e.prototype.createBlockQuoteText=function(t,e){return e?t.replace(Hl,"").trim():"> "+t.trim()},e.prototype.extendBlockQuote=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,a=e.schema,s=dl(r),l=s.endFromOffset,c=s.endToOffset,u=s.endIndex,p=s.to,d=Fl(o,u);if(Hl.test(d)&&p>l&&r.empty){if(d.replace(Hl,"").trim()){var f=d.slice(p-l).trim();Wa(i,c,f,ja(a,t.createBlockQuoteText(f)))}else i.deleteRange(l,c).split(i.mapping.map(c));return n(i),!0}return!1}},e.prototype.commands=function(){var t=this;return function(){return function(e,n){var r=e.selection,o=e.doc,i=dl(r),a=i.startFromOffset,s=i.endToOffset,l=i.startIndex,c=i.endIndex,u=Hl.test(Fl(o,l)),p=$a({state:e,startIndex:l,endIndex:c,from:a,createText:function(e){return t.createBlockQuoteText(e,u)}});return n(p.setSelection(Va(p,p.mapping.map(s)))),!0}}},e.prototype.keymaps=function(){var t=this.commands()();return{"alt-q":t,"alt-Q":t,Enter:this.extendBlockQuote()}},e}(Pl),zl=/(^\s*)([-*+] |[\d]+\. )/,_l=/(^\s*)([\d])+\.( \[[ xX]])? /,jl=/^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,Vl=/(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,Ul=/^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,$l=/(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,Wl=/(^\s*)([-*+])( \[[ xX]]) /;function Gl(t){return _l.test(t)?"ordered":"bullet"}function Kl(t){for(var e=0;t&&"document"!==t.type;)"list"===t.type&&(e+=1),t=t.parent;return e}function Jl(t,e,n,r){for(var o=t.getLineTexts().length,i=[],a=e;r?a<o:a>1;){a=r?a+1:a-1;var s=t.findFirstNodeAtLine(a),l=Kl(s);if(l===n)i.push({line:a,depth:n,mdNode:s});else if(l<n)break}return i}function Zl(t,e,n,r){void 0===r&&(r=0);var o=Number.MAX_VALUE,i=0,a=e.map(function(e,a){var s=e.line;o=Math.min(s-1,o),i=Math.max(s-1,i);var l=Bl(t,s);return l="bullet"===n?function(t){if(!zl.test(t))return"* "+t;var e=Gl(t);return"bullet"===e&&Vl.test(t)?t=t.replace(Wl,"$1$2 "):"ordered"===e&&(t=t.replace(_l,"$1* ")),t}(l):function(t,e){if(!zl.test(t))return e+". "+t;var n=Gl(t);if("bullet"===n||"ordered"===n&&Vl.test(t))t=t.replace(Vl,"$1"+e+". ");else if("ordered"===n){var r=jl.exec(t)[3];Number(r)!==e&&(t=t.replace(_l,"$1"+e+". "))}return t}(l,a+1+r),{text:l,line:s}});return{changedResults:a,firstIndex:o,lastIndex:i}}function Xl(t,e){var n=function(t){var e=t.toastMark,n=t.mdNode,r=t.line,o=Kl(n),i=Jl(e,r,o,!1).reverse(),a=Jl(e,r,o,!0);return i.concat([{line:r,depth:o,mdNode:n}]).concat(a)}(e);return Zl(e.doc,n,t)}var Ql={bullet:function(t){return Xl("bullet",t)},ordered:function(t){return Xl("ordered",t)},task:function(t){var e=t.mdNode,n=t.doc,r=t.line,o=Bl(n,r);return e.listData.task?o=o.replace($l,"$1$2"):Qa(e)&&(o=o.replace(zl,"$1$2[ ] ")),{changedResults:[{text:o,line:r}]}}},Yl={bullet:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* "+Bl(e,n),line:n}]}},ordered:function(t){for(var e=t.toastMark,n=t.doc,r=t.line,o=t.startLine,i=Bl(n,r),a=1,s=o,l=0,c=o-1;c>0;c-=1){var u=e.findFirstNodeAtLine(c),p=Bl(n,c)&&!!ns(u,function(t){return Qa(t)}),d=jl.exec(Bl(n,c));if(!d&&!p)break;if(d||!p){var f=d,h=f[1],m=f[3];if(!h){a=Number(m),s=c;break}}else l+=1}return{changedResults:[{text:a+r-s-l+". "+i,line:r}]}},task:function(t){var e=t.doc,n=t.line;return{changedResults:[{text:"* [ ] "+Bl(e,n),line:n}]}}},tc={bullet:function(t){var e=t.line,n=Bl(t.doc,e),r=Ul.exec(n);return{listSyntax:""+r[1]+r[2]}},ordered:function(t){var e=t.toastMark,n=t.line,r=t.mdNode,o=t.doc,i=Kl(r),a=Bl(o,n),s=jl.exec(a),l=s[1],c=s[3],u=s[4],p=Number(c)+1,d=""+l+p+u,f=Jl(e,n,i,!0).filter(function(t){var e=jl.exec(Bl(o,t.line));return e&&e[1].length===l.length&&!!ns(t.mdNode,function(t){return Ya(t)})});return Ni({listSyntax:d},Zl(o,f,"ordered",p))}};function ec(t,e,n,r,o){for(var i=[],a=Bl(t,n),s=jl.exec(a);s;){var l=s[1],c=s[4],u=s[5],p=l.length;if(p===o)i.push(ja(e,""+l+r+c+u)),r+=1,n+=1;else if(p>o){var d=ec(t,e,n,1,p);n=d.line,i=i.concat(d.nodes)}if(p<o||n>t.childCount)break;a=Bl(t,n),s=jl.exec(a)}return{nodes:i,line:n}}var nc=/(^\s{1,4})(.*)/;function rc(t,e,n){return t<e||zl.test(n)||Hl.test(n)}function oc(t,e,n){var r=n.$from;0===r.depth&&(r=t.resolve(r.pos-1));var o=r.node(1),i=r.start(1),a=o.content.size;return o.rangeHasMark(0,a,e.marks.table)&&r.pos-i!==a&&r.pos!==i}function ic(t,e){var n=e.from,r=e.to;if("indent"===e.type)n+=4,r+=4*(e.lineLen+1);else{var o=e.spaceLenList;n-=o[0];for(var i=0;i<o.length;i+=1)r-=o[i]}return Va(t,n,r)}var ac=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"inline*",attrs:{className:{default:null},codeStart:{default:null},codeEnd:{default:null}},selectable:!1,group:"block",parseDOM:[{tag:"div"}],toDOM:function(t){var e=t.attrs;return e.className?["div",{class:Fs(e.className)},0]:["div",0]}}},enumerable:!1,configurable:!0}),e.prototype.reorderList=function(t,e){for(var n=this.context,r=n.view,o=n.toastMark,i=n.schema,a=r.state,s=a.tr,l=a.selection,c=a.doc,u=o.findFirstNodeAtLine(t),p=u;u&&!ts(u)&&"document"!==u.parent.type;)if(Ya(u=u.parent)){p=u;break}p&&(t=p.sourcepos[0][0]);var d=jl.exec(Bl(c,t)),f=d[1],h=d[3],m=f.length,v=ec(c,i,t,Number(h),m),g=v.line,y=v.nodes;e=Math.max(e,g-1);for(var b=fl(c,t-1).startOffset,w=t-1;w<=e-1;w+=1){var k=c.child(w),x=k.nodeSize,C=k.content,T=s.mapping.map(b),E=T+C.size;s.replaceWith(T,E,y[w-t+1]),b+=x}var M=Va(s,l.from,l.to);r.dispatch(s.setSelection(M))},e.prototype.indent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.schema,i=n.selection,a=n.doc,s=dl(i),l=s.from,c=s.to,u=s.startFromOffset,p=s.startIndex,d=s.endIndex;if(t&&oc(a,o,i))return!1;var f=Fl(a,p);if(t&&rc(l,c,f)||!t&&zl.test(f)){var h=$a({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){return" "+t}}),m={type:"indent",from:l,to:c,lineLen:d-p};r(h.setSelection(ic(h,m))),jl.test(f)&&e.reorderList(p+1,d+1)}else t&&r(n.tr.insert(c,ja(o," ")));return!0}}},e.prototype.outdent=function(t){var e=this;return void 0===t&&(t=!1),function(){return function(n,r){var o=n.selection,i=n.doc,a=n.schema,s=dl(o),l=s.from,c=s.to,u=s.startFromOffset,p=s.startIndex,d=s.endIndex;if(t&&oc(i,a,o))return!1;var f=Fl(i,p);if(t&&rc(l,c,f)||!t&&zl.test(f)){var h=[],m=$a({state:n,from:u,startIndex:p,endIndex:d,createText:function(t){var e=nc.exec(t);return h.push(e?e[1].length:0),t.replace(nc,"$2")}}),v={type:"outdent",from:l,to:c,spaceLenList:h};r(m.setSelection(ic(m,v))),jl.test(f)&&e.reorderList(p+1,d+1)}else if(t){var g=f.slice(0,c-u),y=g.replace(/\s{1,4}$/,""),b=c-(g.length-y.length);r(n.tr.delete(b,c))}return!0}}},e.prototype.deleteLines=function(){var t=this;return function(e,n){var r=t.context.view,o=dl(e.selection),i=o.startFromOffset,a=o.endToOffset;return jo(function(){return n(e.tr.deleteRange(i,a)),!0},Io)(e,n,r)}},e.prototype.moveDown=function(){return function(t,e){var n=t.doc,r=t.tr,o=t.selection,i=t.schema,a=dl(o),s=a.startFromOffset,l=a.endToOffset,c=a.endIndex;if(c<n.content.childCount-1){var u=n.child(c+1),p=u.nodeSize,d=u.textContent;return r.delete(l,l+p).split(s).insert(r.mapping.map(s)-2,ja(i,d)),e(r),!0}return!1}},e.prototype.moveUp=function(){return function(t,e){var n=t.tr,r=t.doc,o=t.selection,i=t.schema,a=dl(o),s=a.startFromOffset,l=a.endToOffset,c=a.startIndex;if(c>0){var u=r.child(c-1),p=u.nodeSize,d=u.textContent;return n.delete(s-p,s).split(n.mapping.map(l)).insert(n.mapping.map(l),ja(i,d)),e(n),!0}return!1}},e.prototype.commands=function(){return{indent:this.indent(),outdent:this.outdent()}},e.prototype.keymaps=function(){return{Tab:this.indent(!0)(),"Shift-Tab":this.outdent(!0)(),"Mod-d":this.deleteLines(),"Mod-D":this.deleteLines(),"Alt-ArrowUp":this.moveUp(),"Alt-ArrowDown":this.moveDown()}},e}(Xs),sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),e}(Xs),lc=/^#{1,6}\s/,cc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{level:{default:1},seText:{default:!1}},toDOM:function(t){var e=t.attrs,n="heading|heading"+e.level;return e.seText&&(n+="|delimiter|setext"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.createHeadingText=function(t,e,n){for(var r=e.replace(n,"").trim(),o="";t>0;)o+="#",t-=1;return o+" "+r},e.prototype.commands=function(){var t=this;return function(e){return function(n,r){var o=e.level,i=dl(n.selection),a=i.startFromOffset,s=i.endToOffset,l=$a({state:n,from:a,startIndex:i.startIndex,endIndex:i.endIndex,createText:function(e){var n=e.match(lc),r=n?n[0]:"";return t.createHeadingText(o,e,r)}});return r(l.setSelection(Va(l,l.mapping.map(s)))),!0}}},e}(Pl),uc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("code-block")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=dl(n),a=i.startFromOffset,s=i.endToOffset,l=ja(r,"```");return o.insert(a,l).split(a+3),o.split(o.mapping.map(s)).insert(o.mapping.map(s),l),e(o.setSelection(Va(o,o.mapping.map(s)-5))),!0}}},e.prototype.keepIndentation=function(){var t=this;return function(e,n){var r,o=e.selection,i=e.tr,a=e.doc,s=e.schema,l=t.context.toastMark,c=dl(o),u=c.startFromOffset,p=c.endToOffset,d=c.endIndex,f=c.from,h=c.to,m=Fl(a,d);if(f===h&&m.trim()){var v=m.match(/^\s+/);if((r=l.findFirstNodeAtLine(d+1))&&"codeBlock"===r.type&&v){var g=v[0],y=m.slice(h-u);return Wa(i,p,y,ja(s,g+y)),n(i),!0}}return!1}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,Enter:this.keepIndentation()}},e}(Pl),pc=/\||\s/g;function dc(t,e){for(var n="|",r=0;r<t;r+=1)n+=e?" --- |":" |";return n}var fc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("table")},0]}}},enumerable:!1,configurable:!0}),e.prototype.extendTable=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.tr,a=e.schema;if(!r.empty)return!1;var s=dl(r),l=s.endFromOffset,c=s.endToOffset,u=s.endIndex,p=s.to,d=Fl(o,u),f=[u+1,p-l+1],h=ns(t.context.toastMark.findNodeAtPosition(f),function(t){return es(t)&&("tableDelimRow"===t.parent.type||"tableBody"===t.parent.parent.type)});if(h){var m=!d.replace(pc,"").trim(),v=dc(h.parent.parent.parent.columns.length);return m?i.deleteRange(l,c).split(i.mapping.map(c)):i.split(c).insert(i.mapping.map(c),ja(a,v)).setSelection(Va(i,i.mapping.map(c)-2)),n(i),!0}return!1}},e.prototype.moveTableCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,a=dl(o),s=a.endFromOffset,l=[a.endIndex+1,a.to-s],c=ns(e.context.toastMark.findNodeAtPosition(l),function(t){return es(t)});if(c){var u=c.parent,p=function(t){return t?{type:"next",parentType:"tableHead",childType:"firstChild"}:{type:"prev",parentType:"tableBody",childType:"lastChild"}}(t),d=p.type,f=p.parentType,h=p.childType,m=Za(c);if(c[d])m=Za(c[d])-1;else{var v=u[d]||u.parent.type!==f?u[d]:u.parent[d][h];"next"===d?m+=(v?Za(v[h]):0)+2:"prev"===d&&(m=v?-4:0)}return r(i.setSelection(Va(i,s+m))),!0}return!1}},e.prototype.addTable=function(){return function(t){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=t,s=a.columnCount,l=a.rowCount,c=dl(r).endToOffset,u=function(t){return[dc(t),dc(t,!0)]}(s),p=function(t,e){for(var n=[],r=0;r<e;r+=1)n.push(dc(t));return n}(s,l-1);return Si(Si([],u),p).forEach(function(t){o.split(o.mapping.map(c)).insert(o.mapping.map(c),ja(i,t))}),n(o.setSelection(Va(o,c+4))),!0}}},e.prototype.commands=function(){return{addTable:this.addTable()}},e.prototype.keymaps=function(){return{Enter:this.extendTable(),Tab:this.moveTableCell(!0),"Shift-Tab":this.moveTableCell(!1)}},e}(Pl),hc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("thematic-break")},0]}}},enumerable:!1,configurable:!0}),e.prototype.hr=function(){return function(){return function(t,e){var n=t.selection,r=t.schema,o=t.tr,i=dl(n),a=i.from,s=i.to,l=i.endToOffset,c=ja(r,"***");return o.split(a).replaceWith(o.mapping.map(a),o.mapping.map(s),c).split(o.mapping.map(s)).setSelection(Va(o,o.mapping.map(l))),e(o),!0}}},e.prototype.commands=function(){return{hr:this.hr()}},e.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},e}(Pl);function mc(t,e){var n=t.type;return e<=t.sourcepos[0][0]&&("codeBlock"===n||"heading"===n||n.match("table"))}var vc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{odd:{default:!1},even:{default:!1},listStyle:{default:!1}},toDOM:function(t){var e=t.attrs,n=e.odd,r=e.even,o="list-item";return e.listStyle&&(o+="|list-item-style"),n&&(o+="|list-item-odd"),r&&(o+="|list-item-even"),["span",{class:Fs.apply(void 0,o.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.extendList=function(){var t=this;return function(e,n){var r=e.selection,o=e.doc,i=e.schema,a=e.tr,s=t.context.toastMark,l=dl(r),c=l.to,u=l.startFromOffset,p=l.endFromOffset,d=l.endIndex,f=l.endToOffset,h=Fl(o,d);if(!zl.test(h)||r.from===u||!r.empty)return!1;if(h.replace(Vl,"").trim()){var m=Gl(h),v=s.findFirstNodeAtLine(d+1),g=h.slice(c-p),y={toastMark:s,mdNode:v,doc:o,line:d+1},b=tc[m](y),w=b.listSyntax,k=b.changedResults;if(null==k?void 0:k.length){a.split(c),k.unshift({text:w+g,line:d+1}),t.changeToListPerLine(a,k,{from:c,startLine:k[0].line,endLine:Aa(k).line});var x=a.mapping.map(f)-g.length;a.setSelection(Va(a,x))}else Wa(a,f,g,ja(i,w+g))}else a.deleteRange(p,f).split(a.mapping.map(f));return n(a),!0}},e.prototype.toList=function(t){var e=this;return function(){return function(n,r){for(var o=n.doc,i=n.tr,a=n.selection,s=e.context.toastMark,l=dl(a),c=l.startIndex+1,u=l.endIndex+1,p=l.endToOffset,d=[],f=c;f<=u;f+=1){var h=s.findFirstNodeAtLine(f);if(h&&mc(h,f))break;if(-1===d.indexOf(f)){var m={toastMark:s,mdNode:h,doc:o,line:f,startLine:c},v=(Qa(h)?Ql[t](m):Yl[t](m)).changedResults,g=e.changeToListPerLine(i,v,{from:fl(o,v[0].line-1).startOffset,startLine:v[0].line,endLine:Aa(v).line,indexDiff:1});p=Math.max(g,p),v&&(d=d.concat(v.map(function(t){return t.line})))}}return r(i.setSelection(Va(i,i.mapping.map(p)))),!0}}},e.prototype.changeToListPerLine=function(t,e,n){for(var r=n.from,o=n.startLine,i=n.endLine,a=n.indexDiff,s=void 0===a?0:a,l=0,c=function(n){var o=t.doc.child(n),i=o.nodeSize,a=o.content,c=t.mapping.map(r),p=c+a.size,d=e.filter(function(t){return t.line-s===n})[0];d&&(t.replaceWith(c,p,ja(u.context.schema,d.text)),l=Math.max(l,r+a.size)),r+=i},u=this,p=o-s;p<=i-s;p+=1)c(p);return l},e.prototype.toggleTask=function(){var t=this;return function(e,n){for(var r=e.selection,o=e.tr,i=e.doc,a=e.schema,s=t.context.toastMark,l=dl(r),c=l.startIndex,u=l.endIndex,p=null,d=c;d<=u;d+=1){var f=s.findFirstNodeAtLine(d+1);if(Qa(f)&&f.listData.task){var h=f.listData,m=h.checked,v=h.padding,g=m?" ":"x",y=f.sourcepos[0],b=fl(i,y[0]-1).startOffset;b+=y[1]+v,p=o.replaceWith(b,b+1,a.text(g))}}return!!p&&(n(p),!0)}},e.prototype.commands=function(){return{bulletList:this.toList("bullet"),orderedList:this.toList("ordered"),taskList:this.toList("task")}},e.prototype.keymaps=function(){var t=this.toList("bullet")(),e=this.toList("ordered")(),n=this.toList("task")(),r=this.toggleTask();return{"Mod-u":t,"Mod-U":t,"Mod-o":e,"Mod-O":e,"alt-t":n,"alt-T":n,"Shift-Ctrl-x":r,"Shift-Ctrl-X":r,Enter:this.extendList()}},e}(Pl);function gc(t,e){return function(){return function(n,r){var o=n.tr,i=n.selection,a=nl(t)?t:function(e){return t.test(e)},s=e.length,l=o.doc,c=al(i),u=c[0],p=c[1],d=Math.max(u-s,1),f=Math.min(p+s,l.content.size-1),h=i.content(),m=h.content.textBetween(0,h.content.size,"\n"),v=l.textBetween(d,u,"\n"),g=l.textBetween(p,f,"\n");if(m=""+v+m+g,v&&g&&a(m))o.delete(f-s,f).delete(d,d+s);else{o.insertText(e,p).insertText(e,u);var y=i.empty?Va(o,u+s):Va(o,u+s,p+s);o.setSelection(y)}return r(o),!0}}}var yc=/^(\*{2}|_{2}).*([\s\S]*)\1$/m,bc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("strong")},0]}}},enumerable:!1,configurable:!0}),e.prototype.bold=function(){return gc(yc,"**")},e.prototype.commands=function(){return{bold:this.bold()}},e.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},e}(Pl),wc=/^(~{2}).*([\s\S]*)\1$/m,kc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("strike")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return gc(wc,"~~")},e.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},e}(Pl),xc=/^(\*|_).*([\s\S]*)\1$/m,Cc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("emph")},0]}}},enumerable:!1,configurable:!0}),e.prototype.italic=function(){return gc(xc,"*")},e.prototype.commands=function(){return{italic:this.italic()}},e.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},e}(Pl),Tc=/^(`).*([\s\S]*)\1$/m,Ec=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{start:{default:!1},end:{default:!1},marked:{default:!1}},toDOM:function(t){var e=t.attrs,n="code";return e.start&&(n+="|delimiter|start"),e.end&&(n+="|delimiter|end"),e.marked&&(n+="|marked-text"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return gc(Tc,"`")},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},e}(Pl),Mc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:{url:{default:!1},desc:{default:!1}},toDOM:function(t){var e=t.attrs,n="link";return e.url&&(n+="|link-url|marked-text"),e.desc&&(n+="|link-desc|marked-text"),["span",{class:Fs.apply(void 0,n.split("|"))},0]}}},enumerable:!1,configurable:!0}),e.prototype.addLinkOrImage=function(t){return function(e){return function(n,r){var o=n.selection,i=n.tr,a=n.schema,s=al(o),l=s[0],c=s[1],u=e,p=u.linkText,d=u.altText,f=u.linkUrl,h=u.imageUrl,m=p,v=f,g="";return"image"===t&&(m=d,v=h,g="!"),g+="["+(m=Na(m))+"]("+v+")",r(i.replaceWith(l,c,ja(a,g))),!0}}},e.prototype.commands=function(){return{addImage:this.addLinkOrImage("image"),addLink:this.addLinkOrImage("link")}},e}(Pl),Nc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"taskDelimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("delimiter","list-item")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"delimiter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("delimiter")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Dc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"meta"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("meta")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Lc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"markedText"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("marked-text")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Oc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("table-cell")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Ac=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"html"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("html")},0]}}},enumerable:!1,configurable:!0}),e}(Pl),Ic=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{toDOM:function(){return["span",{class:Fs("custom-block")},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,a=dl(r),s=a.startFromOffset,l=a.endToOffset;if(!(null==t?void 0:t.info))return!1;var c="$$"+t.info,u=ja(o,c),p=ja(o,"$$");return i.insert(s,u).split(s+c.length),i.split(i.mapping.map(l)).insert(i.mapping.map(l),p),n(i.setSelection(Va(i,i.mapping.map(l)-4))),!0}}},e}(Pl),Rc=/x|backspace/i,Pc=/^\[(\s*)(x?)(\s*)\](?:\s+)/i;function Bc(t){var e=t.schema,n=t.toastMark;return new Te({props:{handleDOMEvents:{keyup:function(t,r){var o,i=t.state,a=i.doc,s=i.tr,l=i.selection;if(l.empty&&Rc.test(r.key)){var c=dl(l),u=c.startIndex,p=c.startFromOffset,d=[u+1,c.from-p+1],f=ns(n.findNodeAtPosition(d),function(t){var e;return"paragraph"===t.type&&"item"===(null===(e=t.parent)||void 0===e?void 0:e.type)});if(null===(o=null==f?void 0:f.firstChild)||void 0===o?void 0:o.literal){var h=f.firstChild,m=h.literal.match(Pc);if(m){var v=h.sourcepos[0],g=m[1],y=m[2],b=m[3],w=g.length+b.length,k=fl(a,v[0]-1).startOffset,x=v[1]+k;if(y){var C=w?w+1:0;s.replaceWith(x,C+x,e.text(y)),t.dispatch(s)}else w||(s.insertText(" ",x),t.dispatch(s))}}}return!1}}}})}var Fc="cut",Hc=/\r\n|\n|\r/,qc=function(t){function e(e,n){var r=t.call(this,e)||this,o=n.toastMark,i=n.useCommandShortcut,a=void 0===i||i,s=n.mdPlugins,l=void 0===s?[]:s;return r.editorType="markdown",r.el.classList.add("md-mode"),r.toastMark=o,r.extraPlugins=l,r.specs=r.createSpecs(),r.schema=r.createSchema(),r.context=r.createContext(),r.keymaps=r.createKeymaps(a),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Ni(Ni({},r.context),{view:r.view})),r.createClipboard(),r.eventEmitter.listen("changePreviewTabWrite",function(t){return r.toggleActive(!0,t)}),r.eventEmitter.listen("changePreviewTabPreview",function(){return r.toggleActive(!1)}),r.initEvent(),r}return Mi(e,t),e.prototype.toggleActive=function(t,e){zs(this.el,"active",t),t?e||this.focus():this.blur()},e.prototype.createClipboard=function(){var t=this;this.clipboard=document.createElement("textarea"),this.clipboard.className=Bs("pseudo-clipboard"),this.clipboard.addEventListener("paste",function(e){var n=e.clipboardData||window.clipboardData,r=n&&n.items;if(r&&!za(r).some(function(t){return"string"===t.kind&&"text/rtf"===t.type})){var o=Js(r);o&&(e.preventDefault(),Ks(t.eventEmitter,o,e.type))}}),this.clipboard.addEventListener("input",function(e){var n=e.target.value;t.replaceSelection(n),e.preventDefault(),e.target.value=""}),this.el.insertBefore(this.clipboard,this.view.dom)},e.prototype.createContext=function(){return{toastMark:this.toastMark,schema:this.schema,eventEmitter:this.eventEmitter}},e.prototype.createSpecs=function(){return new il([new Rl,new ac,new tl,new sc,new cc,new ql,new uc,new Ic,new fc,new Oc,new hc,new vc,new bc,new kc,new Cc,new Ec,new Mc,new Sc,new Nc,new Lc,new Dc,new Ac])},e.prototype.createPlugins=function(){return Si([Dl(this.context),Il(this.context),Bc(this.context)],this.createPluginProps()).concat(this.defaultPlugins)},e.prototype.createView=function(){var t=this;return new po(this.el,{state:this.createState(),dispatchTransaction:function(e){t.updateMarkdown(e);var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e)},handleKeyDown:function(e,n){return(n.metaKey||n.ctrlKey)&&"V"===n.key.toUpperCase()&&t.clipboard.focus(),t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{copy:function(e,n){return t.captureCopy(n)},cut:function(e,n){return t.captureCopy(n,Fc)},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1}},nodeViews:{widget:Qs}})},e.prototype.createCommands=function(){return this.specs.commands(this.view)},e.prototype.captureCopy=function(t,e){t.preventDefault();var n=this.view.state,r=n.selection,o=n.tr;if(r.empty)return!0;var i=this.getChanged(r.content());return t.clipboardData?t.clipboardData.setData("text/plain",i):window.clipboardData.setData("Text",i),e===Fc&&this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent",Fc)),!0},e.prototype.updateMarkdown=function(t){var e=this;t.docChanged&&t.steps.forEach(function(n,r){if(n.slice&&!(n instanceof Bt)){var o=t.docs[r],i=[n.from,n.to],a=cl(o,i[0],i[1]),s=a[0],l=a[1],c=e.getChanged(n.slice);s[0]===l[0]&&s[1]===l[1]&&""===c&&(c="\n");var u=e.toastMark.editMarkdown(s,l,c);e.eventEmitter.emit("updatePreview",u),t.setMeta("editResult",u).scrollIntoView()}})},e.prototype.getChanged=function(t){var e="",n=t.content.size;return t.content.nodesBetween(0,n,function(t,r){t.isText?e+=t.text.slice(Math.max(0,r)-r,n-r):t.isBlock&&r>0&&(e+="\n")}),e},e.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=pl(n.doc,t,e),o=r[0],i=r[1];this.view.dispatch(n.setSelection(Va(n,o,i)).scrollIntoView())},e.prototype.replaceSelection=function(t,e,n){var r,o=this.view.state,i=o.tr,a=o.schema,s=o.doc,c=t.split(Hc).map(function(t){return _a(a,vs(t,a))}),u=new m(l.from(c),1,1);if(this.focus(),e&&n){var p=pl(s,e,n),d=p[0],f=p[1];r=i.replaceRange(d,f,u)}else r=i.replaceSelection(u);this.view.dispatch(r.scrollIntoView())},e.prototype.deleteSelection=function(t,e){var n,r=this.view.state,o=r.tr,i=r.doc;if(t&&e){var a=pl(i,t,e),s=a[0],l=a[1];n=o.deleteRange(s,l)}else n=o.deleteSelection();this.view.dispatch(n.scrollIntoView())},e.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,a=o.to;if(t&&e){var s=pl(r,t,e);i=s[0],a=s[1]}return r.textBetween(i,a,"\n")},e.prototype.getSelection=function(){var t=this.view.state.selection,e=t.from,n=t.to;return cl(this.view.state.tr.doc,e,n)},e.prototype.setMarkdown=function(t,e){void 0===e&&(e=!0);var n=t.split(Hc),r=this.view.state,o=r.tr,i=r.doc,a=r.schema,s=n.map(function(t){return _a(a,vs(t,a))});this.view.dispatch(o.replaceWith(0,i.content.size,s)),e&&this.moveCursorToEnd(!0)},e.prototype.addWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.doc,a=r.selection,s=n?pl(i,n,n)[0]:a.to;this.view.dispatch(o.setMeta("widget",{pos:s,node:t,style:e}))},e.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=r.schema,a=pl(r.doc,t,e),s=vs(n,i);this.view.dispatch(o.replaceWith(a[0],a[1],s))},e.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t||cl(n,r.from)[0],i=this.toastMark.findNodeAtPosition(o);return"text"===i.type&&"paragraph"!==i.parent.type&&(i=i.parent),i.sourcepos[1][1]+=1,{range:i.sourcepos,type:i.type}},e.prototype.getMarkdown=function(){return this.toastMark.getLineTexts().map(function(t){return ds(t)}).join("\n")},e.prototype.getToastMark=function(){return this.toastMark},e}(el),zc="_feEventKey",_c=function(t,e){var n,r=t[zc];return r||(r=t[zc]={}),(n=r[e])||(n=r[e]=[]),n},jc=Ai,Vc=Hi,Uc=_c;function $c(t,e,n){var r,o=Uc(t,e);n?(Vc(o,function(o,i){return n!==o.handler||(Wc(t,e,o.wrappedHandler),r=i,!1)}),o.splice(r,1)):(Vc(o,function(n){Wc(t,e,n.wrappedHandler)}),o.splice(0,o.length))}function Wc(t,e,n){"removeEventListener"in t?t.removeEventListener(e,n):"detachEvent"in t&&t.detachEvent("on"+e,n)}var Gc=function(t,e,n){jc(e)?Vc(e.split(/\s+/g),function(e){$c(t,e,n)}):Vc(e,function(e,n){$c(t,n,e)})},Kc=Ai,Jc=Hi,Zc=_c;function Xc(t,e,n,r){function o(e){n.call(r||t,e||window.event)}"addEventListener"in t?t.addEventListener(e,o):"attachEvent"in t&&t.attachEvent("on"+e,o),function(t,e,n,r){var o=Zc(t,e),i=!1;Jc(o,function(t){return t.handler!==n||(i=!0,!1)}),i||o.push({handler:n,wrappedHandler:r})}(t,e,n,o)}var Qc=function(t,e,n,r){Kc(e)?Jc(e.split(/\s+/g),function(e){Xc(t,e,n,r)}):Jc(e,function(e,r){Xc(t,r,e,n)})},Yc=function(t,e){return(Yc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function tu(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Yc(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var eu=function(){return eu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},eu.apply(this,arguments)};function nu(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var ru="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ou={};function iu(t,e,n){var r,o,i,a,s,l="";for("string"!=typeof e&&(n=e,e=iu.defaultChars),void 0===n&&(n=!0),s=function(t){var e,n,r=ou[t];if(r)return r;for(r=ou[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)r[t.charCodeAt(e)]=t[e];return r}(e),r=0,o=t.length;r<o;r++)if(i=t.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(r+1,r+3)))l+=t.slice(r,r+3),r+=2;else if(i<128)l+=s[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(a=t.charCodeAt(r+1))>=56320&&a<=57343){l+=encodeURIComponent(t[r]+t[r+1]),r++;continue}l+="%EF%BF%BD"}else l+=encodeURIComponent(t[r]);return l}iu.defaultChars=";/?:@&=+$,-_.!~*'()#",iu.componentChars="-_.!~*'()";var au=iu,su={},lu={},cu={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:"‌"},uu={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},pu={},du=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pu,"__esModule",{value:!0});var fu=du({0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}),hu=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+String.fromCharCode(t)};pu.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in fu.default&&(t=fu.default[t]),hu(t))};var mu=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lu,"__esModule",{value:!0}),lu.decodeHTML=lu.decodeHTMLStrict=lu.decodeXML=void 0;var vu=mu(cu),gu=mu({Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"}),yu=mu(uu),bu=mu(pu),wu=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function ku(t){var e=Cu(t);return function(t){return String(t).replace(wu,e)}}lu.decodeXML=ku(yu.default),lu.decodeHTMLStrict=ku(vu.default);var xu=function(t,e){return t<e?1:-1};function Cu(t){return function(e){if("#"===e.charAt(1)){var n=e.charAt(2);return"X"===n||"x"===n?bu.default(parseInt(e.substr(3),16)):bu.default(parseInt(e.substr(2),10))}return t[e.slice(1,-1)]||e}}lu.decodeHTML=function(){for(var t=Object.keys(gu.default).sort(xu),e=Object.keys(vu.default).sort(xu),n=0,r=0;n<e.length;n++)t[r]===e[n]?(e[n]+=";?",r++):e[n]+=";";var o=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=Cu(vu.default);function a(t){return";"!==t.substr(-1)&&(t+=";"),i(t)}return function(t){return String(t).replace(o,a)}}();var Tu={},Eu=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.escapeUTF8=Tu.escape=Tu.encodeNonAsciiHTML=Tu.encodeHTML=Tu.encodeXML=void 0;var Mu=Au(Eu(uu).default),Nu=Iu(Mu);Tu.encodeXML=Hu(Mu);var Su,Du,Lu=Au(Eu(cu).default),Ou=Iu(Lu);function Au(t){return Object.keys(t).sort().reduce(function(e,n){return e[t[n]]="&"+n+";",e},{})}function Iu(t){for(var e=[],n=[],r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];1===i.length?e.push("\\"+i):n.push(i)}e.sort();for(var a=0;a<e.length-1;a++){for(var s=a;s<e.length-1&&e[s].charCodeAt(1)+1===e[s+1].charCodeAt(1);)s+=1;var l=1+s-a;l<3||e.splice(a,l,e[a]+"-"+e[s])}return n.unshift("["+e.join("")+"]"),new RegExp(n.join("|"),"g")}Tu.encodeHTML=(Su=Lu,Du=Ou,function(t){return t.replace(Du,function(t){return Su[t]}).replace(Ru,Bu)}),Tu.encodeNonAsciiHTML=Hu(Lu);var Ru=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,Pu=null!=String.prototype.codePointAt?function(t){return t.codePointAt(0)}:function(t){return 1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)-56320+65536};function Bu(t){return"&#x"+(t.length>1?Pu(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var Fu=new RegExp(Nu.source+"|"+Ru.source,"g");function Hu(t){return function(e){return e.replace(Fu,function(e){return t[e]||Bu(e)})}}Tu.escape=function(t){return t.replace(Fu,Bu)},Tu.escapeUTF8=function(t){return t.replace(Nu,Bu)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=lu,n=Tu;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=Tu;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=lu;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(su);var qu="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",zu=/[\\&]/,_u="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",ju=new RegExp("\\\\"+_u+"|"+qu,"gi"),Vu=new RegExp('[&<>"]',"g"),Uu=function(t){return 92===t.charCodeAt(0)?t.charAt(1):su.decodeHTML(t)};function $u(t){return zu.test(t)?t.replace(ju,Uu):t}function Wu(t){try{return au(t)}catch(e){return t}}function Gu(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return t}}function Ku(t){return Vu.test(t)?t.replace(Vu,Gu):t}function Ju(t,e){for(var n=[],r=0;r<e;r++)n.push(t);return n.join("")}function Zu(t){return!t||!/[^ \t]+/.test(t)}var Xu=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.next=function(){var t=this.current,e=this.entering;if(null===t)return null;var n=Qu(t);return e&&n?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:null===t.next?(this.current=t.parent,this.entering=!1):(this.current=t.next,this.entering=!0),{entering:e,node:t}},t.prototype.resumeAt=function(t,e){this.current=t,this.entering=!0===e},t}();function Qu(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var Yu=1,tp={};function ep(t){delete tp[t]}var np=function(){function t(t,e){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===t?-1:Yu++,this.type=t,this.sourcepos=e,tp[this.id]=this}return t.prototype.isContainer=function(){return Qu(this)},t.prototype.unlink=function(){this.prev?this.prev.next=this.next:this.parent&&(this.parent.firstChild=this.next),this.next?this.next.prev=this.prev:this.parent&&(this.parent.lastChild=this.prev),this.parent=null,this.next=null,this.prev=null},t.prototype.replaceWith=function(t){this.insertBefore(t),this.unlink()},t.prototype.insertAfter=function(t){t.unlink(),t.next=this.next,t.next&&(t.next.prev=t),t.prev=this,this.next=t,this.parent&&(t.parent=this.parent,t.next||(t.parent.lastChild=t))},t.prototype.insertBefore=function(t){t.unlink(),t.prev=this.prev,t.prev&&(t.prev.next=t),t.next=this,this.prev=t,t.parent=this.parent,t.prev||(t.parent.firstChild=t)},t.prototype.appendChild=function(t){t.unlink(),t.parent=this,this.lastChild?(this.lastChild.next=t,t.prev=this.lastChild,this.lastChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.prependChild=function(t){t.unlink(),t.parent=this,this.firstChild?(this.firstChild.prev=t,t.next=this.firstChild,this.firstChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.walker=function(){return new Xu(this)},t}(),rp=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=e,r}return tu(e,t),e}(np),op=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.listData=null,e}return tu(e,t),e}(rp),ip=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.level=0,e.headingType="atx",e}return tu(e,t),e}(rp),ap=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isFenced=!1,e.fenceChar=null,e.fenceLength=0,e.fenceOffset=-1,e.info=null,e.infoPadding=0,e}return tu(e,t),e}(rp),sp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.columns=[],e}return tu(e,t),e}(rp),lp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.startIdx=0,e.endIdx=0,e.paddingLeft=0,e.paddingRight=0,e.ignored=!1,e}return tu(e,t),e}(rp),cp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="",e.dest="",e.label="",e}return tu(e,t),e}(rp),up=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.syntaxLength=0,e.offset=-1,e.info="",e}return tu(e,t),e}(rp),pp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.htmlBlockType=-1,e}return tu(e,t),e}(rp),dp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.destination=null,e.title=null,e.extendedAutolink=!1,e}return tu(e,t),e}(np),fp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.tickCount=0,e}return tu(e,t),e}(np),hp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.info="",e}return tu(e,t),e}(np);function mp(t,e){switch(t){case"heading":return new ip(t,e);case"list":case"item":return new op(t,e);case"link":case"image":return new dp(t,e);case"codeBlock":return new ap(t,e);case"htmlBlock":return new pp(t,e);case"table":return new sp(t,e);case"tableCell":return new lp(t,e);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new rp(t,e);case"code":return new fp(t,e);case"refDef":return new cp(t,e);case"customBlock":return new up(t,e);case"customInline":return new hp(t,e);default:return new np(t,e)}}function vp(t){return"codeBlock"===t.type}function gp(t){return"list"===t.type}function yp(t){return"refDef"===t.type}function bp(t){return"customBlock"===t.type}function wp(t,e){var n=mp("text",e);return n.literal=t,n}var kp,xp="[A-Za-z][A-Za-z0-9-]*",Cp="<"+xp+"(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Tp="</"+xp+"\\s*[>]",Ep=new RegExp("^(?:"+Cp+"|"+Tp+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)kp=function(t){try{return String.fromCodePoint(t)}catch(e){if(e instanceof RangeError)return String.fromCharCode(65533);throw e}};else{var Mp=String.fromCharCode,Np=Math.floor;kp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r,o=[],i=-1,a=t.length;if(!a)return"";for(var s="";++i<a;){var l=Number(t[i]);if(!isFinite(l)||l<0||l>1114111||Np(l)!==l)return String.fromCharCode(65533);l<=65535?o.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,o.push(n,r)),(i+1===a||o.length>16384)&&(s+=Mp.apply(void 0,o),o.length=0)}return s}}var Sp=kp;function Dp(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r<o.length;r++){var i=o[r];"("===i?n<0?n=1:n+=1:")"===i&&(n-=1)}if(n<0){var a=Math.min(-n,e[0].length);return t.substring(0,t.length-a)}}return t}function Lp(t){return t.replace(/&[A-Za-z0-9]+;$/,"")}function Op(t){return nu(nu([],function(t){for(var e,n=new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]","g"),r=[];e=n.exec(t);){var o=Lp(Dp(e[0])),i="www"===e[1]?"http://":"";r.push({text:o,range:[e.index,e.index+o.length-1],url:""+i+o})}return r}(t)),function(t){for(var e,n=new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+","g"),r=[];e=n.exec(t);){var o=e[0];/[_-]+$/.test(o)||r.push({text:o,range:[e.index,e.index+o.length-1],url:"mailto:"+o})}return r}(t)).sort(function(t,e){return t.range[0]-e.range[0]})}function Ap(t){return t[t.length-1]}function Ip(t){return t.slice(1,t.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function Rp(t,e){Object.keys(t).forEach(function(n){e(n,t[n])})}function Pp(t){return!Object.keys(t).length}var Bp=39,Fp=34,Hp=36,qp="\\\\"+_u,zp=new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\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\u0AF0\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-\u2E42\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]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),_p=new RegExp('^(?:"('+qp+'|[^"\\x00])*"|\'('+qp+"|[^'\\x00])*'|\\(("+qp+"|[^()\\x00])*\\))"),jp=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,Vp=new RegExp("^"+_u),Up=new RegExp("^"+qu,"i"),$p=/`+/,Wp=/^`+/,Gp=/\.\.\./g,Kp=/--+/g,Jp=/^<([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])?)*)>/,Zp=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Xp=/^ *(?:\n *)?/,Qp=/^[ \t\n\x0b\x0c\x0d]/,Yp=/^\s/,td=/ *$/,ed=/^ */,nd=/^ *(?:\n|$)/,rd=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,od=/^[^\n`\[\]\\!<&*_'"~$]+/m,id=function(){function t(t){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},t.prototype.spnl=function(){return this.match(Xp),!0},t.prototype.parseBackticks=function(t){var e=this.pos+1,n=this.match(Wp);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match($p));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),a=this.sourcepos(e,this.pos),s=i.split("\n");if(s.length>1){var l=Ap(s);this.lineIdx+=s.length-1,this.linePosOffset=-(this.pos-l.length-n.length),a[1]=this.sourcepos(this.pos),i=s.join(" ")}var c=mp("code",a);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?c.literal=i.slice(1,i.length-1):c.literal=i,c.tickCount=n.length,t.appendChild(c),!0}return this.pos=o,t.appendChild(wp(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=mp("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):Vp.test(n.charAt(this.pos))?(t.appendChild(wp(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(wp("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Jp))?(n=e.slice(1,e.length-1),(r=mp("link",this.sourcepos(o,this.pos))).destination=Wu("mailto:"+n),r.title="",r.appendChild(wp(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Zp))&&(n=e.slice(1,e.length-1),(r=mp("link",this.sourcepos(o,this.pos))).destination=Wu(n),r.title="",r.appendChild(wp(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(Ep);if(null===n)return!1;var r=mp("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===Bp||t===Fp)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(126===t||t===Hp))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":Sp(i);var a,s,l=Yp.test(r),c=zp.test(r),u=Yp.test(o),p=zp.test(o),d=!l&&(!c||u||p),f=!u&&(!p||l||c);return 95===t?(a=d&&(!f||p),s=f&&(!d||c)):t===Bp||t===Fp?(a=d&&!f,s=f):t===Hp?(a=!l,s=!u):(a=d,s=f),this.pos=n,{numdelims:e,canOpen:a,canClose:s}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=wp(t===Bp?"’":t===Fp?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==Bp&&t!==Fp)&&(this.delimiters={cc:t,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,a,s,l=!1,c=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,s=!1;null!==n&&n!==t&&n!==c[u][p?r.origdelims%3:0];){if(l=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!l){s=!0;break}n=n.previous}if(o=r,p||126===u||u===Hp)if(s){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,a=r.node;var h=p?1===d?"emph":"strong":"strike";u===Hp&&(h="customInline");var m=mp(h),v=i.sourcepos[1],g=a.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,a.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),a.literal=a.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==a;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===Hp){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length<=x.length?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&a.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===Bp?(r.node.literal="’",s&&(n.node.literal="‘"),r=r.next):u===Fp&&(r.node.literal="”",s&&(n.node.literal="“"),r=r.next);s||(c[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(_p);return null===t?null:$u(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(jp);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&Vp.test(this.subject.charAt(this.pos+1)))this.pos+=1,-1!==this.peek()&&(this.pos+=1);else if(40===r)this.pos+=1,n+=1;else if(41===r){if(n<1)break;this.pos+=1,n-=1}else{if(null!==Qp.exec(Sp(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:Wu($u(t=this.subject.substr(e,this.pos-e)))}return Wu($u(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(rd);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=wp("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=wp("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else n=wp("!",this.sourcepos(this.pos,this.pos)),t.appendChild(n);return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(wp("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(wp("]",this.sourcepos(o,o))),this.removeBracket(),!0;var a=i.image,s=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(Qp.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=s);var l="";if(!r){var c=this.pos,u=this.parseLinkLabel();if(u>2?l=this.subject.slice(c,c+u):i.bracketAfter||(l=this.subject.slice(i.index,o)),0===u&&(this.pos=s),l){l=Ip(l);var p=this.refMap[l];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=mp(a?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!a)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0}return this.removeBracket(),this.pos=o,t.appendChild(wp("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(Up))&&(t.appendChild(wp(su.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(od)){if(this.options.smart){var r=e.replace(Gp,"…").replace(Kp,function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),Ju("—",n)+Ju("–",e)});t.appendChild(wp(r,this.sourcepos(n,this.pos)))}else{var o=wp(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(td,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild(mp(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild(mp("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(ed),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var a=this.parseLinkDestination();if(null===a)return this.pos=r,0;var s=this.pos;this.spnl(),this.pos!==s&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=s);var l=!0;if(null===this.match(nd)&&(""===n?l=!1:(n="",this.pos=s,l=null!==this.match(nd))),!l)return this.pos=r,0;var c=Ip(i);if(""===c)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=mp("refDef",u);return p.title=n,p.dest=a,p.label=c,t.insertBefore(p),e[c]?this.refDefCandidateMap[p.id]=p:e[c]=Jd(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],a=n[n.length-1];i.sourcepos&&a.sourcepos&&(i.sourcepos[1]=a.sourcepos[1]),i.next=a.next,i.next&&(i.next.prev=i);for(var s=1;s<n.length;s+=1)i.literal+=n[s].literal,n[s].unlink();n=[]}}},t.prototype.getReferenceDefSourcepos=function(t){for(var e=t.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<e.length;i+=1){var a=e[i];if(Qp.test(a))break;if(/\:/.test(a)&&0===r){if(n)break;var s=a.indexOf(":")===a.length-1?i+1:i;o={line:s,ch:e[s].length},n=!0}var l=a.match(/'|"/g);if(l&&(r+=l.length),2===r){o={line:i,ch:a.length};break}}return[[t.sourcepos[0][0],t.sourcepos[0][1]],[t.sourcepos[0][0]+o.line,o.ch]]},t.prototype.parseInline=function(t){var e,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(t);break;case 92:n=this.parseBackslash(t);break;case 96:n=this.parseBackticks(t);break;case 42:case 95:case 126:case Hp:n=this.handleDelim(r,t);break;case Bp:case Fp:n=!!(null===(e=this.options)||void 0===e?void 0:e.smart)&&this.handleDelim(r,t);break;case 91:n=this.parseOpenBracket(t);break;case 33:n=this.parseBang(t);break;case 93:n=this.parseCloseBracket(t);break;case 60:n=this.parseAutolink(t)||this.parseHtmlTag(t);break;case 38:t.disabledEntityParse||(n=this.parseEntity(t));break;default:n=this.parseString(t)}return n||(this.pos+=1,t.appendChild(wp(Sp(r),this.sourcepos(this.pos,this.pos+1)))),!0},t.prototype.parse=function(t){for(this.subject=t.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=t.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=t.sourcepos[0][0],function(t){return"heading"===t.type}(t)&&(this.lineOffsets[0]+=t.level+1);this.parseInline(t););t.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(t.walker());var e=this.options,n=e.extendedAutolinks,r=e.customParser;if(n&&function(t,e){var n;"boolean"==typeof e&&(e=Op);for(var r=function(){var t=n.entering,r=n.node;if(t&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=e(o);if(!i||!i.length)return"continue";for(var a=0,s=r.sourcepos[0],l=s[0],c=s[1],u=function(t,e){return[[l,c+t],[l,c+e]]},p=[],d=0,f=i;d<f.length;d++){var h=f[d],m=h.range,v=h.url,g=h.text;m[0]>a&&p.push(wp(o.substring(a,m[0]),u(a,m[0]-1)));var y=mp("link",u.apply(void 0,m));y.appendChild(wp(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),a=m[1]+1}a<o.length&&p.push(wp(o.substring(a),u(a,o.length-1)));for(var b=0,w=p;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=t.next();)r()}(t.walker(),n),r&&t.firstChild)for(var o,i=t.firstChild.walker();o=i.next();){var a=o.node,s=o.entering;r[a.type]&&r[a.type](a,{entering:s,options:this.options})}},t}(),ad=/^\[([ \txX])\][ \t]+/,sd=/[^ \t\f\v\r\n]/,ld=/^(?:`{3,}|~{3,})(?= *$)/;function cd(t){for(var e=t;e;){if(e.lastLineBlank)return!0;var n=e.type;if(e.lastLineChecked||"list"!==n&&"item"!==n){e.lastLineChecked=!0;break}e.lastLineChecked=!0,e=e.lastChild}return!1}function ud(t,e){return e<t.length?t.charCodeAt(e):-1}function pd(t){return!sd.test(t)}function dd(t){return 32===t||9===t}var fd=/^\$\$$/,hd={continue:function(t,e){var n=t.currentLine,r=n.match(fd);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&dd(ud(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),a=o.match(/^(\s*)(.*)/);e.info=$u(a[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},md={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},vd={continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(ld);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&dd(ud(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),a=r.slice(o+1),s=i.match(/^(\s*)(.*)/);e.infoPadding=s[1].length,e.info=$u(s[2].trim()),e.literal=a}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},gd={document:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},list:{continue:function(){return 0},finalize:function(t,e){for(var n=e.firstChild;n;){if(cd(n)&&n.next){e.listData.tight=!1;break}for(var r=n.firstChild;r;){if(cd(r)&&(n.next||r.next)){e.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(t){return"item"===t},acceptsLines:!1},blockQuote:{continue:function(t){var e=t.currentLine;return t.indented||62!==ud(e,t.nextNonspace)?1:(t.advanceNextNonspace(),t.advanceOffset(1,!1),dd(ud(e,t.offset))&&t.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},item:{continue:function(t,e){if(t.blank){if(null===e.firstChild)return 1;t.advanceNextNonspace()}else{if(!(t.indent>=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(ad);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:vd,htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===ud(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&pd(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:md,customBlock:hd,frontMatter:md};function yd(t){for(var e=0,n=0,r=[],o=0;o<t.length;o+=1)if("|"===t[o]&&"\\"!==t[o-1]){var i=t.substring(e,o);0===e&&Zu(i)?n=o+1:r.push(i),e=o+1}return e<t.length&&(Zu(i=t.substring(e,t.length))||r.push(i)),[n,r]}function bd(t,e,n,r){for(var o=[],i=0,a=e;i<a.length;i++){var s=a[i],l=s.match(/^[ \t]+/),c=l?l[0].length:0,u=void 0,p=void 0;if(c===s.length)c=0,u=0,p="";else{var d=s.match(/[ \t]+$/);u=d?d[0].length:0,p=s.slice(c,s.length-u)}var f=r+c,h=mp(t,[[n,r],[n,r+s.length-1]]);h.stringContent=p.replace(/\\\|/g,"|"),h.startIdx=o.length,h.endIdx=o.length,h.lineOffsets=[f-1],h.paddingLeft=c,h.paddingRight=u,o.push(h),r+=s.length+1}return o}function wd(t){var e=null,n=t.stringContent,r=n[0];return":"===n[n.length-1]?e=":"===r?"center":"right":":"===r&&(e="left"),{align:e}}var kd=/^(\$\$)(\s*[a-zA-Z])+/,xd=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,Cd=/^`{3,}(?!.*`)|^~{3,}/,Td=[/./,/^<(?:script|pre|style)(?:\s|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Z]/,/^<!\[CDATA\[/,/^<[/]?(?: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|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,new RegExp("^(?:"+Cp+"|"+Tp+")\\s*$","i")],Ed=/^(?:=+|-+)[ \t]*$/,Md=/^#{1,6}(?:[ \t]+|$)/,Nd=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,Sd=/^[*+-]/,Dd=/^(\d{1,9})([.)])/;function Ld(t,e){return t.options.disallowDeepHeading&&("blockQuote"===e.type||"item"===e.type)}var Od=[function(t){return t.indented||62!==ud(t.currentLine,t.nextNonspace)?0:(t.advanceNextNonspace(),t.advanceOffset(1,!1),dd(ud(t.currentLine,t.offset))&&t.advanceOffset(1,!0),t.closeUnmatchedBlocks(),t.addChild("blockQuote",t.nextNonspace),1)},function(t,e){var n;if(!t.indented&&!Ld(t,e)&&(n=t.currentLine.slice(t.nextNonspace).match(Md))){t.advanceNextNonspace(),t.advanceOffset(n[0].length,!1),t.closeUnmatchedBlocks();var r=t.addChild("heading",t.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=t.currentLine.slice(t.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),t.advanceOffset(t.currentLine.length-t.offset),2}return 0},function(t){var e;if(!t.indented&&(e=t.currentLine.slice(t.nextNonspace).match(Cd))){var n=e[0].length;t.closeUnmatchedBlocks();var r=t.addChild("codeBlock",t.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=e[0][0],r.fenceOffset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0},function(t,e){if(!t.indented&&60===ud(t.currentLine,t.nextNonspace)){var n=t.currentLine.slice(t.nextNonspace),r=t.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(Td[o]);if(i){if(7===o){if("paragraph"===e.type)return 0;if(r.length>0&&new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return t.closeUnmatchedBlocks(),t.addChild("htmlBlock",t.offset).htmlBlockType=o,2}}}return 0},function(t,e){var n;if(null!==e.stringContent&&!t.indented&&"paragraph"===e.type&&!Ld(t,e.parent)&&(n=t.currentLine.slice(t.nextNonspace).match(Ed))){t.closeUnmatchedBlocks();for(var r=void 0;91===ud(e.stringContent,0)&&(r=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(r);if(e.stringContent.length>0){var o=mp("heading",e.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=e.stringContent,e.insertAfter(o),e.unlink(),t.tip=o,t.advanceOffset(t.currentLine.length-t.offset,!1),2}return 0}return 0},function(t){return!t.indented&&Nd.test(t.currentLine.slice(t.nextNonspace))?(t.closeUnmatchedBlocks(),t.addChild("thematicBreak",t.nextNonspace),t.advanceOffset(t.currentLine.length-t.offset,!1),2):0},function(t,e){var n,r,o,i=e;return t.indented&&"list"!==e.type||!(n=function(t,e){var n,r,o=t.currentLine.slice(t.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:t.indent,task:!1,checked:!1};if(t.indent>=4)return null;if(n=o.match(Sd))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(Dd))||"paragraph"===e.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=ud(t.currentLine,t.nextNonspace+n[0].length))&&9!==r&&32!==r)return null;if("paragraph"===e.type&&!t.currentLine.slice(t.nextNonspace+n[0].length).match(sd))return null;t.advanceNextNonspace(),t.advanceOffset(n[0].length,!0);var a=t.column,s=t.offset;do{t.advanceOffset(1,!0),r=ud(t.currentLine,t.offset)}while(t.column-a<5&&dd(r));var l=-1===ud(t.currentLine,t.offset),c=t.column-a;return c>=5||c<1||l?(i.padding=n[0].length+1,t.column=a,t.offset=s,dd(ud(t.currentLine,t.offset))&&t.advanceOffset(1,!0)):i.padding=n[0].length+c,i}(t,i))?0:(t.closeUnmatchedBlocks(),"list"===t.tip.type&&(o=n,(r=i.listData).type===o.type&&r.delimiter===o.delimiter&&r.bulletChar===o.bulletChar)||((i=t.addChild("list",t.nextNonspace)).listData=n),(i=t.addChild("item",t.nextNonspace)).listData=n,1)},function(t){return t.indented&&"paragraph"!==t.tip.type&&!t.blank?(t.advanceOffset(4,!0),t.closeUnmatchedBlocks(),t.addChild("codeBlock",t.offset),2):0},function(t,e){var n=e.stringContent;if("paragraph"===e.type&&!t.indented&&!t.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),a=t.currentLine.slice(t.nextNonspace),s=yd(i),l=s[0],c=s[1],u=yd(a),p=u[0],d=u[1],f=/^[ \t]*:?-+:?[ \t]*$/;if(!c.length||!d.length||d.some(function(t){return!f.test(t)})||1===d.length&&0!==a.indexOf("|"))return 0;var h=e.lineOffsets,m=t.lineNumber-1,v=Ap(h)+1,g=mp("table",[[m,v],[t.lineNumber,t.offset]]);if(g.columns=d.map(function(){return{align:null}}),e.insertAfter(g),1===h.length)e.unlink();else{e.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;t.lastLineLength=h[h.length-2]+y,t.finalize(e,m-1)}t.advanceOffset(t.currentLine.length-t.offset,!1);var b=mp("tableHead",[[m,v],[t.lineNumber,t.offset]]);g.appendChild(b);var w=mp("tableRow",[[m,v],[m,v+i.length-1]]),k=mp("tableDelimRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.offset]]);b.appendChild(w),b.appendChild(k),bd("tableCell",c,m,v+l).forEach(function(t){w.appendChild(t)});var x=bd("tableDelimCell",d,t.lineNumber,t.nextNonspace+1+p);return x.forEach(function(t){k.appendChild(t)}),g.columns=x.map(wd),t.tip=g,2}return 0},function(t,e){if("table"!==e.type&&"tableBody"!==e.type||!t.blank&&-1===t.currentLine.indexOf("|"))return 0;if(t.advanceOffset(t.currentLine.length-t.offset,!1),t.blank){var n=e;return"tableBody"===e.type&&(n=e.parent,t.finalize(e,t.lineNumber-1)),t.finalize(n,t.lineNumber-1),0}var r=e;"table"===e.type&&((r=t.addChild("tableBody",t.nextNonspace)).stringContent=null);var o=mp("tableRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.currentLine.length]]);r.appendChild(o);var i=r.parent,a=yd(t.currentLine.slice(t.nextNonspace)),s=a[0];return bd("tableCell",a[1],t.lineNumber,t.nextNonspace+1+s).forEach(function(t,e){e>=i.columns.length&&(t.ignored=!0),o.appendChild(t)}),2},function(t){var e;if(!t.indented&&!xd.test(t.currentLine)&&(e=t.currentLine.match(kd))){var n=e[1].length;t.closeUnmatchedBlocks();var r=t.addChild("customBlock",t.nextNonspace);return r.syntaxLength=n,r.offset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0}],Ad=/^(-{3}|\+{3}|;{3})$/,Id=function(t,e){var n=t.currentLine,r=t.lineNumber,o=t.indented;return 1===r&&!o&&"document"===e.type&&Ad.test(n)?(t.closeUnmatchedBlocks(),t.addChild("frontMatter",t.nextNonspace).stringContent=n,t.advanceNextNonspace(),t.advanceOffset(n.length,!1),2):0},Rd={continue:function(t,e){var n=t.currentLine,r=n.match(Ad);return"frontMatter"===e.type&&r?(e.stringContent+=n,t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2):0},finalize:function(t,e){null!==e.stringContent&&(e.literal=e.stringContent,e.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},Pd=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],Bd=/^[#`~*+_=<>0-9-;$]/,Fd=/\r\n|\n|\r/;function Hd(){return mp("document",[[1,1],[0,0]])}var qd={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},zd=function(){function t(t){this.options=eu(eu({},qd),t),this.doc=Hd(),this.tip=this.doc,this.oldtip=this.doc,this.lineNumber=0,this.offset=0,this.column=0,this.nextNonspace=0,this.nextNonspaceColumn=0,this.indent=0,this.currentLine="",this.indented=!1,this.blank=!1,this.partiallyConsumedTab=!1,this.allClosed=!0,this.lastMatchedContainer=this.doc,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.lastLineLength=0,this.lines=[],this.options.frontMatter&&(gd.frontMatter=Rd,Od.unshift(Id)),this.inlineParser=new id(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=Ju(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!gd[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=mp(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],gd[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.entering,a=o.type;n&&n[a]&&n[a](o,{entering:i,options:this.options}),i||"paragraph"!==a&&"heading"!==a&&("tableCell"!==a||o.ignored)||this.inlineParser.parse(o)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),gd[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&gd[e.type].acceptsLines,i=Od.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!Bd.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var a=0;a<i;){var s=Od[a](this,e);if(1===s){e=this.tip;break}if(2===s){e=this.tip,o=!0;break}a++}if(a===i){this.advanceNextNonspace();break}}if(this.allClosed||this.blank||"paragraph"!==this.tip.type){this.closeUnmatchedBlocks(),this.blank&&e.lastChild&&(e.lastChild.lastLineBlank=!0);for(var l=e.type,c=this.blank&&!("blockQuote"===l||vp(e)&&e.isFenced||"item"===l&&!e.firstChild&&e.sourcepos[0][0]===this.lineNumber),u=e;u;)u.lastLineBlank=c,u=u.parent;gd[l].acceptsLines?(this.addLine(),"htmlBlock"===e.type&&e.htmlBlockType>=1&&e.htmlBlockType<=5&&Pd[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offset<t.length&&!this.blank&&(e=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=t.length},t.prototype.parse=function(t,e){this.doc=Hd(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=t.split(Fd),r=n.length;this.lines=e||n,this.options.referenceDefinition&&this.clearRefMaps(),10===t.charCodeAt(t.length-1)&&(r-=1);for(var o=0;o<r;o++)this.incorporateLine(n[o]);for(;this.tip;)this.finalize(this.tip,r);return this.processInlines(this.doc),this.doc},t.prototype.partialParseStart=function(t,e){this.doc=Hd(),this.tip=this.doc,this.lineNumber=t-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=e.length,r=0;r<n;r++)this.incorporateLine(e[r]);return this.doc},t.prototype.partialParseExtends=function(t){for(var e=0;e<t.length;e++)this.incorporateLine(t[e])},t.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},t.prototype.setRefMaps=function(t,e,n){this.refMap=t,this.refLinkCandidateMap=e,this.refDefCandidateMap=n},t.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){var e;e=t,Object.keys(e).forEach(function(t){delete e[t]})})},t}();function _d(t,e){return t[0]<e[0]?1:t[0]>e[0]?-1:t[1]<e[1]?1:t[1]>e[1]?-1:0}function jd(t,e){var n=t[0];return 1===_d(t[1],e)?1:-1===_d(n,e)?-1:0}function Vd(t,e){for(var n=0,r=e;n<r.length;n++){var o=r[n];t.insertBefore(o)}}function Ud(t,e){var n=t[0];return t[1][0]<e?1:n[0]>e?-1:0}function $d(t,e){for(var n=t.firstChild;n;){var r=Ud(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function Wd(t){return function(t){return tp[t]}(t)||null}function Gd(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var Kd=/\r\n|\n|\r/;function Jd(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var Zd=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new zd(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(Kd),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,o=t[0],i=t[1],a=e[0],s=e[1],l=n.split(Kd),c=l.length,u=this.lineTexts[o-1],p=this.lineTexts[a-1];l[0]=u.slice(0,i-1)+l[0],l[c-1]=l[c-1]+p.slice(s-1);var d=a-o+1;return(r=this.lineTexts).splice.apply(r,nu([o-1,d],l)),c-d},t.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?(Vd(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var a=i[o];n[a]&&(ep(n[a].id),n[a]=null)}n=r}t.next=e.next,e.next?e.next.prev=t:t.parent.lastChild=t}}(t,e),[t.id,e.id].forEach(function(t){return ep(t)}),t.unlink()):e?(Vd(e,n),ep(e.id),e.unlink()):function(t,e){for(var n=e.length-1;n>=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=$d(this.root,t[0]),r=$d(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach(function(t){t(e)})},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&(gp(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return Sd.test(n)||Dd.test(n)}(this.lineTexts[n-1])||"table"===t.prev.type&&!pd(o=this.lineTexts[n-1])&&-1!==o.indexOf("|"))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),a=this.parser.partialParseStart(n,i),s=e?e.next:this.root.firstChild,l=a.lastChild,c=l&&vp(l)&&l.open,u=l&&bp(l)&&l.open,p=l&&gp(l);(c||u)&&s||p&&s&&("list"===s.type||s.sourcepos[0][1]>=2);){var d=this.extendEndLine(s.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=s,r=d,s=s.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(a),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&yp(t)||e&&yp(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!Pp(this.refMap)){var r=function(t){if(yp(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&Gd(r,t.parent,e),e&&Gd(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!Pp(this.refMap)){var n=function(t){if(yp(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=Jd(t))}};t.forEach(function(t){Gd(n,t)})}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;Pp(this.refDefCandidateMap)||Rp(this.refDefCandidateMap,function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=Jd(n))})},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!Pp(this.refMap)){var i=$d(this.root,t-1),a=$d(this.root,e+1);i&&yp(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),a&&yp(a)&&a!==n&&a!==r&&(r=a,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],a=o?Math.min(o.sourcepos[0][0],t[0]):t[0],s=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),l=this.parseRange.apply(this,this.getRangeWithRefDef(a,s,o,i,n)),c=l.newNodes,u=l.extStartNode,p=l.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,c),this.replaceWithNewRefDefState(c)):this.replaceRangeNodes(u,p,c),{nodes:c,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return Pp(this.refMap)||Rp(this.refMap,function(n,r){r.unlinked&&delete t.refMap[n],Rp(t.refLinkCandidateMap,function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))})}),e},t.prototype.removeUnlinkedCandidate=function(){Pp(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){Rp(t,function(e){(function(t){var e=Wd(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]})})},t.prototype.editMarkdown=function(t,e,n){var r=this.updateLineTexts(t,e,n),o=this.parse(t,e,r),i=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=eu({},t);return e.forEach(function(t){delete r[t]}),r}(o,"nextNode");!function(t,e){if(t&&t.parent&&0!==e){var n,r=t.parent.walker();for(r.resumeAt(t,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=e,o.sourcepos[1][0]+=e)}}}(o.nextNode,r),this.updateRootNodeState();var a=[i];return this.referenceDefinition&&(this.removeUnlinkedCandidate(),this.replaceWithRefDefCandidate(),a=a.concat(this.parseRefLink())),this.trigger("change",a),a},t.prototype.getLineTexts=function(){return this.lineTexts},t.prototype.getRootNode=function(){return this.root},t.prototype.findNodeAtPosition=function(t){var e=function(t,e){for(var n=t,r=null;n;){var o=jd(n.sourcepos,e);if(0===o){if(!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)return r;if(!n.next)return r;n=n.next}}return n}(this.root,t);return e&&e!==this.root?e:null},t.prototype.findFirstNodeAtLine=function(t){return function(t,e){for(var n=t.firstChild,r=null;n;){var o=Ud(n.sourcepos,e);if(0===o){if(n.sourcepos[0][0]===e||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(t){for(;t.parent&&"document"!==t.parent.type&&t.parent.sourcepos[0][0]===t.sourcepos[0][0];)t=t.parent;return t}(function(t){for(;t.lastChild;)t=t.lastChild;return t}(r)):null}(this.root,t)},t.prototype.on=function(t,e){this.eventHandlerMap[t].push(e)},t.prototype.off=function(t,e){var n=this.eventHandlerMap[t],r=n.indexOf(e);n.splice(r,1)},t.prototype.findNodeById=function(t){return Wd(t)},t.prototype.removeAllNode=function(){tp={}},t}(),Xd=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function Qd(t){return Xd.test(t)?t.replace(Xd,function(t,e){return"&lt;"+e}):t}var Yd={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.listData,o=r.type,i=r.start,a="bullet"===o?"ul":"ol",s={};return"ol"===a&&null!==i&&1!==i&&(s.start=i.toString()),{type:n?"openTag":"closeTag",tagName:a,attributes:s,outerNewLine:!0}},item:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?Qd(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?Qd(t.literal):t.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+Ku(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,r=n.title,o=n.destination;return{type:"openTag",tagName:"a",attributes:eu({href:Ku(o)},r&&{title:Ku(r)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,r=e.skipChildren,o=t,i=o.title,a=o.destination;return r(),{type:"openTag",tagName:"img",selfClose:!0,attributes:eu({src:Ku(a),alt:n(t)},i&&{title:Ku(i)})}},customBlock:function(t,e,n){var r=n[t.info.trim().toLowerCase()];if(r)try{return r(t,e)}catch(o){}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.info,i=r.firstChild,a=n[o.trim().toLowerCase()],s=e.entering;if(a)try{return a(t,e)}catch(l){}return s?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+o+(i?" ":"")}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},tf={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,r=t.listData,o=r.checked,i=r.task;if(n){var a={type:"openTag",tagName:"li",outerNewLine:!0};return i?[a,{type:"openTag",tagName:"input",selfClose:!0,attributes:eu(eu({},o&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:a}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;o<r;o+=1)n.push({type:"openTag",tagName:"td",outerNewLine:!0},{type:"closeTag",tagName:"td",outerNewLine:!0});return n.push({type:"closeTag",tagName:"tr",outerNewLine:!0}),n},tableCell:function(t,e){var n=e.entering;if(t.ignored)return{type:"text",content:""};var r=t.parent.parent,o="tableHead"===r.type?"th":"td",i=r.parent.columns[t.startIdx],a=(null==i?void 0:i.align)?{align:i.align}:null;return n?eu({type:"openTag",tagName:o,outerNewLine:!0},a&&{attributes:a}):{type:"closeTag",tagName:o,outerNewLine:!0}}},ef={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function nf(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var rf=function(){function t(t){this.buffer=[],this.options=eu(eu({},ef),t),this.convertors=this.createConvertors(),delete this.options.convertors}return t.prototype.createConvertors=function(){var t=eu({},Yd);if(this.options.gfm&&(t=eu(eu({},t),tf)),this.options.convertors){var e=this.options.convertors,n=Object.keys(e),r=eu(eu({},Yd),tf);n.forEach(function(n){var o=t[n],i=e[n],a=-1===Object.keys(r).indexOf(n)?n.toLowerCase():n;t[a]=o?function(t,e,n){return e.origin=function(){return o(t,e,n)},i(t,e)}:i})}return t},t.prototype.getConvertors=function(){return this.convertors},t.prototype.getOptions=function(){return this.options},t.prototype.render=function(t){var e=this;this.buffer=[];for(var n=t.walker(),r=null,o=function(){var t=r.node,o=r.entering,a=i.convertors[t.type];if(!a)return"continue";var s=!1,l={entering:o,leaf:!Qu(t),options:i.options,getChildrenText:nf,skipChildren:function(){s=!0}},c=bp(t)||function(t){return"customInline"===t.type}(t)?a(t,l,i.convertors):a(t,l);c&&((Array.isArray(c)?c:[c]).forEach(function(n,r){"openTag"===n.type&&e.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(t.id)),e.renderHTMLNode(n)}),s&&(n.resumeAt(t,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},t.prototype.renderHTMLNode=function(t){switch(t.type){case"openTag":case"closeTag":this.renderElementNode(t);break;case"text":this.renderTextNode(t);break;case"html":this.renderRawHtmlNode(t)}},t.prototype.generateOpenTagString=function(t){var e=this,n=t.tagName,r=t.classNames,o=t.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach(function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')}),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push("</"+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==Ap(Ap(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(Ku(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),of=Object.hasOwnProperty,af=Object.setPrototypeOf,sf=Object.isFrozen,lf=Object.getPrototypeOf,cf=Object.getOwnPropertyDescriptor,uf=Object.freeze,pf=Object.seal,df=Object.create,ff="undefined"!=typeof Reflect&&Reflect,hf=ff.apply,mf=ff.construct;hf||(hf=function(t,e,n){return t.apply(e,n)}),uf||(uf=function(t){return t}),pf||(pf=function(t){return t}),mf||(mf=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var vf,gf=Nf(Array.prototype.forEach),yf=Nf(Array.prototype.pop),bf=Nf(Array.prototype.push),wf=Nf(String.prototype.toLowerCase),kf=Nf(String.prototype.match),xf=Nf(String.prototype.replace),Cf=Nf(String.prototype.indexOf),Tf=Nf(String.prototype.trim),Ef=Nf(RegExp.prototype.test),Mf=(vf=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return mf(vf,e)});function Nf(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return hf(t,e,r)}}function Sf(t,e){af&&af(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var o=wf(r);o!==r&&(sf(e)||(e[n]=o),r=o)}t[r]=!0}return t}function Df(t){var e=df(null),n=void 0;for(n in t)hf(of,t,[n])&&(e[n]=t[n]);return e}function Lf(t,e){for(;null!==t;){var n=cf(t,e);if(n){if(n.get)return Nf(n.get);if("function"==typeof n.value)return Nf(n.value)}t=lf(t)}return function(t){return null}}var Of=uf(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Af=uf(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),If=uf(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Rf=uf(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Pf=uf(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Bf=uf(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ff=uf(["#text"]),Hf=uf(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),qf=uf(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),zf=uf(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_f=uf(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jf=pf(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Vf=pf(/<%[\s\S]*|[\s\S]*%>/gm),Uf=pf(/^data-[\-\w.\u00B7-\uFFFF]/),$f=pf(/^aria-[\-\w]+$/),Wf=pf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gf=pf(/^(?:\w+script|data):/i),Kf=pf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jf="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};function Zf(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var Xf=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,n=function(e){return t(e)};if(n.version="2.3.3",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,o=e.document,i=e.DocumentFragment,a=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap,p=void 0===u?e.NamedNodeMap||e.MozNamedAttrMap:u,d=e.Text,f=e.Comment,h=e.DOMParser,m=e.trustedTypes,v=l.prototype,g=Lf(v,"cloneNode"),y=Lf(v,"nextSibling"),b=Lf(v,"childNodes"),w=Lf(v,"parentNode");if("function"==typeof a){var k=o.createElement("template");k.content&&k.content.ownerDocument&&(o=k.content.ownerDocument)}var x=function(t,e){if("object"!==(void 0===t?"undefined":Jf(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:function(t){return t}})}catch(i){return null}}(m,r),C=x&&et?x.createHTML(""):"",T=o,E=T.implementation,M=T.createNodeIterator,N=T.createDocumentFragment,S=T.getElementsByTagName,D=r.importNode,L={};try{L=Df(o).documentMode?o.documentMode:{}}catch(Ft){}var O={};n.isSupported="function"==typeof w&&E&&void 0!==E.createHTMLDocument&&9!==L;var A=jf,I=Vf,R=Uf,P=$f,B=Gf,F=Kf,H=Wf,q=null,z=Sf({},[].concat(Zf(Of),Zf(Af),Zf(If),Zf(Pf),Zf(Ff))),_=null,j=Sf({},[].concat(Zf(Hf),Zf(qf),Zf(zf),Zf(_f))),V=null,U=null,$=!0,W=!0,G=!1,K=!1,J=!1,Z=!1,X=!1,Q=!1,Y=!1,tt=!0,et=!1,nt=!0,rt=!0,ot=!1,it={},at=null,st=Sf({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),lt=null,ct=Sf({},["audio","video","img","source","image","track"]),ut=null,pt=Sf({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),dt="http://www.w3.org/1998/Math/MathML",ft="http://www.w3.org/2000/svg",ht="http://www.w3.org/1999/xhtml",mt=ht,vt=!1,gt=void 0,yt=["application/xhtml+xml","text/html"],bt=void 0,wt=null,kt=o.createElement("form"),xt=function(t){wt&&wt===t||(t&&"object"===(void 0===t?"undefined":Jf(t))||(t={}),t=Df(t),q="ALLOWED_TAGS"in t?Sf({},t.ALLOWED_TAGS):z,_="ALLOWED_ATTR"in t?Sf({},t.ALLOWED_ATTR):j,ut="ADD_URI_SAFE_ATTR"in t?Sf(Df(pt),t.ADD_URI_SAFE_ATTR):pt,lt="ADD_DATA_URI_TAGS"in t?Sf(Df(ct),t.ADD_DATA_URI_TAGS):ct,at="FORBID_CONTENTS"in t?Sf({},t.FORBID_CONTENTS):st,V="FORBID_TAGS"in t?Sf({},t.FORBID_TAGS):{},U="FORBID_ATTR"in t?Sf({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,$=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,K=t.SAFE_FOR_TEMPLATES||!1,J=t.WHOLE_DOCUMENT||!1,Q=t.RETURN_DOM||!1,Y=t.RETURN_DOM_FRAGMENT||!1,tt=!1!==t.RETURN_DOM_IMPORT,et=t.RETURN_TRUSTED_TYPE||!1,X=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,rt=!1!==t.KEEP_CONTENT,ot=t.IN_PLACE||!1,H=t.ALLOWED_URI_REGEXP||H,mt=t.NAMESPACE||ht,gt=gt=-1===yt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,bt="application/xhtml+xml"===gt?function(t){return t}:wf,K&&(W=!1),Y&&(Q=!0),it&&(q=Sf({},[].concat(Zf(Ff))),_=[],!0===it.html&&(Sf(q,Of),Sf(_,Hf)),!0===it.svg&&(Sf(q,Af),Sf(_,qf),Sf(_,_f)),!0===it.svgFilters&&(Sf(q,If),Sf(_,qf),Sf(_,_f)),!0===it.mathMl&&(Sf(q,Pf),Sf(_,zf),Sf(_,_f))),t.ADD_TAGS&&(q===z&&(q=Df(q)),Sf(q,t.ADD_TAGS)),t.ADD_ATTR&&(_===j&&(_=Df(_)),Sf(_,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&Sf(ut,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(at===st&&(at=Df(at)),Sf(at,t.FORBID_CONTENTS)),rt&&(q["#text"]=!0),J&&Sf(q,["html","head","body"]),q.table&&(Sf(q,["tbody"]),delete V.tbody),uf&&uf(t),wt=t)},Ct=Sf({},["mi","mo","mn","ms","mtext"]),Tt=Sf({},["foreignobject","desc","title","annotation-xml"]),Et=Sf({},Af);Sf(Et,If),Sf(Et,Rf);var Mt=Sf({},Pf);Sf(Mt,Bf);var Nt=function(t){bf(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(Ft){try{t.outerHTML=C}catch(e){t.remove()}}},St=function(t,e){try{bf(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(Ft){bf(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!_[t])if(Q||Y)try{Nt(e)}catch(Ft){}else try{e.setAttribute(t,"")}catch(Ft){}},Dt=function(t){var e=void 0,n=void 0;if(X)t="<remove></remove>"+t;else{var r=kf(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=x?x.createHTML(t):t;if(mt===ht)try{e=(new h).parseFromString(i,gt)}catch(Ft){}if(!e||!e.documentElement){e=E.createDocument(mt,"template",null);try{e.documentElement.innerHTML=vt?"":i}catch(Ft){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),mt===ht?S.call(e,J?"html":"body")[0]:J?e.documentElement:a},Lt=function(t){return M.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ot=function(t){return"object"===(void 0===s?"undefined":Jf(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":Jf(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},At=function(t,e,r){O[t]&&gf(O[t],function(t){t.call(n,e,r,wt)})},It=function(t){var e,r=void 0;if(At("beforeSanitizeElements",t,null),!((e=t)instanceof d||e instanceof f||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof p&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore))return Nt(t),!0;if(kf(t.nodeName,/[\u0080-\uFFFF]/))return Nt(t),!0;var o=bt(t.nodeName);if(At("uponSanitizeElement",t,{tagName:o,allowedTags:q}),!Ot(t.firstElementChild)&&(!Ot(t.content)||!Ot(t.content.firstElementChild))&&Ef(/<[/\w]/g,t.innerHTML)&&Ef(/<[/\w]/g,t.textContent))return Nt(t),!0;if("select"===o&&Ef(/<template/i,t.innerHTML))return Nt(t),!0;if(!q[o]||V[o]){if(rt&&!at[o]){var i=w(t)||t.parentNode,a=b(t)||t.childNodes;if(a&&i)for(var s=a.length-1;s>=0;--s)i.insertBefore(g(a[s],!0),y(t))}return Nt(t),!0}return t instanceof l&&!function(t){var e=w(t);e&&e.tagName||(e={namespaceURI:ht,tagName:"template"});var n=wf(t.tagName),r=wf(e.tagName);if(t.namespaceURI===ft)return e.namespaceURI===ht?"svg"===n:e.namespaceURI===dt?"svg"===n&&("annotation-xml"===r||Ct[r]):Boolean(Et[n]);if(t.namespaceURI===dt)return e.namespaceURI===ht?"math"===n:e.namespaceURI===ft?"math"===n&&Tt[r]:Boolean(Mt[n]);if(t.namespaceURI===ht){if(e.namespaceURI===ft&&!Tt[r])return!1;if(e.namespaceURI===dt&&!Ct[r])return!1;var o=Sf({},["title","style","font","a","script"]);return!Mt[n]&&(o[n]||!Et[n])}return!1}(t)?(Nt(t),!0):"noscript"!==o&&"noembed"!==o||!Ef(/<\/no(script|embed)/i,t.innerHTML)?(K&&3===t.nodeType&&(r=t.textContent,r=xf(r,A," "),r=xf(r,I," "),t.textContent!==r&&(bf(n.removed,{element:t.cloneNode()}),t.textContent=r)),At("afterSanitizeElements",t,null),!1):(Nt(t),!0)},Rt=function(t,e,n){if(nt&&("id"===e||"name"===e)&&(n in o||n in kt))return!1;if(W&&!U[e]&&Ef(R,e));else if($&&Ef(P,e));else{if(!_[e]||U[e])return!1;if(ut[e]);else if(Ef(H,xf(n,F,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Cf(n,"data:")||!lt[t])if(G&&!Ef(B,xf(n,F,"")));else if(n)return!1}return!0},Pt=function(t){var e=void 0,r=void 0,o=void 0,i=void 0;At("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_};for(i=a.length;i--;){var l=e=a[i],c=l.name,u=l.namespaceURI;if(r=Tf(e.value),o=bt(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,At("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(St(c,t),s.keepAttr))if(Ef(/\/>/i,r))St(c,t);else{K&&(r=xf(r,A," "),r=xf(r,I," "));var p=bt(t.nodeName);if(Rt(p,o,r))try{u?t.setAttributeNS(u,c,r):t.setAttribute(c,r),yf(n.removed)}catch(Ft){}}}At("afterSanitizeAttributes",t,null)}},Bt=function t(e){var n=void 0,r=Lt(e);for(At("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)At("uponSanitizeShadowNode",n,null),It(n)||(n.content instanceof i&&t(n.content),Pt(n));At("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,o){var a=void 0,l=void 0,c=void 0,u=void 0,p=void 0;if((vt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ot(t)){if("function"!=typeof t.toString)throw Mf("toString is not a function");if("string"!=typeof(t=t.toString()))throw Mf("dirty is not a string, aborting")}if(!n.isSupported){if("object"===Jf(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(Ot(t))return e.toStaticHTML(t.outerHTML)}return t}if(Z||xt(o),n.removed=[],"string"==typeof t&&(ot=!1),ot);else if(t instanceof s)1===(l=(a=Dt("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!Q&&!K&&!J&&-1===t.indexOf("<"))return x&&et?x.createHTML(t):t;if(!(a=Dt(t)))return Q?null:C}a&&X&&Nt(a.firstChild);for(var d=Lt(ot?t:a);c=d.nextNode();)3===c.nodeType&&c===u||It(c)||(c.content instanceof i&&Bt(c.content),Pt(c),u=c);if(u=null,ot)return t;if(Q){if(Y)for(p=N.call(a.ownerDocument);a.firstChild;)p.appendChild(a.firstChild);else p=a;return tt&&(p=D.call(r,p,!0)),p}var f=J?a.outerHTML:a.innerHTML;return K&&(f=xf(f,A," "),f=xf(f,I," ")),x&&et?x.createHTML(f):f},n.setConfig=function(t){xt(t),Z=!0},n.clearConfig=function(){wt=null,Z=!1},n.isValidAttribute=function(t,e,n){wt||xt({});var r=bt(t),o=bt(e);return Rt(r,o,n)},n.addHook=function(t,e){"function"==typeof e&&(O[t]=O[t]||[],bf(O[t],e))},n.removeHook=function(t){O[t]&&yf(O[t])},n.removeHooks=function(t){O[t]&&(O[t]=[])},n.removeAllHooks=function(){O={}},n}(),Qf=["iframe","embed"],Yf=[];function th(t){xa(Qf,t)&&Yf.push(t.toLowerCase())}function eh(t,e){return Xf.sanitize(t,Ni({ADD_TAGS:Yf,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},e))}function nh(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]*>)|(</"+e+"\\s*[>])","ig"),"").trim()}function rh(t){var e=(t=t.match(Ls)[0]).match(new RegExp(Ns,"g"));return e?e.reduce(function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t},{}):{}}function oh(t){return za(t.attributes).reduce(function(t,e){return t[e.nodeName]=e.nodeValue,t},{})}function ih(t,e,n,r){var o=r.getToDOMNode(e)(t),i=n(o.outerHTML),a=document.createElement("div");return a.innerHTML=i,{dom:o=a.firstChild,htmlAttrs:oh(o)}}var ah={htmlBlock:function(t,e,n){return{atom:!0,content:"block+",group:"block",attrs:{htmlAttrs:{default:{}},childrenHTML:{default:""},htmlBlock:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:oh(t),childrenHTML:t.innerHTML}}}],toDOM:function(r){var o=ih(r,t,e,n),i=o.dom,a=o.htmlAttrs;return a.class=a.class?a.class+" html-block":"html-block",Si([t,a],za(i.childNodes))}}},htmlInline:function(t,e,n){return{attrs:{htmlAttrs:{default:{}},htmlInline:{default:!0}},parseDOM:[{tag:t,getAttrs:function(t){return{htmlAttrs:oh(t)}}}],toDOM:function(r){var o=ih(r,t,e,n).htmlAttrs;return[t,o,0]}}}},sh=/^\s*<\s*\//,lh={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/<br ?\/?>/.test(t.prev.literal)?"\n":"<br>\n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.info,o=r?r.split(/\s+/):[],i=[],a={};if(n>3&&(a["data-backticks"]=n),o.length>0&&o[0].length>0){var s=o[0];i.push("lang-"+s),a["data-language"]=s}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:a},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;return-1!==i.indexOf("widget")&&r?(o(),[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:hs(i,gs(t)).outerHTML},{type:"closeTag",tagName:"span"}]):n()}};function ch(t,e){var n=Ni({},lh);return t&&(n.link=function(e,n){var r=n.entering,o=(0,n.origin)();return r&&(o.attributes=Ni(Ni({},o.attributes),t)),o}),e&&Object.keys(e).forEach(function(t){var r=n[t],o=e[t];r&&nl(o)?n[t]=function(t,e){var n=Ni({},e);return n.origin=function(){return r(t,e)},o(t,n)}:xa(["htmlBlock","htmlInline"],t)&&!nl(o)?n[t]=function(t,e){var n=t.literal.match(Ls);if(n){var r=n[0],i=n[1],a=n[3],s=(i||a).toLowerCase(),l=o[s],c=nh(t,s);if(l){var u=Ni({},t);return u.attrs=rh(r),u.childrenHTML=c,u.type=s,e.entering=!sh.test(t.literal),l(u,e)}}return e.origin()}:n[t]=o}),n}var uh=["list","item","blockQuote"],ph=["UL","OL","BLOCKQUOTE"];function dh(t,e){var n,r=t.child(e);return!r.childCount||1===r.childCount&&!(null===(n=r.firstChild.text)||void 0===n?void 0:n.trim())}function fh(t,e,n){var r=Ga(e)-1,o=Ka(e)-1,i=n[r].getBoundingClientRect(),a=n[o].offsetTop-n[r].offsetTop+n[o].clientHeight;return{height:a<=0?n[r].clientHeight:a+hh(t,n,Math.min(o+1,t.childCount-1)),rect:i}}function hh(t,e,n){for(var r=t.childCount-1,o=0;n<=r&&dh(t,n);)o+=e[n].clientHeight,n+=1;return o}function mh(t,e){for(var n=0;t&&t!==e&&(xa(ph,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function vh(t,e,n){return t&&e>n+t.offsetTop?vh(t.nextElementSibling,e,n)||t:null}function gh(t,e){for(var n=t.querySelector('[data-nodeid="'+e.id+'"]');!n||Xa(e);)e=e.parent,n=t.querySelector('[data-nodeid="'+e.id+'"]');return function(t){for(var e=t.mdNode,n=t.el;(xa(uh,e.type)||"table"===e.type)&&e.firstChild;)e=e.firstChild,n=n.firstElementChild;return{mdNode:e,el:n}}({mdNode:e,el:n})}var yh={};function bh(t){t&&(delete yh[Number(t.getAttribute("data-nodeid"))],za(t.children).forEach(function(t){bh(t)}))}var wh=Bs("md-preview-highlight"),kh=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=Bs("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,a=e.highlight,s=void 0!==a&&a;this.renderer=new rf({gfm:!0,nodeId:!0,convertors:ch(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(s),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return t.prototype.initContentSection=function(){this.previewContent=_s('<div class="'+Bs("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){zs(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(t&&(this.eventEmitter.listen("changeToolbarState",function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)}),this.eventEmitter.listen("blur",function(){e.removeHighlight()})),Qc(this.el,"scroll",function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=vh(o,t,mh(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return e.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return e.toggleActive(!1)}))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&ia(t,wh)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=ns(t,function(t){return!function(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(t)})).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(Ja(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&ia(r,wh),o&&ta(o,wh),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach(function(t){return e.replaceRangeNodes(t)}),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map(function(t){return e.renderer.render(t)}).join("")));if(r){var a=r.id,s=a[0],l=a[1],c=this.getElementByNodeId(s),u=this.getElementByNodeId(l);if(c){c.insertAdjacentHTML("beforebegin",i);for(var p=c;p&&p!==u;){var d=p.nextElementSibling;qs(p),bh(p),p=d}(null==p?void 0:p.parentNode)&&(qs(p),bh(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){Gc(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){_i(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){_i(this.el,{minHeight:t+"px"})},t}();function xh(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r,n))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}function Ch(t){return!!xh(t,function(t){var e=t.type;return"listItem"===e.name||"bulletList"===e.name||"orderedList"===e.name})}function Th(t){return!!xh(t,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})}function Eh(t){return xh(t,function(t){return"listItem"===t.type.name})}function Mh(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}}function Nh(t){return Object.keys(t).reduce(function(e,n){return"rawHTML"!==n&&t[n]&&(e[n="className"===n?"class":n]=t[n]),e},{})}function Sh(t){return{tag:t,getAttrs:function(t){return["rawHTML","colspan","rowspan","extended"].reduce(function(e,n){var r="rawHTML"===n?"data-raw-html":n,o=t.getAttribute(r);return o&&(e[n]=xa(["rawHTML","extended"],n)?o:Number(o)),e},{})}}}function Dh(t){var e=t.htmlAttrs,n=t.classNames;return Ni(Ni({},e),{class:n?n.join(" "):null})}function Lh(t,e,n,r){var o=e.$from,i=e.$to,a=e.depth,s=e,c=!1;if(a>=2&&o.node(a-1).type.compatibleContent(n)&&0===e.startIndex&&o.index(a-1)){var u=t.doc.resolve(e.start-2);s=new I(u,u,a),e.endIndex<e.parent.childCount&&(e=new I(o,t.doc.resolve(i.end(a)),a)),c=!0}var p=function(t,e,n,r){var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(i){var a=i.length?i[0]:e;return n.canReplaceWith(r,o,a)?i:null}return null}(t,n),i=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),a=e.contentMatch.findWrapping(i.type);if(a){for(var s=(a.length?a[a.length-1]:e).contentMatch,l=r;s&&l<o;l+=1)s=s.matchType(n.child(l).type);if(s&&s.validEnd)return a}return null}(e,n);if(o&&i){var a=o.map(function(t){return{type:t}}),s=i.map(function(t){return{type:t,attrs:r}});return a.concat({type:n}).concat(s)}return null}(s,e,n,r);return p?function(t,e,n,r,o){for(var i=e.start,a=e.end,s=e.startIndex,c=e.endIndex,u=e.parent,p=l.empty,d=n.length-1;d>=0;d-=1)p=l.from(n[d].type.create(n[d].attrs,p));t.step(new Bt(i-(r?2:0),a,i,a,new m(p,0,0),n.length,!0));var f=0;for(d=0;d<n.length;d+=1)if(n[d].type===o){f=d+1;break}for(var h=n.length-f,v=i+n.length-(r?2:0),g=(d=s,c);d<g;d+=1)!(d===s)&&jt(t.doc,v,h)&&(t.split(v,h),v+=2*h),v+=u.child(d).nodeSize;return t}(t,e,p,c,n):t}function Oh(t,e){for(var n=t.resolve(e);"paragraph"!==n.node().type.name;)e-=2,n=t.resolve(e);return Eh(n)}function Ah(t){return function(e,n){var r=e.selection,o=e.tr,i=r.$from,a=r.$to,s=i.blockRange(a);if(s){var l=Ch(i)?function(t,e,n){var r=e.$from,o=e.$to,i=Eh(r),a=Eh(o);if(i&&a)for(;a;){var s=a.offset,l=a.node,c=a.depth;l.attrs.task&&t.setNodeMarkup(s,null,{task:!1,checked:!1});var u=t.doc.resolve(s);if(u.parent.type!==n){var p=u.before(c-1);t.setNodeMarkup(p,n)}if(s===i.offset)break;a=Oh(t.doc,s)}return t}(o,s,t):Lh(o,s,t);return n(l),!0}return!1}}function Ih(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,a=n.$to,s=i.blockRange(a);if(s){var l=Ch(i)?function(t,e){var n=e.$from,r=e.$to,o=Eh(n),i=Eh(r);if(o&&i)for(;i;){var a=i.offset,s={task:!i.node.attrs.task,checked:!1};if(t.setNodeMarkup(a,null,s),a===o.offset)break;i=Oh(t.doc,a)}return t}(r,s):Lh(r,s,o.nodes.bulletList,{task:!0});return e(l),!0}return!1}}function Rh(){return{indent:function(){return function(t,e){var n,r=t.selection,o=t.schema,i=r.$from,a=r.$to;return!(!i.blockRange(a)||!Ch(i))&&(n=o.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to,s=i.blockRange(a,function(t){var e=t.childCount,r=t.firstChild;return!!e&&r.type===n});if(s&&s.startIndex>0){var c=s.parent,u=c.child(s.startIndex-1);if(u.type!==n)return!1;var p=u.lastChild&&u.lastChild.type===c.type,d=p?l.from(n.create()):null,f=new m(l.from(n.create(null,l.from(c.type.create(null,d)))),p?3:1,0),h=s.start,v=s.end;return r.step(new Bt(h-(p?3:1),v,h,v,f,1,!0)),e(r),!0}return!1})(t,e)}},outdent:function(){return function(t,e){var n,r=t.selection,o=t.schema,i=r.$from,a=r.$to;return!(!i.blockRange(a)||!Ch(i))&&(n=o.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to,s=i.blockRange(a,function(t){var e=t.childCount,r=t.firstChild;return!!e&&r.type===n});if(s){var c=i.node(s.depth-1).type===n?function(t,e,n){var r=e.$from,o=e.$to,i=e.end,a=e.depth,s=e.parent,c=o.end(a);return i<c&&(t.step(new Bt(i-1,c,i,c,new m(l.from(n.create(null,s.copy())),1,0),1,!0)),e=new I(t.doc.resolve(r.pos),t.doc.resolve(c),a)),t.lift(e,qt(e)),t}(r,s,n):function(t,e){for(var n=e.parent,r=e.end,o=e.endIndex-1,i=e.startIndex;o>i;o-=1)r-=n.child(o).nodeSize,t.delete(r-1,r+1);var a=t.doc.resolve(e.start),s=a.nodeAfter,c=0===e.startIndex,u=e.endIndex===n.childCount,p=a.node(-1),d=a.index(-1),f=p.canReplace(d+(c?0:1),d+1,null==s?void 0:s.content.append(u?l.empty:l.from(n)));if(s&&f){var h=a.pos,v=h+s.nodeSize;t.step(new Bt(h-(c?1:0),v+(u?1:0),h+1,v-1,new m((c?l.empty:l.from(n.copy(l.empty))).append(u?l.empty:l.from(n.copy(l.empty))),c?0:1,u?0:1),c?0:1))}return t}(r,s);return e(c),!0}return!1})(t,e)}}}}var Ph=/* @__PURE__ */new Map,Bh=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=xh(e,function(t){return"table"===t.type.name});if(n){var r=n.node,o=n.depth,i=n.offset,a=Ph.get(r);if((null==a?void 0:a.tableStartPos)===i+1)return a;var s=[],l=e.start(o),c=r.child(0),u=r.child(1),p=Fh(c,l),d=Fh(u,l+c.nodeSize);c.forEach(function(t){return s.push(t)}),u.forEach(function(t){return s.push(t)});var f=new t(r,s,l,p.concat(d));return Ph.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},t.prototype.getNodeAndPos=function(t,e){var n=this.rowInfo[t][e];return{node:this.table.nodeAt(n.offset-this.tableStartOffset),pos:n.offset}},t.prototype.extendedRowspan=function(t,e){return!1},t.prototype.extendedColspan=function(t,e){return!1},t.prototype.getRowspanCount=function(t,e){return 0},t.prototype.getColspanCount=function(t,e){return 0},t.prototype.decreaseColspanCount=function(t,e){return 0},t.prototype.decreaseRowspanCount=function(t,e){return 0},t.prototype.getColspanStartInfo=function(t,e){return null},t.prototype.getRowspanStartInfo=function(t,e){return null},t.prototype.getCellStartOffset=function(t,e){var n=this.rowInfo[t][e].offset;return this.extendedRowspan(t,e)?this.posAt(t,e):n},t.prototype.getCellEndOffset=function(t,e){var n=this.rowInfo[t][e],r=n.offset,o=n.nodeSize;return this.extendedRowspan(t,e)?this.posAt(t,e):r+o},t.prototype.getCellIndex=function(t){for(var e=0;e<this.totalRowCount;e+=1)for(var n=this.rowInfo[e],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>t.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),a=i[0],s=i[1],l=this.getCellIndex(e),c=l[0],u=l[1];return a=(r=Ha(a,c))[0],c=r[1],s=(o=Ha(s,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:a,startColIdx:s,endRowIdx:c,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),Fh=function(t,e){var n=[];return t.forEach(function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach(function(t,n){for(var i=t.nodeSize,a=0;o[a];)a+=1;o[a]={offset:e+r+n+2,nodeSize:i},o.length+=1}),n.push(o)}),n};function Hh(t,e){return Fa(Bh.prototype,t),Fh=e,Bh}var qh=function(t){function e(e,n){void 0===n&&(n=e);var r=this,o=e.node(0),i=Bh.create(e),a=i.getRectOffsets(e,n),s=function(t,e,n){for(var r=n.startRowIdx,o=n.startColIdx,i=n.endRowIdx,a=n.endColIdx,s=[],l=r;l<=i;l+=1)for(var c=o;c<=a;c+=1){var u=e.getCellInfo(l,c),p=u.offset,d=u.nodeSize;s.push(new ae(t.resolve(p+1),t.resolve(p+d-1)))}return s}(o,i,a);return(r=t.call(this,s[0].$from,s[0].$to,s)||this).startCell=e,r.endCell=n,r.offsetMap=i,r.isCellSelection=!0,r.visible=!1,r}return Mi(e,t),e.prototype.map=function(t,n){var r=this.startCell.pos,o=this.endCell.pos,i=t.resolve(n.map(r)),a=t.resolve(n.map(o)),s=Bh.create(i);if(this.offsetMap.totalColumnCount>s.totalColumnCount||this.offsetMap.totalRowCount>s.totalRowCount){var l={tableBody:1,tableRow:2,tableCell:3,paragraph:4}[a.parent.type.name],c=a.end(a.depth-l),u=Math.min(c-4,a.pos);return se.create(t,u)}return new e(i,a)},e.prototype.eq=function(t){return t instanceof e&&t.startCell.pos===this.startCell.pos&&t.endCell.pos===this.endCell.pos},e.prototype.content=function(){for(var t=this.startCell.node(-2),e=this.startCell.start(-2),n=t.child(1).firstChild,r=t.child(0).type.create(),o=t.child(1).type.create(),i=Bh.create(this.startCell),a=i.getRectOffsets(this.startCell,this.endCell),s=a.startRowIdx,c=a.startColIdx,u=a.endRowIdx,p=a.endColIdx,d=!1,f=s;f<=u;f+=1){for(var h=[],v=c;v<=p;v+=1){var g=i.getCellInfo(f,v).offset,y=t.nodeAt(g-e);y&&(d="tableHeadCell"===y.type.name,i.extendedRowspan(f,v)||i.extendedColspan(f,v)?h.push(y.type.create({extended:!0})):h.push(y.copy(y.content)))}var b=n.copy(l.from(h)),w=d?r:o;w.content=w.content.append(l.from(b))}return new m(function(t,e){var n=[];return t.childCount&&n.push(t),e.childCount&&n.push(e),l.from(n)}(r,o),1,1)},e}(oe);function zh(t,e,n,r){for(var o=n.nodes,i=o.tableRow,a=o.tableBodyCell,s=o.paragraph,l=[],c=0;c<t;c+=1){for(var u=[],p=0;p<e;p+=1){var d=r&&r[c*e+p],f=s.create(null,d?n.text(d):[]);u.push(a.create(null,f))}l.push(i.create(null,u))}return l}function _h(t,e,n,r){void 0===r&&(r=null);for(var o=n.nodes,i=o.tableHeadCell,a=o.tableBodyCell,s=o.paragraph,l=0===e?i:a,c=[],u=0;u<t;u+=1)c.push(l.create(r,s.create()));return c}function jh(t,e){for(;t&&t!==e;){if("TD"===t.nodeName||"TH"===t.nodeName)return t;t=t.parentNode}return null}function Vh(t){return xh(t,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})}function Uh(t){if(t instanceof se){var e=t.$anchor,n=Vh(e);if(n){var r=e.node(0).resolve(e.before(n.depth));return{anchor:r,head:r}}}var o=t;return{anchor:o.startCell,head:o.endCell}}function $h(t){var e;if(t.size){var n=t.content,r=t.openStart,o=t.openEnd;if(1!==n.childCount)return null;for(;1===n.childCount&&(r>0&&o>0||"table"===(null===(e=n.firstChild)||void 0===e?void 0:e.type.name));)r-=1,o-=1,n=n.firstChild.content;if("tableHead"===n.firstChild.type.name||"tableBody"===n.firstChild.type.name)return n}return null}function Wh(t){var e=t.startRowIdx,n=t.startColIdx;return{rowCount:t.endRowIdx-e+1,columnCount:t.endColIdx-n+1}}function Gh(t,e){return Ni(Ni({},t.attrs),e)}var Kh=new Ne("cellSelection"),Jh=function(){function t(t){this.view=t,this.handlers={mousedown:this.handleMousedown.bind(this),mousemove:this.handleMousemove.bind(this),mouseup:this.handleMouseup.bind(this)},this.startCellPos=null,this.init()}return t.prototype.init=function(){this.view.dom.addEventListener("mousedown",this.handlers.mousedown)},t.prototype.handleMousedown=function(t){var e=jh(t.target,this.view.dom);if(2!==t.button){if(e){var n=this.getCellPos(t);n&&(this.startCellPos=n),this.bindEvent()}}else t.preventDefault()},t.prototype.handleMousemove=function(t){var e,n=Kh.getState(this.view.state),r=this.getCellPos(t),o=this.startCellPos;n?e=this.view.state.doc.resolve(n):o!==r&&(e=o),e&&o&&r&&this.setCellSelection(o,r)},t.prototype.handleMouseup=function(){this.startCellPos=null,this.unbindEvent(),null!==Kh.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(Kh,-1))},t.prototype.bindEvent=function(){var t=this.view.dom;t.addEventListener("mousemove",this.handlers.mousemove),t.addEventListener("mouseup",this.handlers.mouseup)},t.prototype.unbindEvent=function(){var t=this.view.dom;t.removeEventListener("mousemove",this.handlers.mousemove),t.removeEventListener("mouseup",this.handlers.mouseup)},t.prototype.getCellPos=function(t){var e=t.clientX,n=t.clientY,r=this.view.posAtCoords({left:e,top:n});if(r){var o=this.view.state.doc,i=o.resolve(r.pos),a=Vh(i);if(a){var s=i.before(a.depth);return o.resolve(s)}}return null},t.prototype.setCellSelection=function(t,e){var n=this.view.state,r=n.selection,o=n.tr,i=null===Kh.getState(this.view.state),a=new qh(t,e);if(i||!r.eq(a)){var s=o.setSelection(a);i&&s.setMeta(Kh,e.pos),this.view.dispatch(s)}},t.prototype.destroy=function(){this.view.dom.removeEventListener("mousedown",this.handlers.mousedown)},t}(),Zh=Bs("cell-selected");function Xh(t){var e=t.selection,n=t.doc;if(e instanceof qh){var r=[];return e.ranges.forEach(function(t){var e=t.$from,n=t.$to;r.push(Zr.node(e.pos-1,n.pos+1,{class:Zh}))}),to.create(n,r)}return null}var Qh=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return Vi(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach(function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)})},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),Yh="en-US",tm=function(){function t(){this.code=Yh,this.langs=new Qh}return t.prototype.setCode=function(t){this.code=t||Yh},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach(function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,Oi(r,e))}else n.langs.set(t,e)})},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(Yh));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}(),em=new tm,nm=[[{action:"Add row to up",command:"addRowToUp",disableInThead:!0,className:"add-row-up"},{action:"Add row to down",command:"addRowToDown",disableInThead:!0,className:"add-row-down"},{action:"Remove row",command:"removeRow",disableInThead:!0,className:"remove-row"}],[{action:"Add column to left",command:"addColumnToLeft",className:"add-column-left"},{action:"Add column to right",command:"addColumnToRight",className:"add-column-right"},{action:"Remove column",command:"removeColumn",className:"remove-column"}],[{action:"Align column to left",command:"alignColumn",payload:{align:"left"},className:"align-column-left"},{action:"Align column to center",command:"alignColumn",payload:{align:"center"},className:"align-column-center"},{action:"Align column to right",command:"alignColumn",payload:{align:"right"},className:"align-column-right"}],[{action:"Remove table",command:"removeTable",className:"remove-table"}]];function rm(t,e){return nm.map(function(n){return n.map(function(n){var r=n.action,o=n.command,i=n.payload,a=n.disableInThead,s=n.className;return{label:em.get(r),onClick:function(){t.emit("command",o,i)},disabled:e&&!!a,className:s}})}).concat()}var om=["image","link","customBlock","frontMatter"],im=["strong","strike","emph","code"],am=["bulletList","orderedList","taskList"];function sm(t,e,n){var r=t.$from,o=t.$to,i=t.from,a=t.to,s={indent:{active:!1,disabled:!0},outdent:{active:!1,disabled:!0}};return e.nodesBetween(i,a,function(t,e,i){var a=function(t,e){var n=t.type.name;return"listItem"===n?t.attrs.task?"taskList":e.type.name:-1!==n.indexOf("table")?"table":n}(t,i);xa(om,a)||(xa(am,a)?(function(t,e){e[t]={active:!0},am.filter(function(e){return e!==t}).forEach(function(t){e[t]&&delete e[t]})}(a,s),s.indent.disabled=!1,s.outdent.disabled=!1):"paragraph"===a||"text"===a?function(t,e,n,r){im.forEach(function(o){var i=n.marks[o],a=t.marksAcross(e)||[];i.isInSet(a)&&(r[o]={active:!0})})}(r,o,n,s):s[a]={active:!0})}),s}function lm(t){return new Te({view:function(){return{update:function(e){var n=e.state,r=n.selection,o=n.doc,i=n.schema;t.emit("changeToolbarState",{toolbarState:sm(r,o,i)})}}}})}var cm=function(){function t(t,e,n,r){var o=this;this.openEditor=function(){if(o.innerEditorView)throw new Error("The editor is already opened.");o.dom.draggable=!1,o.wrapper.style.display="none",o.innerViewContainer.style.display="block",o.innerEditorView=new po(o.innerViewContainer,{state:we.create({doc:o.node,plugins:[So({"Mod-z":function(){return Ci(o.innerEditorView.state,o.innerEditorView.dispatch)},"Shift-Mod-z":function(){return Ti(o.innerEditorView.state,o.innerEditorView.dispatch)},Tab:function(t,e){return e(t.tr.insertText("\t")),!0},Enter:Po,Escape:function(){return o.cancelEditing(),!0},"Ctrl-Enter":function(){return o.saveAndFinishEditing(),!0}}),xi()]}),dispatchTransaction:function(t){return o.dispatchInner(t)},handleDOMEvents:{mousedown:function(){return o.editorView.hasFocus()&&o.innerEditorView.focus(),!0},blur:function(){return o.saveAndFinishEditing(),!0}}}),o.innerEditorView.focus()},this.node=t,this.editorView=e,this.getPos=n,this.toDOMAdaptor=r,this.innerEditorView=null,this.canceled=!1,this.dom=document.createElement("div"),this.dom.className=Bs("custom-block"),this.wrapper=document.createElement("div"),this.wrapper.className=Bs("custom-block-view"),this.createInnerViewContainer(),this.renderCustomBlock(),this.dom.appendChild(this.innerViewContainer),this.dom.appendChild(this.wrapper)}return t.prototype.renderToolArea=function(){var t=this,e=document.createElement("div"),n=document.createElement("span"),r=document.createElement("button");e.className="tool",n.textContent=this.node.attrs.info,n.className="info",r.type="button",r.addEventListener("click",function(){return t.openEditor()}),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e)},t.prototype.renderCustomBlock=function(){var t=this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);if(t){for(var e=t(this.node);this.wrapper.hasChildNodes();)this.wrapper.removeChild(this.wrapper.lastChild);e&&this.wrapper.appendChild(e),this.renderToolArea()}},t.prototype.createInnerViewContainer=function(){this.innerViewContainer=document.createElement("div"),this.innerViewContainer.className=Bs("custom-block-editor"),this.innerViewContainer.style.display="none"},t.prototype.closeEditor=function(){this.innerEditorView&&(this.innerEditorView.destroy(),this.innerEditorView=null,this.innerViewContainer.style.display="none"),this.wrapper.style.display="block"},t.prototype.saveAndFinishEditing=function(){var t=this.editorView.state.selection.to,e=this.editorView.state;this.editorView.dispatch(e.tr.setSelection(Va(e.tr,t))),this.editorView.focus(),this.renderCustomBlock(),this.closeEditor()},t.prototype.cancelEditing=function(){var t=function(t){var e=wi.getState(t);return e?e.done.eventCount:0}(this.innerEditorView.state);for(this.canceled=!0;t--;)Ci(this.innerEditorView.state,this.innerEditorView.dispatch),Ci(this.editorView.state,this.editorView.dispatch);this.canceled=!1;var e=this.editorView.state.selection.to,n=this.editorView.state;this.editorView.dispatch(n.tr.setSelection(se.create(n.doc,e))),this.editorView.focus(),this.closeEditor()},t.prototype.dispatchInner=function(t){var e=this.innerEditorView.state.applyTransaction(t),n=e.state,r=e.transactions;if(this.innerEditorView.updateState(n),!this.canceled&&nl(this.getPos)){for(var o=this.editorView.state.tr,i=Mt.offset(this.getPos()+1),a=0;a<r.length;a+=1)for(var s=r[a].steps,l=0;l<s.length;l+=1)o.step(s[l].map(i));o.docChanged&&this.editorView.dispatch(o)}},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,this.innerEditorView||this.renderCustomBlock(),!0)},t.prototype.stopEvent=function(t){return!!this.innerEditorView&&!!t.target&&this.innerEditorView.dom.contains(t.target)},t.prototype.ignoreMutation=function(){return!0},t.prototype.destroy=function(){this.dom.removeEventListener("dblclick",this.openEditor),this.closeEditor()},t}(),um="image-link",pm=function(){function t(t,e,n,r){var o,i=this;this.handleMousedown=function(t){t.preventDefault();var e=t.target,n=t.offsetX,r=t.offsetY;if(i.imageLink&&nl(i.getPos)&&ks(e,um)){var o=getComputedStyle(e,":before");if(t.stopPropagation(),Rs(o,n,r)){var a=i.view.state.tr,s=i.getPos();a.setSelection(Va(a,s,s+1)),i.view.dispatch(a),i.eventEmitter.emit("openPopup","link",i.imageLink.attrs)}}},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.imageLink=null!==(o=t.marks.filter(function(t){return"link"===t.type.name})[0])&&void 0!==o?o:null,this.dom=this.createElement(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.createImageElement(this.node);if(this.imageLink){var e=document.createElement("span");return e.className=um,e.appendChild(t),e}return t},t.prototype.createImageElement=function(t){var e=document.createElement("img"),n=t.attrs,r=n.imageUrl,o=n.altText,i=Dh(t.attrs);return e.src=r,o&&(e.alt=o),$s(i,e),e},t.prototype.bindEvent=function(){this.imageLink&&this.dom.addEventListener("mousedown",this.handleMousedown)},t.prototype.stopEvent=function(){return!0},t.prototype.destroy=function(){this.imageLink&&this.dom.removeEventListener("mousedown",this.handleMousedown)},t}(),dm=function(){function t(t,e,n,r){var o=this;this.dom=null,this.contentDOM=null,this.input=null,this.timer=null,this.handleMousedown=function(t){var e=t.target;if("none"!==getComputedStyle(e,":after").backgroundImage&&nl(o.getPos)){var n=o.view.coordsAtPos(o.getPos()),r=n.top,i=n.right;o.createLanguageEditor({top:r,right:i})}},this.handleKeydown=function(t){"Enter"===t.key&&o.input&&(t.preventDefault(),o.changeLanguage())},this.node=t,this.view=e,this.getPos=n,this.eventEmitter=r,this.createElement(),this.bindDOMEvent(),this.bindEvent()}return t.prototype.createElement=function(){var t=this.node.attrs.language,e=document.createElement("div");e.setAttribute("data-language",t||"text"),e.className="toastui-editor-ww-code-block";var n=this.createCodeBlockElement(),r=n.firstChild;e.appendChild(n),this.dom=e,this.contentDOM=r},t.prototype.createCodeBlockElement=function(){var t=document.createElement("pre"),e=document.createElement("code"),n=this.node.attrs.language,r=Dh(this.node.attrs);return n&&e.setAttribute("data-language",n),$s(r,t),t.appendChild(e),t},t.prototype.createLanguageEditor=function(t){var e=this,n=t.top,r=t.right,o=document.createElement("span");o.className="toastui-editor-ww-code-block-language";var i=document.createElement("input");i.type="text",i.value=this.node.attrs.language,o.appendChild(i),this.view.dom.parentElement.appendChild(o);var a=o.clientWidth;_i(o,{top:n+10+"px",left:r-a-10+"px",width:a+"px"}),this.input=i,this.input.addEventListener("blur",function(){return e.changeLanguage()}),this.input.addEventListener("keydown",this.handleKeydown),this.clearTimer(),this.timer=setTimeout(function(){e.input.focus()})},t.prototype.bindDOMEvent=function(){this.dom&&this.dom.addEventListener("click",this.handleMousedown)},t.prototype.bindEvent=function(){var t=this;this.eventEmitter.listen("scroll",function(){t.input&&t.reset()})},t.prototype.changeLanguage=function(){if(this.input&&nl(this.getPos)){var t=this.input.value;this.reset();var e=this.getPos(),n=this.view.state.tr;n.setNodeMarkup(e,null,{language:t}),this.view.dispatch(n)}},t.prototype.reset=function(){var t;if(null===(t=this.input)||void 0===t?void 0:t.parentElement){var e=this.input.parentElement;this.input=null,qs(e)}},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.stopEvent=function(){return!0},t.prototype.update=function(t){return!!t.sameMarkup(this.node)&&(this.node=t,!0)},t.prototype.destroy=function(){this.reset(),this.clearTimer(),this.dom&&this.dom.removeEventListener("click",this.handleMousedown)},t}(),fm=/MsoListParagraph/,hm=/style=(.|\n)*mso-/,mm=/mso-list:(.*)/,vm=/O:P/,gm=/^(n|u|l)/;function ym(t){for(var e=[],n=document.createTreeWalker(t,1,null,!1);n.nextNode();){var r=n.currentNode;if(Hs(r)){var o=r,i=o.outerHTML,a=o.textContent,s=hm.test(i),l=mm.test(i);s&&!l&&a?e.push([r,!0]):(vm.test(r.nodeName)||s&&!a||l)&&e.push([r,!1])}}return e.forEach(function(t){var e=t[0];t[1]?function(t){for(var e=[];t.firstChild;)e.push(t.firstChild),t.parentNode&&t.parentNode.insertBefore(t.firstChild,t);qs(t)}(e):qs(e)}),t.innerHTML.trim()}function bm(t){var e=t[0].unordered?"ul":"ol",n=document.createElement(e);return t.forEach(function(t){var e=t.children,r=t.contents,o=document.createElement("li");o.innerHTML=r,n.appendChild(o),e.length&&n.appendChild(bm(e))}),n}function wm(t){return bm(function(t){var e=[];return t.forEach(function(t,n){var r=e[n-1],o=function(t,e){var n=t.getAttribute("style");if(n){var r=n.match(mm)[1].trim().split(" ")[1];return{id:e,level:parseInt(r.replace("level",""),10),prev:null,parent:null,children:[],unordered:gm.test(t.textContent||""),contents:ym(t)}}return null}(t,n);o&&(r&&function(t,e){if(e.level<t.level)e.children.push(t),t.parent=e;else{for(;e&&e.level!==t.level;)e=e.parent;e&&(t.prev=e,t.parent=e.parent,t.parent&&t.parent.children.push(t))}}(o,r),e.push(o))}),e}(t).filter(function(t){return!t.parent}))}function km(t){return function(t){return hm.test(t)}(t=function(t){return/<\/td>((?!<\/tr>)[\s\S])*$/i.test(t)&&(t="<tr>"+t+"</tr>"),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(t)&&(t="<table>"+t+"</table>"),t}(t=function(t){var e=t.indexOf("\x3c!--StartFragment--\x3e"),n=t.lastIndexOf("\x3c!--EndFragment--\x3e");return e>-1&&n>-1&&(t=t.slice(e+20,n)),t.replace(/<br[^>]*>/g,Is)}(t)))&&(t=function(t){var e=document.createElement("div");e.innerHTML=t;var n=[],r=function(t){var e=za(t.querySelectorAll("p.MsoListParagraph"));return e.length?e:[]}(e);return r.forEach(function(t){var r,o,i=function(t){for(;t&&!Hs(t);)t=t.nextSibling;return!t||!fm.test(t.className)}(t.nextSibling);if(n.push(t),i){var a=wm(n),s=t.nextSibling;s?(r=a,(o=s).parentNode&&o.parentNode.insertBefore(r,o)):function(t,e){(e=Ii(e)?za(e):[e]).forEach(function(e){t.appendChild(e)})}(e,a),n=[]}qs(t)}),(r.length?"<p></p>":"")+e.innerHTML}(t)),t}function xm(t,e,n){for(var r=[],o=t.childCount,i=0;i<o;i+=1)if(!t.child(i).attrs.extended){var a=i<o?n.create(t.child(i).attrs,t.child(i).content):n.createAndFill();r.push(a)}return r}function Cm(t,e,n){var r=n.nodes,o=r.tableRow,i=xm(t,0,r.tableHeadCell);return o.create(null,i)}function Tm(t,e,n){var r=n.nodes,o=r.tableRow,i=xm(t,0,r.tableBodyCell);return o.create(null,i)}function Em(t){var e=[],n=[];return"tableHead"===t.firstChild.type.name&&t.firstChild.forEach(function(t){return e.push(t)}),"tableBody"===t.lastChild.type.name&&t.lastChild.forEach(function(t){return n.push(t)}),Si(Si([],e),n)}function Mm(t,e,n){var r=Cm(t,0,n);return n.nodes.tableHead.create(null,r)}function Nm(t,e,n){var r=t.map(function(t){return Tm(t,0,n)});if(!t.length){var o=function(t,e){for(var n=e.nodes,r=n.tableRow,o=n.tableBodyCell,i=[],a=0;a<t;a+=1){var s=o.createAndFill();i.push(s)}return r.create({dummyRowForPasting:!0},i)}(e,n);r.push(o)}return n.nodes.tableBody.create(null,r)}function Sm(t){return 4*t}var Dm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"doc"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"block+"}},enumerable:!1,configurable:!0}),e}(Xs),Lm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"paragraph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"inline*",group:"block",attrs:Ni({},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"p"}],toDOM:function(t){return["p",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Om=/\s{1,4}$/,Am=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"text"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{group:"inline"}},enumerable:!1,configurable:!0}),e.prototype.addSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to;return!(!o.blockRange(i)||Ch(o)||Th(o)||(e(r.insertText(" ",o.pos,i.pos)),0))}},e.prototype.removeSpaces=function(){return function(t,e){var n=t.selection,r=t.tr,o=n.$from,i=n.$to,a=n.from;if(o.blockRange(i)&&!Ch(o)&&!Th(o)){var s=o.nodeBefore;if(s&&s.isText){var l=s.text,c=l.replace(Om,""),u=l.length-c.length;return e(r.delete(a-u,a)),!0}}return!1}},e.prototype.keymaps=function(){return{Tab:this.addSpaces(),"Shift-Tab":this.removeSpaces()}},e}(Xs),Im=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"heading"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return[1,2,3,4,5,6]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=this.levels.map(function(t){return{tag:"h"+t,getAttrs:function(e){var n=e.getAttribute("data-raw-html");return Ni({level:t},n&&{rawHTML:n})}}});return{attrs:Ni({level:{default:1},headingType:{default:"atx"},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"inline*",group:"block",defining:!0,parseDOM:t,toDOM:function(t){var e=t.attrs;return["h"+e.level,Dh(e),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){return zo(e.schema.nodes[t.level?"heading":"paragraph"],t)(e,n)}}},e}(Xs),Rm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"codeBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:Ni({language:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),code:!0,defining:!0,marks:"",parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:function(t){var e=t.getAttribute("data-raw-html"),n=t.firstElementChild;return Ni({language:(null==n?void 0:n.getAttribute("data-language"))||null},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"pre",["code",Ni({"data-language":e.language},Dh(e)),0]]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return zo(t.schema.nodes.codeBlock)(t,e)}}},e.prototype.moveCursor=function(t){var e=this;return function(n,r){var o,i=n.tr,a=n.doc,s=n.schema,l=n.selection.$from;if(e.context.view.endOfTextblock(t)&&"codeBlock"===l.node().type.name){var c=l.parent.textContent.split("\n"),u="up"===t?l.start():l.end(),p="up"===t?[u,c[0].length+u]:[u-Aa(c).length,u],d=a.resolve("up"===t?l.before():l.after()),f="up"===t?d.nodeBefore:d.nodeAfter;if((o=l.pos)>=p[0]&&o<=p[1]&&!f){var h=Ua(i,d,s);if(h)return r(h),!0}}return!1}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-p":t,"Shift-Mod-P":t,ArrowUp:this.moveCursor("up"),ArrowDown:this.moveCursor("down")}},e}(Xs),Pm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"bulletList"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("ul")],toDOM:function(t){return["ul",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.changeList=function(){return function(t,e){return Ah(t.schema.nodes.bulletList)(t,e)}},e.prototype.commands=function(){return{bulletList:this.changeList,taskList:Ih}},e.prototype.keymaps=function(){var t=this.changeList(),e=Rh(),n=e.indent,r=e.outdent;return{"Mod-u":t,"Mod-U":t,Tab:n(),"Shift-Tab":r()}},e}(Xs),Bm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"orderedList"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"listItem+",group:"block",attrs:Ni({order:{default:1},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"ol",getAttrs:function(t){var e=t.getAttribute("start"),n=t.getAttribute("data-raw-html");return Ni({order:t.hasAttribute("start")?Number(e):1},n&&{rawHTML:n})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"ol",Ni({start:1===e.order?null:e.order},Dh(e)),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return Ah(t.schema.nodes.orderedList)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()(),e=Rh(),n=e.indent,r=e.outdent;return{"Mod-o":t,"Mod-O":t,Tab:n(),"Shift-Tab":r()}},e}(Xs),Fm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"listItem"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"paragraph block*",selectable:!1,attrs:{task:{default:!1},checked:{default:!1},rawHTML:{default:null}},defining:!0,parseDOM:[{tag:"li",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({task:t.hasAttribute("data-task"),checked:t.hasAttribute("data-task-checked")},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs,n=e.task,r=e.checked;if(!n)return[e.rawHTML||"li",0];var o=["task-list-item"];return r&&o.push("checked"),[e.rawHTML||"li",Ni({class:o.join(" "),"data-task":n},r&&{"data-task-checked":r}),0]}}},enumerable:!1,configurable:!0}),e.prototype.liftToPrevListItem=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from,a=n.empty,s=o.nodes.listItem,l=i.parent,c=i.node(-1);if(a&&!l.childCount&&c.type===s){if(i.index(-2)>=1)return r.delete(i.start(-1)-1,i.end(-1)),e(r),!0;if(i.node(-3).type===s)return r.delete(i.start(-2)-1,i.end(-1)),e(r),!0}return!1}},e.prototype.keymaps=function(){return{Backspace:this.liftToPrevListItem(),Enter:function(t,e){return(n=t.schema.nodes.listItem,function(t,e){var r=t.tr,o=t.selection,i=o.$from,a=o.$to;if(i.depth<2||!i.sameParent(a))return!1;var s=i.node(-1);if(s.type!==n)return!1;if(0===i.parent.content.size&&i.node(-1).childCount===i.indexAfter(-1)){if(2===i.depth||i.node(-3).type!==n||i.index(-2)!==i.node(-2).childCount-1)return!1;for(var c=i.index(-1)>0,u=l.empty,p=i.depth-(c?1:2);p>=i.depth-3;p-=1)u=l.from(i.node(p).copy(u));return u=u.append(l.from(n.createAndFill())),r.replace(c?i.before():i.before(-1),i.after(-3),new m(u,c?3:2,2)),r.setSelection(oe.near(r.doc.resolve(i.pos+(c?3:2)))),e(r),!0}var d=a.pos===i.end()?s.contentMatchAt(0).defaultType:null,f=d&&[null,{type:d}];return r.delete(i.pos,a.pos),!!jt(r.doc,i.pos,2,f)&&(r.split(i.pos,2,f),e(r),!0)})(t,e);var n}}},e}(Xs),Hm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"blockQuote"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),content:"block+",group:"block",parseDOM:[Mh("blockquote")],toDOM:function(t){return["blockquote",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return(n=t.schema.nodes.blockQuote,function(t,e){var r=t.selection,o=r.$from,i=r.$to,a=o.blockRange(i),s=a&&zt(a,n,undefined);return!!s&&(e&&e(t.tr.wrap(a,s).scrollIntoView()),!0)})(t,e);var n}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Alt-q":t,"Alt-Q":t}},e}(Xs),qm={left:function(t,e){var n=t[0],r=t[1],o=e.totalColumnCount,i=0===r;if(0!==n||!i){r-=1,i&&(n-=1,r=o-1);var a=e.getCellInfo(n,r);return a.offset+a.nodeSize-2}return null},right:function(t,e){var n=t[0],r=t[1],o=e.totalRowCount,i=e.totalColumnCount,a=r===i-1;if(n!==o-1||!a){var s=r+1,l=e.getColspanStartInfo(n,r);return(null==l?void 0:l.count)>1&&(s+=l.count-1),(a||s===i)&&(n+=1,s=0),e.getCellInfo(n,s).offset+2}return null},up:function(t,e){var n=t[0],r=t[1];if(n>0){var o=e.getCellInfo(n-1,r);return o.offset+o.nodeSize-2}return null},down:function(t,e){var n=t[0],r=t[1];if(n<e.totalRowCount-1){var o=n+1,i=e.getRowspanStartInfo(n,r);return(null==i?void 0:i.count)>1&&(o+=i.count-1),e.getCellInfo(o,r).offset+2}return null}};function zm(t,e,n){var r=n[0],o=n[1],i=e.getRowspanStartInfo(r,o),a="up"===t&&0===r,s="down"===t&&((null==i?void 0:i.count)>1?r+i.count-1:r)===e.totalRowCount-1;return a||s}function _m(t,e,n,r){void 0===r&&(r=!1);var o=t.doc.resolve(e.tableEndOffset);return r||!o.nodeAfter?Ua(t,o,n):t.setSelection(oe.near(o,1))}function jm(t,e,n,r){var o=(0,qm[t])(n,r);if(o){var i="right"===t||"down"===t?1:-1;return e.setSelection(oe.near(e.doc.resolve(o),i))}return null}function Vm(t,e,n){var r=t.getCellInfo(e,0).offset,o=t.getCellInfo(e,n-1);return{from:r,to:o.offset+o.nodeSize}}var Um=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"table"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableHead{1} tableBody{1}",group:"block",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("table")],toDOM:function(t){return["table",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e.prototype.addTable=function(){return function(t){return void 0===t&&(t={rowCount:2,columnCount:1,data:[]}),function(e,n){var r=t.rowCount,o=t.columnCount,i=t.data,a=e.schema,s=e.selection,l=e.tr,c=s.from,u=s.to,p=s.$from;if(c===u&&!Th(p)){var d=a.nodes,f=d.tableHead,h=d.tableBody,m=null==i?void 0:i.slice(0,o),v=null==i?void 0:i.slice(o,i.length),g=function(t,e,n){for(var r=e.nodes,o=r.tableRow,i=r.tableHeadCell,a=r.paragraph,s=[],l=0;l<t;l+=1){var c=n&&n[l],u=a.create(null,c?e.text(c):[]);s.push(i.create(null,u))}return[o.create(null,s)]}(o,a,m),y=zh(r-1,o,a,v),b=a.nodes.table.create(null,[f.create(null,g),h.create(null,y)]);return n(l.replaceSelectionWith(b)),!0}return!1}}},e.prototype.removeTable=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Bh.create(n.$anchor);if(o){var i=o.tableStartOffset,a=o.tableEndOffset,s=i-1,l=Va(r.delete(s,a),s);return e(r.setSelection(l)),!0}return!1}}},e.prototype.addColumn=function(t){return function(){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){for(var c=Bh.create(s),u=c.getRectOffsets(s,l),p="left"===t?u.startColIdx:u.endColIdx+1,d=Wh(u).columnCount,f=c.totalRowCount,h=0;h<f;h+=1){var m=_h(d,h,i);o.insert(o.mapping.map(c.posAt(h,p)),m)}return n(o),!0}return!1}}},e.prototype.removeColumn=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Uh(n),i=o.anchor,a=o.head;if(i&&a){var s=Bh.create(i),l=s.getRectOffsets(i,a),c=s.totalColumnCount,u=s.totalRowCount;if(Wh(l).columnCount===c)return!1;for(var p=l.startColIdx,d=l.endColIdx,f=r.mapping.maps.length,h=0;h<u;h+=1)for(var m=d;m>=p;m-=1){var v=s.getCellInfo(h,m),g=v.offset,y=v.nodeSize,b=r.mapping.slice(f).map(g),w=b+y;r.delete(b,w)}return e(r),!0}return!1}}},e.prototype.addRow=function(t){return function(){return function(e,n){var r=e.selection,o=e.schema,i=e.tr,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c=Bh.create(s),u=c.totalColumnCount,p=c.getRectOffsets(s,l),d=Wh(p).rowCount,f=function(t,e,n){var r,o,i;return"up"===t?(r=n.startRowIdx,o=0,i=-1):(r=n.endRowIdx,o=e.totalColumnCount-1,i=e.getCellInfo(r,o).nodeSize+1),{targetRowIdx:r,insertColIdx:o,nodeSize:i}}(t,c,p),h=f.targetRowIdx,m=f.insertColIdx,v=f.nodeSize;if(0!==h){for(var g=[],y=i.mapping.map(c.posAt(h,m))+v,b=[],w=0;w<u;w+=1)b=b.concat(_h(1,h,o));for(var k=0;k<d;k+=1)g.push(o.nodes.tableRow.create(null,b));return n(i.insert(y,g)),!0}}return!1}}},e.prototype.removeRow=function(){return function(){return function(t,e){var n=t.selection,r=t.tr,o=Uh(n),i=o.anchor,a=o.head;if(i&&a){var s=Bh.create(i),l=s.totalRowCount,c=s.totalColumnCount,u=s.getRectOffsets(i,a),p=Wh(u).rowCount,d=u.startRowIdx,f=u.endRowIdx;if(p===l-1||0===d)return!1;for(var h=f;h>=d;h-=1){var m=Vm(s,h,c),v=m.from,g=m.to;r.delete(v-1,g+1)}return e(r),!0}return!1}}},e.prototype.alignColumn=function(){return function(t){return void 0===t&&(t={align:"center"}),function(e,n){var r=t.align,o=e.selection,i=e.tr,a=Uh(o),s=a.anchor,l=a.head;if(s&&l){for(var c=Bh.create(s),u=c.totalRowCount,p=c.getRectOffsets(s,l),d=p.startColIdx,f=p.endColIdx,h=0;h<u;h+=1)for(var m=d;m<=f;m+=1)if(!c.extendedRowspan(h,m)&&!c.extendedColspan(h,m)){var v=c.getNodeAndPos(h,m),g=v.node,y=v.pos,b=Gh(g,{align:r});i.setNodeMarkup(y,null,b)}return n(i),!0}return!1}}},e.prototype.moveToCell=function(t){return function(e,n){var r=e.selection,o=e.tr,i=e.schema,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c,u=Bh.create(s),p=u.getCellIndex(s);if(c=zm(t,u,p)?_m(o,u,i):jm(t,o,p,u))return n(c),!0}return!1}},e.prototype.moveInCell=function(t){var e=this;return function(n,r){var o=n.selection,i=n.tr,a=n.doc,s=n.schema,l=o.$from;if(!e.context.view.endOfTextblock(t))return!1;var c=xh(l,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name});if(c){var u=xh(l,function(t){return"paragraph"===t.type.name}),p=c.depth;if(u&&function(t,e,n,r){var o=e[0],i=e[1],a=o+3,s=i>=a,l=s?o+1:i,c=function(t,e,n,r,o){var i=e[2];if("left"===t||"up"===t){if(o&&!function(t,e,n){var r=n[0],o=n[1],i=e.resolve(t.before(r-1));return o===r&&!i.nodeBefore}(n,r,[e[0],e[1]]))return!1;var a=n.before(i);if(r.resolve(a).nodeBefore)return!1}return!0}(t,[i,a,l],n,r,s),u=function(t,e,n,r,o){if("right"===t||"down"===t){if(o&&!function(t){for(var e,n,r=t.depth;r&&"tableBodyCell"!==(n=t.node(r)).type.name;){if("listItem"===n.type.name){var o=t.node(r-1).lastChild===n,i="paragraph"!==(null===(e=n.lastChild)||void 0===e?void 0:e.type.name);return!!o&&!i}r-=1}return!1}(n))return!1;var i=n.after(e);if(r.resolve(i).nodeAfter)return!1}return!0}(t,l,n,r,s);return c&&u}(t,[p,u.depth],l,a)){var d=Uh(o).anchor,f=Bh.create(d),h=f.getCellIndex(d),m=void 0;if(function(t,e,n){var r=n[0],o=n[1];if("up"===t||"down"===t)return!1;var i=e.tableStartOffset,a=e.tableEndOffset,s=e.getCellInfo(r,o),l=s.offset,c=s.nodeSize;return("left"===t?i:a)===("left"===t?l-2:l+c+3)}(t,f,h)?m=function(t,e,n){var r=t.doc.resolve(e.before(n-3));return t.setSelection(new ce(r))}(i,l,p):zm(t,f,h)?"up"===t?m=function(t,e,n){var r=t.doc.resolve(e.tableStartOffset-1);return r.nodeBefore?t.setSelection(oe.near(r,-1)):Ua(t,r,n)}(i,f,s):"down"===t&&(m=_m(i,f,s)):m=jm(t,i,h,f),m)return r(m),!0}}return!1}},e.prototype.deleteCells=function(){return function(t,e){var n=t.schema,r=t.selection,o=t.tr,i=Uh(r),a=i.anchor,s=i.head;if(a&&s&&!(r instanceof se)){for(var l=Bh.create(a),c=l.getRectOffsets(a,s),u=c.startRowIdx,p=c.startColIdx,d=c.endRowIdx,f=c.endColIdx,h=u;h<=d;h+=1)for(var m=p;m<=f;m+=1)if(!l.extendedRowspan(h,m)&&!l.extendedColspan(h,m)){var v=l.getNodeAndPos(h,m),g=v.node,y=v.pos,b=_h(1,h,n,g.attrs);o.replaceWith(o.mapping.map(y),o.mapping.map(y+g.nodeSize),b)}return e(o),!0}return!1}},e.prototype.exitTable=function(){return function(t,e){var n=t.selection,r=t.tr,o=t.schema,i=n.$from;if(xh(i,function(t){var e=t.type;return"tableHeadCell"===e.name||"tableBodyCell"===e.name})&&xh(i,function(t){return"paragraph"===t.type.name})){var a=Uh(n).anchor;return e(_m(r,Bh.create(a),o,!0)),!0}return!1}},e.prototype.commands=function(){return{addTable:this.addTable(),removeTable:this.removeTable(),addColumnToLeft:this.addColumn("left"),addColumnToRight:this.addColumn("right"),removeColumn:this.removeColumn(),addRowToUp:this.addRow("up"),addRowToDown:this.addRow("down"),removeRow:this.removeRow(),alignColumn:this.alignColumn()}},e.prototype.keymaps=function(){var t=this.deleteCells();return{Tab:this.moveToCell("right"),"Shift-Tab":this.moveToCell("left"),ArrowUp:this.moveInCell("up"),ArrowDown:this.moveInCell("down"),ArrowLeft:this.moveInCell("left"),ArrowRight:this.moveInCell("right"),Backspace:t,"Mod-Backspace":t,Delete:t,"Mod-Delete":t,"Mod-Enter":this.exitTable()}},e}(Xs),$m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableHead"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableRow{1}",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[Mh("thead")],toDOM:function(t){return["thead",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Wm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableBody"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"tableRow+",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tbody",getAttrs:function(t){var e=t.querySelectorAll("tr")[0].children.length,n=t.getAttribute("data-raw-html");return!!e&&Ni({},n&&{rawHTML:n})}}],toDOM:function(t){return["tbody",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Gm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableRow"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"(tableHeadCell | tableBodyCell)*",attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"tr",getAttrs:function(t){var e=t.children.length,n=t.getAttribute("data-raw-html");return!!e&&Ni({},n&&{rawHTML:n})}}],toDOM:function(t){return["tr",Dh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Km=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableHeadCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"paragraph+",attrs:Ni({align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},extended:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),isolating:!0,parseDOM:[Sh("th")],toDOM:function(t){var e=t.attrs,n=Nh(e);return["th",Ni(Ni({},n),Dh(e)),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Jm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"tableBodyCell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"(paragraph | bulletList | orderedList)+",attrs:{align:{default:null},className:{default:null},rawHTML:{default:null},colspan:{default:null},rowspan:{default:null},extended:{default:null}},isolating:!0,parseDOM:[Sh("td")],toDOM:function(t){return["td",Nh(t.attrs),0]}}},enumerable:!1,configurable:!0}),e}(Xs),Zm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"image"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{inline:!0,attrs:Ni({imageUrl:{default:""},altText:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"img[src]",getAttrs:function(t){var e=eh(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("src")||"",r=e.getAttribute("data-raw-html"),o=e.getAttribute("alt");return Ni({imageUrl:n,altText:o},r&&{rawHTML:r})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"img",Ni(Ni({src:ka(e.imageUrl)},e.altText&&{alt:e.altText}),Dh(e))]}}},enumerable:!1,configurable:!0}),e.prototype.addImage=function(){return function(t){return function(e,n){var r=e.schema,o=e.tr,i=t,a=i.imageUrl,s=i.altText;if(!a)return!1;var l=r.nodes.image.createAndFill(Ni({imageUrl:a},s&&{altText:s}));return n(o.replaceSelectionWith(l).scrollIntoView()),!0}}},e.prototype.commands=function(){return{addImage:this.addImage()}},e}(Xs),Xm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"thematicBreak"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),group:"block",parseDOM:[{tag:"hr"}],selectable:!1,toDOM:function(t){var e=t.attrs;return["div",Dh(e),[e.rawHTML||"hr"]]}}},enumerable:!1,configurable:!0}),e.prototype.hr=function(){var t=this;return function(){return function(e,n){var r,o=e.selection,i=o.$from;if(i===o.$to){var a=e.doc,s=e.schema.nodes,l=s.thematicBreak,c=s.paragraph,u=[l.create()],p=i.node(1),d=a.child(a.childCount-1)===p,f=a.resolve(i.after(1)),h=(null===(r=i.nodeAfter)||void 0===r?void 0:r.type.name)===t.name;return(d||h)&&u.push(c.create()),n(e.tr.insert(f.pos,u).scrollIntoView()),!0}return!1}}},e.prototype.commands=function(){return{hr:this.hr()}},e.prototype.keymaps=function(){var t=this.hr()();return{"Mod-l":t,"Mod-L":t}},e}(Xs),Qm=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strong"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["b","strong"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"strong",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.bold=function(){return function(){return function(t,e){return _o(t.schema.marks.strong)(t,e)}}},e.prototype.commands=function(){return{bold:this.bold()}},e.prototype.keymaps=function(){var t=this.bold()();return{"Mod-b":t,"Mod-B":t}},e}(Pl),Ym=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"emph"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["i","em"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"em",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.italic=function(){return function(){return function(t,e){return _o(t.schema.marks.emph)(t,e)}}},e.prototype.commands=function(){return{italic:this.italic()}},e.prototype.keymaps=function(){var t=this.italic()();return{"Mod-i":t,"Mod-I":t}},e}(Pl),tv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"strike"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=["s","del"].map(function(t){return{tag:t,getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}});return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:t,toDOM:function(t){var e=t.attrs;return[e.rawHTML||"del",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return _o(t.schema.marks.strike)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Mod-s":t,"Mod-S":t}},e}(Pl),ev=function(t){function e(e){var n=t.call(this)||this;return n.linkAttributes=e,n}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"link"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){var t=this;return{attrs:Ni({linkUrl:{default:""},title:{default:null},rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:function(t){var e=eh(t,{RETURN_DOM_FRAGMENT:!0}).firstChild,n=e.getAttribute("href")||"",r=e.getAttribute("title")||"",o=e.getAttribute("data-raw-html");return Ni({linkUrl:n,title:r},o&&{rawHTML:o})}}],toDOM:function(e){var n=e.attrs;return[n.rawHTML||"a",Ni(Ni({href:ka(n.linkUrl)},t.linkAttributes),Dh(n))]}}},enumerable:!1,configurable:!0}),e.prototype.addLink=function(){return function(t){return function(e,n){var r=t,o=r.linkUrl,i=r.linkText,a=void 0===i?"":i,s=e.schema,l=e.tr,c=e.selection,u=c.empty,p=c.from,d=c.to;if(p&&d&&o){var f={linkUrl:o},h=s.mark("link",f);if(u&&a){var m=ja(s,a,h);l.replaceRangeWith(p,d,m)}else l.addMark(p,d,h);return n(l.scrollIntoView()),!0}return!1}}},e.prototype.toggleLink=function(){return function(t){return function(e,n){return _o(e.schema.marks.link,t)(e,n)}}},e.prototype.commands=function(){return{addLink:this.addLink(),toggleLink:this.toggleLink()}},e}(Pl),nv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"code"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{attrs:Ni({rawHTML:{default:null}},{htmlAttrs:{default:null},classNames:{default:null}}),parseDOM:[{tag:"code",getAttrs:function(t){var e=t.getAttribute("data-raw-html");return Ni({},e&&{rawHTML:e})}}],toDOM:function(t){var e=t.attrs;return[e.rawHTML||"code",Dh(e)]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e){return _o(t.schema.marks.code)(t,e)}}},e.prototype.keymaps=function(){var t=this.commands()();return{"Shift-Mod-c":t,"Shift-Mod-C":t}},e}(Pl),rv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"customBlock"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",attrs:{info:{default:null}},atom:!0,code:!0,defining:!0,parseDOM:[{tag:"div[data-custom-info]",getAttrs:function(t){return{info:t.getAttribute("data-custom-info")}}}],toDOM:function(t){return["div",{"data-custom-info":t.attrs.info||null},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(t){return function(e,n){return!!(null==t?void 0:t.info)&&zo(e.schema.nodes.customBlock,t)(e,n)}}},e}(Xs),ov=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"frontMatter"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-front-matter]"}],toDOM:function(){return["div",{"data-front-matter":"true"},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e,n){var r=t.selection.$from;return!(!n.endOfTextblock("down")||"frontMatter"!==r.node().type.name)&&Fo(t,e)}}},e.prototype.keymaps=function(){return{Enter:this.commands()()}},e}(Xs),iv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"htmlComment"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return{content:"text*",group:"block",code:!0,defining:!0,parseDOM:[{preserveWhitespace:"full",tag:"div[data-html-comment]"}],toDOM:function(){return["div",{"data-html-comment":"true"},0]}}},enumerable:!1,configurable:!0}),e.prototype.commands=function(){return function(){return function(t,e,n){var r=t.selection.$from;return!(!n.endOfTextblock("down")||"htmlComment"!==r.node().type.name)&&Fo(t,e)}}},e.prototype.keymaps=function(){return{Enter:this.commands()()}},e}(Xs),av=Bs("contents"),sv=function(t){function e(e,n){var r=t.call(this,e)||this,o=n.toDOMAdaptor,i=n.htmlSchemaMap,a=void 0===i?{}:i,s=n.linkAttributes,l=void 0===s?{}:s,c=n.useCommandShortcut,u=void 0===c||c,p=n.wwPlugins,d=void 0===p?[]:p,f=n.wwNodeViews,h=void 0===f?{}:f;return r.editorType="wysiwyg",r.el.classList.add("ww-mode"),r.toDOMAdaptor=o,r.linkAttributes=l,r.extraPlugins=d,r.pluginNodeViews=h,r.specs=r.createSpecs(),r.schema=r.createSchema(a),r.context=r.createContext(),r.keymaps=r.createKeymaps(u),r.view=r.createView(),r.commands=r.createCommands(),r.specs.setContext(Ni(Ni({},r.context),{view:r.view})),r.initEvent(),r}return Mi(e,t),e.prototype.createSpecs=function(){return t=this.linkAttributes,new il([new Dm,new Lm,new Am,new Im,new Rm,new Pm,new Bm,new Fm,new Hm,new Um,new $m,new Wm,new Gm,new Km,new Jm,new Zm,new Xm,new Qm,new Ym,new tv,new ev(t),new nv,new rv,new ov,new tl,new iv]);var t},e.prototype.createContext=function(){return{schema:this.schema,eventEmitter:this.eventEmitter}},e.prototype.createSchema=function(t){return new it({nodes:Ni(Ni({},this.specs.nodes),t.nodes),marks:Ni(Ni({},this.specs.marks),t.marks)})},e.prototype.createPlugins=function(){return Si([new Te({key:Kh,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(Kh);if(n)return-1===n?null:n;if(sa(e)||!t.docChanged)return e;var r=t.mapping.mapResult(e),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:Xh,createSelectionBetween:function(t){var e=t.state;return sa(Kh.getState(e))?null:e.selection}},view:function(t){return new Jh(t)}}),(t=this.eventEmitter,new Te({props:{handleDOMEvents:{contextmenu:function(e,n){var r=jh(n.target,e.dom);if(r){n.preventDefault();var o=n,i=o.clientX,a=o.clientY,s=e.dom.parentNode.getBoundingClientRect(),l=s.left,c=s.top,u="TH"===r.nodeName;return t.emit("contextmenu",{pos:{left:i-l+10+"px",top:a-c+30+"px"},menuGroups:rm(t,u),tableCell:r}),!0}return!1}}}})),new Te({props:{handleDOMEvents:{mousedown:function(t,e){var n=e,r=n.clientX,o=n.clientY,i=t.posAtCoords({left:r,top:o});if(i){var a=t.state,s=a.doc,l=a.tr,c=s.resolve(i.pos),u=Eh(c),p=e.target,d=getComputedStyle(p,":before"),f=e,h=f.offsetX,m=f.offsetY;if(!u||!Rs(d,h,m))return!1;e.preventDefault();var v=c.before(u.depth),g=u.node.attrs;return l.setNodeMarkup(v,null,Ni(Ni({},g),{checked:!g.checked})),t.dispatch(l),!0}return!1}}}}),lm(this.eventEmitter)],this.createPluginProps()).concat(this.defaultPlugins);var t},e.prototype.createPluginNodeViews=function(){var t=this.eventEmitter,e=this.pluginNodeViews,n={};return e&&Object.keys(e).forEach(function(r){n[r]=function(n,o,i){return e[r](n,o,i,t)}}),n},e.prototype.createView=function(){var t=this,e=this.toDOMAdaptor,n=this.eventEmitter;return new po(this.el,{state:this.createState(),attributes:{class:av},nodeViews:Ni({customBlock:function(t,n,r){return new cm(t,n,r,e)},image:function(t,e,r){return new pm(t,e,r,n)},codeBlock:function(t,e,r){return new dm(t,e,r,n)},widget:Qs},this.createPluginNodeViews()),dispatchTransaction:function(e){var n=t.view.state.applyTransaction(e).state;t.view.updateState(n),t.emitChangeEvent(e.scrollIntoView()),t.eventEmitter.emit("setFocusedNode",n.selection.$from.node(1))},transformPastedHTML:km,transformPasted:function(e){return function(t,e,n){var r=[],o=t.content,i=t.openStart,a=t.openEnd;return o.forEach(function(t){if("table"===t.type.name){var o=$h(new m(l.from(t),0,0));if(o){var i=Em(o),a="tableBody"===o.firstChild.type.name,s=function(t,e,n,r){var o=function(t){return t.reduce(function(t,e){return t.childCount>e.childCount?t:e}).childCount}(t);if(n&&r)return e.nodes.table.create(null,[Nm(t,o,e)]);var i=t[0],a=t.slice(1),s=[Mm(i,0,e)];return a.length&&s.push(Nm(a,o,e)),e.nodes.table.create(null,s)}(i,e,a,n);r.push(s)}}else r.push(t)}),new m(l.from(r),i,a)}(e,t.schema,Th(t.view.state.selection.$from))},handlePaste:function(t,e,n){return function(t,e){var n=t.state,r=n.selection,o=n.schema,i=n.tr,a=Uh(r),s=a.anchor,l=a.head;if(s&&l){var c=$h(e);if(!c)return!1;var u=Bh.create(s),p=u.getRectOffsets(s,l),d=function(t,e,n){var r=[],o=Em(t),i=(o[0].childCount,o.length),a=0===e.startRowIdx,s=o.slice(0,i);if(a){var l=s.shift();if(l){var c=Cm(l,0,n).content;r.push(c)}}return s.forEach(function(t){if(!t.attrs.dummyRowForPasting){var e=Tm(t,0,n).content;r.push(e)}}),r}(c,p,o),f=function(t,e,n){for(var r=e.startRowIdx,o=e.startColIdx,i=n.length,a=0,s=function(t){var e=n[t].childCount;n[t].forEach(function(t){var n=t.attrs.colspan;n>1&&(e+=n-1)}),a=Math.max(a,e)},l=0;l<i;l+=1)s(l);var c=r+i-1,u=o+a-1;return{startRowIdx:r,startColIdx:o,endRowIdx:c,endColIdx:u,addedRowCount:Math.max(c+1-t.totalRowCount,0),addedColumnCount:Math.max(u+1-t.totalColumnCount,0)}}(u,p,d),h=[];return function(t,e){var n=Wh(t.getSpannedOffsets(e)),r=n.rowCount,o=n.columnCount,i=Wh(e),a=i.rowCount,s=i.columnCount;return r===a&&o===s}(u,f)&&(function(t,e){for(var n=t.startRowIdx,r=t.startColIdx,o=t.endRowIdx,i=t.endColIdx,a=t.addedRowCount,s=t.addedColumnCount,l=n;l<=o-a;l+=1)e.push({rowIdx:l,startColIdx:r,endColIdx:i-s})}(f,h),f.addedColumnCount&&function(t,e,n,r,o){for(var i=r.startRowIdx,a=r.startColIdx,s=r.endRowIdx,l=r.endColIdx,c=r.addedRowCount,u=r.addedColumnCount,p=n.totalRowCount,d=0,f=0;f<p;f+=1){var h=n.getCellInfo(f,l-u),m=h.offset,v=h.nodeSize,g=t.mapping.map(m+v),y=_h(u,f,e);if(t.insert(g,y),f>=i&&f<=s-c){var b=n.getCellInfo(f,l-u),w=t.mapping.map(b.offset),k=g+Sm(u);o[d]={rowIdx:f,startColIdx:a,endColIdx:l,dummyOffsets:[w,k]},d+=1}}}(i,o,u,f,h),f.addedRowCount&&function(t,e,n,r,o){var i=r.addedRowCount,a=r.addedColumnCount,s=r.startColIdx,l=r.endColIdx,c=t.mapping.maps.length,u=n.tableEndOffset-2,p=zh(i,n.totalColumnCount+a,e),d=u;t.insert(t.mapping.slice(c).map(d),p);for(var f=0;f<i;f+=1){var h=d+Sm(s)+1,m=d+Sm(l+1)+1,v=d+Sm(n.totalColumnCount+a)+2;o.push({rowIdx:f+n.totalRowCount,startColIdx:s,endColIdx:l,dummyOffsets:[h,m]}),d=v}}(i,o,u,f,h),function(t,e,n,r){var o=t.mapping.maps.length;n.forEach(function(n,i){var a=n.rowIdx,s=n.startColIdx,l=n.endColIdx,c=n.dummyOffsets,u=t.mapping.slice(o),p=new m(e[i],0,0),d=c?c[0]:r.getCellStartOffset(a,s),f=c?c[1]:r.getCellEndOffset(a,l);t.replace(u.map(d),u.map(f),p)})}(i,d,h,u),t.dispatch(i),function(t,e,n){var r=t.state,o=r.tr,i=r.doc,a=Bh.create(i.resolve(n)),s=e[0],l=s.rowIdx,c=s.startColIdx,u=Aa(e),p=u.rowIdx,d=u.endColIdx,f=a.getCellInfo(l,c).offset,h=a.getCellInfo(p,d).offset;t.dispatch(o.setSelection(new qh(i.resolve(f),i.resolve(h))))}(t,h,u.getCellInfo(0,0).offset)),!0}return!1}(t,n)},handleKeyDown:function(e,n){return t.eventEmitter.emit("keydown",t.editorType,n),!1},handleDOMEvents:{paste:function(e,n){var r=n.clipboardData||window.clipboardData,o=null==r?void 0:r.items;if(o&&!za(o).some(function(t){return"string"===t.kind&&"text/rtf"===t.type})){var i=Js(o);i&&(n.preventDefault(),Ks(t.eventEmitter,i,n.type))}return!1},keyup:function(e,n){return t.eventEmitter.emit("keyup",t.editorType,n),!1},scroll:function(){return t.eventEmitter.emit("scroll","editor"),!0}}})},e.prototype.createCommands=function(){return this.specs.commands(this.view,Rh())},e.prototype.getHTML=function(){return this.view.dom.innerHTML},e.prototype.getModel=function(){return this.view.state.doc},e.prototype.getSelection=function(){var t=this.view.state.selection;return[t.from,t.to]},e.prototype.getSchema=function(){return this.view.state.schema},e.prototype.replaceSelection=function(t,e,n){var r=this.view.state,o=r.schema,i=r.tr,a=t.split("\n").map(function(t){return _a(o,vs(t,o))}),s=new m(l.from(a),1,1),c=aa(e)&&aa(n)?i.replaceRange(e,n,s):i.replaceSelection(s);this.view.dispatch(c),this.focus()},e.prototype.deleteSelection=function(t,e){var n=this.view.state.tr,r=aa(t)&&aa(e)?n.deleteRange(t,e):n.deleteSelection();this.view.dispatch(r.scrollIntoView())},e.prototype.getSelectedText=function(t,e){var n=this.view.state,r=n.doc,o=n.selection,i=o.from,a=o.to;return aa(t)&&aa(e)&&(i=t,a=e),r.textBetween(i,a,"\n")},e.prototype.setModel=function(t,e){void 0===e&&(e=!1);var n=this.view.state,r=n.tr,o=n.doc;this.view.dispatch(r.replaceWith(0,o.content.size,t)),e&&this.moveCursorToEnd(!0)},e.prototype.setSelection=function(t,e){void 0===e&&(e=t);var n=this.view.state.tr,r=Va(n,t,e);this.view.dispatch(n.setSelection(r).scrollIntoView())},e.prototype.addWidget=function(t,e,n){var r=this.view,o=r.dispatch,i=r.state;o(i.tr.setMeta("widget",{pos:null!=n?n:i.selection.to,node:t,style:e}))},e.prototype.replaceWithWidget=function(t,e,n){var r=this.view.state,o=r.tr,i=vs(n,r.schema);this.view.dispatch(o.replaceWith(t,e,i))},e.prototype.getRangeInfoOfNode=function(t){var e=this.view.state,n=e.doc,r=e.selection,o=t?n.resolve(t):r.$from,i=o.marks(),a=o.node(),s=o.start(),l=o.end(),c=a.type.name;if(i.length||"paragraph"===c){var u=i[i.length-1];c=u?u.type.name:"text",a.forEach(function(t,e){var n=t.isText,r=t.nodeSize,i=t.marks,a=o.pos-s;n&&e<=a&&e+r>=a&&function(t){return!t.length||xa(t,u)}(i)&&(l=(s+=e)+r)})}return{range:[s,l],type:c}},e}(el),lv=Ui,cv=sa,uv=function(t){return!(e=t,lv(e)||cv(e)||!1===t);var e},pv=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],dv=function(){function t(){var t=this;this.events=new Qh,this.eventTypes=pv.reduce(function(t,e){return Ni(Ni({},t),{type:e})},{}),this.hold=!1,pv.forEach(function(e){t.addEventType(e)})}return t.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this.getTypeInfo(t),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach(function(t){var n=t.apply(void 0,e);Ui(n)||i.push(n)}),i},t.prototype.emitReduce=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(t);return!this.hold&&o&&o.forEach(function(t){var r=t.apply(void 0,Si([e],n));!uv(r)||(e=r)}),e},t.prototype.getTypeInfo=function(t){var e=t.split(".");return{type:e[0],namespace:e[1]}},t.prototype.hasEventType=function(t){return!Ui(this.eventTypes[this.getTypeInfo(t).type])},t.prototype.addEventType=function(t){if(this.hasEventType(t))throw new Error("There is already have event type "+t);this.eventTypes[t]=t},t.prototype.removeEventHandler=function(t,e){var n=this,r=this.getTypeInfo(t),o=r.type,i=r.namespace;o&&e?this.removeEventHandlerWithHandler(o,e):o&&!i?this.events.delete(o):!o&&i?this.events.forEach(function(t,e){n.removeEventHandlerWithTypeInfo(e,i)}):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},t.prototype.removeEventHandlerWithHandler=function(t,e){var n=this.events.get(t);if(n){var r=n.indexOf(e);n.indexOf(e)>=0&&n.splice(r,1)}},t.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map(function(t){return t.namespace!==e&&n.push(t),null}),this.events.set(t,n))},t.prototype.getEvents=function(){return this.events},t.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},t}(),fv=function(){function t(t,e,n,r){this.eventEmitter=t,this.mdCommands=e,this.wwCommands=n,this.getEditorType=r,this.initEvent()}return t.prototype.initEvent=function(){var t=this;this.eventEmitter.listen("command",function(e,n){t.exec(e,n)})},t.prototype.addCommand=function(t,e,n){"markdown"===t?this.mdCommands[e]=n:this.wwCommands[e]=n},t.prototype.deleteCommand=function(t,e){"markdown"===t?delete this.mdCommands[e]:delete this.wwCommands[e]},t.prototype.exec=function(t,e){"markdown"===this.getEditorType()?this.mdCommands[t](e):this.wwCommands[t](e)},t}();function hv(t){return"\n"===t[t.length-1]?t.slice(0,t.length-1):t}function mv(t,e){var n=t.schema,r=e.literal.match(Ls);if(r){var o=r[1],i=r[3],a=(o||i).toLowerCase();return"htmlInline"===e.type&&!(!n.marks[a]&&!n.nodes[a])}return!1}function vv(t){return xa(["text","strong","emph","strike","image","link","code"],t.type)}function gv(t){return"softbreak"===(null==t?void 0:t.type)}function yv(t){var e=t.type,n=t.literal,r="htmlInline"===e&&n.match(Ls);if(r){var o=r[1],i=r[3],a=o||i;if(a)return xa(["ul","ol","li"],a.toLowerCase())}return!1}function bv(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=document.createElement("div");r.innerHTML=eh(t);var o=r.firstChild;return e.map(function(t){return o.getAttribute(t)||""})}var wv=function(t){var e={};return Object.keys(t).forEach(function(n){n.split(", ").forEach(function(r){var o=r.toLowerCase();e[o]=t[n]})}),e}({"b, strong":function(t,e,n){var r=t.schema.marks.strong;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"i, em":function(t,e,n){var r=t.schema.marks.emph;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},"s, del":function(t,e,n){var r=t.schema.marks.strike;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},code:function(t,e,n){var r=t.schema.marks.code;n?t.openMark(r.create({rawHTML:n})):t.closeMark(r)},a:function(t,e,n){var r=e.literal,o=t.schema.marks.link;if(n){var i=bv(r,"href")[0];t.openMark(o.create({linkUrl:i,rawHTML:n}))}else t.closeMark(o)},img:function(t,e,n){var r=e.literal;if(n){var o=bv(r,"src","alt"),i=o[0],a=o[1],s=t.schema.nodes.image;t.addNode(s,Ni({rawHTML:n,imageUrl:i},a&&{altText:a}))}},hr:function(t,e,n){t.addNode(t.schema.nodes.thematicBreak,{rawHTML:n})},br:function(t,e){var n=t.schema.nodes.paragraph,r=e.parent,o=e.prev,i=e.next;"paragraph"===(null==r?void 0:r.type)?(gv(o)&&t.openNode(n),gv(i)?t.closeNode():i&&(t.closeNode(),t.openNode(n))):"tableCell"===(null==r?void 0:r.type)&&(o&&(vv(o)||mv(t,o))&&t.closeNode(),i&&(vv(i)||mv(t,i))&&t.openNode(n))},pre:function(t,e,n){var r,o,i=document.createElement("div");i.innerHTML=e.literal;var a=null===(o=null===(r=i.firstChild)||void 0===r?void 0:r.firstChild)||void 0===o?void 0:o.textContent;t.openNode(t.schema.nodes.codeBlock,{rawHTML:n}),t.addText(hv(a)),t.closeNode()},"ul, ol":function(t,e,n){if("tableCell"===e.parent.type){var r=t.schema.nodes,o=r.bulletList,i=r.orderedList,a=r.paragraph,s="ul"===n?o:i;n?(e.prev&&!yv(e.prev)&&t.closeNode(),t.openNode(s,{rawHTML:n})):(t.closeNode(),e.next&&!yv(e.next)&&t.openNode(a))}},li:function(t,e,n){var r;if("tableCell"===(null===(r=e.parent)||void 0===r?void 0:r.type)){var o=t.schema.nodes,i=o.listItem,a=o.paragraph;if(n){var s=function(t){var e=t.literal;return{task:/data-task/.test(e),checked:/data-task-checked/.test(e)}}(e);e.prev&&!yv(e.prev)&&t.closeNode(),t.openNode(i,Ni({rawHTML:n},s)),e.next&&!yv(e.next)&&t.openNode(a)}else e.prev&&!yv(e.prev)&&t.closeNode(),t.closeNode()}}});function kv(t){return"htmlInline"===t.type&&Os.test(t.literal)}function xv(t){za(t.childNodes).forEach(function(t){if(Hs(t)){var e=t.nodeName.toLowerCase();t.setAttribute("data-raw-html",e),t.childNodes&&xv(t)}})}var Cv={text:function(t,e){t.addText(e.literal||"")},paragraph:function(t,e,n,r){var o;if(n.entering){var i=t.schema.nodes.paragraph;"paragraph"===(null===(o=e.prev)||void 0===o?void 0:o.type)&&(t.openNode(i,r),t.closeNode()),t.openNode(i,r)}else t.closeNode()},heading:function(t,e,n,r){if(n.entering){var o=e,i=o.level,a=o.headingType;t.openNode(t.schema.nodes.heading,Ni({level:i,headingType:a},r))}else t.closeNode()},codeBlock:function(t,e,n){var r=t.schema.nodes.codeBlock,o=e,i=o.info,a=o.literal;t.openNode(r,Ni({language:i},n)),t.addText(hv(a||"")),t.closeNode()},list:function(t,e,n,r){if(n.entering){var o=t.schema.nodes,i=o.bulletList,a=o.orderedList,s=e.listData,l=s.type,c=s.start;"bullet"===l?t.openNode(i,r):t.openNode(a,Ni({order:c},r))}else t.closeNode()},item:function(t,e,n,r){var o=n.entering,i=t.schema.nodes.listItem,a=e.listData,s=a.task,l=a.checked;if(o){var c=Ni(Ni(Ni({},s&&{task:s}),l&&{checked:l}),r);t.openNode(i,c)}else t.closeNode()},blockQuote:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.blockQuote,r):t.closeNode()},image:function(t,e,n,r){var o=n.entering,i=n.skipChildren,a=t.schema.nodes.image,s=e,l=s.destination,c=s.firstChild;o&&i&&i(),t.addNode(a,Ni(Ni({imageUrl:l},c&&{altText:c.literal}),r))},thematicBreak:function(t,e,n,r){t.addNode(t.schema.nodes.thematicBreak,r)},strong:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strong;o?t.openMark(i.create(r)):t.closeMark(i)},emph:function(t,e,n,r){var o=n.entering,i=t.schema.marks.emph;o?t.openMark(i.create(r)):t.closeMark(i)},link:function(t,e,n,r){var o=n.entering,i=t.schema.marks.link,a=e,s=a.destination,l=a.title;if(o){var c=Ni({linkUrl:s,title:l},r);t.openMark(i.create(c))}else t.closeMark(i)},softbreak:function(t,e){if("paragraph"===e.parent.type){var n=e.prev,r=e.next;n&&!kv(n)&&t.closeNode(),r&&!kv(r)&&t.openNode(t.schema.nodes.paragraph)}},table:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.table,r):t.closeNode()},tableHead:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableHead,r):t.closeNode()},tableBody:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableBody,r):t.closeNode()},tableRow:function(t,e,n,r){n.entering?t.openNode(t.schema.nodes.tableRow,r):t.closeNode()},tableCell:function(t,e,n){var r=n.entering;if(!e.ignored){var o=function(e){return e&&(vv(e)||mv(t,e))};if(r){var i=t.schema.nodes,a=i.tableHeadCell,s=i.tableBodyCell,l=i.paragraph,c=e.parent.parent,u="tableHead"===c.type?a:s,p=(c.parent.columns[e.startIdx]||{}).align,d=Ni({},e.attrs);p&&(d.align=p),t.openNode(u,d),o(e.firstChild)&&t.openNode(l)}else o(e.lastChild)&&t.closeNode(),t.closeNode()}},strike:function(t,e,n,r){var o=n.entering,i=t.schema.marks.strike;o?t.openMark(i.create(r)):t.closeMark(i)},code:function(t,e,n,r){var o=t.schema.marks.code;t.openMark(o.create(r)),t.addText(hv(e.literal||"")),t.closeMark(o)},customBlock:function(t,e){var n=t.schema.nodes,r=n.customBlock,o=n.paragraph,i=e,a=i.info,s=i.literal;t.openNode(r,{info:a}),t.addText(hv(s||"")),t.closeNode(),e.next||(t.openNode(o),t.closeNode())},frontMatter:function(t,e){t.openNode(t.schema.nodes.frontMatter),t.addText(e.literal),t.closeNode()},htmlInline:function(t,e){var n=e.literal,r=n.match(Ls),o=r[1],i=r[3],a=(o||i).toLowerCase(),s=t.schema.marks[a],l=eh(n);if(null==s?void 0:s.spec.attrs.htmlInline)if(o){var c=rh(l);t.openMark(s.create({htmlAttrs:c}))}else t.closeMark(s);else{var u=wv[a];u&&u(t,e,o)}},htmlBlock:function(t,e){var n=e.literal,r=document.createElement("div");if(As.test(n))t.openNode(t.schema.nodes.htmlComment),t.addText(e.literal),t.closeNode();else{var o=n.match(Ls),i=o[1],a=o[3],s=(i||a).toLowerCase(),l=t.schema.nodes[s],c=eh(n);if(null==l?void 0:l.spec.attrs.htmlBlock){var u=rh(c),p=nh(e,s);t.addNode(l,{htmlAttrs:u,childrenHTML:p})}else r.innerHTML=c,xv(r),t.convertByDOMParser(r)}},customInline:function(t,e,n){var r=n.entering,o=n.skipChildren,i=e,a=i.info,s=i.firstChild,l=t.schema;if(-1!==a.indexOf("widget")&&r){var c=gs(e);o(),t.addNode(l.nodes.widget,{info:a},[l.text(fs(a,c))])}else{var u="$$";r&&(u+=s?a+" ":a),t.addText(u)}}},Tv=function(){function t(t,e){this.schema=t,this.convertors=e,this.stack=[{type:this.schema.topNodeType,attrs:null,content:[]}],this.marks=f.none}return t.prototype.top=function(){return Aa(this.stack)},t.prototype.push=function(t){this.stack.length&&this.top().content.push(t)},t.prototype.addText=function(t){if(t){var e=this.top().content,n=Aa(e),r=this.schema.text(t,this.marks),o=n&&(a=r,!!((i=n).isText&&a.isText&&f.sameSet(i.marks,a.marks))&&i.withText(i.text+a.text));o?e[e.length-1]=o:e.push(r)}var i,a},t.prototype.openMark=function(t){this.marks=t.addToSet(this.marks)},t.prototype.closeMark=function(t){this.marks=t.removeFromSet(this.marks)},t.prototype.addNode=function(t,e,n){var r=t.createAndFill(e,n,this.marks);return r?(this.push(r),r):null},t.prototype.openNode=function(t,e){this.stack.push({type:t,attrs:e,content:[]})},t.prototype.closeNode=function(){this.marks.length&&(this.marks=f.none);var t=this.stack.pop(),e=t.type,n=t.attrs,r=t.content;return this.addNode(e,n,r)},t.prototype.convertByDOMParser=function(t){var e=this;st.fromSchema(this.schema).parse(t).content.forEach(function(t){return e.push(t)})},t.prototype.closeUnmatchedHTMLInline=function(t,e){var n;if(!e&&"htmlInline"!==t.type)for(var r=this.stack.length-1;r>=0;r-=1){var o=this.stack[r];if(!(null===(n=o.attrs)||void 0===n?void 0:n.rawHTML))break;o.content.length?this.closeNode():this.stack.pop()}},t.prototype.convert=function(t,e){for(var n=t.walker(),r=n.next(),o=function(){var t=r.node,o=r.entering,a=i.convertors[t.type],s=!1;if(a){var l={entering:o,leaf:!ss(t),getChildrenText:ls,options:{gfm:!0,nodeId:!1,tagFilter:!1,softbreak:"\n"},skipChildren:function(){s=!0}};if(i.closeUnmatchedHTMLInline(t,o),a(i,t,l),(null==e?void 0:e.node)===t){var c=i.stack.reduce(function(t,e){return t+e.content.reduce(function(t,e){return t+e.nodeSize},0)},0)+1;e.setMappedPos(c)}}s&&(n.resumeAt(t,!1),n.next()),r=n.next()},i=this;r;)o()},t.prototype.convertNode=function(t,e){return this.convert(t,e),this.stack.length?this.closeNode():null},t}(),Ev={text:function(t,e){var n,r=e.node,o=null!==(n=r.text)&&void 0!==n?n:"";(r.marks||[]).some(function(t){return"link"===t.type.name})?t.text(Na(o),!1):t.text(o)},paragraph:function(t,e){var n=e.node,r=e.parent,o=e.index,i=void 0===o?0:o;if(t.stopNewline)t.convertInline(n);else{var a=0===i,s=!a&&r.child(i-1),l=s&&0===s.childCount,c=i<r.childCount-1&&r.child(i+1),u=c&&"paragraph"===c.type.name,p=0===n.childCount;if(p&&l)t.write("<br>\n");else if(!p||l||a)t.convertInline(n),u?t.write("\n"):t.closeBlock(n);else{if("listItem"===(null==r?void 0:r.type.name)){var d=t.getDelim();t.setDelim(""),t.write("<br>"),t.setDelim(d)}t.write("\n")}}},heading:function(t,e,n){var r=e.node,o=n.delim;"atx"===r.attrs.headingType?(t.write(o+" "),t.convertInline(r),t.closeBlock(r)):(t.convertInline(r),t.ensureNewLine(),t.write(o),t.closeBlock(r))},codeBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,a=o,s=a[0],l=a[1];t.write(s),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(l),t.closeBlock(r)},blockQuote:function(t,e,n){var r=e.node,o=e.parent,i=n.delim;(null==o?void 0:o.type.name)===r.type.name&&t.flushClose(1),t.wrapBlock(i,null,r,function(){return t.convertNode(r)})},bulletList:function(t,e,n){var r=e.node,o=n.delim;t.convertList(r,Ma(" ",4),function(){return o+" "})},orderedList:function(t,e){var n=e.node,r=n.attrs.order||1;t.convertList(n,Ma(" ",4),function(t){return String(r+t)+". "})},listItem:function(t,e){var n=e.node,r=n.attrs,o=r.task,i=r.checked;o&&t.write("["+(i?"x":" ")+"] "),t.convertNode(n)},image:function(t,e,n){var r=n.attrs;t.write("!["+(null==r?void 0:r.altText)+"]("+(null==r?void 0:r.imageUrl)+")")},thematicBreak:function(t,e,n){var r=e.node,o=n.delim;t.write(o),t.closeBlock(r)},table:function(t,e){var n=e.node;t.convertNode(n),t.closeBlock(n)},tableHead:function(t,e,n){var r=e.node,o=n.delim,i=r.firstChild;t.convertNode(r);var a=null!=o?o:"";!o&&i&&i.forEach(function(t){var e=function(t,e){var n=t.length,r="",o="";return"left"===e?(r=":",n-=1):"right"===e?(o=":",n-=1):"center"===e&&(r=":",o=":",n-=2),""+r+Ma("-",Math.max(n,3))+o}(t.textContent,t.attrs.align);a+="| "+e+" "}),t.write(a+"|"),t.ensureNewLine()},tableBody:function(t,e){var n=e.node;t.convertNode(n)},tableRow:function(t,e){var n=e.node;t.convertNode(n),t.write("|"),t.ensureNewLine()},tableHeadCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},tableBodyCell:function(t,e,n){var r=e.node,o=n.delim,i=void 0===o?"| ":o;t.write(i),t.convertTableCell(r),t.write(" ")},customBlock:function(t,e,n){var r=e.node,o=n.delim,i=n.text,a=o,s=a[0],l=a[1];t.write(s),t.ensureNewLine(),t.text(i,!1),t.ensureNewLine(),t.write(l),t.closeBlock(r)},frontMatter:function(t,e,n){var r=e.node,o=n.text;t.text(o,!1),t.closeBlock(r)},widget:function(t,e,n){var r=n.text;t.write(r)},html:function(t,e,n){var r=e.node,o=n.text;t.write(o),r.attrs.htmlBlock&&t.closeBlock(r)},htmlComment:function(t,e,n){var r=e.node,o=n.text;t.write(o),t.closeBlock(r)}};function Mv(t,e){var n=t.text,r=/`+/g,o=0;if(t.isText&&n)for(var i=r.exec(n);i;)o=Math.max(o,i[0].length),i=r.exec(n);for(var a=o>0&&e>0?" `":"`",s=0;s<o;s+=1)a+="`";return o>0&&e<0&&(a+=" "),a}function Nv(t){return t?["<"+t+">","</"+t+">"]:null}function Sv(t){return t?"<"+t+">":null}function Dv(t){return t?"</"+t+">":null}var Lv={heading:function(t){var e=t.node.attrs,n=e.level,r=Ma("#",n);return"setext"===e.headingType&&(r=1===n?"===":"---"),{delim:r,rawHTML:Nv(e.rawHTML)}},codeBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["```"+(n.language||""),"```"],rawHTML:Nv(n.rawHTML),text:r}},blockQuote:function(t){return{delim:"> ",rawHTML:Nv(t.node.attrs.rawHTML)}},bulletList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ul"),{delim:"*",rawHTML:Nv(o)}},orderedList:function(t,e){var n=t.node,r=e.inTable,o=n.attrs.rawHTML;return r&&(o=o||"ol"),{rawHTML:Nv(o)}},listItem:function(t,e){var n=t.node,r=e.inTable,o=n.attrs,i=o.task,a=o.checked,s=n.attrs.rawHTML;return r&&(s=s||"li"),{rawHTML:s?["<"+s+(i?' class="task-list-item'+(a?" checked":"")+'"':"")+(i?" data-task"+(a?" data-task-checked":""):"")+">","</"+s+">"]:null}},table:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableHead:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableBody:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableRow:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableHeadCell:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},tableBodyCell:function(t){return{rawHTML:Nv(t.node.attrs.rawHTML)}},image:function(t){var e=t.node.attrs,n=e.rawHTML,r=e.altText,o=e.imageUrl.replace(/&amp;/g,"&"),i=r?' alt="'+ka(r)+'"':"";return{rawHTML:n?"<"+n+' src="'+ka(o)+'"'+i+">":null,attrs:{altText:Na(r||""),imageUrl:o}}},thematicBreak:function(t){return{delim:"***",rawHTML:Sv(t.node.attrs.rawHTML)}},customBlock:function(t){var e=t.node,n=e.attrs,r=e.textContent;return{delim:["$$"+n.info,"$$"],text:r}},frontMatter:function(t){return{text:t.node.textContent}},widget:function(t){return{text:t.node.textContent}},strong:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="**";return n||(a=o?"<strong>":"</strong>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},emph:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="*";return n||(a=o?"<em>":"</em>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},strike:function(t,e,n){var r=t.node,o=e.entering,i=r.attrs.rawHTML,a="~~";return n||(a=o?"<del>":"</del>"),{delim:a,rawHTML:o?Sv(i):Dv(i)}},link:function(t,e){var n=t.node,r=e.entering,o=n.attrs,i=o.title,a=o.rawHTML,s=o.linkUrl.replace(/&amp;/g,"&"),l=i?' title="'+ka(i)+'"':"";return r?{delim:"[",rawHTML:a?"<"+a+' href="'+ka(s)+'"'+l+">":null}:{delim:"]("+s+(i?" "+Da(Na(i)):"")+")",rawHTML:Dv(a)}},code:function(t,e){var n=t.node,r=t.parent,o=t.index,i=void 0===o?0:o,a=e.entering;return{delim:a?Mv(r.child(i),-1):Mv(r.child(i-1),1),rawHTML:a?Sv(n.attrs.rawHTML):Dv(n.attrs.rawHTML)}},htmlComment:function(t){return{text:t.node.textContent}},html:function(t,e){var n=t.node,r=e.entering,o=n.type.name,i=n.attrs.htmlAttrs,a="<"+o,s="</"+o+">";return Object.keys(i).forEach(function(t){a+=" "+t+'="'+i[t].replace(/"/g,"'")+'"'}),a+=">",n.attrs.htmlInline?{rawHTML:r?a:s}:{text:""+a+n.attrs.childrenHTML+s}}},Ov={strong:{mixable:!0,removedEnclosingWhitespace:!0},emph:{mixable:!0,removedEnclosingWhitespace:!0},strike:{mixable:!0,removedEnclosingWhitespace:!0},code:{escape:!1},link:null,html:null};function Av(t){var e={};return Object.keys(Ev).forEach(function(n){e[n]=function(e,r){if(Ev[n]){var o=t[n],i=o?o(r,{inTable:e.inTable}):{};!function(t,e){var n=e.state,r=e.nodeInfo,o=e.params,i=o.rawHTML;i?Vi(t,["heading","codeBlock"])>-1?function(t,e,n){var r=n[0],o=n[1];t.write(r),t.convertInline(e),t.write(o)}(n,r.node,i):Vi(t,["image","thematicBreak"])>-1?n.write(i):function(t,e,n){var r=e.node,o=e.parent,i=n[0],a=n[1];t.stopNewline=!0,t.write(i),t.convertNode(r),t.write(a),"doc"===(null==o?void 0:o.type.name)&&(t.closeBlock(r),t.stopNewline=!1)}(n,r,i):Ev[t](n,r,o)}(n,{state:e,nodeInfo:r,params:i})}}}),e}var Iv=function(){function t(t){var e=t.nodeTypeConvertors,n=t.markTypeConvertors;this.nodeTypeConvertors=e,this.markTypeConvertors=n,this.delim="",this.result="",this.closed=!1,this.tightList=!1,this.stopNewline=!1,this.inTable=!1}return t.prototype.getMarkConvertor=function(t){var e=t.attrs.htmlInline?"html":t.type.name;return this.markTypeConvertors[e]},t.prototype.isInBlank=function(){return/(^|\n)$/.test(this.result)},t.prototype.isBetweenSpaces=function(t,e){var n,r,o,i=t.content,a=0===e||(o=null!==(n=i.child(e-1).text)&&void 0!==n?n:"a",/(\S*)\s$/g.test(o)),s=e>=i.childCount-1||function(t){return/^\s(\S*)/g.test(t)}(null!==(r=i.child(e+1).text)&&void 0!==r?r:"a");return a&&s},t.prototype.markText=function(t,e,n,r){var o=this.getMarkConvertor(t);if(o){var i=o({node:t,parent:n,index:r},e,this.isBetweenSpaces(n,e?r:r-1)),a=i.delim;return i.rawHTML||a}return""},t.prototype.setDelim=function(t){this.delim=t},t.prototype.getDelim=function(){return this.delim},t.prototype.flushClose=function(t){if(!this.stopNewline&&this.closed){if(this.isInBlank()||(this.result+="\n"),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+=1)this.result+=e+"\n"}this.closed=!1}},t.prototype.wrapBlock=function(t,e,n,r){var o=this.getDelim();this.write(e||t),this.setDelim(this.getDelim()+t),r(),this.setDelim(o),this.closeBlock(n)},t.prototype.ensureNewLine=function(){this.isInBlank()||(this.result+="\n")},t.prototype.write=function(t){void 0===t&&(t=""),this.flushClose(),this.delim&&this.isInBlank()&&(this.result+=this.delim),t&&(this.result+=t)},t.prototype.closeBlock=function(t){this.closed=t},t.prototype.text=function(t,e){void 0===e&&(e=!0);for(var n=t.split("\n"),r=0;r<n.length;r+=1)this.write(),this.result+=e?Sa(n[r]):n[r],r!==n.length-1&&(this.result+="\n")},t.prototype.convertBlock=function(t,e,n){var r=t.type.name,o=this.nodeTypeConvertors[r],i={node:t,parent:e,index:n};t.attrs.htmlBlock?this.nodeTypeConvertors.html(this,i):o&&o(this,i)},t.prototype.convertInline=function(t){var e=this,n=[],r="",o=function(o,i,a){var s=o?o.marks:[],l=r;if(r="",o&&o.isText&&s.some(function(t){var n=e.getMarkConvertor(t),r=n&&n();return r&&r.removedEnclosingWhitespace})&&o&&o.text){var c=/^(\s*)(.*?)(\s*)$/m.exec(o.text),u=c[1],p=c[2],d=c[3];l+=u,r=d,(u||d)&&((o=p?o.withText(p):null)||(s=n))}for(var f=s.length&&Aa(s),h=f&&e.getMarkConvertor(f),m=h&&h(),v=m&&!1===m.escape,g=s.length-(v?1:0),y=0;y<g&&(p=s[y],!m||m.mixable);y+=1)for(var b=0;b<n.length;b+=1){var w=n[b];if(m&&!m.mixable)break;if(p.eq(w)){y>b?s=s.slice(0,b).concat(p).concat(s.slice(b,y)).concat(s.slice(y+1,g)):b>y&&(s=s.slice(0,y).concat(s.slice(y+1,b)).concat(p).concat(s.slice(b,g)));break}}for(var k=0;k<Math.min(n.length,g)&&s[k].eq(n[k]);)k+=1;for(;k<n.length;){var x=n.pop();x&&e.text(e.markText(x,!1,t,a),!1)}if(l&&e.text(l),o){for(;n.length<g;)p=s[n.length],n.push(p),e.text(e.markText(p,!0,t,a),!1);v&&o.isText?e.text(e.markText(f,!0,t,a)+o.text+e.markText(f,!1,t,a+1),!1):e.convertBlock(o,t,a)}};t.forEach(o),o(null,0,t.childCount)},t.prototype.convertList=function(t,e,n){var r,o=this;this.closed&&this.closed.type===t.type?this.flushClose(3):this.tightList&&this.flushClose(1);var i=null===(r=t.attrs.tight)||void 0===r||r,a=this.tightList;this.tightList=i,t.forEach(function(r,a,s){s&&i&&o.flushClose(1),o.wrapBlock(e,n(s),t,function(){return o.convertBlock(r,t,s)})}),this.tightList=a},t.prototype.convertTableCell=function(t){var e=this;this.stopNewline=!0,this.inTable=!0,t.forEach(function(n,r,o){xa(["bulletList","orderedList"],n.type.name)?(e.convertBlock(n,t,o),e.closed=!1):(e.convertInline(n),o<t.childCount-1&&"paragraph"===t.child(o+1).type.name&&e.write("<br>"))}),this.stopNewline=!1,this.inTable=!1},t.prototype.convertNode=function(t,e){var n=this;return t.forEach(function(r,o,i){if(n.convertBlock(r,t,i),(null==e?void 0:e.node)===r){var a=n.result.split("\n");e.setMappedPos([a.length,Aa(a).length+1])}}),this.result},t}(),Rv=function(){function t(t,e,n,r){var o,i=this;this.setMappedPos=function(t){i.mappedPosWhenConverting=t},this.schema=t,this.eventEmitter=r,this.focusedNode=null,this.mappedPosWhenConverting=null,this.toWwConvertors=function(t){var e=Object.keys(t),n=Ni({},Cv),r=new rf({gfm:!0,nodeId:!0,convertors:t}).getConvertors();return e.forEach(function(e){var o=Cv[e];o&&!xa(["htmlBlock","htmlInline"],e)&&(n[e]=function(n,i,a){a.origin=function(){return r[e](i,a,r)};var s,l=t[e](i,a);if(l){var c=Array.isArray(l)?l[0]:l;s={htmlAttrs:c.attributes,classNames:c.classNames}}o(n,i,a,s)})}),n}(n),this.toMdConvertors=(o=e||{},Object.keys(o).forEach(function(t){var e=Lv[t],n=o[t];Lv[t]=e?function(t,r){return r.origin=function(){return e(t,r)},n(t,r)}:n,delete o[t]}),{nodeTypeConvertors:Av(Lv),markTypeConvertors:function(t){var e={};return Object.keys(Ov).forEach(function(n){e[n]=function(e,r,o){var i=Ov[n],a=t[n],s=a&&e&&!Ui(r)?a(e,{entering:r},o):{};return Ni(Ni({},s),i)}}),e}(Lv)}),this.eventEmitter.listen("setFocusedNode",function(t){return i.focusedNode=t})}return t.prototype.getMappedPos=function(){return this.mappedPosWhenConverting},t.prototype.getInfoForPosSync=function(){return{node:this.focusedNode,setMappedPos:this.setMappedPos}},t.prototype.toWysiwygModel=function(t){return new Tv(this.schema,this.toWwConvertors).convertNode(t,this.getInfoForPosSync())},t.prototype.toMarkdownText=function(t){var e=new Iv(this.toMdConvertors).convertNode(t,this.getInfoForPosSync());return this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown",e)},t}();function Pv(t,e,n){return e.listen("mixinTableOffsetMapPrototype",Hh),(null!=t?t:[]).reduce(function(t,r){var o=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:Te,PluginKey:Ne,Selection:oe,TextSelection:se},pmView:{Decoration:Zr,DecorationSet:to},pmModel:{Fragment:l},pmRules:{InputRule:Jo,inputRules:Zo,undoInputRule:Qo},i18n:em};if(Ii(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(r,e,n);if(!o)throw new Error("The return value of the executed plugin is empty.");var i=o.markdownParsers,a=o.toHTMLRenderers,s=o.toMarkdownRenderers,c=o.markdownPlugins,u=o.wysiwygPlugins,p=o.wysiwygNodeViews,d=o.markdownCommands,f=o.wysiwygCommands,h=o.toolbarItems;return a&&(t.toHTMLRenderers=Ra(t.toHTMLRenderers,a)),s&&(t.toMarkdownRenderers=Ra(t.toMarkdownRenderers,s)),c&&(t.mdPlugins=t.mdPlugins.concat(c)),u&&(t.wwPlugins=t.wwPlugins.concat(u)),p&&(t.wwNodeViews=Ni(Ni({},t.wwNodeViews),p)),d&&(t.mdCommands=Ni(Ni({},t.mdCommands),d)),f&&(t.wwCommands=Ni(Ni({},t.wwCommands),f)),h&&(t.toolbarItems=t.toolbarItems.concat(h)),i&&(t.markdownParsers=Ni(Ni({},t.markdownParsers),i)),t},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var Bv=function(){function t(t){var e=this;this.options=Oi({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},t),this.eventEmitter=new dv;var n,r=Ea(this.options.linkAttributes),o=Pv(this.options.plugins,this.eventEmitter,this.options.usageStatistics)||{},i=o.toHTMLRenderers,a=o.markdownParsers,s=this.options,l=s.customHTMLRenderer,c=s.extendedAutolinks,u=s.referenceDefinition,p=s.frontMatter,d=s.customHTMLSanitizer,f={linkAttributes:r,customHTMLRenderer:Ni(Ni({},i),l),extendedAutolinks:c,referenceDefinition:u,frontMatter:p,sanitizer:d||eh};n=f.customHTMLRenderer,["htmlBlock","htmlInline"].forEach(function(t){n[t]&&Object.keys(n[t]).forEach(function(t){return th(t)})}),this.options.events&&Li(this.options.events,function(t,n){e.on(n,t)});var h=this.options,m=h.el,v=h.initialValue,g=h.theme,y=m.innerHTML;"light"!==g&&m.classList.add(Bs(g)),m.innerHTML="",this.toastMark=new Zd("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:c,referenceDefinition:u,disallowDeepHeading:!0,frontMatter:p,customParser:a}),this.preview=new kh(this.eventEmitter,Ni(Ni({},f),{isViewer:!0})),Qc(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),v?this.setMarkdown(v):y&&this.preview.setHTML(y),m.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return t.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&Rs(n,t.offsetX,t.offsetY)&&(zs(e,"checked"),this.eventEmitter.emit("change",{source:"viewer",date:t}))},t.prototype.setMarkdown=function(t){var e=this.toastMark.getLineTexts(),n=[e.length,Aa(e).length+1],r=this.toastMark.editMarkdown([1,1],n,t||"");this.eventEmitter.emit("updatePreview",r)},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.destroy=function(){Gc(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},t.prototype.isViewer=function(){return!0},t.prototype.isMarkdownMode=function(){return!1},t.prototype.isWysiwygMode=function(){return!1},t}();function Fv(t){return t instanceof B}function Hv(t){return xa(["document","blockQuote","bulletList","orderedList","listItem","paragraph","heading","emph","strong","strike","link","image","table","tableHead","tableBody","tableRow","tableHeadCell","tableBodyCell"],t)}var qv={openTag:function(t,e){var n=t,r=n.tagName,o=n.classNames,i=n.attributes,a=document.createElement(r),s={};o&&(a.className=o.join(" ")),i&&(s=Ni(Ni({},s),i)),$s(s,a),e.push(a)},closeTag:function(t,e){if(e.length>1){var n=e.pop();Aa(e).appendChild(n)}},html:function(t,e){Aa(e).insertAdjacentHTML("beforeend",t.content)},text:function(t,e){var n=document.createTextNode(t.content);Aa(e).appendChild(n)}},zv=function(){function t(t,e){var n=ch(t,e),r=Ni(Ni({},e.htmlBlock),e.htmlInline);this.customConvertorKeys=Object.keys(e).concat(Object.keys(r)),this.renderer=new rf({gfm:!0,convertors:Ni(Ni({},n),r)}),this.convertors=this.renderer.getConvertors()}return t.prototype.generateTokens=function(t){var e=function(t){var e=t.attrs,n=t.type.name,r={type:n,wysiwygNode:!0,literal:!Hv(n)&&Fv(t)?t.textContent:null},o={heading:{level:e.level},link:{destination:e.linkUrl,title:e.title},image:{destination:e.imageUrl},codeBlock:{info:e.language},bulletList:{type:"list",listData:{type:"bullet"}},orderedList:{type:"list",listData:{type:"ordered",start:e.order}},listItem:{type:"item",listData:{task:e.task,checked:e.checked}},tableHeadCell:{type:"tableCell",cellType:"head",align:e.align},tableBodyCell:{type:"tableCell",cellType:"body",align:e.align},customBlock:{info:e.info}}[n],i=Ni(Ni({},r),o),a=t.attrs,s=a.htmlAttrs,l=a.childrenHTML;return s?Ni(Ni({},i),{attrs:s,childrenHTML:l}):i}(t),n={entering:!0,leaf:!!Fv(t)&&t.isLeaf,options:this.renderer.getOptions(),getChildrenText:function(){return Fv(t)?t.textContent:""},skipChildren:function(){return!1}},r=this.convertors[t.type.name],o=r(e,n,this.convertors),i=Ii(o)?o:[o];return(Hv(t.type.name)||t.attrs.htmlInline)&&(n.entering=!1,i.push({type:"text",content:Fv(t)?t.textContent:""}),i=i.concat(r(e,n,this.convertors))),i},t.prototype.toDOMNode=function(t){var e=this.generateTokens(t),n=[];return e.forEach(function(t){return qv[t.type](t,n)}),n[0]},t.prototype.getToDOMNode=function(t){return xa(this.customConvertorKeys,t)?this.toDOMNode.bind(this):null},t}(),_v=null,jv=null;function Vv(t,e){var n=e.syncScrollTop,r=e.releaseEventBlock;jv&&clearTimeout(jv),n(t),jv=setTimeout(function(){r()},15)}var Uv=function(){function t(t,e,n){this.latestEditorScrollTop=null,this.latestPreviewScrollTop=null,this.blockedScroll=null,this.active=!0,this.timer=null;var r=e.previewContent,o=e.el;this.previewRoot=r,this.previewEl=o,this.mdEditor=t,this.editorView=t.view,this.toastMark=t.getToastMark(),this.eventEmitter=n,this.addScrollSyncEvent()}return t.prototype.addScrollSyncEvent=function(){var t=this;this.eventEmitter.listen("afterPreviewRender",function(){t.clearTimer(),t.timer=setTimeout(function(){t.syncPreviewScrollTop(!0)},200)}),this.eventEmitter.listen("scroll",function(e,n){t.active&&("editor"===e&&"editor"!==t.blockedScroll?t.syncPreviewScrollTop():"preview"===e&&"preview"!==t.blockedScroll&&t.syncEditorScrollTop(n))}),this.eventEmitter.listen("toggleScrollSync",function(e){t.active=e})},t.prototype.getMdNodeAtPos=function(t,e){var n=t.content.findIndex(e.pos).index;return this.toastMark.findFirstNodeAtLine(n+1)},t.prototype.getScrollTopByCaretPos=function(){var t=this.mdEditor.getSelection(),e=this.toastMark.findFirstNodeAtLine(t[0][0]),n=this.previewEl.clientHeight,r=gh(this.previewRoot,e).el,o=(mh(r,this.previewRoot)||r.offsetTop)+r.clientHeight-.5*n;return this.latestEditorScrollTop=null,r.getBoundingClientRect().top-this.previewEl.getBoundingClientRect().top<n?null:o},t.prototype.syncPreviewScrollTop=function(t){void 0===t&&(t=!1);var e=this,n=e.editorView,r=e.previewEl,o=e.previewRoot,i=n.dom.getBoundingClientRect(),a=i.left,s=i.top,l=n.posAtCoords({left:a,top:s}),c=n.state.doc,u=this.getMdNodeAtPos(c,l);if(u&&!function(t){var e=t.type;return"htmlBlock"===e||"htmlInline"===e}(u)){var p=r.scrollTop,d=n.dom,f=d.scrollTop,h=d.scrollHeight,m=d.clientHeight,v=d.children,g=h-f<=m+18,y=g?r.scrollHeight:0;if(f&&!g){if(t){var b=this.getScrollTopByCaretPos();if(!b)return;y=b}else{var w=gh(this.previewRoot,u),k=w.el,x=fh(c,w.mdNode,v),C=x.height,T=x.rect;y=(mh(k,o)||k.offsetTop)+k.clientHeight*(s>T.top?Math.min((s-T.top)/C,1):0)}y=this.getResolvedScrollTop("editor",f,y,p),this.latestEditorScrollTop=f}y!==p&&this.run("editor",y,p)}},t.prototype.syncEditorScrollTop=function(t){var e=this,n=e.toastMark,r=e.editorView,o=e.previewRoot,i=e.previewEl,a=r.dom,s=r.state,l=i.scrollTop,c=i.clientHeight,u=i.scrollHeight-l<=c,p=a.scrollTop,d=u?a.scrollHeight:0;if(l&&t&&!u){if(t=function(t,e){for(;!t.getAttribute("data-nodeid")&&t.parentElement!==e;)t=t.parentElement;return t}(t,o),!t.getAttribute("data-nodeid"))return;var f=a.children,h=Number(t.getAttribute("data-nodeid")),m=gh(this.previewRoot,n.findNodeById(h)),v=m.mdNode,g=m.el;d=f[Ga(v)-1].offsetTop;var y=fh(s.doc,v,f).height,b=function(t,e,n){var r,o=yh[r=n]&&yh[r].height,i=function(t){return yh[t]&&yh[t].offsetTop}(n),a=o||t.clientHeight,s=i||mh(t,e)||t.offsetTop;return o||function(t,e){yh[t]=yh[t]||{},yh[t].height=e}(n,a),i||function(t,e){yh[t]=yh[t]||{},yh[t].offsetTop=e}(n,s),{nodeHeight:a,offsetTop:s}}(g,o,h),w=b.nodeHeight;d+=function(t,e,n,r){return Math.min((t-e)/n,1)*r}(l,b.offsetTop,w,y),d=this.getResolvedScrollTop("preview",l,d,p),this.latestPreviewScrollTop=l}d!==p&&this.run("preview",d,p)},t.prototype.getResolvedScrollTop=function(t,e,n,r){var o="editor"===t?this.latestEditorScrollTop:this.latestPreviewScrollTop;return null===o?n:o<e?Math.max(n,r):Math.min(n,r)},t.prototype.run=function(t,e,n){var r,o=this;"editor"===t?(r=this.previewEl,this.blockedScroll="preview"):(r=this.editorView.dom,this.blockedScroll="editor"),function(t,e,n){var r=e-t,o=Date.now(),i=function(){var a,s=(Date.now()-o)/100;_v&&clearTimeout(_v),s<1?(a=t+r*Math.cos((1-s)*Math.PI/2),Vv(Math.ceil(a),n),_v=setTimeout(i,1)):(Vv(e,n),_v=null)};i()}(n,e,{syncScrollTop:function(t){return r.scrollTop=t},releaseEventBlock:function(){return o.blockedScroll=null}})},t.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},t.prototype.destroy=function(){this.clearTimer(),this.eventEmitter.removeEventHandler("scroll"),this.eventEmitter.removeEventHandler("afterPreviewRender")},t}(),$v={getPopupInitialValues:function(t,e){return"link"===e.popupName?{linkText:t.getSelectedText()}:{}}},Wv=function(){function t(t){var e=this;this.initialHTML=t.el.innerHTML,t.el.innerHTML="",this.options=Oi({previewStyle:"tab",previewHighlight:!0,initialEditType:"markdown",height:"300px",minHeight:"200px",language:"en-US",useCommandShortcut:!0,usageStatistics:!0,toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","image","link"],["code","codeblock"],["scrollSync"]],hideModeSwitch:!1,linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,customMarkdownRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,widgetRules:[],theme:"light",autofocus:!0},t);var n=this.options,r=n.customHTMLRenderer,o=n.extendedAutolinks,i=n.referenceDefinition,a=n.frontMatter,s=n.customMarkdownRenderer,l=n.useCommandShortcut,c=n.initialEditType,u=n.widgetRules,p=n.customHTMLSanitizer;this.mode=c||"markdown",this.mdPreviewStyle=this.options.previewStyle,this.i18n=em,this.i18n.setCode(this.options.language),this.eventEmitter=new dv,(cs=u).forEach(function(t,e){us["widget"+e]=t});var d=Ea(this.options.linkAttributes);this.pluginInfo=Pv(this.options.plugins,this.eventEmitter,this.options.usageStatistics);var f,h=this.pluginInfo,m=h.toHTMLRenderers,v=h.toMarkdownRenderers,g=h.mdPlugins,y=h.wwPlugins,b=h.wwNodeViews,w=h.mdCommands,k=h.wwCommands,x=h.markdownParsers,C={linkAttributes:d,customHTMLRenderer:Ra(m,r),extendedAutolinks:o,referenceDefinition:i,frontMatter:a,sanitizer:p||eh},T=new zv(d,C.customHTMLRenderer),E=function(t,e,n){var r={nodes:{},marks:{}};return["htmlBlock","htmlInline"].forEach(function(o){t[o]&&Object.keys(t[o]).forEach(function(t){var i="htmlBlock"===o?"nodes":"marks";th(t),r[i][t]=ah[o](t,e,n)})}),r}(C.customHTMLRenderer,C.sanitizer,T);this.toastMark=new Zd("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:o,referenceDefinition:i,disallowDeepHeading:!0,frontMatter:a,customParser:x}),this.mdEditor=new qc(this.eventEmitter,{toastMark:this.toastMark,useCommandShortcut:l,mdPlugins:g}),this.preview=new kh(this.eventEmitter,Ni(Ni({},C),{isViewer:!1,highlight:this.options.previewHighlight})),this.wwEditor=new sv(this.eventEmitter,{toDOMAdaptor:T,useCommandShortcut:l,htmlSchemaMap:E,linkAttributes:d,wwPlugins:y,wwNodeViews:b}),this.convertor=new Rv(this.wwEditor.getSchema(),Ni(Ni({},v),s),ch(d,C.customHTMLRenderer),this.eventEmitter),this.setMinHeight(this.options.minHeight),this.setHeight(this.options.height),this.setMarkdown(this.options.initialValue,!1),this.options.placeholder&&this.setPlaceholder(this.options.placeholder),this.options.initialValue||this.setHTML(this.initialHTML,!1),this.commandManager=new fv(this.eventEmitter,this.mdEditor.commands,this.wwEditor.commands,function(){return e.mode}),this.options.usageStatistics&&function(t,e){var n=location.hostname,r="TOAST UI "+t+" for "+n+": Statistics",o=window.localStorage.getItem(r);(ca(window.tui)||!1!==window.tui.usageStatistics)&&(o&&!function(t){/* @__PURE__ */
2
2
  return(new Date).getTime()-t>6048e5}(o)||(window.localStorage.setItem(r,/* @__PURE__ */(new Date).getTime()),setTimeout(function(){"interactive"!==document.readyState&&"complete"!==document.readyState||ua("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:n,dp:n,dh:t,el:t,ec:"use"})},1e3)))}("editor","UA-129966929-1"),this.scrollSync=new Uv(this.mdEditor,this.preview,this.eventEmitter),this.addInitEvent(),this.addInitCommand(w,k),(f=this).eventEmitter.listen("query",function(t,e){return $v[t](f,e)}),this.options.hooks&&Li(this.options.hooks,function(t,n){return e.addHook(n,t)}),this.options.events&&Li(this.options.events,function(t,n){return e.on(n,t)}),this.eventEmitter.emit("load",this),this.moveCursorToStart(this.options.autofocus)}return t.prototype.addInitEvent=function(){var t=this;this.on("needChangeMode",this.changeMode.bind(this)),this.on("loadUI",function(){if("auto"!==t.height){var e=Math.min(parseInt(t.minHeight,10),parseInt(t.height,10)-75)+"px";t.setMinHeight(e)}}),this.eventEmitter.listen("addImageBlobHook",function(t,e){var n=new FileReader;n.onload=function(t){var n=t.target;return e(n.result)},n.readAsDataURL(t)})},t.prototype.addInitCommand=function(t,e){var n=this,r=function(t,e){Object.keys(e).forEach(function(r){n.addCommand(t,r,e[r])})};this.addCommand("markdown","toggleScrollSync",function(t){return n.eventEmitter.emit("toggleScrollSync",t.active),!0}),r("markdown",t),r("wysiwyg",e)},t.prototype.getCurrentModeEditor=function(){return this.isMarkdownMode()?this.mdEditor:this.wwEditor},t.factory=function(e){return e.viewer?new Bv(e):new t(e)},t.setLanguage=function(t,e){em.setLanguage(t,e)},t.prototype.changePreviewStyle=function(t){this.mdPreviewStyle!==t&&(this.mdPreviewStyle=t,this.eventEmitter.emit("changePreviewStyle",t))},t.prototype.exec=function(t,e){this.commandManager.exec(t,e)},t.prototype.addCommand=function(t,e,n){var r=this;this.commandManager.addCommand(t,e,function(e){void 0===e&&(e={});var o=("markdown"===t?r.mdEditor:r.wwEditor).view;n(e,o.state,o.dispatch,o)})},t.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},t.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},t.prototype.removeHook=function(t){this.eventEmitter.removeEventHandler(t)},t.prototype.focus=function(){this.getCurrentModeEditor().focus()},t.prototype.blur=function(){this.getCurrentModeEditor().blur()},t.prototype.moveCursorToEnd=function(t){void 0===t&&(t=!0),this.getCurrentModeEditor().moveCursorToEnd(t)},t.prototype.moveCursorToStart=function(t){void 0===t&&(t=!0),this.getCurrentModeEditor().moveCursorToStart(t)},t.prototype.setMarkdown=function(t,e){if(void 0===t&&(t=""),void 0===e&&(e=!0),this.mdEditor.setMarkdown(t,e),this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r,e)}},t.prototype.setHTML=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!0);var n=document.createElement("div");n.innerHTML=function(t){var e=t.replace(/<p><br\s*\/*><\/p>/gi,"<p></p>"),n=new RegExp(Ds,"ig"),r=e.match(n);return null==r||r.forEach(function(t,n){if(Os.test(t)){var o=Is;if(n){var i=r[n-1].match(Ss);if(i&&!/br/i.test(i[1])){var a=i[1];o="</"+a+"><"+a+">"}}e=e.replace(Os,o)}}),e}(t);var r=st.fromSchema(this.wwEditor.schema).parse(n);this.isMarkdownMode()?this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),e):this.wwEditor.setModel(r,e)},t.prototype.getMarkdown=function(){return this.isMarkdownMode()?this.mdEditor.getMarkdown():this.convertor.toMarkdownText(this.wwEditor.getModel())},t.prototype.getHTML=function(){var t=this;this.eventEmitter.holdEventInvoke(function(){if(t.isMarkdownMode()){var e=t.toastMark.getRootNode(),n=t.convertor.toWysiwygModel(e);t.wwEditor.setModel(n)}});var e=this.wwEditor.view.dom.innerHTML;if(this.placeholder){var n=new RegExp('<span class="placeholder[^>]+>'+this.placeholder+"</span>","i");return e.replace(n,"")}return e},t.prototype.insertText=function(t){this.getCurrentModeEditor().replaceSelection(t)},t.prototype.setSelection=function(t,e){this.getCurrentModeEditor().setSelection(t,e)},t.prototype.replaceSelection=function(t,e,n){this.getCurrentModeEditor().replaceSelection(t,e,n)},t.prototype.deleteSelection=function(t,e){this.getCurrentModeEditor().deleteSelection(t,e)},t.prototype.getSelectedText=function(t,e){return this.getCurrentModeEditor().getSelectedText(t,e)},t.prototype.getRangeInfoOfNode=function(t){return this.getCurrentModeEditor().getRangeInfoOfNode(t)},t.prototype.addWidget=function(t,e,n){this.getCurrentModeEditor().addWidget(t,e,n)},t.prototype.replaceWithWidget=function(t,e,n){this.getCurrentModeEditor().replaceWithWidget(t,e,n)},t.prototype.setHeight=function(t){var e=this.options.el;Ai(t)&&("auto"===t?ta(e,"auto-height"):ia(e,"auto-height"),this.setMinHeight(this.getMinHeight())),_i(e,{height:t}),this.height=t},t.prototype.getHeight=function(){return this.height},t.prototype.setMinHeight=function(t){if(t!==this.minHeight){var e=this.height||this.options.height;"auto"!==e&&this.options.el.querySelector("."+Bs("main"))&&(t=Math.min(parseInt(t,10),parseInt(e,10)-75)+"px");var n=parseInt(t,10);this.minHeight=t,this.wwEditor.setMinHeight(n),this.mdEditor.setMinHeight(n),this.preview.setMinHeight(n)}},t.prototype.getMinHeight=function(){return this.minHeight},t.prototype.isMarkdownMode=function(){return"markdown"===this.mode},t.prototype.isWysiwygMode=function(){return"wysiwyg"===this.mode},t.prototype.isViewer=function(){return!1},t.prototype.getCurrentPreviewStyle=function(){return this.mdPreviewStyle},t.prototype.changeMode=function(t,e){if(this.mode!==t){if(this.mode=t,this.isWysiwygMode()){var n=this.toastMark.getRootNode(),r=this.convertor.toWysiwygModel(n);this.wwEditor.setModel(r)}else r=this.wwEditor.getModel(),this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r),!e);if(this.eventEmitter.emit("removePopupWidget"),this.eventEmitter.emit("changeMode",t),!e){var o=this.convertor.getMappedPos();this.focus(),this.isWysiwygMode()&&aa(o)?this.wwEditor.setSelection(o):Array.isArray(o)&&this.mdEditor.setSelection(o)}}},t.prototype.destroy=function(){var t=this;this.wwEditor.destroy(),this.mdEditor.destroy(),this.preview.destroy(),this.scrollSync.destroy(),this.eventEmitter.emit("destroy"),this.eventEmitter.getEvents().forEach(function(e,n){return t.off(n)})},t.prototype.hide=function(){this.eventEmitter.emit("hide")},t.prototype.show=function(){this.eventEmitter.emit("show")},t.prototype.setScrollTop=function(t){this.getCurrentModeEditor().setScrollTop(t)},t.prototype.getScrollTop=function(){return this.getCurrentModeEditor().getScrollTop()},t.prototype.reset=function(){this.wwEditor.setModel([]),this.mdEditor.setMarkdown("")},t.prototype.getSelection=function(){return this.getCurrentModeEditor().getSelection()},t.prototype.setPlaceholder=function(t){this.placeholder=t,this.mdEditor.setPlaceholder(t),this.wwEditor.setPlaceholder(t)},t.prototype.getEditorElements=function(){return{mdEditor:this.mdEditor.getElement(),mdPreview:this.preview.getElement(),wwEditor:this.wwEditor.getElement()}},t.prototype.convertPosToMatchEditorMode=function(t,e,n){var r,o;void 0===e&&(e=t),void 0===n&&(n=this.mode);var i=this.mdEditor.view.state.doc,a=Array.isArray(t),s=Array.isArray(e),l=t,c=e;if(a!==s)throw new Error("Types of arguments must be same");return"markdown"!==n||a||s?"wysiwyg"===n&&a&&s&&(l=(o=pl(i,t,e))[0],c=o[1]):(l=(r=cl(i,t,e))[0],c=r[1]),[l,c]},t}(),Gv=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.walk=function(){var t=this.entering,e=this.current;return e?(t?e.firstChild?(this.current=e.firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:e.next?(this.current=e.next,this.entering=!0):(this.current=e.parent,this.entering=!1),{vnode:e,entering:t}):null},t}(),Kv=function(){function t(t,e,n){this.parent=null,this.old=null,this.firstChild=null,this.next=null,this.skip=!1,this.type=t,this.props=e,this.children=n,this.props.children=n,e.ref&&(this.ref=e.ref,delete e.ref),e.key&&(this.key=e.key,delete e.key)}return t.prototype.walker=function(){return new Gv(this)},t.removalNodes=[],t}();function Jv(t,e){var n,r,o=t;"boolean"==typeof(r=t)||r instanceof Boolean||null==t?o=null:(Ai(t)||aa(t))&&(n=String(t),o=new Kv("TEXT_NODE",{nodeValue:n},[])),o&&e.push(o)}var Zv=function(t){for(var e,n,r=arguments,o=1,i="",a="",s=[0],l=function(t){1===o&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(t?r[t]:i):3===o&&(t||i)?(s[1]=t?r[t]:i,o=2):2===o&&"..."===i&&t?s[2]=Fa(s[2]||{},r[t]):2===o&&i&&!t?(s[2]=s[2]||{})[i]=!0:o>=5&&(5===o?((s[2]=s[2]||{})[n]=t?i?i+r[t]:r[t]:i,o=6):(t||i)&&(s[2][n]+=t?i+r[t]:i)),i=""},c=0;c<t.length;c++){c&&(1===o&&l(),l(c));for(let r=0;r<t[c].length;r++)e=t[c][r],1===o?"<"===e?(l(),s=[s,"",null],o=3):i+=e:4===o?"--"===i&&">"===e?(o=1,i=""):i=e+i[0]:a?e===a?a="":i+=e:'"'===e||"'"===e?a=e:">"===e?(l(),o=1):o&&("="===e?(o=5,n=i,i=""):"/"===e&&(o<5||">"===t[c][r+1])?(l(),3===o&&(s=s[0]),o=s,(s=s[0]).push(this.apply(null,o.slice(1))),o=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(l(),o=2):i+=e),3===o&&"!--"===i&&(o=4,s=s[0])}return l(),s.length>2?s.slice(1):s[1]}.bind(function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=[];return n.forEach(function(t){Array.isArray(t)?t.forEach(function(t){Jv(t,o)}):Jv(t,o)}),new Kv(t,e||{},o)});function Xv(t){var e;return"TEXT_NODE"===t.type?e=document.createTextNode(t.props.nodeValue):tg(e=document.createElement(t.type),{},t.props),e}function Qv(t,e){t.node?e.removeChild(t.node):Qv(t.firstChild,e)}var Yv=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function tg(t,e,n,r){Object.keys(n).forEach(function(o){if(!r||r(o))if(/^on/.test(o)){var i=o.slice(2).toLowerCase();t.addEventListener(i,n[o])}else"nodeValue"===o?t[o]=n[o]:"style"===o&&(a=n[o])===Object(a)?function(t,e,n){e&&Object.keys(e).forEach(function(e){t.style[e]=""}),Object.keys(n).forEach(function(e){var r=n[e];t.style[e]=aa(r)&&!Yv.test(e)?r+"px":r})}(t,e[o],n[o]):"children"!==o&&(!1===n[o]?t.removeAttribute(o):t.setAttribute(o,n[o]));var a})}function eg(t){if(Kv.removalNodes.forEach(function(t){return rg(t)}),t)for(var e=void 0,n=t.walker();e=n.walk();)if(t=e.vnode,e.entering)rg(t);else if(nl(t.type)){var r=t.component;if(!t.old&&r.mounted&&r.mounted(),t.old&&r.updated){var o=r.prevProps||{};r.updated(o)}}}function ng(t){for(var e=t.parent;!e.node;)e=e.parent;return e.node}function rg(t){if(t&&t.parent){if(t.node){var e=ng(t);"A"===t.effect?e.appendChild(t.node):"U"===t.effect&&(i=t.node,a=t.old.props,s=t.props,Object.keys(a).forEach(function(t){if(/^on/.test(t)){if(!s[t]||a[t]!==s[t]){var e=t.slice(2).toLowerCase();i.removeEventListener(e,a[t])}}else"children"===t||s[t]||function(t){return(null==t?void 0:t.nodeType)===Node.TEXT_NODE}(i)||i.removeAttribute(t)}),tg(i,a,s,function(t){return!Oa(a[t],s[t])}))}if("D"===t.effect)for(var n=void 0,r=t.walker();n=r.walk();)if(t=n.vnode,!n.entering)if(nl(t.type)){var o=t.component;o.beforeDestroy&&o.beforeDestroy()}else Qv(t,e=ng(t));t.ref&&(t.component?t.ref(t.component):t.node&&t.ref(t.node))}var i,a,s}function og(t,e){var n=e.props,r=e.component;return r?(r.prevProps=r.props,r.props=e.props,r):new t(n)}function ig(t){for(var e=t;t&&!t.skip;){if(nl(t.type)){var n=og(t.type,t);n.vnode=t,t.component=n,t.props.children=t.children=[n.render()],ag(t)}else t.node||(t.node=Xv(t)),ag(t);if(t.firstChild)t=t.firstChild;else{for(;t&&t.parent&&!t.next&&(t=t.parent)!==e;);t=t.next}}}function ag(t){var e=t.children,n=t.old?t.old.firstChild:null,r=null;e.forEach(function(e,o){var i=function(t,e){return t&&e&&e.type===t.type&&(!e.key||e.key===t.key)}(n,e);i&&(e.old=n,e.parent=t,e.node=n.node,e.component=n.component,e.effect="U"),e&&!i&&(e.old=null,e.parent=t,e.node=null,e.effect="A"),n&&!i&&(Kv.removalNodes.push(n),n.effect="D"),n&&(n=n.next),0===o?t.firstChild=e:e&&(r.next=e),r=e});var o=Aa(e);if(!e.length)for(;n;)Kv.removalNodes.push(n),n.effect="D",n=n.next;for(;n&&o;)n&&o.old!==n&&(Kv.removalNodes.push(n),n.effect="D",n=n.next)}var sg,lg=function(){function t(t){this.props=t,this.state={},this.refs={}}return t.prototype.setState=function(t){var e=Ni(Ni({},this.state),t);Oa(this.state,e)||(this.state=e,function(t){var e=t.vnode;e.effect="U",e.old=e,e.next&&(e.next.skip=!0),Kv.removalNodes=[],ig(e),eg(e),e.next&&(e.next.skip=!1)}(this))},t}(),cg=function(t){function e(e){var n=t.call(this,e)||this;return n.state={hide:!1},n}return Mi(e,t),e.prototype.show=function(){this.setState({hide:!1})},e.prototype.hide=function(){this.setState({hide:!0})},e.prototype.render=function(){var t=this.props,e=t.editorType,n=t.eventEmitter;return Zv(sg||(sg=Di(['\n <div class="','" style="display: ','">\n <div\n class="tab-item','"\n onClick=',"\n >\n ",'\n </div>\n <div\n class="tab-item','"\n onClick=',"\n >\n ","\n </div>\n </div>\n "],['\n <div class="','" style="display: ','">\n <div\n class="tab-item','"\n onClick=',"\n >\n ",'\n </div>\n <div\n class="tab-item','"\n onClick=',"\n >\n ","\n </div>\n </div>\n "])),Bs("mode-switch"),this.state.hide?"none":"block","markdown"===e?" active":"",function(){n.emit("needChangeMode","markdown")},em.get("Markdown"),"wysiwyg"===e?" active":"",function(){n.emit("needChangeMode","wysiwyg")},em.get("WYSIWYG"))},e}(lg),ug=function(t,e){var n,r,o,i,a=!0,s=function(e){t.apply(null,e),n=null};function l(){if(i=Array.prototype.slice.call(arguments),a)return s(i),void(a=!1);o=Number(/* @__PURE__ */new Date),n=n||o,r(i),o-n>=e&&s(i)}return r=function(t,e){var n,r;return e=e||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout(function(){t.apply(null,r)},e)}}(s,e=e||0),l.reset=function(){a=!0,n=null},l},pg=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];t.call(e,o[1],o[0])}},e}()}(),dg="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,fg="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),hg="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(fg):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},mg=["top","right","bottom","left","width","height","size","weight"],vg="undefined"!=typeof MutationObserver,gg=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t){var e=!1,n=!1,r=0;function o(){e&&(e=!1,t()),n&&a()}function i(){hg(o)}function a(){var t=Date.now();if(e){if(t-r<2)return;n=!0}else e=!0,n=!1,setTimeout(i,20);r=t}return a}(this.refresh.bind(this))}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},t.prototype.connect_=function(){dg&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),vg?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){dg&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e,r=mg.some(function(t){return!!~n.indexOf(t)});r&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),yg=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},bg=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||fg},wg=Eg(0,0,0,0);function kg(t){return parseFloat(t)||0}function xg(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(e,n){return e+kg(t["border-"+n+"-width"])},0)}var Cg="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof bg(t).SVGGraphicsElement}:function(t){return t instanceof bg(t).SVGElement&&"function"==typeof t.getBBox};function Tg(t){return dg?Cg(t)?function(t){var e=t.getBBox();return Eg(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return wg;var r=bg(t).getComputedStyle(t),o=function(t){for(var e={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],i=t["padding-"+o];e[o]=kg(i)}return e}(r),i=o.left+o.right,a=o.top+o.bottom,s=kg(r.width),l=kg(r.height);if("border-box"===r.boxSizing&&(Math.round(s+i)!==e&&(s-=xg(r,"left","right")+i),Math.round(l+a)!==n&&(l-=xg(r,"top","bottom")+a)),!function(t){return t===bg(t).document.documentElement}(t)){var c=Math.round(s+i)-e,u=Math.round(l+a)-n;1!==Math.abs(c)&&(s-=c),1!==Math.abs(u)&&(l-=u)}return Eg(o.left,o.top,s,l)}(t):wg}function Eg(t,e,n,r){return{x:t,y:e,width:n,height:r}}var Mg=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Eg(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=Tg(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),Ng=
3
3
  /* @__PURE__ */function(){return function(t,e){var n=function(t){var e=t.x,n=t.y,r=t.width,o=t.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,a=Object.create(i.prototype);return yg(a,{x:e,y:n,width:r,height:o,top:n,right:e+r,bottom:o+n,left:e}),a}(e);yg(this,{target:t,contentRect:n})}}(),Sg=function(){function t(t,e,n){if(this.activeObservations_=[],this.observations_=new pg,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof bg(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Mg(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof bg(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new Ng(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Dg="undefined"!=typeof WeakMap?/* @__PURE__ */new WeakMap:new pg,Lg=
4
4
  /* @__PURE__ */function(){return function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=gg.getInstance(),r=new Sg(e,n,this);Dg.set(this,r)}}();["observe","unobserve","disconnect"].forEach(function(t){Lg.prototype[t]=function(){var e;return(e=Dg.get(this))[t].apply(e,arguments)}});var Og,Ag,Ig,Rg,Pg,Bg,Fg,Hg,qg,zg,_g,jg,Vg,Ug,$g,Wg,Gg=void 0!==fg.ResizeObserver?fg.ResizeObserver:Lg,Kg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),e.prototype.execCommand=function(t){var e=Vs(t.target,"li");this.props.execCommand("heading",{level:Number(e.getAttribute("data-level"))})},e.prototype.render=function(){var t=this;return Zv(Ag||(Ag=Di(["\n <ul\n onClick=",'\n aria-role="menu"\n aria-label="','"\n >\n ','\n <li data-type="Paragraph" aria-role="menuitem">\n <div>',"</div>\n </li>\n </ul>\n "],["\n <ul\n onClick=",'\n aria-role="menu"\n aria-label="','"\n >\n ','\n <li data-type="Paragraph" aria-role="menuitem">\n <div>',"</div>\n </li>\n </ul>\n "])),function(e){return t.execCommand(e)},em.get("Headings"),[1,2,3,4,5,6].map(function(t){return Zv(Og||(Og=Di(['\n <li data-level="','" data-type="Heading" aria-role="menuitem">\n <',">"," ","</$>\n </li>\n "],['\n <li data-level="','" data-type="Heading" aria-role="menuitem">\n <',">"," ","</$>\n </li>\n "])),t,"h"+t,em.get("Heading"),t)}),em.get("Paragraph"))},e}(lg),Jg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),e.prototype.toggleTab=function(t,e){this.props.onClick(t,e)},e.prototype.render=function(){var t=this;return Zv(Rg||(Rg=Di(['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "],['\n <div class="','" aria-role="tabpanel">\n ',"\n </div>\n "])),Bs("tabs"),this.props.tabs.map(function(e){var n=e.name,r=e.text,o=t.props.activeTab===n;return Zv(Ig||(Ig=Di(['\n <div\n class="tab-item','"\n onClick=','\n aria-role="tab"\n aria-label="','"\n aria-selected="','"\n tabindex="','"\n >\n ',"\n </div>\n "],['\n <div\n class="tab-item','"\n onClick=','\n aria-role="tab"\n aria-label="','"\n aria-selected="','"\n tabindex="','"\n >\n ',"\n </div>\n "])),o?" active":"",function(e){return t.toggleTab(e,n)},em.get(r),o?"true":"false",o?"0":"-1",em.get(r))}))},e}(lg),Zg=function(t){function e(e){var n=t.call(this,e)||this;return n.initialize=function(t){void 0===t&&(t="file");var e=n.refs.url;e.value="",n.refs.altText.value="",n.refs.file.value="",ia(e,"wrong"),n.setState({activeTab:t,file:null,fileNameElClassName:""})},n.execCommand=function(){"file"===n.state.activeTab?n.emitAddImageBlob():n.emitAddImage()},n.toggleTab=function(t,e){e!==n.state.activeTab&&n.initialize(e)},n.showFileSelectBox=function(){n.refs.file.click()},n.changeFile=function(t){var e=t.target.files;(null==e?void 0:e.length)&&n.setState({file:e[0]})},n.state={activeTab:"file",file:null,fileNameElClassName:""},n.tabs=[{name:"file",text:"File"},{name:"url",text:"URL"}],n}return Mi(e,t),e.prototype.emitAddImageBlob=function(){var t=this,e=this.refs.file.files,n=this.refs.altText,r=" wrong";if(null==e?void 0:e.length){r="";var o=e.item(0);this.props.eventEmitter.emit("addImageBlobHook",o,function(e,r){return t.props.execCommand("addImage",{imageUrl:e,altText:r||n.value})},"ui")}this.setState({fileNameElClassName:r})},e.prototype.emitAddImage=function(){var t=this.refs.url,e=this.refs.altText,n=t.value,r=e.value||"image";ia(t,"wrong"),n.length?n&&this.props.execCommand("addImage",{imageUrl:n,altText:r}):ta(t,"wrong")},e.prototype.preventSelectStart=function(t){t.preventDefault()},e.prototype.updated=function(){this.props.show||this.initialize()},e.prototype.render=function(){var t=this,e=this.state,n=e.activeTab,r=e.file,o=e.fileNameElClassName;return Zv(Pg||(Pg=Di(['\n <div aria-label="','">\n <'," tabs="," activeTab="," onClick=",' />\n <div style="display:','">\n <label for="toastuiImageUrlInput">','</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=','\n />\n </div>\n <div style="display:',';position: relative;">\n <label for="toastuiImageFileInput">','</label>\n <span\n class="',"",'"\n onClick=',"\n onSelectstart=","\n >\n ",'\n </span>\n <button\n type="button"\n class="','"\n onClick=',"\n >\n ",'\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=',"\n ref=",'\n />\n </div>\n <label for="toastuiAltTextInput">','</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "],['\n <div aria-label="','">\n <'," tabs="," activeTab="," onClick=",' />\n <div style="display:','">\n <label for="toastuiImageUrlInput">','</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=','\n />\n </div>\n <div style="display:',';position: relative;">\n <label for="toastuiImageFileInput">','</label>\n <span\n class="',"",'"\n onClick=',"\n onSelectstart=","\n >\n ",'\n </span>\n <button\n type="button"\n class="','"\n onClick=',"\n >\n ",'\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=',"\n ref=",'\n />\n </div>\n <label for="toastuiAltTextInput">','</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "])),em.get("Insert image"),Jg,this.tabs,n,this.toggleTab,"url"===n?"block":"none",em.get("Image URL"),function(e){return t.refs.url=e},"file"===n?"block":"none",em.get("Select image file"),Bs("file-name"),r?" has-file":o,this.showFileSelectBox,this.preventSelectStart,r?r.name:em.get("No file"),Bs("file-select-button"),this.showFileSelectBox,em.get("Choose a file"),this.changeFile,function(e){return t.refs.file=e},em.get("Description"),function(e){return t.refs.altText=e},Bs("button-container"),Bs("close-button"),this.props.hidePopup,em.get("Cancel"),Bs("ok-button"),this.execCommand,em.get("OK"))},e}(lg),Xg=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.execCommand=function(){var t=e.refs.url,n=e.refs.text;ia(t,"wrong"),ia(n,"wrong"),t.value.length<1?ta(t,"wrong"):Ui(e.props.initialValues.linkUrl)&&n.value.length<1?ta(n,"wrong"):e.props.execCommand("addLink",{linkUrl:t.value,linkText:n.value})},e}return Mi(e,t),e.prototype.initialize=function(){var t=this.props.initialValues,e=t.linkUrl,n=t.linkText,r=this.refs.url,o=this.refs.text;ia(r,"wrong"),ia(o,"wrong","disabled"),o.removeAttribute("disabled"),e&&(ta(o,"disabled"),o.setAttribute("disabled","disabled")),r.value=e||"",o.value=n||""},e.prototype.mounted=function(){this.initialize()},e.prototype.updated=function(t){!t.show&&this.props.show&&this.initialize()},e.prototype.render=function(){var t=this;return Zv(Bg||(Bg=Di(['\n <div aria-label="','">\n <label for="toastuiLinkUrlInput">','</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=','\n />\n <label for="toastuiLinkTextInput">','</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "],['\n <div aria-label="','">\n <label for="toastuiLinkUrlInput">','</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=','\n />\n <label for="toastuiLinkTextInput">','</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=','\n />\n <div class="','">\n <button type="button" class="','" onClick=',">\n ",'\n </button>\n <button type="button" class="','" onClick=',">\n ","\n </button>\n </div>\n </div>\n "])),em.get("Insert link"),em.get("URL"),function(e){return t.refs.url=e},em.get("Link text"),function(e){return t.refs.text=e},Bs("button-container"),Bs("close-button"),this.props.hidePopup,em.get("Cancel"),Bs("ok-button"),this.execCommand,em.get("OK"))},e}(lg),Qg=function(t){function e(e){var n=t.call(this,e)||this;return n.extendSelectionRange=function(t){var e=t.pageX,r=t.pageY,o=e-n.offsetRect.left,i=r-n.offsetRect.top,a=n.getSelectionRangeByOffset(o,i);n.setState(Ni({},a))},n.execCommand=function(){n.props.execCommand("addTable",{rowCount:n.state.rowIdx+1,columnCount:n.state.colIdx+1})},n.state={rowIdx:-1,colIdx:-1},n}return Mi(e,t),e.prototype.getDescription=function(){return-1===this.state.colIdx?"":this.state.colIdx+1+" x "+(this.state.rowIdx+1)},e.prototype.getBoundByRange=function(t,e){return{width:20*(t+1),height:20*(e+1)}},e.prototype.getRangeByOffset=function(t,e){return{colIdx:Math.floor(t/20),rowIdx:Math.floor(e/20)}},e.prototype.getTableRange=function(){var t=this.state,e=t.colIdx,n=t.rowIdx,r=Math.max(e,5),o=Math.max(n,5);return e>=5&&r<9&&(r+=1),n>=5&&o<14&&(o+=1),{colIdx:r+1,rowIdx:o+1}},e.prototype.getSelectionAreaBound=function(){var t=this.getBoundByRange(this.state.colIdx,this.state.rowIdx),e=t.width,n=t.height;return e||n?{width:e-1,height:n-1,display:"block"}:{display:"none"}},e.prototype.getSelectionRangeByOffset=function(t,e){var n=this.getRangeByOffset(t,e);return n.rowIdx=Math.min(Math.max(n.rowIdx,1),14),n.colIdx=Math.min(Math.max(n.colIdx,1),9),n},e.prototype.updated=function(){if(this.props.show){if(-1===this.state.colIdx&&-1===this.state.rowIdx){var t=this.refs.tableEl.getBoundingClientRect(),e=t.left,n=t.top;this.offsetRect={left:window.pageXOffset+e,top:window.pageYOffset+n}}}else this.setState({colIdx:-1,rowIdx:-1})},e.prototype.createTableArea=function(t){for(var e=t.colIdx,n=t.rowIdx,r=[],o=0;o<n;o+=1){for(var i=[],a=0;a<e;a+=1){var s=Bs("table-cell")+(o>0?"":" header");i.push(Zv(Fg||(Fg=Di(['<div class="','"></div>'],['<div class="','"></div>'])),s))}r.push(Zv(Hg||(Hg=Di(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Bs("table-row"),i))}return Zv(qg||(qg=Di(['<div class="','">',"</div>"],['<div class="','">',"</div>"])),Bs("table"),r)},e.prototype.render=function(){var t=this,e=this.getTableRange(),n=this.getSelectionAreaBound();return Zv(zg||(zg=Di(['\n <div aria-label="','">\n <div\n class="','"\n ref=',"\n onMousemove=","\n onClick=","\n >\n ",'\n <div class="','" style=','></div>\n </div>\n <p class="','">',"</p>\n </div>\n "],['\n <div aria-label="','">\n <div\n class="','"\n ref=',"\n onMousemove=","\n onClick=","\n >\n ",'\n <div class="','" style=','></div>\n </div>\n <p class="','">',"</p>\n </div>\n "])),em.get("Insert table"),Bs("table-selection"),function(e){return t.refs.tableEl=e},this.extendSelectionRange,this.execCommand,this.createTableArea(e),Bs("table-selection-layer"),n,Bs("table-description"),this.getDescription())},e}(lg),Yg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),e.prototype.mounted=function(){this.refs.el.appendChild(this.props.body)},e.prototype.updated=function(t){this.refs.el.replaceChild(this.props.body,t.body)},e.prototype.render=function(){var t=this;return Zv(_g||(_g=Di(["<div ref=","></div>"],["<div ref=","></div>"])),function(e){return t.refs.el=e})},e}(lg);function ty(t){return Ai(t)?function(t){var e;switch(t){case"heading":e={name:"heading",className:"heading",tooltip:em.get("Headings"),state:"heading"};break;case"bold":e={name:"bold",className:"bold",command:"bold",tooltip:em.get("Bold"),state:"strong"};break;case"italic":e={name:"italic",className:"italic",command:"italic",tooltip:em.get("Italic"),state:"emph"};break;case"strike":e={name:"strike",className:"strike",command:"strike",tooltip:em.get("Strike"),state:"strike"};break;case"hr":e={name:"hr",className:"hrline",command:"hr",tooltip:em.get("Line"),state:"thematicBreak"};break;case"quote":e={name:"quote",className:"quote",command:"blockQuote",tooltip:em.get("Blockquote"),state:"blockQuote"};break;case"ul":e={name:"ul",className:"bullet-list",command:"bulletList",tooltip:em.get("Unordered list"),state:"bulletList"};break;case"ol":e={name:"ol",className:"ordered-list",command:"orderedList",tooltip:em.get("Ordered list"),state:"orderedList"};break;case"task":e={name:"task",className:"task-list",command:"taskList",tooltip:em.get("Task"),state:"taskList"};break;case"table":e={name:"table",className:"table",tooltip:em.get("Insert table"),state:"table"};break;case"image":e={name:"image",className:"image",tooltip:em.get("Insert image")};break;case"link":e={name:"link",className:"link",tooltip:em.get("Insert link")};break;case"code":e={name:"code",className:"code",command:"code",tooltip:em.get("Code"),state:"code"};break;case"codeblock":e={name:"codeblock",className:"codeblock",command:"codeBlock",tooltip:em.get("Insert CodeBlock"),state:"codeBlock"};break;case"indent":e={name:"indent",className:"indent",command:"indent",tooltip:em.get("Indent"),state:"indent"};break;case"outdent":e={name:"outdent",className:"outdent",command:"outdent",tooltip:em.get("Outdent"),state:"outdent"};break;case"scrollSync":e=function(){var t=document.createElement("label"),e=document.createElement("input"),n=document.createElement("span");t.className="scroll-sync active",e.type="checkbox",e.checked=!0,n.className="switch";return t.appendChild(e),t.appendChild(n),{name:"scrollSync",el:t,onMounted:function(n){return e.addEventListener("change",function(e){var r=e.target.checked;r?ta(t,"active"):ia(t,"active"),n("toggleScrollSync",{active:r})})}}}();break;case"more":e={name:"more",className:"more",tooltip:em.get("More")}}return"scrollSync"!==e.name&&(e.className+=" "+Bs("toolbar-icons")),e}(t):t}function ey(t,e){var n=e.el,r=e.pos,o=e.popup,i=e.initialValues;switch(t){case"heading":return{render:function(t){return Zv(jg||(jg=Di(["<"," ..."," />"],["<"," ..."," />"])),Kg,t)},className:Bs("popup-add-heading"),fromEl:n,pos:r};case"link":return{render:function(t){return Zv(Vg||(Vg=Di(["<"," ..."," />"],["<"," ..."," />"])),Xg,t)},className:Bs("popup-add-link"),fromEl:n,pos:r,initialValues:i};case"image":return{render:function(t){return Zv(Ug||(Ug=Di(["<"," ..."," />"],["<"," ..."," />"])),Zg,t)},className:Bs("popup-add-image"),fromEl:n,pos:r};case"table":return{render:function(t){return Zv($g||($g=Di(["<"," ..."," />"],["<"," ..."," />"])),Qg,t)},className:Bs("popup-add-table"),fromEl:n,pos:r};case"customPopupBody":return o?Ni({render:function(t){return Zv(Wg||(Wg=Di(["<"," ..."," body="," />"],["<"," ..."," body="," />"])),Yg,t,o.body)},fromEl:n,pos:r},o):null;default:return null}}function ny(t){t.hidden=t.length===t.filter(function(t){return t.hidden}).length}var ry,oy,iy=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleMousedown=function(t){Vs(t.target,"."+Bs("popup"))||Vs(t.target,e.props.info.fromEl)||e.props.hidePopup()},e}return Mi(e,t),e.prototype.mounted=function(){document.addEventListener("mousedown",this.handleMousedown),this.props.eventEmitter.listen("closePopup",this.props.hidePopup)},e.prototype.beforeDestroy=function(){document.removeEventListener("mousedown",this.handleMousedown)},e.prototype.updated=function(t){var e=this.props,n=e.show,r=e.info;if(n&&r.pos&&t.show!==n){var o=Ni({},r.pos),i=this.refs.el.offsetWidth,a=Vs(this.refs.el,"."+Bs("toolbar")).offsetWidth;o.left+i>=a&&(o.left=a-i-20),Oa(this.state.popupPos,o)||this.setState({popupPos:o})}},e.prototype.render=function(){var t=this,e=this.props,n=e.info,r=e.show,o=e.hidePopup,i=e.eventEmitter,a=e.execCommand,s=n||{},l=s.className,c=void 0===l?"":l,u=s.style,p=s.render,d=s.initialValues,f=void 0===d?{}:d,h=Ni(Ni({display:r?"block":"none"},u),this.state.popupPos);return Zv(ry||(ry=Di(['\n <div\n class="'," ",'"\n style=',"\n ref=",'\n aria-role="dialog"\n >\n <div class="','">\n ',"\n </div>\n </div>\n "],['\n <div\n class="'," ",'"\n style=',"\n ref=",'\n aria-role="dialog"\n >\n <div class="','">\n ',"\n </div>\n </div>\n "])),Bs("popup"),c,h,function(e){return t.refs.el=e},Bs("popup-body"),p&&p({eventEmitter:i,show:r,hidePopup:o,execCommand:a,initialValues:f}))},e}(lg);function ay(t){return function(e){function n(t){var n=e.call(this,t)||this;return n.showTooltip=function(t){var e=n.props.item.tooltip;if(!n.props.disabled&&e){var r=n.getBound(t),o=r.left+6+"px",i=r.top+6+"px";_i(n.props.tooltipRef.current,{display:"block",left:o,top:i}),n.props.tooltipRef.current.querySelector(".text").textContent=e}},n.hideTooltip=function(){_i(n.props.tooltipRef.current,"display","none")},n.state={active:!1,disabled:t.disabled},n.addEvent(),n}return Mi(n,e),n.prototype.addEvent=function(){var t=this,e=this.props,n=e.item,r=e.eventEmitter;n.state&&r.listen("changeToolbarState",function(e){var r,o=null!==(r=e.toolbarState[n.state])&&void 0!==r?r:{},i=o.active,a=o.disabled;t.setState({active:!!i,disabled:null!=a?a:t.props.disabled})})},n.prototype.getBound=function(t){var e=Us(t,Vs(t,"."+Bs("toolbar"))),n=e.offsetLeft,r=e.offsetTop;return{left:n,top:t.offsetHeight+r}},n.prototype.render=function(){return Zv(oy||(oy=Di(["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n disabled=","\n />\n "],["\n <","\n ...","\n active=","\n showTooltip=","\n hideTooltip=","\n getBound=","\n disabled=","\n />\n "])),t,this.props,this.state.active,this.showTooltip,this.hideTooltip,this.getBound,this.state.disabled||this.props.disabled)},n}(lg)}var sy,ly,cy,uy,py,dy,fy,hy,my,vy,gy,yy,by,wy,ky=ay(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.execCommand=function(){var t=e.props,n=t.item,r=t.execCommand,o=t.setPopupInfo,i=t.getBound,a=t.eventEmitter,s=n.command,l=n.name,c=n.popup;if(s)r(s);else{var u=c?"customPopupBody":l,p=a.emit("query","getPopupInitialValues",{popupName:u})[0],d=ey(u,{el:e.refs.el,pos:i(e.refs.el),popup:c,initialValues:p});d&&o(d)}},e}return Mi(e,t),e.prototype.mounted=function(){this.setItemWidth()},e.prototype.updated=function(t){t.item.name!==this.props.item.name&&this.setItemWidth()},e.prototype.setItemWidth=function(){var t=this.props,e=t.setItemWidth,n=t.item;e&&e(n.name,js(this.refs.el)+(n.hidden?80:0))},e.prototype.render=function(){var t=this,e=this.props,n=e.hideTooltip,r=e.disabled,o=e.item,i=e.active,a=Ni({display:o.hidden?"none":null},o.style),s=(o.className||"")+(i?" active":"");return Zv(sy||(sy=Di(["\n <button\n ref=",'\n type="button"\n style=',"\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=","\n aria-label=","\n >\n ","\n </button>\n "],["\n <button\n ref=",'\n type="button"\n style=',"\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=","\n aria-label=","\n >\n ","\n </button>\n "])),function(e){return t.refs.el=e},a,s,this.execCommand,this.showTooltip,n,!!r,o.text||o.tooltip||"",o.text||"")},e}(lg)),xy=ay(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.showTooltip=function(){e.props.showTooltip(e.refs.el)},e.showPopup=function(){var t=ey("customPopupBody",{el:e.refs.el,pos:e.props.getBound(e.refs.el),popup:e.props.item.popup});t&&e.props.setPopupInfo(t)},e}return Mi(e,t),e.prototype.mounted=function(){var t=this.props,e=t.setItemWidth,n=t.item;this.refs.el.appendChild(n.el),e&&e(n.name,js(this.refs.el)),n.onMounted&&n.onMounted(this.props.execCommand)},e.prototype.updated=function(t){var e,n=this.props,r=n.item,o=n.active,i=n.disabled;t.active===o&&t.disabled===i||null===(e=r.onUpdated)||void 0===e||e.call(r,{active:o,disabled:i})},e.prototype.render=function(){var t=this,e=this.props,n=e.disabled,r={display:e.item.hidden?"none":"inline-block"},o=function(t){return n?null:t};return Zv(ly||(ly=Di(["\n <div\n ref=","\n style=","\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n ></div>\n "],["\n <div\n ref=","\n style=","\n class=","\n onClick=","\n onMouseover=","\n onMouseout=","\n ></div>\n "])),function(e){return t.refs.el=e},r,Bs("toolbar-item-wrapper"),o(this.showPopup),o(this.showTooltip),o(this.props.hideTooltip))},e}(lg)),Cy=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mi(e,t),e.prototype.render=function(){var t=this,e=this.props,n=e.group,r=e.hiddenDivider,o=n.hidden?{display:"none"}:null,i=r?{display:"none"}:null;return Zv(uy||(uy=Di(['\n <div class="','" style=',">\n ",'\n <div class="','" style=',"></div>\n </div>\n "],['\n <div class="','" style=',">\n ",'\n <div class="','" style=',"></div>\n </div>\n "])),Bs("toolbar-group"),o,n.map(function(e){var n=e.el?xy:ky;return Zv(cy||(cy=Di(["<"," key="," ..."," item="," />"],["<"," key="," ..."," item="," />"])),n,e.name,t.props,e)}),Bs("toolbar-divider"),i)},e}(lg),Ty=ay(function(t){function e(e){var n=t.call(this,e)||this;return n.handleClickDocument=function(t){var e=t.target;Vs(e,"."+Bs("dropdown-toolbar"))||Vs(e,".more")||n.setState({showDropdown:!1,dropdownPos:null})},n.showTooltip=function(){n.props.showTooltip(n.refs.el)},n.state={showDropdown:!1,dropdownPos:null},n}return Mi(e,t),e.prototype.getBound=function(){var t=this.props.getBound(this.refs.el);return t.top+=4,Ni(Ni({},t),{left:null,right:10})},e.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},e.prototype.updated=function(){this.state.showDropdown&&!this.state.dropdownPos&&this.setState({dropdownPos:this.getBound()})},e.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},e.prototype.render=function(){var t=this,e=this.state,n=e.showDropdown,r=e.dropdownPos,o=this.props,i=o.disabled,a=o.item,s=o.items,l=o.hideTooltip,c=s.filter(function(t){return!t.hidden}),u=c.length?null:{display:"none"},p=n?null:{display:"none"};return Zv(dy||(dy=Di(['\n <div class="','" style=',">\n <button\n ref=",'\n type="button"\n class=',"\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=",'\n ></button>\n <div\n class="','"\n style=',"\n ref=","\n >\n ","\n </div>\n </div>\n "],['\n <div class="','" style=',">\n <button\n ref=",'\n type="button"\n class=',"\n onClick=","\n onMouseover=","\n onMouseout=","\n disabled=",'\n ></button>\n <div\n class="','"\n style=',"\n ref=","\n >\n ","\n </div>\n </div>\n "])),Bs("toolbar-group"),u,function(e){return t.refs.el=e},a.className,function(){return t.setState({showDropdown:!0})},this.showTooltip,l,i,Bs("dropdown-toolbar"),Ni(Ni({},p),r),function(e){return t.refs.dropdownEl=e},c.length?c.map(function(e,n){var r;return Zv(py||(py=Di(["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n ...","\n />\n "])),Cy,e,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),t.props)}):null)},e}(lg)),Ey=function(t){function e(e){var n,r,o=t.call(this,e)||this;return o.toggleTab=function(t,e){var n=o.props.eventEmitter;if(o.state.activeTab!==e){var r="write"===e?"changePreviewTabWrite":"changePreviewTabPreview";n.emit(r),o.setState({activeTab:e})}},o.setItemWidth=function(t,e){o.itemWidthMap[t]=e},o.setPopupInfo=function(t){o.setState({showPopup:!0,popupInfo:t})},o.openPopup=function(t,e){void 0===e&&(e={});var n=o.refs.el.querySelector("."+Bs("toolbar-group")+" ."+t);if(n){var r=Us(n,Vs(n,"."+Bs("toolbar"))),i=r.offsetLeft,a=r.offsetTop,s=ey(t,{el:n,pos:{left:i,top:n.offsetHeight+a},initialValues:e});s&&o.setPopupInfo(s)}},o.hidePopup=function(){o.state.showPopup&&o.setState({showPopup:!1})},o.execCommand=function(t,e){o.props.eventEmitter.emit("command",t,e),o.hidePopup()},o.tabs=[{name:"write",text:"Write"},{name:"preview",text:"Preview"}],o.itemWidthMap={},o.initialItems=(n=e.toolbarItems||[],r=o.hiddenScrollSync(),n.reduce(function(t,e){t.push(e.map(function(t){return function(t){return t.hidden="scrollSync"===t.name&&r,t}(ty(t))}));var n=t[(t.length||1)-1];return n&&ny(n),t},[])),o.state={items:o.initialItems,dropdownItems:[],showPopup:!1,popupInfo:{},activeTab:"write"},o.tooltipRef={current:null},o.resizeObserver=new Gg(function(){return o.handleResize()}),o.addEvent(),o}return Mi(e,t),e.prototype.insertToolbarItem=function(t,e){var n=t.groupIndex,r=t.itemIndex,o=this.initialItems[n];e=ty(e),o?o.splice(r,0,e):this.initialItems.push([e]),this.setState(this.classifyToolbarItems())},e.prototype.removeToolbarItem=function(t){var e=this;Ri(this.initialItems,function(n){var r=!1;return Ri(n,function(o,i){return o.name!==t||(r=!0,n.splice(i,1),e.setState(e.classifyToolbarItems()),!1)}),!r})},e.prototype.addEvent=function(){var t=this,e=this.props.eventEmitter;this.handleResize=ug(function(){t.setState({items:t.initialItems,dropdownItems:[]}),t.setState(t.classifyToolbarItems())},200),e.listen("openPopup",this.openPopup)},e.prototype.appendTooltipToRoot=function(){var t='<div class="'+Bs("tooltip")+'" style="display:none">\n <div class="arrow"></div>\n <span class="text"></span>\n </div>';this.tooltipRef.current=_s(t,this.refs.el)},e.prototype.hiddenScrollSync=function(){return"wysiwyg"===this.props.editorType||"tab"===this.props.previewStyle},e.prototype.movePrevItemToDropdownToolbar=function(t,e,n,r){var o=function(t){var e=t.pop();e&&r.push(e)};if(t>1)o(n);else{var i=Aa(e);i&&o(i)}},e.prototype.classifyToolbarItems=function(){var t=this,e=0,n=this.refs.el.clientWidth,r=this.refs.el.querySelector("."+Bs("toolbar-divider")),o=r?js(r):0,i=[],a=[],s=!1;return this.initialItems.forEach(function(r,l){var c=[],u=[];r.forEach(function(r,o){r.hidden||((e+=t.itemWidthMap[r.name])>n-50?(s||(t.movePrevItemToDropdownToolbar(o,i,c,u),s=!0),u.push(r)):c.push(r))}),c.length&&(ny(c),i.push(c)),u.length&&(ny(u),a.push(u)),l<t.state.items.length-1&&(e+=o)}),{items:i,dropdownItems:a}},e.prototype.mounted=function(){"tab"===this.props.previewStyle&&this.props.eventEmitter.emit("changePreviewTabWrite",!0),this.setState(this.classifyToolbarItems()),this.appendTooltipToRoot(),this.resizeObserver.observe(this.refs.el)},e.prototype.updated=function(t){var e,n,r=this.props,o=r.editorType,i=r.previewStyle,a=r.eventEmitter,s=i!==t.previewStyle,l=o!==t.editorType;if(s||l){e=this.initialItems,n=this.hiddenScrollSync(),e.forEach(function(t){t.forEach(function(t){return t.hidden="scrollSync"===t.name&&n}),ny(t)});var c=this.classifyToolbarItems();(s||"tab"===i&&"markdown"===o)&&(a.emit("changePreviewTabWrite"),c.activeTab="write"),this.setState(c)}},e.prototype.beforeDestroy=function(){window.removeEventListener("resize",this.handleResize),this.resizeObserver.disconnect(),qs(this.tooltipRef.current)},e.prototype.render=function(){var t=this,e=this.props,n=e.previewStyle,r=e.eventEmitter,o=e.editorType,i=this.state,a=i.popupInfo,s=i.showPopup,l=i.activeTab,c=i.items,u=i.dropdownItems,p={eventEmitter:r,tooltipRef:this.tooltipRef,disabled:"markdown"===o&&"tab"===n&&"preview"===l,execCommand:this.execCommand,setPopupInfo:this.setPopupInfo},d="tab"===n?{borderTopLeftRadius:0}:null;return Zv(hy||(hy=Di(['\n <div class="','">\n <div\n class="','"\n style="display: ','"\n >\n <'," tabs="," activeTab="," onClick=",' />\n </div>\n <div\n class="','"\n ref=',"\n style=","\n >\n ","\n <","\n item=","\n items=","\n ...","\n />\n </div>\n <","\n info=","\n show=","\n eventEmitter=","\n hidePopup=","\n execCommand=","\n />\n </div>\n "],['\n <div class="','">\n <div\n class="','"\n style="display: ','"\n >\n <'," tabs="," activeTab="," onClick=",' />\n </div>\n <div\n class="','"\n ref=',"\n style=","\n >\n ","\n <","\n item=","\n items=","\n ...","\n />\n </div>\n <","\n info=","\n show=","\n eventEmitter=","\n hidePopup=","\n execCommand=","\n />\n </div>\n "])),Bs("toolbar"),Bs("md-tab-container"),"wysiwyg"===o||"vertical"===n?"none":"block",Jg,this.tabs,l,this.toggleTab,Bs("defaultUI-toolbar"),function(e){return t.refs.el=e},d,c.map(function(e,n){var r;return Zv(fy||(fy=Di(["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "],["\n <","\n group=","\n hiddenDivider=","\n setItemWidth=","\n ...","\n />\n "])),Cy,e,n===c.length-1||(null===(r=c[n+1])||void 0===r?void 0:r.hidden),t.setItemWidth,p)}),Ty,ty("more"),u,p,iy,a,s,r,this.hidePopup,this.execCommand)},e}(lg),My=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClickDocument=function(t){Vs(t.target,"."+Bs("context-menu"))||n.setState({pos:null})},n.state={pos:null,menuGroups:[]},n.addEvent(),n}return Mi(e,t),e.prototype.addEvent=function(){var t=this;this.props.eventEmitter.listen("contextmenu",function(e){var n=e.pos,r=e.menuGroups;t.setState({pos:n,menuGroups:r})})},e.prototype.mounted=function(){document.addEventListener("click",this.handleClickDocument)},e.prototype.beforeDestroy=function(){document.removeEventListener("click",this.handleClickDocument)},e.prototype.getMenuGroupElements=function(){var t=this,e=this.state,n=e.pos,r=e.menuGroups;return n?r.reduce(function(e,n){var r=[];return n.forEach(function(e){var n=e.label,o=e.className,i=void 0!==o&&o,a=e.disabled,s=e.onClick;r.push(Zv(my||(my=Di(["\n <li\n onClick=",'\n class="menu-item','"\n aria-role="menuitem"\n >\n <span class="','">',"</span>\n </li>\n "],["\n <li\n onClick=",'\n class="menu-item','"\n aria-role="menuitem"\n >\n <span class="','">',"</span>\n </li>\n "])),function(){a||(s(),t.setState({pos:null}))},a?" disabled":"",i,n))}),e.push(Zv(vy||(vy=Di(['<ul class="menu-group">\n ',"\n </ul>"],['<ul class="menu-group">\n ',"\n </ul>"])),r)),e},[]):[]},e.prototype.render=function(){var t=Ni({display:this.state.pos?"block":"none"},this.state.pos);return Zv(gy||(gy=Di(['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"],['<div class="','" style=',' aria-role="menu">\n ',"\n </div>"])),Bs("context-menu"),t,this.getMenuGroupElements())},e}(lg),Ny=function(t){function e(e){var n=t.call(this,e)||this;n.changeMode=function(t){t!==n.state.editorType&&n.setState({editorType:t})},n.changePreviewStyle=function(t){t!==n.state.previewStyle&&n.setState({previewStyle:t})},n.hide=function(){n.setState({hide:!0})},n.show=function(){n.setState({hide:!1})};var r=e.editorType,o=e.previewStyle;return n.state={editorType:r,previewStyle:o,hide:!1},n.addEvent(),n}return Mi(e,t),e.prototype.mounted=function(){var t=this.props.slots,e=t.wwEditor,n=t.mdEditor,r=t.mdPreview;this.refs.wwContainer.appendChild(e),this.refs.mdContainer.insertAdjacentElement("afterbegin",n),this.refs.mdContainer.appendChild(r)},e.prototype.insertToolbarItem=function(t,e){this.toolbar.insertToolbarItem(t,e)},e.prototype.removeToolbarItem=function(t){this.toolbar.removeToolbarItem(t)},e.prototype.render=function(){var t=this,e=this.props,n=e.eventEmitter,r=e.hideModeSwitch,o=e.toolbarItems,i=e.theme,a=this.state,s=a.hide,l=a.previewStyle,c=a.editorType,u=s?" hidden":"",p=Bs("markdown"===c?"md-mode":"ww-mode"),d=Bs("md")+"-"+l+"-style",f=Bs(["light"!==i,i+" "]);return Zv(by||(by=Di(['\n <div\n class="',"","",'"\n ref=',"\n >\n <","\n ref=","\n eventEmitter=","\n previewStyle=","\n toolbarItems=","\n editorType=",'\n />\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','">\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','"></div>\n </div>\n <div\n class="','"\n ref=',"\n />\n </div>\n </div>\n ","\n <"," eventEmitter="," />\n </div>\n "],['\n <div\n class="',"","",'"\n ref=',"\n >\n <","\n ref=","\n eventEmitter=","\n previewStyle=","\n toolbarItems=","\n editorType=",'\n />\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','">\n <div\n class="'," ",'"\n ref=','\n >\n <div class="','"></div>\n </div>\n <div\n class="','"\n ref=',"\n />\n </div>\n </div>\n ","\n <"," eventEmitter="," />\n </div>\n "])),f,Bs("defaultUI"),u,function(e){return t.refs.el=e},Ey,function(e){return t.toolbar=e},n,l,o,c,Bs("main"),p,function(e){return t.refs.editorSection=e},Bs("main-container"),Bs("md-container"),d,function(e){return t.refs.mdContainer=e},Bs("md-splitter"),Bs("ww-container"),function(e){return t.refs.wwContainer=e},!r&&Zv(yy||(yy=Di(["<"," eventEmitter="," editorType="," />"],["<"," eventEmitter="," editorType="," />"])),cg,n,c),My,n)},e.prototype.addEvent=function(){var t=this.props.eventEmitter;t.listen("hide",this.hide),t.listen("show",this.show),t.listen("changeMode",this.changeMode),t.listen("changePreviewStyle",this.changePreviewStyle)},e}(lg),Sy=function(t){function e(e){var n,r,o=t.call(this,e)||this,i=function(t,e){var n=new Kv(t.tagName.toLowerCase(),{},[e]);return n.node=t,Kv.removalNodes=[],ig(n),eg(n),function(){return function(t){t.effect="D",Kv.removalNodes=[t],eg(),Kv.removalNodes=[]}(n.firstChild)}}(o.options.el,Zv(wy||(wy=Di(["\n <","\n ref=","\n eventEmitter=","\n slots=","\n hideModeSwitch=","\n toolbarItems=","\n previewStyle=","\n editorType=","\n theme=","\n />\n "],["\n <","\n ref=","\n eventEmitter=","\n slots=","\n hideModeSwitch=","\n toolbarItems=","\n previewStyle=","\n editorType=","\n theme=","\n />\n "])),Ny,function(t){return r=t},o.eventEmitter,o.getEditorElements(),o.options.hideModeSwitch,o.options.toolbarItems,o.options.previewStyle,o.options.initialEditType,o.options.theme));return o.setMinHeight(o.options.minHeight),o.setHeight(o.options.height),o.defaultUI={insertToolbarItem:r.insertToolbarItem.bind(r),removeToolbarItem:r.removeToolbarItem.bind(r),destroy:i},null===(n=o.pluginInfo.toolbarItems)||void 0===n||n.forEach(function(t){var e=t.groupIndex,n=t.itemIndex,r=t.item;o.defaultUI.insertToolbarItem({groupIndex:e,itemIndex:n},r)}),o.eventEmitter.emit("loadUI",o),o}return Mi(e,t),e.factory=function(t){return t.viewer?new Bv(t):new e(t)},e.prototype.insertToolbarItem=function(t,e){this.defaultUI.insertToolbarItem(t,e)},e.prototype.removeToolbarItem=function(t){this.defaultUI.removeToolbarItem(t)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.defaultUI.destroy()},e}(Wv);Wv.setLanguage(["en","en-US"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Write",Preview:"Preview",Headings:"Headings",Paragraph:"Paragraph",Bold:"Bold",Italic:"Italic",Strike:"Strike",Code:"Inline code",Line:"Line",Blockquote:"Blockquote","Unordered list":"Unordered list","Ordered list":"Ordered list",Task:"Task",Indent:"Indent",Outdent:"Outdent","Insert link":"Insert link","Insert CodeBlock":"Insert codeBlock","Insert table":"Insert table","Insert image":"Insert image",Heading:"Heading","Image URL":"Image URL","Select image file":"Select image file","Choose a file":"Choose a file","No file":"No file",Description:"Description",OK:"OK",More:"More",Cancel:"Cancel",File:"File",URL:"URL","Link text":"Link text","Add row to up":"Add row to up","Add row to down":"Add row to down","Add column to left":"Add column to left","Add column to right":"Add column to right","Remove row":"Remove row","Remove column":"Remove column","Align column to left":"Align column to left","Align column to center":"Align column to center","Align column to right":"Align column to right","Remove table":"Remove table","Would you like to paste as table?":"Would you like to paste as table?","Text color":"Text color","Auto scroll enabled":"Auto scroll enabled","Auto scroll disabled":"Auto scroll disabled","Choose language":"Choose language"});var Dy={exports:{}},Ly=/* @__PURE__ */n.getAugmentedNamespace(ii),Oy=/* @__PURE__ */n.getAugmentedNamespace(kt),Ay=/* @__PURE__ */n.getAugmentedNamespace(Se),Iy=/* @__PURE__ */n.getAugmentedNamespace(yo);!function(){var t;self,t=function(t,e,n,r){return function(){var o={368:function(t){t.exports=function(){var t=Object.hasOwnProperty,e=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,o=Object.getOwnPropertyDescriptor,i=Object.freeze,a=Object.seal,s=Object.create,l="undefined"!=typeof Reflect&&Reflect,c=l.apply,u=l.construct;c||(c=function(t,e,n){return t.apply(e,n)}),i||(i=function(t){return t}),a||(a=function(t){return t}),u||(u=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var p=k(Array.prototype.forEach),d=k(Array.prototype.pop),f=k(Array.prototype.push),h=k(String.prototype.toLowerCase),m=k(String.prototype.match),v=k(String.prototype.replace),g=k(String.prototype.indexOf),y=k(String.prototype.trim),b=k(RegExp.prototype.test),w=function(t){return function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return u(t,n)}}(TypeError);function k(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return c(t,e,r)}}function x(t,r){e&&e(t,null);for(var o=r.length;o--;){var i=r[o];if("string"==typeof i){var a=h(i);a!==i&&(n(r)||(r[o]=a),i=a)}t[i]=!0}return t}function C(e){var n=s(null),r=void 0;for(r in e)c(t,e,[r])&&(n[r]=e[r]);return n}function T(t,e){for(;null!==t;){var n=o(t,e);if(n){if(n.get)return k(n.get);if("function"==typeof n.value)return k(n.value)}t=r(t)}return function(t){return null}}var E=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),M=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),S=i(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),D=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),L=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),O=i(["#text"]),A=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),I=i(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),R=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),P=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),F=a(/<%[\s\S]*|[\s\S]*%>/gm),H=a(/^data-[\-\w.\u00B7-\uFFFF]/),q=a(/^aria-[\-\w]+$/),z=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_=a(/^(?:\w+script|data):/i),j=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),V="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};function U(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}return function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,n=function(e){return t(e)};if(n.version="2.3.3",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,o=e.document,a=e.DocumentFragment,s=e.HTMLTemplateElement,l=e.Node,c=e.Element,u=e.NodeFilter,k=e.NamedNodeMap,$=void 0===k?e.NamedNodeMap||e.MozNamedAttrMap:k,W=e.Text,G=e.Comment,K=e.DOMParser,J=e.trustedTypes,Z=c.prototype,X=T(Z,"cloneNode"),Q=T(Z,"nextSibling"),Y=T(Z,"childNodes"),tt=T(Z,"parentNode");if("function"==typeof s){var et=o.createElement("template");et.content&&et.content.ownerDocument&&(o=et.content.ownerDocument)}var nt=function(t,e){if("object"!==(void 0===t?"undefined":V(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:function(t){return t}})}catch(i){return null}}(J,r),rt=nt&&Pt?nt.createHTML(""):"",ot=o,it=ot.implementation,at=ot.createNodeIterator,st=ot.createDocumentFragment,lt=ot.getElementsByTagName,ct=r.importNode,ut={};try{ut=C(o).documentMode?o.documentMode:{}}catch(ge){}var pt={};n.isSupported="function"==typeof tt&&it&&void 0!==it.createHTMLDocument&&9!==ut;var dt=B,ft=F,ht=H,mt=q,vt=_,gt=j,yt=z,bt=null,wt=x({},[].concat(U(E),U(M),U(N),U(D),U(O))),kt=null,xt=x({},[].concat(U(A),U(I),U(R),U(P))),Ct=null,Tt=null,Et=!0,Mt=!0,Nt=!1,St=!1,Dt=!1,Lt=!1,Ot=!1,At=!1,It=!1,Rt=!0,Pt=!1,Bt=!0,Ft=!0,Ht=!1,qt={},zt=null,_t=x({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),jt=null,Vt=x({},["audio","video","img","source","image","track"]),Ut=null,$t=x({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Wt="http://www.w3.org/1998/Math/MathML",Gt="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml",Jt=Kt,Zt=!1,Xt=void 0,Qt=["application/xhtml+xml","text/html"],Yt=void 0,te=null,ee=o.createElement("form"),ne=function(t){te&&te===t||(t&&"object"===(void 0===t?"undefined":V(t))||(t={}),t=C(t),bt="ALLOWED_TAGS"in t?x({},t.ALLOWED_TAGS):wt,kt="ALLOWED_ATTR"in t?x({},t.ALLOWED_ATTR):xt,Ut="ADD_URI_SAFE_ATTR"in t?x(C($t),t.ADD_URI_SAFE_ATTR):$t,jt="ADD_DATA_URI_TAGS"in t?x(C(Vt),t.ADD_DATA_URI_TAGS):Vt,zt="FORBID_CONTENTS"in t?x({},t.FORBID_CONTENTS):_t,Ct="FORBID_TAGS"in t?x({},t.FORBID_TAGS):{},Tt="FORBID_ATTR"in t?x({},t.FORBID_ATTR):{},qt="USE_PROFILES"in t&&t.USE_PROFILES,Et=!1!==t.ALLOW_ARIA_ATTR,Mt=!1!==t.ALLOW_DATA_ATTR,Nt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,St=t.SAFE_FOR_TEMPLATES||!1,Dt=t.WHOLE_DOCUMENT||!1,At=t.RETURN_DOM||!1,It=t.RETURN_DOM_FRAGMENT||!1,Rt=!1!==t.RETURN_DOM_IMPORT,Pt=t.RETURN_TRUSTED_TYPE||!1,Ot=t.FORCE_BODY||!1,Bt=!1!==t.SANITIZE_DOM,Ft=!1!==t.KEEP_CONTENT,Ht=t.IN_PLACE||!1,yt=t.ALLOWED_URI_REGEXP||yt,Jt=t.NAMESPACE||Kt,Xt=Xt=-1===Qt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Yt="application/xhtml+xml"===Xt?function(t){return t}:h,St&&(Mt=!1),It&&(At=!0),qt&&(bt=x({},[].concat(U(O))),kt=[],!0===qt.html&&(x(bt,E),x(kt,A)),!0===qt.svg&&(x(bt,M),x(kt,I),x(kt,P)),!0===qt.svgFilters&&(x(bt,N),x(kt,I),x(kt,P)),!0===qt.mathMl&&(x(bt,D),x(kt,R),x(kt,P))),t.ADD_TAGS&&(bt===wt&&(bt=C(bt)),x(bt,t.ADD_TAGS)),t.ADD_ATTR&&(kt===xt&&(kt=C(kt)),x(kt,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&x(Ut,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(zt===_t&&(zt=C(zt)),x(zt,t.FORBID_CONTENTS)),Ft&&(bt["#text"]=!0),Dt&&x(bt,["html","head","body"]),bt.table&&(x(bt,["tbody"]),delete Ct.tbody),i&&i(t),te=t)},re=x({},["mi","mo","mn","ms","mtext"]),oe=x({},["foreignobject","desc","title","annotation-xml"]),ie=x({},M);x(ie,N),x(ie,S);var ae=x({},D);x(ae,L);var se=function(t){f(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(ge){try{t.outerHTML=rt}catch(e){t.remove()}}},le=function(t,e){try{f(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(ge){f(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!kt[t])if(At||It)try{se(e)}catch(ge){}else try{e.setAttribute(t,"")}catch(ge){}},ce=function(t){var e=void 0,n=void 0;if(Ot)t="<remove></remove>"+t;else{var r=m(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===Xt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=nt?nt.createHTML(t):t;if(Jt===Kt)try{e=(new K).parseFromString(i,Xt)}catch(ge){}if(!e||!e.documentElement){e=it.createDocument(Jt,"template",null);try{e.documentElement.innerHTML=Zt?"":i}catch(ge){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),Jt===Kt?lt.call(e,Dt?"html":"body")[0]:Dt?e.documentElement:a},ue=function(t){return at.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},pe=function(t){return"object"===(void 0===l?"undefined":V(l))?t instanceof l:t&&"object"===(void 0===t?"undefined":V(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},de=function(t,e,r){pt[t]&&p(pt[t],function(t){t.call(n,e,r,te)})},fe=function(t){var e,r=void 0;if(de("beforeSanitizeElements",t,null),!((e=t)instanceof W||e instanceof G||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof $&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore))return se(t),!0;if(m(t.nodeName,/[\u0080-\uFFFF]/))return se(t),!0;var o=Yt(t.nodeName);if(de("uponSanitizeElement",t,{tagName:o,allowedTags:bt}),!pe(t.firstElementChild)&&(!pe(t.content)||!pe(t.content.firstElementChild))&&b(/<[/\w]/g,t.innerHTML)&&b(/<[/\w]/g,t.textContent))return se(t),!0;if("select"===o&&b(/<template/i,t.innerHTML))return se(t),!0;if(!bt[o]||Ct[o]){if(Ft&&!zt[o]){var i=tt(t)||t.parentNode,a=Y(t)||t.childNodes;if(a&&i)for(var s=a.length-1;s>=0;--s)i.insertBefore(X(a[s],!0),Q(t))}return se(t),!0}return t instanceof c&&!function(t){var e=tt(t);e&&e.tagName||(e={namespaceURI:Kt,tagName:"template"});var n=h(t.tagName),r=h(e.tagName);if(t.namespaceURI===Gt)return e.namespaceURI===Kt?"svg"===n:e.namespaceURI===Wt?"svg"===n&&("annotation-xml"===r||re[r]):Boolean(ie[n]);if(t.namespaceURI===Wt)return e.namespaceURI===Kt?"math"===n:e.namespaceURI===Gt?"math"===n&&oe[r]:Boolean(ae[n]);if(t.namespaceURI===Kt){if(e.namespaceURI===Gt&&!oe[r])return!1;if(e.namespaceURI===Wt&&!re[r])return!1;var o=x({},["title","style","font","a","script"]);return!ae[n]&&(o[n]||!ie[n])}return!1}(t)?(se(t),!0):"noscript"!==o&&"noembed"!==o||!b(/<\/no(script|embed)/i,t.innerHTML)?(St&&3===t.nodeType&&(r=t.textContent,r=v(r,dt," "),r=v(r,ft," "),t.textContent!==r&&(f(n.removed,{element:t.cloneNode()}),t.textContent=r)),de("afterSanitizeElements",t,null),!1):(se(t),!0)},he=function(t,e,n){if(Bt&&("id"===e||"name"===e)&&(n in o||n in ee))return!1;if(Mt&&!Tt[e]&&b(ht,e));else if(Et&&b(mt,e));else{if(!kt[e]||Tt[e])return!1;if(Ut[e]);else if(b(yt,v(n,gt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==g(n,"data:")||!jt[t])if(Nt&&!b(vt,v(n,gt,"")));else if(n)return!1}return!0},me=function(t){var e=void 0,r=void 0,o=void 0,i=void 0;de("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:kt};for(i=a.length;i--;){var l=e=a[i],c=l.name,u=l.namespaceURI;if(r=y(e.value),o=Yt(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,de("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(le(c,t),s.keepAttr))if(b(/\/>/i,r))le(c,t);else{St&&(r=v(r,dt," "),r=v(r,ft," "));var p=Yt(t.nodeName);if(he(p,o,r))try{u?t.setAttributeNS(u,c,r):t.setAttribute(c,r),d(n.removed)}catch(ge){}}}de("afterSanitizeAttributes",t,null)}},ve=function t(e){var n=void 0,r=ue(e);for(de("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)de("uponSanitizeShadowNode",n,null),fe(n)||(n.content instanceof a&&t(n.content),me(n));de("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,o){var i=void 0,s=void 0,c=void 0,u=void 0,p=void 0;if((Zt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!pe(t)){if("function"!=typeof t.toString)throw w("toString is not a function");if("string"!=typeof(t=t.toString()))throw w("dirty is not a string, aborting")}if(!n.isSupported){if("object"===V(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(pe(t))return e.toStaticHTML(t.outerHTML)}return t}if(Lt||ne(o),n.removed=[],"string"==typeof t&&(Ht=!1),Ht);else if(t instanceof l)1===(s=(i=ce("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?i=s:i.appendChild(s);else{if(!At&&!St&&!Dt&&-1===t.indexOf("<"))return nt&&Pt?nt.createHTML(t):t;if(!(i=ce(t)))return At?null:rt}i&&Ot&&se(i.firstChild);for(var d=ue(Ht?t:i);c=d.nextNode();)3===c.nodeType&&c===u||fe(c)||(c.content instanceof a&&ve(c.content),me(c),u=c);if(u=null,Ht)return t;if(At){if(It)for(p=st.call(i.ownerDocument);i.firstChild;)p.appendChild(i.firstChild);else p=i;return Rt&&(p=ct.call(r,p,!0)),p}var f=Dt?i.outerHTML:i.innerHTML;return St&&(f=v(f,dt," "),f=v(f,ft," ")),nt&&Pt?nt.createHTML(f):f},n.setConfig=function(t){ne(t),Lt=!0},n.clearConfig=function(){te=null,Lt=!1},n.isValidAttribute=function(t,e,n){te||ne({});var r=Yt(t),o=Yt(e);return he(r,o,n)},n.addHook=function(t,e){"function"==typeof e&&(pt[t]=pt[t]||[],f(pt[t],e))},n.removeHook=function(t){pt[t]&&d(pt[t])},n.removeHooks=function(t){pt[t]&&(pt[t]=[])},n.removeAllHooks=function(){pt={}},n}()}()},928:function(t,e,n){var r=n(322);t.exports=function(t,e,n){var o,i;if(n=n||0,!r(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(i=e.length,o=n;n>=0&&o<i;o+=1)if(e[o]===t)return o;return-1}},690:function(t,e,n){var r=n(322),o=n(893),i=n(956);t.exports=function(t,e,n){r(t)?o(t,e,n):i(t,e,n)}},893:function(t){t.exports=function(t,e,n){var r=0,o=t.length;for(n=n||null;r<o&&!1!==e.call(n,t[r],r,t);r+=1);}},956:function(t){t.exports=function(t,e,n){var r;for(r in n=n||null,t)if(t.hasOwnProperty(r)&&!1===e.call(n,t[r],r,t))break}},990:function(t,e,n){var r=n(893);t.exports=function(t){var e;try{e=Array.prototype.slice.call(t)}catch(n){e=[],r(t,function(t){e.push(t)})}return e}},755:function(t){var e="_feEventKey";t.exports=function(t,n){var r,o=t[e];return o||(o=t[e]={}),(r=o[n])||(r=o[n]=[]),r}},349:function(t,e,n){var r=n(758),o=n(690),i=n(755);function a(t,e,n){var r,a=i(t,e);n?(o(a,function(o,i){return n!==o.handler||(s(t,e,o.wrappedHandler),r=i,!1)}),a.splice(r,1)):(o(a,function(n){s(t,e,n.wrappedHandler)}),a.splice(0,a.length))}function s(t,e,n){"removeEventListener"in t?t.removeEventListener(e,n):"detachEvent"in t&&t.detachEvent("on"+e,n)}t.exports=function(t,e,n){r(e)?o(e.split(/\s+/g),function(e){a(t,e,n)}):o(e,function(e,n){a(t,n,e)})}},348:function(t,e,n){var r=n(758),o=n(690),i=n(755);function a(t,e,n,r){function a(e){n.call(r||t,e||window.event)}"addEventListener"in t?t.addEventListener(e,a):"attachEvent"in t&&t.attachEvent("on"+e,a),function(t,e,n,r){var a=i(t,e),s=!1;o(a,function(t){return t.handler!==n||(s=!0,!1)}),s||a.push({handler:n,wrappedHandler:r})}(t,e,n,a)}t.exports=function(t,e,n,i){r(e)?o(e.split(/\s+/g),function(e){a(t,e,n,i)}):o(e,function(e,r){a(t,r,e,n)})}},24:function(t,e,n){var r=n(322),o=n(929);t.exports=function(t,e){e=(e=r(e)?e.join(" "):e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),o(t.className.baseVal)?t.className=e:t.className.baseVal=e}},204:function(t,e,n){var r=n(690),o=n(928),i=n(902),a=n(24);t.exports=function(t){var e,n=Array.prototype.slice.call(arguments,1),s=t.classList,l=[];s?r(n,function(e){t.classList.add(e)}):((e=i(t))&&(n=[].concat(e.split(/\s+/),n)),r(n,function(t){o(t,l)<0&&l.push(t)}),a(t,l))}},522:function(t,e,n){var r=n(758),o=n(690);t.exports=function(t,e,n){var i=t.style;r(e)?i[e]=n:o(e,function(t,e){i[e]=t})}},902:function(t,e,n){var r=n(929);t.exports=function(t){return t&&t.className?r(t.className.baseVal)?t.className:t.className.baseVal:""}},714:function(t,e,n){var r=n(928),o=n(902);t.exports=function(t,e){var n;return t.classList?t.classList.contains(e):(n=o(t).split(/\s+/),r(e,n)>-1)}},471:function(t,e,n){var r=n(928),o=n(990),i=Element.prototype,a=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return r(this,o(e.querySelectorAll(t)))>-1};t.exports=function(t,e){return a.call(t,e)}},462:function(t,e,n){var r=n(893),o=n(928),i=n(902),a=n(24);t.exports=function(t){var e,n,s=Array.prototype.slice.call(arguments,1),l=t.classList;l?r(s,function(t){l.remove(t)}):(e=i(t).split(/\s+/),n=[],r(e,function(t){o(t,s)<0&&n.push(t)}),a(t,n))}},969:function(t){t.exports=function(t,e){var n,r,o,i,a=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o<i;o+=1)for(r in n=arguments[o])a.call(n,r)&&(t[r]=n[r]);return t}},254:function(t,e,n){var r=n(956);t.exports=function(t,e){var n=document.createElement("img"),o="";return r(e,function(t,e){o+="&"+e+"="+t}),o=o.substring(1),n.src=t+"?"+o,n.style.display="none",document.body.appendChild(n),document.body.removeChild(n),n}},391:function(t,e,n){var r=n(929),o=n(254);t.exports=function(t,e){var n=location.hostname,i="TOAST UI "+t+" for "+n+": Statistics",a=window.localStorage.getItem(i);(r(window.tui)||!1!==window.tui.usageStatistics)&&(a&&!function(t){/* @__PURE__ */
5
5
  return(new Date).getTime()-t>6048e5}(a)||(window.localStorage.setItem(i,/* @__PURE__ */(new Date).getTime()),setTimeout(function(){"interactive"!==document.readyState&&"complete"!==document.readyState||o("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:n,dp:n,dh:t,el:t,ec:"use"})},1e3)))}},322:function(t){t.exports=function(t){return t instanceof Array}},65:function(t,e,n){var r=n(929),o=n(934);t.exports=function(t){return!r(t)&&!o(t)}},404:function(t,e,n){var r=n(790);t.exports=function(t){return!r(t)}},294:function(t){t.exports=function(t){return t instanceof Function}},934:function(t){t.exports=function(t){return null===t}},758:function(t){t.exports=function(t){return"string"==typeof t||t instanceof String}},790:function(t,e,n){var r=n(65);t.exports=function(t){return r(t)&&!1!==t}},929:function(t){t.exports=function(t){return void 0===t}},479:function(e){e.exports=t},43:function(t){t.exports=e},814:function(t){t.exports=n},311:function(t){t.exports=r}},i={};function a(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,{a:e}),e},a.d=function(t,e){for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var s={};return function(){a.d(s,{default:function(){return Pr}});var t=function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},t.apply(this,arguments)},e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};function o(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:"undefined"!=typeof self?self:{},l={};function c(t,e,n){var r,o,i,a,s,u="";for("string"!=typeof e&&(n=e,e=c.defaultChars),void 0===n&&(n=!0),s=function(t){var e,n,r=l[t];if(r)return r;for(r=l[t]=[],e=0;e<128;e++)n=String.fromCharCode(e),/^[0-9a-z]$/i.test(n)?r.push(n):r.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e<t.length;e++)r[t.charCodeAt(e)]=t[e];return r}(e),r=0,o=t.length;r<o;r++)if(i=t.charCodeAt(r),n&&37===i&&r+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(r+1,r+3)))u+=t.slice(r,r+3),r+=2;else if(i<128)u+=s[i];else if(i>=55296&&i<=57343){if(i>=55296&&i<=56319&&r+1<o&&(a=t.charCodeAt(r+1))>=56320&&a<=57343){u+=encodeURIComponent(t[r]+t[r+1]),r++;continue}u+="%EF%BF%BD"}else u+=encodeURIComponent(t[r]);return u}c.defaultChars=";/?:@&=+$,-_.!~*'()#",c.componentChars="-_.!~*'()";var u=c,p={},d={},f={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:"‌"},h={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},m={},v=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(m,"__esModule",{value:!0});var g=v({0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}),y=String.fromCodePoint||function(t){var e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+String.fromCharCode(t)};m.default=function(t){return t>=55296&&t<=57343||t>1114111?"�":(t in g.default&&(t=g.default[t]),y(t))};var b=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(d,"__esModule",{value:!0}),d.decodeHTML=d.decodeHTMLStrict=d.decodeXML=void 0;var w=b(f),k=b({Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"}),x=b(h),C=b(m),T=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function E(t){var e=N(t);return function(t){return String(t).replace(T,e)}}d.decodeXML=E(x.default),d.decodeHTMLStrict=E(w.default);var M=function(t,e){return t<e?1:-1};function N(t){return function(e){if("#"===e.charAt(1)){var n=e.charAt(2);return"X"===n||"x"===n?C.default(parseInt(e.substr(3),16)):C.default(parseInt(e.substr(2),10))}return t[e.slice(1,-1)]||e}}d.decodeHTML=function(){for(var t=Object.keys(k.default).sort(M),e=Object.keys(w.default).sort(M),n=0,r=0;n<e.length;n++)t[r]===e[n]?(e[n]+=";?",r++):e[n]+=";";var o=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),i=N(w.default);function a(t){return";"!==t.substr(-1)&&(t+=";"),i(t)}return function(t){return String(t).replace(o,a)}}();var S={},D=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(S,"__esModule",{value:!0}),S.escapeUTF8=S.escape=S.encodeNonAsciiHTML=S.encodeHTML=S.encodeXML=void 0;var L=R(D(h).default),O=P(L);S.encodeXML=z(L);var A=R(D(f).default),I=P(A);function R(t){return Object.keys(t).sort().reduce(function(e,n){return e[t[n]]="&"+n+";",e},{})}function P(t){for(var e=[],n=[],r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];1===i.length?e.push("\\"+i):n.push(i)}e.sort();for(var a=0;a<e.length-1;a++){for(var s=a;s<e.length-1&&e[s].charCodeAt(1)+1===e[s+1].charCodeAt(1);)s+=1;var l=1+s-a;l<3||e.splice(a,l,e[a]+"-"+e[s])}return n.unshift("["+e.join("")+"]"),new RegExp(n.join("|"),"g")}S.encodeHTML=function(t,e){return function(n){return n.replace(e,function(e){return t[e]}).replace(B,H)}}(A,I),S.encodeNonAsciiHTML=z(A);var B=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,F=null!=String.prototype.codePointAt?function(t){return t.codePointAt(0)}:function(t){return 1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)-56320+65536};function H(t){return"&#x"+(t.length>1?F(t):t.charCodeAt(0)).toString(16).toUpperCase()+";"}var q=new RegExp(O.source+"|"+B.source,"g");function z(t){return function(e){return e.replace(q,function(e){return t[e]||H(e)})}}S.escape=function(t){return t.replace(q,H)},S.escapeUTF8=function(t){return t.replace(O,H)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var e=d,n=S;t.decode=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTML)(t)},t.decodeStrict=function(t,n){return(!n||n<=0?e.decodeXML:e.decodeHTMLStrict)(t)},t.encode=function(t,e){return(!e||e<=0?n.encodeXML:n.encodeHTML)(t)};var r=S;Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return r.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return r.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return r.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return r.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return r.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return r.encodeHTML}});var o=d;Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})}(p);var _="&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",j=/[\\&]/,V="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",U=new RegExp("\\\\"+V+"|"+_,"gi"),$=new RegExp('[&<>"]',"g"),W=function(t){return 92===t.charCodeAt(0)?t.charAt(1):p.decodeHTML(t)};function G(t){return j.test(t)?t.replace(U,W):t}function K(t){try{return u(t)}catch(e){return t}}function J(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return t}}function Z(t){return $.test(t)?t.replace($,J):t}function X(t,e){for(var n=[],r=0;r<e;r++)n.push(t);return n.join("")}function Q(t){return!t||!/[^ \t]+/.test(t)}var Y=function(){function t(t){this.current=t,this.root=t,this.entering=!0}return t.prototype.next=function(){var t=this.current,e=this.entering;if(null===t)return null;var n=tt(t);return e&&n?t.firstChild?(this.current=t.firstChild,this.entering=!0):this.entering=!1:t===this.root?this.current=null:null===t.next?(this.current=t.parent,this.entering=!1):(this.current=t.next,this.entering=!0),{entering:e,node:t}},t.prototype.resumeAt=function(t,e){this.current=t,this.entering=!0===e},t}();function tt(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}var et=1,nt={};function rt(t){delete nt[t]}var ot=function(){function t(t,e){this.parent=null,this.prev=null,this.next=null,this.firstChild=null,this.lastChild=null,this.literal=null,this.id="document"===t?-1:et++,this.type=t,this.sourcepos=e,nt[this.id]=this}return t.prototype.isContainer=function(){return tt(this)},t.prototype.unlink=function(){this.prev?this.prev.next=this.next:this.parent&&(this.parent.firstChild=this.next),this.next?this.next.prev=this.prev:this.parent&&(this.parent.lastChild=this.prev),this.parent=null,this.next=null,this.prev=null},t.prototype.replaceWith=function(t){this.insertBefore(t),this.unlink()},t.prototype.insertAfter=function(t){t.unlink(),t.next=this.next,t.next&&(t.next.prev=t),t.prev=this,this.next=t,this.parent&&(t.parent=this.parent,t.next||(t.parent.lastChild=t))},t.prototype.insertBefore=function(t){t.unlink(),t.prev=this.prev,t.prev&&(t.prev.next=t),t.next=this,this.prev=t,t.parent=this.parent,t.prev||(t.parent.firstChild=t)},t.prototype.appendChild=function(t){t.unlink(),t.parent=this,this.lastChild?(this.lastChild.next=t,t.prev=this.lastChild,this.lastChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.prependChild=function(t){t.unlink(),t.parent=this,this.firstChild?(this.firstChild.prev=t,t.next=this.firstChild,this.firstChild=t):(this.firstChild=t,this.lastChild=t)},t.prototype.walker=function(){return new Y(this)},t}(),it=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.open=!0,r.lineOffsets=null,r.stringContent=null,r.lastLineBlank=!1,r.lastLineChecked=!1,r.type=e,r}return n(e,t),e}(ot),at=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.listData=null,e}return n(e,t),e}(it),st=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.level=0,e.headingType="atx",e}return n(e,t),e}(it),lt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isFenced=!1,e.fenceChar=null,e.fenceLength=0,e.fenceOffset=-1,e.info=null,e.infoPadding=0,e}return n(e,t),e}(it),ct=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.columns=[],e}return n(e,t),e}(it),ut=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.startIdx=0,e.endIdx=0,e.paddingLeft=0,e.paddingRight=0,e.ignored=!1,e}return n(e,t),e}(it),pt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="",e.dest="",e.label="",e}return n(e,t),e}(it),dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.syntaxLength=0,e.offset=-1,e.info="",e}return n(e,t),e}(it),ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.htmlBlockType=-1,e}return n(e,t),e}(it),ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.destination=null,e.title=null,e.extendedAutolink=!1,e}return n(e,t),e}(ot),mt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.tickCount=0,e}return n(e,t),e}(ot),vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.info="",e}return n(e,t),e}(ot);function gt(t,e){switch(t){case"heading":return new st(t,e);case"list":case"item":return new at(t,e);case"link":case"image":return new ht(t,e);case"codeBlock":return new lt(t,e);case"htmlBlock":return new ft(t,e);case"table":return new ct(t,e);case"tableCell":return new ut(t,e);case"document":case"paragraph":case"blockQuote":case"thematicBreak":case"tableRow":case"tableBody":case"tableHead":case"frontMatter":return new it(t,e);case"code":return new mt(t,e);case"refDef":return new pt(t,e);case"customBlock":return new dt(t,e);case"customInline":return new vt(t,e);default:return new ot(t,e)}}function yt(t){return"codeBlock"===t.type}function bt(t){return"list"===t.type}function wt(t){return"refDef"===t.type}function kt(t){return"customBlock"===t.type}function xt(t,e){var n=gt("text",e);return n.literal=t,n}var Ct,Tt="[A-Za-z][A-Za-z0-9-]*",Et="<"+Tt+"(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",Mt="</"+Tt+"\\s*[>]",Nt=new RegExp("^(?:"+Et+"|"+Mt+"|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)","i");if(String.fromCodePoint)Ct=function(t){try{return String.fromCodePoint(t)}catch(e){if(e instanceof RangeError)return String.fromCharCode(65533);throw e}};else{var St=String.fromCharCode,Dt=Math.floor;Ct=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r,o=[],i=-1,a=t.length;if(!a)return"";for(var s="";++i<a;){var l=Number(t[i]);if(!isFinite(l)||l<0||l>1114111||Dt(l)!==l)return String.fromCharCode(65533);l<=65535?o.push(l):(n=55296+((l-=65536)>>10),r=l%1024+56320,o.push(n,r)),(i+1===a||o.length>16384)&&(s+=St.apply(void 0,o),o.length=0)}return s}}var Lt=Ct;function Ot(t){var e=/\)+$/.exec(t);if(e){for(var n=0,r=0,o=t;r<o.length;r++){var i=o[r];"("===i?n<0?n=1:n+=1:")"===i&&(n-=1)}if(n<0){var a=Math.min(-n,e[0].length);return t.substring(0,t.length-a)}}return t}function At(t){return t.replace(/&[A-Za-z0-9]+;$/,"")}function It(t){return o(o([],function(t){for(var e,n=new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]","g"),r=[];e=n.exec(t);){var o=At(Ot(e[0])),i="www"===e[1]?"http://":"";r.push({text:o,range:[e.index,e.index+o.length-1],url:""+i+o})}return r}(t)),function(t){for(var e,n=new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+","g"),r=[];e=n.exec(t);){var o=e[0];/[_-]+$/.test(o)||r.push({text:o,range:[e.index,e.index+o.length-1],url:"mailto:"+o})}return r}(t)).sort(function(t,e){return t.range[0]-e.range[0]})}function Rt(t){return t[t.length-1]}function Pt(t){return t.slice(1,t.length-1).trim().replace(/[ \t\r\n]+/," ").toLowerCase().toUpperCase()}function Bt(t,e){Object.keys(t).forEach(function(n){e(n,t[n])})}function Ft(t){return!Object.keys(t).length}var Ht=39,qt=34,zt=36,_t="\\\\"+V,jt=new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\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\u0AF0\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-\u2E42\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]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),Vt=new RegExp('^(?:"('+_t+'|[^"\\x00])*"|\'('+_t+"|[^'\\x00])*'|\\(("+_t+"|[^()\\x00])*\\))"),Ut=/^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,$t=new RegExp("^"+V),Wt=new RegExp("^"+_,"i"),Gt=/`+/,Kt=/^`+/,Jt=/\.\.\./g,Zt=/--+/g,Xt=/^<([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])?)*)>/,Qt=/^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,Yt=/^ *(?:\n *)?/,te=/^[ \t\n\x0b\x0c\x0d]/,ee=/^\s/,ne=/ *$/,re=/^ */,oe=/^ *(?:\n|$)/,ie=/^\[(?:[^\\\[\]]|\\.){0,1000}\]/,ae=/^[^\n`\[\]\\!<&*_'"~$]+/m,se=function(){function t(t){this.subject="",this.delimiters=null,this.brackets=null,this.pos=0,this.lineStartNum=0,this.lineIdx=0,this.lineOffsets=[0],this.linePosOffset=0,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.options=t}return t.prototype.sourcepos=function(t,e){var n=this.linePosOffset+this.lineOffsets[this.lineIdx],r=this.lineStartNum+this.lineIdx,o=[r,t+n];return"number"==typeof e?[o,[r,e+n]]:o},t.prototype.nextLine=function(){this.lineIdx+=1,this.linePosOffset=-this.pos},t.prototype.match=function(t){var e=t.exec(this.subject.slice(this.pos));return null===e?null:(this.pos+=e.index+e[0].length,e[0])},t.prototype.peek=function(){return this.pos<this.subject.length?this.subject.charCodeAt(this.pos):-1},t.prototype.spnl=function(){return this.match(Yt),!0},t.prototype.parseBackticks=function(t){var e=this.pos+1,n=this.match(Kt);if(null===n)return!1;for(var r,o=this.pos;null!==(r=this.match(Gt));)if(r===n){var i=this.subject.slice(o,this.pos-n.length),a=this.sourcepos(e,this.pos),s=i.split("\n");if(s.length>1){var l=Rt(s);this.lineIdx+=s.length-1,this.linePosOffset=-(this.pos-l.length-n.length),a[1]=this.sourcepos(this.pos),i=s.join(" ")}var c=gt("code",a);return i.length>0&&null!==i.match(/[^ ]/)&&" "==i[0]&&" "==i[i.length-1]?c.literal=i.slice(1,i.length-1):c.literal=i,c.tickCount=n.length,t.appendChild(c),!0}return this.pos=o,t.appendChild(xt(n,this.sourcepos(e,this.pos-1))),!0},t.prototype.parseBackslash=function(t){var e,n=this.subject;this.pos+=1;var r=this.pos;return 10===this.peek()?(this.pos+=1,e=gt("linebreak",this.sourcepos(this.pos-1,this.pos)),t.appendChild(e),this.nextLine()):$t.test(n.charAt(this.pos))?(t.appendChild(xt(n.charAt(this.pos),this.sourcepos(r,this.pos))),this.pos+=1):t.appendChild(xt("\\",this.sourcepos(r,r))),!0},t.prototype.parseAutolink=function(t){var e,n,r,o=this.pos+1;return(e=this.match(Xt))?(n=e.slice(1,e.length-1),(r=gt("link",this.sourcepos(o,this.pos))).destination=K("mailto:"+n),r.title="",r.appendChild(xt(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0):!!(e=this.match(Qt))&&(n=e.slice(1,e.length-1),(r=gt("link",this.sourcepos(o,this.pos))).destination=K(n),r.title="",r.appendChild(xt(n,this.sourcepos(o+1,this.pos-1))),t.appendChild(r),!0)},t.prototype.parseHtmlTag=function(t){var e=this.pos+1,n=this.match(Nt);if(null===n)return!1;var r=gt("htmlInline",this.sourcepos(e,this.pos));return r.literal=n,t.appendChild(r),!0},t.prototype.scanDelims=function(t){var e=0,n=this.pos;if(t===Ht||t===qt)e++,this.pos++;else for(;this.peek()===t;)e++,this.pos++;if(0===e||e<2&&(126===t||t===zt))return this.pos=n,null;var r,o=0===n?"\n":this.subject.charAt(n-1),i=this.peek();r=-1===i?"\n":Lt(i);var a,s,l=ee.test(r),c=jt.test(r),u=ee.test(o),p=jt.test(o),d=!l&&(!c||u||p),f=!u&&(!p||l||c);return 95===t?(a=d&&(!f||p),s=f&&(!d||c)):t===Ht||t===qt?(a=d&&!f,s=f):t===zt?(a=!l,s=!u):(a=d,s=f),this.pos=n,{numdelims:e,canOpen:a,canClose:s}},t.prototype.handleDelim=function(t,e){var n=this.scanDelims(t);if(!n)return!1;var r=n.numdelims,o=this.pos+1;this.pos+=r;var i=xt(t===Ht?"’":t===qt?"“":this.subject.slice(o-1,this.pos),this.sourcepos(o,this.pos));return e.appendChild(i),(n.canOpen||n.canClose)&&(this.options.smart||t!==Ht&&t!==qt)&&(this.delimiters={cc:t,numdelims:r,origdelims:r,node:i,previous:this.delimiters,next:null,canOpen:n.canOpen,canClose:n.canClose},this.delimiters.previous&&(this.delimiters.previous.next=this.delimiters)),!0},t.prototype.removeDelimiter=function(t){null!==t.previous&&(t.previous.next=t.next),null===t.next?this.delimiters=t.previous:t.next.previous=t.previous},t.prototype.removeDelimitersBetween=function(t,e){t.next!==e&&(t.next=e,e.previous=t)},t.prototype.processEmphasis=function(t){var e,n,r,o,i,a,s,l=!1,c=((e={})[95]=[t,t,t],e[42]=[t,t,t],e[39]=[t],e[34]=[t],e[126]=[t],e[36]=[t],e);for(r=this.delimiters;null!==r&&r.previous!==t;)r=r.previous;for(;null!==r;){var u=r.cc,p=95===u||42===u;if(r.canClose){for(n=r.previous,s=!1;null!==n&&n!==t&&n!==c[u][p?r.origdelims%3:0];){if(l=p&&(r.canOpen||n.canClose)&&r.origdelims%3!=0&&(n.origdelims+r.origdelims)%3==0,n.cc===r.cc&&n.canOpen&&!l){s=!0;break}n=n.previous}if(o=r,p||126===u||u===zt)if(s){if(n){var d=r.numdelims>=2&&n.numdelims>=2?2:1,f=p?0:1;i=n.node,a=r.node;var h=p?1===d?"emph":"strong":"strike";u===zt&&(h="customInline");var m=gt(h),v=i.sourcepos[1],g=a.sourcepos[0];m.sourcepos=[[v[0],v[1]-d+1],[g[0],g[1]+d-1]],i.sourcepos[1][1]-=d,a.sourcepos[0][1]+=d,i.literal=i.literal.slice(d),a.literal=a.literal.slice(d),n.numdelims-=d,r.numdelims-=d;for(var y=i.next,b=void 0;y&&y!==a;)b=y.next,y.unlink(),m.appendChild(y),y=b;if(u===zt){var w=m.firstChild,k=w.literal||"",x=k.split(/\s/)[0];m.info=x,k.length<=x.length?w.unlink():(w.sourcepos[0][1]+=x.length,w.literal=k.replace(x+" ",""))}if(i.insertAfter(m),this.removeDelimitersBetween(n,r),n.numdelims<=f&&(0===n.numdelims&&i.unlink(),this.removeDelimiter(n)),r.numdelims<=f){0===r.numdelims&&a.unlink();var C=r.next;this.removeDelimiter(r),r=C}}}else r=r.next;else u===Ht?(r.node.literal="’",s&&(n.node.literal="‘"),r=r.next):u===qt&&(r.node.literal="”",s&&(n.node.literal="“"),r=r.next);s||(c[u][p?o.origdelims%3:0]=o.previous,o.canOpen||this.removeDelimiter(o))}else r=r.next}for(;null!==this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)},t.prototype.parseLinkTitle=function(){var t=this.match(Vt);return null===t?null:G(t.substr(1,t.length-2))},t.prototype.parseLinkDestination=function(){var t=this.match(Ut);if(null===t){if(60===this.peek())return null;for(var e=this.pos,n=0,r=void 0;-1!==(r=this.peek());)if(92===r&&$t.test(this.subject.charAt(this.pos+1)))this.pos+=1,-1!==this.peek()&&(this.pos+=1);else if(40===r)this.pos+=1,n+=1;else if(41===r){if(n<1)break;this.pos+=1,n-=1}else{if(null!==te.exec(Lt(r)))break;this.pos+=1}return this.pos===e&&41!==r||0!==n?null:K(G(t=this.subject.substr(e,this.pos-e)))}return K(G(t.substr(1,t.length-2)))},t.prototype.parseLinkLabel=function(){var t=this.match(ie);return null===t||t.length>1001?0:t.length},t.prototype.parseOpenBracket=function(t){var e=this.pos;this.pos+=1;var n=xt("[",this.sourcepos(this.pos,this.pos));return t.appendChild(n),this.addBracket(n,e,!1),!0},t.prototype.parseBang=function(t){var e=this.pos;if(this.pos+=1,91===this.peek()){this.pos+=1;var n=xt("![",this.sourcepos(this.pos-1,this.pos));t.appendChild(n),this.addBracket(n,e+1,!0)}else n=xt("!",this.sourcepos(this.pos,this.pos)),t.appendChild(n);return!0},t.prototype.parseCloseBracket=function(t){var e=null,n=null,r=!1;this.pos+=1;var o=this.pos,i=this.brackets;if(null===i)return t.appendChild(xt("]",this.sourcepos(o,o))),!0;if(!i.active)return t.appendChild(xt("]",this.sourcepos(o,o))),this.removeBracket(),!0;var a=i.image,s=this.pos;40===this.peek()&&(this.pos++,this.spnl()&&null!==(e=this.parseLinkDestination())&&this.spnl()&&(te.test(this.subject.charAt(this.pos-1))&&(n=this.parseLinkTitle()),1)&&this.spnl()&&41===this.peek()?(this.pos+=1,r=!0):this.pos=s);var l="";if(!r){var c=this.pos,u=this.parseLinkLabel();if(u>2?l=this.subject.slice(c,c+u):i.bracketAfter||(l=this.subject.slice(i.index,o)),0===u&&(this.pos=s),l){l=Pt(l);var p=this.refMap[l];p&&(e=p.destination,n=p.title,r=!0)}}if(r){var d=gt(a?"image":"link");d.destination=e,d.title=n||"",d.sourcepos=[i.startpos,this.sourcepos(this.pos)];for(var f=i.node.next,h=void 0;f;)h=f.next,f.unlink(),d.appendChild(f),f=h;if(t.appendChild(d),this.processEmphasis(i.previousDelimiter),this.removeBracket(),i.node.unlink(),!a)for(i=this.brackets;null!==i;)i.image||(i.active=!1),i=i.previous;return this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0}return this.removeBracket(),this.pos=o,t.appendChild(xt("]",this.sourcepos(o,o))),this.options.referenceDefinition&&(this.refLinkCandidateMap[t.id]={node:t,refLabel:l}),!0},t.prototype.addBracket=function(t,e,n){null!==this.brackets&&(this.brackets.bracketAfter=!0),this.brackets={node:t,startpos:this.sourcepos(e+(n?0:1)),previous:this.brackets,previousDelimiter:this.delimiters,index:e,image:n,active:!0}},t.prototype.removeBracket=function(){this.brackets&&(this.brackets=this.brackets.previous)},t.prototype.parseEntity=function(t){var e,n=this.pos+1;return!!(e=this.match(Wt))&&(t.appendChild(xt(p.decodeHTML(e),this.sourcepos(n,this.pos))),!0)},t.prototype.parseString=function(t){var e,n=this.pos+1;if(e=this.match(ae)){if(this.options.smart){var r=e.replace(Jt,"…").replace(Zt,function(t){var e=0,n=0;return t.length%3==0?n=t.length/3:t.length%2==0?e=t.length/2:t.length%3==2?(e=1,n=(t.length-2)/3):(e=2,n=(t.length-4)/3),X("—",n)+X("–",e)});t.appendChild(xt(r,this.sourcepos(n,this.pos)))}else{var o=xt(e,this.sourcepos(n,this.pos));t.appendChild(o)}return!0}return!1},t.prototype.parseNewline=function(t){this.pos+=1;var e=t.lastChild;if(e&&"text"===e.type&&" "===e.literal[e.literal.length-1]){var n=" "===e.literal[e.literal.length-2],r=e.literal.length;e.literal=e.literal.replace(ne,"");var o=r-e.literal.length;e.sourcepos[1][1]-=o,t.appendChild(gt(n?"linebreak":"softbreak",this.sourcepos(this.pos-o,this.pos)))}else t.appendChild(gt("softbreak",this.sourcepos(this.pos,this.pos)));return this.nextLine(),this.match(re),!0},t.prototype.parseReference=function(t,e){if(!this.options.referenceDefinition)return 0;this.subject=t.stringContent,this.pos=0;var n=null,r=this.pos,o=this.parseLinkLabel();if(0===o)return 0;var i=this.subject.substr(0,o);if(58!==this.peek())return this.pos=r,0;this.pos++,this.spnl();var a=this.parseLinkDestination();if(null===a)return this.pos=r,0;var s=this.pos;this.spnl(),this.pos!==s&&(n=this.parseLinkTitle()),null===n&&(n="",this.pos=s);var l=!0;if(null===this.match(oe)&&(""===n?l=!1:(n="",this.pos=s,l=null!==this.match(oe))),!l)return this.pos=r,0;var c=Pt(i);if(""===c)return this.pos=r,0;var u=this.getReferenceDefSourcepos(t);t.sourcepos[0][0]=u[1][0]+1;var p=gt("refDef",u);return p.title=n,p.dest=a,p.label=c,t.insertBefore(p),e[c]?this.refDefCandidateMap[p.id]=p:e[c]=Xe(p),this.pos-r},t.prototype.mergeTextNodes=function(t){for(var e,n=[];e=t.next();){var r=e.entering,o=e.node;if(r&&"text"===o.type)n.push(o);else if(1===n.length)n=[];else if(n.length>1){var i=n[0],a=n[n.length-1];i.sourcepos&&a.sourcepos&&(i.sourcepos[1]=a.sourcepos[1]),i.next=a.next,i.next&&(i.next.prev=i);for(var s=1;s<n.length;s+=1)i.literal+=n[s].literal,n[s].unlink();n=[]}}},t.prototype.getReferenceDefSourcepos=function(t){for(var e=t.stringContent.split(/\n|\r\n/),n=!1,r=0,o={line:0,ch:0},i=0;i<e.length;i+=1){var a=e[i];if(te.test(a))break;if(/\:/.test(a)&&0===r){if(n)break;var s=a.indexOf(":")===a.length-1?i+1:i;o={line:s,ch:e[s].length},n=!0}var l=a.match(/'|"/g);if(l&&(r+=l.length),2===r){o={line:i,ch:a.length};break}}return[[t.sourcepos[0][0],t.sourcepos[0][1]],[t.sourcepos[0][0]+o.line,o.ch]]},t.prototype.parseInline=function(t){var e,n=!1,r=this.peek();if(-1===r)return!1;switch(r){case 10:n=this.parseNewline(t);break;case 92:n=this.parseBackslash(t);break;case 96:n=this.parseBackticks(t);break;case 42:case 95:case 126:case zt:n=this.handleDelim(r,t);break;case Ht:case qt:n=!!(null===(e=this.options)||void 0===e?void 0:e.smart)&&this.handleDelim(r,t);break;case 91:n=this.parseOpenBracket(t);break;case 33:n=this.parseBang(t);break;case 93:n=this.parseCloseBracket(t);break;case 60:n=this.parseAutolink(t)||this.parseHtmlTag(t);break;case 38:t.disabledEntityParse||(n=this.parseEntity(t));break;default:n=this.parseString(t)}return n||(this.pos+=1,t.appendChild(xt(Lt(r),this.sourcepos(this.pos,this.pos+1)))),!0},t.prototype.parse=function(t){for(this.subject=t.stringContent.trim(),this.pos=0,this.delimiters=null,this.brackets=null,this.lineOffsets=t.lineOffsets||[0],this.lineIdx=0,this.linePosOffset=0,this.lineStartNum=t.sourcepos[0][0],function(t){return"heading"===t.type}(t)&&(this.lineOffsets[0]+=t.level+1);this.parseInline(t););t.stringContent=null,this.processEmphasis(null),this.mergeTextNodes(t.walker());var e=this.options,n=e.extendedAutolinks,r=e.customParser;if(n&&function(t,e){var n;"boolean"==typeof e&&(e=It);for(var r=function(){var t=n.entering,r=n.node;if(t&&"text"===r.type&&"link"!==r.parent.type){var o=r.literal,i=e(o);if(!i||!i.length)return"continue";for(var a=0,s=r.sourcepos[0],l=s[0],c=s[1],u=function(t,e){return[[l,c+t],[l,c+e]]},p=[],d=0,f=i;d<f.length;d++){var h=f[d],m=h.range,v=h.url,g=h.text;m[0]>a&&p.push(xt(o.substring(a,m[0]),u(a,m[0]-1)));var y=gt("link",u.apply(void 0,m));y.appendChild(xt(g,u.apply(void 0,m))),y.destination=v,y.extendedAutolink=!0,p.push(y),a=m[1]+1}a<o.length&&p.push(xt(o.substring(a),u(a,o.length-1)));for(var b=0,w=p;b<w.length;b++){var k=w[b];r.insertBefore(k)}r.unlink()}};n=t.next();)r()}(t.walker(),n),r&&t.firstChild)for(var o,i=t.firstChild.walker();o=i.next();){var a=o.node,s=o.entering;r[a.type]&&r[a.type](a,{entering:s,options:this.options})}},t}(),le=/^\[([ \txX])\][ \t]+/,ce=/[^ \t\f\v\r\n]/,ue=/^(?:`{3,}|~{3,})(?= *$)/;function pe(t){for(var e=t;e;){if(e.lastLineBlank)return!0;var n=e.type;if(e.lastLineChecked||"list"!==n&&"item"!==n){e.lastLineChecked=!0;break}e.lastLineChecked=!0,e=e.lastChild}return!1}function de(t,e){return e<t.length?t.charCodeAt(e):-1}function fe(t){return!ce.test(t)}function he(t){return 32===t||9===t}var me=/^\$\$$/,ve={continue:function(t,e){var n=t.currentLine,r=n.match(me);if(r)return t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2;for(var o=e.offset;o>0&&he(de(n,t.offset));)t.advanceOffset(1,!0),o--;return 0},finalize:function(t,e){if(null!==e.stringContent){var n=e.stringContent,r=n.indexOf("\n"),o=n.slice(0,r),i=n.slice(r+1),a=o.match(/^(\s*)(.*)/);e.info=G(a[2].trim()),e.literal=i,e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},ge={continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!0},ye={continue:function(t,e){var n=t.currentLine,r=t.indent;if(e.isFenced){var o=r<=3&&n.charAt(t.nextNonspace)===e.fenceChar&&n.slice(t.nextNonspace).match(ue);if(o&&o[0].length>=e.fenceLength)return t.lastLineLength=t.offset+r+o[0].length,t.finalize(e,t.lineNumber),2;for(var i=e.fenceOffset;i>0&&he(de(n,t.offset));)t.advanceOffset(1,!0),i--}else if(r>=4)t.advanceOffset(4,!0);else{if(!t.blank)return 1;t.advanceNextNonspace()}return 0},finalize:function(t,e){var n;if(null!==e.stringContent){if(e.isFenced){var r=e.stringContent,o=r.indexOf("\n"),i=r.slice(0,o),a=r.slice(o+1),s=i.match(/^(\s*)(.*)/);e.infoPadding=s[1].length,e.info=G(s[2].trim()),e.literal=a}else e.literal=null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,"\n");e.stringContent=null}},canContain:function(){return!1},acceptsLines:!0},be={document:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},list:{continue:function(){return 0},finalize:function(t,e){for(var n=e.firstChild;n;){if(pe(n)&&n.next){e.listData.tight=!1;break}for(var r=n.firstChild;r;){if(pe(r)&&(n.next||r.next)){e.listData.tight=!1;break}r=r.next}n=n.next}},canContain:function(t){return"item"===t},acceptsLines:!1},blockQuote:{continue:function(t){var e=t.currentLine;return t.indented||62!==de(e,t.nextNonspace)?1:(t.advanceNextNonspace(),t.advanceOffset(1,!1),he(de(e,t.offset))&&t.advanceOffset(1,!0),0)},finalize:function(){},canContain:function(t){return"item"!==t},acceptsLines:!1},item:{continue:function(t,e){if(t.blank){if(null===e.firstChild)return 1;t.advanceNextNonspace()}else{if(!(t.indent>=e.listData.markerOffset+e.listData.padding))return 1;t.advanceOffset(e.listData.markerOffset+e.listData.padding,!0)}return 0},finalize:function(t,e){if(e.firstChild&&"paragraph"===e.firstChild.type){var n=e.firstChild,r=n.stringContent.match(le);if(r){var o=r[0].length;n.stringContent=n.stringContent.substring(o-1),n.sourcepos[0][1]+=o,n.lineOffsets[0]+=o,e.listData.task=!0,e.listData.checked=/[xX]/.test(r[1])}}},canContain:function(t){return"item"!==t},acceptsLines:!1},heading:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},thematicBreak:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},codeBlock:ye,htmlBlock:{continue:function(t,e){return!t.blank||6!==e.htmlBlockType&&7!==e.htmlBlockType?0:1},finalize:function(t,e){var n;e.literal=(null===(n=e.stringContent)||void 0===n?void 0:n.replace(/(\n *)+$/,""))||null,e.stringContent=null},canContain:function(){return!1},acceptsLines:!0},paragraph:{continue:function(t){return t.blank?1:0},finalize:function(t,e){if(null!==e.stringContent){for(var n,r=!1;91===de(e.stringContent,0)&&(n=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(n),r=!0;r&&fe(e.stringContent)&&e.unlink()}},canContain:function(){return!1},acceptsLines:!0},table:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableHead"===t||"tableBody"===t},acceptsLines:!1},tableBody:{continue:function(){return 0},finalize:function(){},canContain:function(t){return"tableRow"===t},acceptsLines:!1},tableHead:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableRow"===t||"tableDelimRow"===t},acceptsLines:!1},tableRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableCell"===t},acceptsLines:!1},tableCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},tableDelimRow:{continue:function(){return 1},finalize:function(){},canContain:function(t){return"tableDelimCell"===t},acceptsLines:!1},tableDelimCell:{continue:function(){return 1},finalize:function(){},canContain:function(){return!1},acceptsLines:!1},refDef:ge,customBlock:ve,frontMatter:ge};function we(t){for(var e=0,n=0,r=[],o=0;o<t.length;o+=1)if("|"===t[o]&&"\\"!==t[o-1]){var i=t.substring(e,o);0===e&&Q(i)?n=o+1:r.push(i),e=o+1}return e<t.length&&(Q(i=t.substring(e,t.length))||r.push(i)),[n,r]}function ke(t,e,n,r){for(var o=[],i=0,a=e;i<a.length;i++){var s=a[i],l=s.match(/^[ \t]+/),c=l?l[0].length:0,u=void 0,p=void 0;if(c===s.length)c=0,u=0,p="";else{var d=s.match(/[ \t]+$/);u=d?d[0].length:0,p=s.slice(c,s.length-u)}var f=r+c,h=gt(t,[[n,r],[n,r+s.length-1]]);h.stringContent=p.replace(/\\\|/g,"|"),h.startIdx=o.length,h.endIdx=o.length,h.lineOffsets=[f-1],h.paddingLeft=c,h.paddingRight=u,o.push(h),r+=s.length+1}return o}function xe(t){var e=null,n=t.stringContent,r=n[0];return":"===n[n.length-1]?e=":"===r?"center":"right":":"===r&&(e="left"),{align:e}}var Ce=/^(\$\$)(\s*[a-zA-Z])+/,Te=/^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,Ee=/^`{3,}(?!.*`)|^~{3,}/,Me=[/./,/^<(?:script|pre|style)(?:\s|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Z]/,/^<!\[CDATA\[/,/^<[/]?(?: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|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,new RegExp("^(?:"+Et+"|"+Mt+")\\s*$","i")],Ne=/^(?:=+|-+)[ \t]*$/,Se=/^#{1,6}(?:[ \t]+|$)/,De=/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,Le=/^[*+-]/,Oe=/^(\d{1,9})([.)])/;function Ae(t,e){return t.options.disallowDeepHeading&&("blockQuote"===e.type||"item"===e.type)}var Ie=[function(t){return t.indented||62!==de(t.currentLine,t.nextNonspace)?0:(t.advanceNextNonspace(),t.advanceOffset(1,!1),he(de(t.currentLine,t.offset))&&t.advanceOffset(1,!0),t.closeUnmatchedBlocks(),t.addChild("blockQuote",t.nextNonspace),1)},function(t,e){var n;if(!t.indented&&!Ae(t,e)&&(n=t.currentLine.slice(t.nextNonspace).match(Se))){t.advanceNextNonspace(),t.advanceOffset(n[0].length,!1),t.closeUnmatchedBlocks();var r=t.addChild("heading",t.nextNonspace);return r.level=n[0].trim().length,r.headingType="atx",r.stringContent=t.currentLine.slice(t.offset).replace(/^[ \t]*#+[ \t]*$/,"").replace(/[ \t]+#+[ \t]*$/,""),t.advanceOffset(t.currentLine.length-t.offset),2}return 0},function(t){var e;if(!t.indented&&(e=t.currentLine.slice(t.nextNonspace).match(Ee))){var n=e[0].length;t.closeUnmatchedBlocks();var r=t.addChild("codeBlock",t.nextNonspace);return r.isFenced=!0,r.fenceLength=n,r.fenceChar=e[0][0],r.fenceOffset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0},function(t,e){if(!t.indented&&60===de(t.currentLine,t.nextNonspace)){var n=t.currentLine.slice(t.nextNonspace),r=t.options.disallowedHtmlBlockTags,o=void 0;for(o=1;o<=7;o++){var i=n.match(Me[o]);if(i){if(7===o){if("paragraph"===e.type)return 0;if(r.length>0&&new RegExp("</?(?:"+r.join("|")+")","i").test(i[0]))return 0}return t.closeUnmatchedBlocks(),t.addChild("htmlBlock",t.offset).htmlBlockType=o,2}}}return 0},function(t,e){var n;if(null!==e.stringContent&&!t.indented&&"paragraph"===e.type&&!Ae(t,e.parent)&&(n=t.currentLine.slice(t.nextNonspace).match(Ne))){t.closeUnmatchedBlocks();for(var r=void 0;91===de(e.stringContent,0)&&(r=t.inlineParser.parseReference(e,t.refMap));)e.stringContent=e.stringContent.slice(r);if(e.stringContent.length>0){var o=gt("heading",e.sourcepos);return o.level="="===n[0][0]?1:2,o.headingType="setext",o.stringContent=e.stringContent,e.insertAfter(o),e.unlink(),t.tip=o,t.advanceOffset(t.currentLine.length-t.offset,!1),2}return 0}return 0},function(t){return!t.indented&&De.test(t.currentLine.slice(t.nextNonspace))?(t.closeUnmatchedBlocks(),t.addChild("thematicBreak",t.nextNonspace),t.advanceOffset(t.currentLine.length-t.offset,!1),2):0},function(t,e){var n,r,o,i=e;return t.indented&&"list"!==e.type||!(n=function(t,e){var n,r,o=t.currentLine.slice(t.nextNonspace),i={type:"bullet",tight:!0,bulletChar:"",start:0,delimiter:"",padding:0,markerOffset:t.indent,task:!1,checked:!1};if(t.indent>=4)return null;if(n=o.match(Le))i.type="bullet",i.bulletChar=n[0][0];else{if(!(n=o.match(Oe))||"paragraph"===e.type&&"1"!==n[1])return null;i.type="ordered",i.start=parseInt(n[1],10),i.delimiter=n[2]}if(-1!==(r=de(t.currentLine,t.nextNonspace+n[0].length))&&9!==r&&32!==r)return null;if("paragraph"===e.type&&!t.currentLine.slice(t.nextNonspace+n[0].length).match(ce))return null;t.advanceNextNonspace(),t.advanceOffset(n[0].length,!0);var a=t.column,s=t.offset;do{t.advanceOffset(1,!0),r=de(t.currentLine,t.offset)}while(t.column-a<5&&he(r));var l=-1===de(t.currentLine,t.offset),c=t.column-a;return c>=5||c<1||l?(i.padding=n[0].length+1,t.column=a,t.offset=s,he(de(t.currentLine,t.offset))&&t.advanceOffset(1,!0)):i.padding=n[0].length+c,i}(t,i))?0:(t.closeUnmatchedBlocks(),"list"===t.tip.type&&(o=n,(r=i.listData).type===o.type&&r.delimiter===o.delimiter&&r.bulletChar===o.bulletChar)||((i=t.addChild("list",t.nextNonspace)).listData=n),(i=t.addChild("item",t.nextNonspace)).listData=n,1)},function(t){return t.indented&&"paragraph"!==t.tip.type&&!t.blank?(t.advanceOffset(4,!0),t.closeUnmatchedBlocks(),t.addChild("codeBlock",t.offset),2):0},function(t,e){var n=e.stringContent;if("paragraph"===e.type&&!t.indented&&!t.blank){var r=n.length-1,o=n.lastIndexOf("\n",r-1)+1,i=n.slice(o,r),a=t.currentLine.slice(t.nextNonspace),s=we(i),l=s[0],c=s[1],u=we(a),p=u[0],d=u[1],f=/^[ \t]*:?-+:?[ \t]*$/;if(!c.length||!d.length||d.some(function(t){return!f.test(t)})||1===d.length&&0!==a.indexOf("|"))return 0;var h=e.lineOffsets,m=t.lineNumber-1,v=Rt(h)+1,g=gt("table",[[m,v],[t.lineNumber,t.offset]]);if(g.columns=d.map(function(){return{align:null}}),e.insertAfter(g),1===h.length)e.unlink();else{e.stringContent=n.slice(0,o);var y=o-(n.lastIndexOf("\n",o-2)+1)-1;t.lastLineLength=h[h.length-2]+y,t.finalize(e,m-1)}t.advanceOffset(t.currentLine.length-t.offset,!1);var b=gt("tableHead",[[m,v],[t.lineNumber,t.offset]]);g.appendChild(b);var w=gt("tableRow",[[m,v],[m,v+i.length-1]]),k=gt("tableDelimRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.offset]]);b.appendChild(w),b.appendChild(k),ke("tableCell",c,m,v+l).forEach(function(t){w.appendChild(t)});var x=ke("tableDelimCell",d,t.lineNumber,t.nextNonspace+1+p);return x.forEach(function(t){k.appendChild(t)}),g.columns=x.map(xe),t.tip=g,2}return 0},function(t,e){if("table"!==e.type&&"tableBody"!==e.type||!t.blank&&-1===t.currentLine.indexOf("|"))return 0;if(t.advanceOffset(t.currentLine.length-t.offset,!1),t.blank){var n=e;return"tableBody"===e.type&&(n=e.parent,t.finalize(e,t.lineNumber-1)),t.finalize(n,t.lineNumber-1),0}var r=e;"table"===e.type&&((r=t.addChild("tableBody",t.nextNonspace)).stringContent=null);var o=gt("tableRow",[[t.lineNumber,t.nextNonspace+1],[t.lineNumber,t.currentLine.length]]);r.appendChild(o);var i=r.parent,a=we(t.currentLine.slice(t.nextNonspace)),s=a[0];return ke("tableCell",a[1],t.lineNumber,t.nextNonspace+1+s).forEach(function(t,e){e>=i.columns.length&&(t.ignored=!0),o.appendChild(t)}),2},function(t){var e;if(!t.indented&&!Te.test(t.currentLine)&&(e=t.currentLine.match(Ce))){var n=e[1].length;t.closeUnmatchedBlocks();var r=t.addChild("customBlock",t.nextNonspace);return r.syntaxLength=n,r.offset=t.indent,t.advanceNextNonspace(),t.advanceOffset(n,!1),2}return 0}],Re=/^(-{3}|\+{3}|;{3})$/,Pe=function(t,e){var n=t.currentLine,r=t.lineNumber,o=t.indented;return 1===r&&!o&&"document"===e.type&&Re.test(n)?(t.closeUnmatchedBlocks(),t.addChild("frontMatter",t.nextNonspace).stringContent=n,t.advanceNextNonspace(),t.advanceOffset(n.length,!1),2):0},Be={continue:function(t,e){var n=t.currentLine,r=n.match(Re);return"frontMatter"===e.type&&r?(e.stringContent+=n,t.lastLineLength=r[0].length,t.finalize(e,t.lineNumber),2):0},finalize:function(t,e){null!==e.stringContent&&(e.literal=e.stringContent,e.stringContent=null)},canContain:function(){return!1},acceptsLines:!0},Fe=[/./,/<\/(?:script|pre|style)>/i,/-->/,/\?>/,/>/,/\]\]>/],He=/^[#`~*+_=<>0-9-;$]/,qe=/\r\n|\n|\r/;function ze(){return gt("document",[[1,1],[0,0]])}var _e={smart:!1,tagFilter:!1,extendedAutolinks:!1,disallowedHtmlBlockTags:[],referenceDefinition:!1,disallowDeepHeading:!1,customParser:null,frontMatter:!1},je=function(){function t(t){this.options=r(r({},_e),t),this.doc=ze(),this.tip=this.doc,this.oldtip=this.doc,this.lineNumber=0,this.offset=0,this.column=0,this.nextNonspace=0,this.nextNonspaceColumn=0,this.indent=0,this.currentLine="",this.indented=!1,this.blank=!1,this.partiallyConsumedTab=!1,this.allClosed=!0,this.lastMatchedContainer=this.doc,this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.lastLineLength=0,this.lines=[],this.options.frontMatter&&(be.frontMatter=Be,Ie.unshift(Pe)),this.inlineParser=new se(this.options)}return t.prototype.advanceOffset=function(t,e){void 0===e&&(e=!1);for(var n,r,o,i=this.currentLine;t>0&&(o=i[this.offset]);)"\t"===o?(n=4-this.column%4,e?(this.partiallyConsumedTab=n>t,r=n>t?t:n,this.column+=r,this.offset+=this.partiallyConsumedTab?0:1,t-=r):(this.partiallyConsumedTab=!1,this.column+=n,this.offset+=1,t-=1)):(this.partiallyConsumedTab=!1,this.offset+=1,this.column+=1,t-=1)},t.prototype.advanceNextNonspace=function(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn,this.partiallyConsumedTab=!1},t.prototype.findNextNonspace=function(){for(var t,e=this.currentLine,n=this.offset,r=this.column;""!==(t=e.charAt(n));)if(" "===t)n++,r++;else{if("\t"!==t)break;n++,r+=4-r%4}this.blank="\n"===t||"\r"===t||""===t,this.nextNonspace=n,this.nextNonspaceColumn=r,this.indent=this.nextNonspaceColumn-this.column,this.indented=this.indent>=4},t.prototype.addLine=function(){if(this.partiallyConsumedTab){this.offset+=1;var t=4-this.column%4;this.tip.stringContent+=X(" ",t)}this.tip.lineOffsets?this.tip.lineOffsets.push(this.offset):this.tip.lineOffsets=[this.offset],this.tip.stringContent+=this.currentLine.slice(this.offset)+"\n"},t.prototype.addChild=function(t,e){for(;!be[this.tip.type].canContain(t);)this.finalize(this.tip,this.lineNumber-1);var n=e+1,r=gt(t,[[this.lineNumber,n],[0,0]]);return r.stringContent="",this.tip.appendChild(r),this.tip=r,r},t.prototype.closeUnmatchedBlocks=function(){if(!this.allClosed){for(;this.oldtip!==this.lastMatchedContainer;){var t=this.oldtip.parent;this.finalize(this.oldtip,this.lineNumber-1),this.oldtip=t}this.allClosed=!0}},t.prototype.finalize=function(t,e){var n=t.parent;t.open=!1,t.sourcepos[1]=[e,this.lastLineLength],be[t.type].finalize(this,t),this.tip=n},t.prototype.processInlines=function(t){var e,n=this.options.customParser,r=t.walker();for(this.inlineParser.refMap=this.refMap,this.inlineParser.refLinkCandidateMap=this.refLinkCandidateMap,this.inlineParser.refDefCandidateMap=this.refDefCandidateMap,this.inlineParser.options=this.options;e=r.next();){var o=e.node,i=e.entering,a=o.type;n&&n[a]&&n[a](o,{entering:i,options:this.options}),i||"paragraph"!==a&&"heading"!==a&&("tableCell"!==a||o.ignored)||this.inlineParser.parse(o)}},t.prototype.incorporateLine=function(t){var e=this.doc;this.oldtip=this.tip,this.offset=0,this.column=0,this.blank=!1,this.partiallyConsumedTab=!1,this.lineNumber+=1,-1!==t.indexOf("\0")&&(t=t.replace(/\0/g,"�")),this.currentLine=t;for(var n,r=!0;(n=e.lastChild)&&n.open;){switch(e=n,this.findNextNonspace(),be[e.type].continue(this,e)){case 0:break;case 1:r=!1;break;case 2:return void(this.lastLineLength=t.length);default:throw new Error("continue returned illegal value, must be 0, 1, or 2")}if(!r){e=e.parent;break}}this.allClosed=e===this.oldtip,this.lastMatchedContainer=e;for(var o="paragraph"!==e.type&&be[e.type].acceptsLines,i=Ie.length;!o;){if(this.findNextNonspace(),"table"!==e.type&&"tableBody"!==e.type&&"paragraph"!==e.type&&!this.indented&&!He.test(t.slice(this.nextNonspace))){this.advanceNextNonspace();break}for(var a=0;a<i;){var s=Ie[a](this,e);if(1===s){e=this.tip;break}if(2===s){e=this.tip,o=!0;break}a++}if(a===i){this.advanceNextNonspace();break}}if(this.allClosed||this.blank||"paragraph"!==this.tip.type){this.closeUnmatchedBlocks(),this.blank&&e.lastChild&&(e.lastChild.lastLineBlank=!0);for(var l=e.type,c=this.blank&&!("blockQuote"===l||yt(e)&&e.isFenced||"item"===l&&!e.firstChild&&e.sourcepos[0][0]===this.lineNumber),u=e;u;)u.lastLineBlank=c,u=u.parent;be[l].acceptsLines?(this.addLine(),"htmlBlock"===e.type&&e.htmlBlockType>=1&&e.htmlBlockType<=5&&Fe[e.htmlBlockType].test(this.currentLine.slice(this.offset))&&(this.lastLineLength=t.length,this.finalize(e,this.lineNumber))):this.offset<t.length&&!this.blank&&(e=this.addChild("paragraph",this.offset),this.advanceNextNonspace(),this.addLine())}else this.addLine();this.lastLineLength=t.length},t.prototype.parse=function(t,e){this.doc=ze(),this.tip=this.doc,this.lineNumber=0,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";var n=t.split(qe),r=n.length;this.lines=e||n,this.options.referenceDefinition&&this.clearRefMaps(),10===t.charCodeAt(t.length-1)&&(r-=1);for(var o=0;o<r;o++)this.incorporateLine(n[o]);for(;this.tip;)this.finalize(this.tip,r);return this.processInlines(this.doc),this.doc},t.prototype.partialParseStart=function(t,e){this.doc=ze(),this.tip=this.doc,this.lineNumber=t-1,this.lastLineLength=0,this.offset=0,this.column=0,this.lastMatchedContainer=this.doc,this.currentLine="";for(var n=e.length,r=0;r<n;r++)this.incorporateLine(e[r]);return this.doc},t.prototype.partialParseExtends=function(t){for(var e=0;e<t.length;e++)this.incorporateLine(t[e])},t.prototype.partialParseFinish=function(){for(;this.tip;)this.finalize(this.tip,this.lineNumber);this.processInlines(this.doc)},t.prototype.setRefMaps=function(t,e,n){this.refMap=t,this.refLinkCandidateMap=e,this.refDefCandidateMap=n},t.prototype.clearRefMaps=function(){[this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){var e;e=t,Object.keys(e).forEach(function(t){delete e[t]})})},t}();function Ve(t,e){return t[0]<e[0]?1:t[0]>e[0]?-1:t[1]<e[1]?1:t[1]>e[1]?-1:0}function Ue(t,e){var n=t[0];return 1===Ve(t[1],e)?1:-1===Ve(n,e)?-1:0}function $e(t,e){for(var n=0,r=e;n<r.length;n++){var o=r[n];t.insertBefore(o)}}function We(t,e){var n=t[0];return t[1][0]<e?1:n[0]>e?-1:0}function Ge(t,e){for(var n=t.firstChild;n;){var r=We(n.sourcepos,e);if(0===r)return n;if(-1===r)return n.prev||n;n=n.next}return t.lastChild}function Ke(t){return function(t){return nt[t]}(t)||null}function Je(t,e,n){if(void 0===n&&(n=null),e)for(var r=e.walker();e&&e!==n;){t(e);var o=r.next();if(!o)break;e=o.node}}var Ze=/\r\n|\n|\r/;function Xe(t){return{id:t.id,title:t.title,sourcepos:t.sourcepos,unlinked:!1,destination:t.dest}}var Qe=function(){function t(t,e){this.refMap={},this.refLinkCandidateMap={},this.refDefCandidateMap={},this.referenceDefinition=!!(null==e?void 0:e.referenceDefinition),this.parser=new je(e),this.parser.setRefMaps(this.refMap,this.refLinkCandidateMap,this.refDefCandidateMap),this.eventHandlerMap={change:[]},t=t||"",this.lineTexts=t.split(Ze),this.root=this.parser.parse(t,this.lineTexts)}return t.prototype.updateLineTexts=function(t,e,n){var r,i=t[0],a=t[1],s=e[0],l=e[1],c=n.split(Ze),u=c.length,p=this.lineTexts[i-1],d=this.lineTexts[s-1];c[0]=p.slice(0,a-1)+c[0],c[u-1]=c[u-1]+d.slice(l-1);var f=s-i+1;return(r=this.lineTexts).splice.apply(r,o([i-1,f],c)),u-f},t.prototype.updateRootNodeState=function(){if(1===this.lineTexts.length&&""===this.lineTexts[0])return this.root.lastLineBlank=!0,void(this.root.sourcepos=[[1,1],[1,0]]);this.root.lastChild&&(this.root.lastLineBlank=this.root.lastChild.lastLineBlank);for(var t=this.lineTexts,e=t.length-1;""===t[e];)e-=1;t.length-2>e&&(e+=1),this.root.sourcepos[1]=[e+1,t[e].length]},t.prototype.replaceRangeNodes=function(t,e,n){t?($e(t,n),function(t,e){if(t.parent===e.parent&&t!==e){for(var n=t.next;n&&n!==e;){for(var r=n.next,o=0,i=["parent","prev","next"];o<i.length;o++){var a=i[o];n[a]&&(rt(n[a].id),n[a]=null)}n=r}t.next=e.next,e.next?e.next.prev=t:t.parent.lastChild=t}}(t,e),[t.id,e.id].forEach(function(t){return rt(t)}),t.unlink()):e?($e(e,n),rt(e.id),e.unlink()):function(t,e){for(var n=e.length-1;n>=0;n-=1)t.prependChild(e[n])}(this.root,n)},t.prototype.getNodeRange=function(t,e){var n=Ge(this.root,t[0]),r=Ge(this.root,e[0]);return r&&r.next&&e[0]+1===r.next.sourcepos[0][0]&&(r=r.next),[n,r]},t.prototype.trigger=function(t,e){this.eventHandlerMap[t].forEach(function(t){t(e)})},t.prototype.extendEndLine=function(t){for(;""===this.lineTexts[t];)t+=1;return t},t.prototype.parseRange=function(t,e,n,r){var o;t&&t.prev&&(bt(t.prev)&&function(t){var e=t.match(/^[ \t]+/);if(e&&(e[0].length>=2||/\t/.test(e[0])))return!0;var n=e?t.slice(e.length):t;return Le.test(n)||Oe.test(n)}(this.lineTexts[n-1])||"table"===t.prev.type&&!fe(o=this.lineTexts[n-1])&&-1!==o.indexOf("|"))&&(n=(t=t.prev).sourcepos[0][0]);for(var i=this.lineTexts.slice(n-1,r),a=this.parser.partialParseStart(n,i),s=e?e.next:this.root.firstChild,l=a.lastChild,c=l&&yt(l)&&l.open,u=l&&kt(l)&&l.open,p=l&&bt(l);(c||u)&&s||p&&s&&("list"===s.type||s.sourcepos[0][1]>=2);){var d=this.extendEndLine(s.sourcepos[1][0]);this.parser.partialParseExtends(this.lineTexts.slice(r,d)),t||(t=e),e=s,r=d,s=s.next}return this.parser.partialParseFinish(),{newNodes:function(t){for(var e=[],n=t.firstChild;n;)e.push(n),n=n.next;return e}(a),extStartNode:t,extEndNode:e}},t.prototype.getRemovedNodeRange=function(t,e){return!t||t&&wt(t)||e&&wt(e)?null:{id:[t.id,e.id],line:[t.sourcepos[0][0]-1,e.sourcepos[1][0]-1]}},t.prototype.markDeletedRefMap=function(t,e){var n=this;if(!Ft(this.refMap)){var r=function(t){if(wt(t)){var e=n.refMap[t.label];e&&t.id===e.id&&(e.unlinked=!0)}};t&&Je(r,t.parent,e),e&&Je(r,e)}},t.prototype.replaceWithNewRefDefState=function(t){var e=this;if(!Ft(this.refMap)){var n=function(t){if(wt(t)){var n=t.label,r=e.refMap[n];r&&!r.unlinked||(e.refMap[n]=Xe(t))}};t.forEach(function(t){Je(n,t)})}},t.prototype.replaceWithRefDefCandidate=function(){var t=this;Ft(this.refDefCandidateMap)||Bt(this.refDefCandidateMap,function(e,n){var r=n.label,o=n.sourcepos,i=t.refMap[r];(!i||i.unlinked||i.sourcepos[0][0]>o[0][0])&&(t.refMap[r]=Xe(n))})},t.prototype.getRangeWithRefDef=function(t,e,n,r,o){if(this.referenceDefinition&&!Ft(this.refMap)){var i=Ge(this.root,t-1),a=Ge(this.root,e+1);i&&wt(i)&&i!==n&&i!==r&&(t=(n=i).sourcepos[0][0]),a&&wt(a)&&a!==n&&a!==r&&(r=a,e=this.extendEndLine(r.sourcepos[1][0]+o))}return[n,r,t,e]},t.prototype.parse=function(t,e,n){void 0===n&&(n=0);var r=this.getNodeRange(t,e),o=r[0],i=r[1],a=o?Math.min(o.sourcepos[0][0],t[0]):t[0],s=this.extendEndLine((i?Math.max(i.sourcepos[1][0],e[0]):e[0])+n),l=this.parseRange.apply(this,this.getRangeWithRefDef(a,s,o,i,n)),c=l.newNodes,u=l.extStartNode,p=l.extEndNode,d=this.getRemovedNodeRange(u,p),f=p?p.next:this.root.firstChild;return this.referenceDefinition?(this.markDeletedRefMap(u,p),this.replaceRangeNodes(u,p,c),this.replaceWithNewRefDefState(c)):this.replaceRangeNodes(u,p,c),{nodes:c,removedNodeRange:d,nextNode:f}},t.prototype.parseRefLink=function(){var t=this,e=[];return Ft(this.refMap)||Bt(this.refMap,function(n,r){r.unlinked&&delete t.refMap[n],Bt(t.refLinkCandidateMap,function(r,o){var i=o.node;o.refLabel===n&&e.push(t.parse(i.sourcepos[0],i.sourcepos[1]))})}),e},t.prototype.removeUnlinkedCandidate=function(){Ft(this.refDefCandidateMap)||[this.refLinkCandidateMap,this.refDefCandidateMap].forEach(function(t){Bt(t,function(e){(function(t){var e=Ke(t);if(!e)return!0;for(;e&&"document"!==e.type;){if(!e.parent&&!e.prev&&!e.next)return!0;e=e.parent}return!1})(e)&&delete t[e]})})},t.prototype.editMarkdown=function(t,e,n){var o=this.updateLineTexts(t,e,n),i=this.parse(t,e,o),a=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o=r({},t);return e.forEach(function(t){delete o[t]}),o}(i,"nextNode");!function(t,e){if(t&&t.parent&&0!==e){var n,r=t.parent.walker();for(r.resumeAt(t,!0);n=r.next();){var o=n.node;n.entering&&(o.sourcepos[0][0]+=e,o.sourcepos[1][0]+=e)}}}(i.nextNode,o),this.updateRootNodeState();var s=[a];return this.referenceDefinition&&(this.removeUnlinkedCandidate(),this.replaceWithRefDefCandidate(),s=s.concat(this.parseRefLink())),this.trigger("change",s),s},t.prototype.getLineTexts=function(){return this.lineTexts},t.prototype.getRootNode=function(){return this.root},t.prototype.findNodeAtPosition=function(t){var e=function(t,e){for(var n=t,r=null;n;){var o=Ue(n.sourcepos,e);if(0===o){if(!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)return r;if(!n.next)return r;n=n.next}}return n}(this.root,t);return e&&e!==this.root?e:null},t.prototype.findFirstNodeAtLine=function(t){return function(t,e){for(var n=t.firstChild,r=null;n;){var o=We(n.sourcepos,e);if(0===o){if(n.sourcepos[0][0]===e||!n.firstChild)return n;r=n,n=n.firstChild}else{if(-1===o)break;r=n,n=n.next}}return r?function(t){for(;t.parent&&"document"!==t.parent.type&&t.parent.sourcepos[0][0]===t.sourcepos[0][0];)t=t.parent;return t}(function(t){for(;t.lastChild;)t=t.lastChild;return t}(r)):null}(this.root,t)},t.prototype.on=function(t,e){this.eventHandlerMap[t].push(e)},t.prototype.off=function(t,e){var n=this.eventHandlerMap[t],r=n.indexOf(e);n.splice(r,1)},t.prototype.findNodeById=function(t){return Ke(t)},t.prototype.removeAllNode=function(){nt={}},t}(),Ye=new RegExp("<(/?(?:"+["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"].join("|")+")[^>]*>)","ig");function tn(t){return Ye.test(t)?t.replace(Ye,function(t,e){return"&lt;"+e}):t}var en={heading:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"h"+t.level,outerNewLine:!0}},text:function(t){return{type:"text",content:t.literal}},softbreak:function(t,e){return{type:"html",content:e.options.softbreak}},linebreak:function(){return{type:"html",content:"<br />\n"}},emph:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"em"}},strong:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"strong"}},paragraph:function(t,e){var n,r=e.entering,o=null===(n=t.parent)||void 0===n?void 0:n.parent;return o&&"list"===o.type&&o.listData.tight?null:{type:r?"openTag":"closeTag",tagName:"p",outerNewLine:!0}},thematicBreak:function(){return{type:"openTag",tagName:"hr",outerNewLine:!0,selfClose:!0}},blockQuote:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"blockquote",outerNewLine:!0,innerNewLine:!0}},list:function(t,e){var n=e.entering,r=t.listData,o=r.type,i=r.start,a="bullet"===o?"ul":"ol",s={};return"ol"===a&&null!==i&&1!==i&&(s.start=i.toString()),{type:n?"openTag":"closeTag",tagName:a,attributes:s,outerNewLine:!0}},item:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"li",outerNewLine:!0}},htmlInline:function(t,e){return{type:"html",content:e.options.tagFilter?tn(t.literal):t.literal}},htmlBlock:function(t,e){var n=e.options,r=n.tagFilter?tn(t.literal):t.literal;return n.nodeId?[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"html",content:r},{type:"closeTag",tagName:"div",outerNewLine:!0}]:{type:"html",content:r,outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code"},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t.info,n=e?e.split(/\s+/):[],r=[];return n.length>0&&n[0].length>0&&r.push("language-"+Z(n[0])),[{type:"openTag",tagName:"pre",outerNewLine:!0},{type:"openTag",tagName:"code",classNames:r},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre",outerNewLine:!0}]},link:function(t,e){if(e.entering){var n=t,o=n.title,i=n.destination;return{type:"openTag",tagName:"a",attributes:r({href:Z(i)},o&&{title:Z(o)})}}return{type:"closeTag",tagName:"a"}},image:function(t,e){var n=e.getChildrenText,o=e.skipChildren,i=t,a=i.title,s=i.destination;return o(),{type:"openTag",tagName:"img",selfClose:!0,attributes:r({src:Z(s),alt:n(t)},a&&{title:Z(a)})}},customBlock:function(t,e,n){var r=n[t.info.trim().toLowerCase()];if(r)try{return r(t,e)}catch(o){}return[{type:"openTag",tagName:"div",outerNewLine:!0},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},frontMatter:function(t){return[{type:"openTag",tagName:"div",outerNewLine:!0,attributes:{style:"white-space: pre; display: none;"}},{type:"text",content:t.literal},{type:"closeTag",tagName:"div",outerNewLine:!0}]},customInline:function(t,e,n){var r=t,o=r.info,i=r.firstChild,a=n[o.trim().toLowerCase()],s=e.entering;if(a)try{return a(t,e)}catch(l){}return s?[{type:"openTag",tagName:"span"},{type:"text",content:"$$"+o+(i?" ":"")}]:[{type:"text",content:"$$"},{type:"closeTag",tagName:"span"}]}},nn={strike:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"del"}},item:function(t,e){var n=e.entering,o=t.listData,i=o.checked,a=o.task;if(n){var s={type:"openTag",tagName:"li",outerNewLine:!0};return a?[s,{type:"openTag",tagName:"input",selfClose:!0,attributes:r(r({},i&&{checked:""}),{disabled:"",type:"checkbox"})},{type:"text",content:" "}]:s}return{type:"closeTag",tagName:"li",outerNewLine:!0}},table:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"table",outerNewLine:!0}},tableHead:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"thead",outerNewLine:!0}},tableBody:function(t,e){return{type:e.entering?"openTag":"closeTag",tagName:"tbody",outerNewLine:!0}},tableRow:function(t,e){if(e.entering)return{type:"openTag",tagName:"tr",outerNewLine:!0};var n=[];if(t.lastChild)for(var r=t.parent.parent.columns.length,o=t.lastChild.endIdx+1;o<r;o+=1)n.push({type:"openTag",tagName:"td",outerNewLine:!0},{type:"closeTag",tagName:"td",outerNewLine:!0});return n.push({type:"closeTag",tagName:"tr",outerNewLine:!0}),n},tableCell:function(t,e){var n=e.entering;if(t.ignored)return{type:"text",content:""};var o=t.parent.parent,i="tableHead"===o.type?"th":"td",a=o.parent.columns[t.startIdx],s=(null==a?void 0:a.align)?{align:a.align}:null;return n?r({type:"openTag",tagName:i,outerNewLine:!0},s&&{attributes:s}):{type:"closeTag",tagName:i,outerNewLine:!0}}},rn={softbreak:"\n",gfm:!1,tagFilter:!1,nodeId:!1};function on(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var an=function(){function t(t){this.buffer=[],this.options=r(r({},rn),t),this.convertors=this.createConvertors(),delete this.options.convertors}return t.prototype.createConvertors=function(){var t=r({},en);if(this.options.gfm&&(t=r(r({},t),nn)),this.options.convertors){var e=this.options.convertors,n=Object.keys(e),o=r(r({},en),nn);n.forEach(function(n){var r=t[n],i=e[n],a=-1===Object.keys(o).indexOf(n)?n.toLowerCase():n;t[a]=r?function(t,e,n){return e.origin=function(){return r(t,e,n)},i(t,e)}:i})}return t},t.prototype.getConvertors=function(){return this.convertors},t.prototype.getOptions=function(){return this.options},t.prototype.render=function(t){var e=this;this.buffer=[];for(var n=t.walker(),r=null,o=function(){var t=r.node,o=r.entering,a=i.convertors[t.type];if(!a)return"continue";var s=!1,l={entering:o,leaf:!tt(t),options:i.options,getChildrenText:on,skipChildren:function(){s=!0}},c=kt(t)||function(t){return"customInline"===t.type}(t)?a(t,l,i.convertors):a(t,l);c&&((Array.isArray(c)?c:[c]).forEach(function(n,r){"openTag"===n.type&&e.options.nodeId&&0===r&&(n.attributes||(n.attributes={}),n.attributes["data-nodeid"]=String(t.id)),e.renderHTMLNode(n)}),s&&(n.resumeAt(t,!1),n.next()))},i=this;r=n.next();)o();return this.addNewLine(),this.buffer.join("")},t.prototype.renderHTMLNode=function(t){switch(t.type){case"openTag":case"closeTag":this.renderElementNode(t);break;case"text":this.renderTextNode(t);break;case"html":this.renderRawHtmlNode(t)}},t.prototype.generateOpenTagString=function(t){var e=this,n=t.tagName,r=t.classNames,o=t.attributes;this.buffer.push("<"+n),r&&r.length>0&&this.buffer.push(' class="'+r.join(" ")+'"'),o&&Object.keys(o).forEach(function(t){var n=o[t];e.buffer.push(" "+t+'="'+n+'"')}),t.selfClose&&this.buffer.push(" /"),this.buffer.push(">")},t.prototype.generateCloseTagString=function(t){var e=t.tagName;this.buffer.push("</"+e+">")},t.prototype.addNewLine=function(){this.buffer.length&&"\n"!==Rt(Rt(this.buffer))&&this.buffer.push("\n")},t.prototype.addOuterNewLine=function(t){t.outerNewLine&&this.addNewLine()},t.prototype.addInnerNewLine=function(t){t.innerNewLine&&this.addNewLine()},t.prototype.renderTextNode=function(t){this.buffer.push(Z(t.content))},t.prototype.renderRawHtmlNode=function(t){this.addOuterNewLine(t),this.buffer.push(t.content),this.addOuterNewLine(t)},t.prototype.renderElementNode=function(t){"openTag"===t.type?(this.addOuterNewLine(t),this.generateOpenTagString(t),t.selfClose?this.addOuterNewLine(t):this.addInnerNewLine(t)):(this.addInnerNewLine(t),this.generateCloseTagString(t),this.addOuterNewLine(t))},t}(),sn=a(956),ln=/* @__PURE__ */a.n(sn),cn=a(969),un=/* @__PURE__ */a.n(cn),pn=a(348),dn=/* @__PURE__ */a.n(pn),fn=a(349),hn=/* @__PURE__ */a.n(fn),mn=a(204),vn=/* @__PURE__ */a.n(mn),gn=a(462),yn=/* @__PURE__ */a.n(gn),bn=a(522),wn=/* @__PURE__ */a.n(bn),kn=a(990),xn=/* @__PURE__ */a.n(kn),Cn=a(322),Tn=/* @__PURE__ */a.n(Cn),En=a(758),Mn=/* @__PURE__ */a.n(En),Nn=a(929),Sn=/* @__PURE__ */a.n(Nn),Dn=a(714),Ln=/* @__PURE__ */a.n(Dn);a(471);var On="[A-Za-z][A-Za-z0-9-]*",An="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",In=new RegExp("^(?:<("+On+")("+An+")*\\s*/?>|</("+On+")\\s*[>])","i");function Rn(t,e){return-1!==t.indexOf(e)}a(934),a(391);var Pn=["rel","target","hreflang","type"];function Bn(t){return"object"==typeof t&&null!==t}function Fn(e,n){var r=t({},e);return e&&n&&Object.keys(n).forEach(function(t){Bn(r[t])?Array.isArray(n[t])?r[t]=Hn(n[t]):r.hasOwnProperty(t)?r[t]=Fn(r[t],n[t]):r[t]=qn(n[t]):r[t]=n[t]}),r}function Hn(t){return t.map(function(t){return Bn(t)?Array.isArray(t)?Hn(t):qn(t):t})}function qn(t){var e=Object.keys(t);return e.length?e.reduce(function(e,n){return Bn(t[n])?e[n]=Array.isArray(t[n])?Hn(t[n]):qn(t[n]):e[n]=t[n],e},{}):t}function zn(t,e){return void 0===e&&(e={}),Object.keys(e).forEach(function(n){t.hasOwnProperty(n)&&"object"==typeof t[n]?Array.isArray(e[n])?t[n]=e[n]:zn(t[n],e[n]):t[n]=e[n]}),t}function _n(t,e){return t>e?[e,t]:[t,e]}function jn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,o=t;r<o.length;r++){var i,a=o[r];(i=Array.isArray(a)?a[0]?a[1]:null:a)&&n.push("toastui-editor-"+i)}return n.join(" ")}function Vn(t){t.parentNode&&t.parentNode.removeChild(t)}function Un(t,e,n){Sn()(n)&&(n=!Ln()(t,e)),(n?vn():yn())(t,e)}var $n=a(294),Wn=/* @__PURE__ */a.n($n);function Gn(t){return t.sourcepos[0][1]}function Kn(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}var Jn={},Zn=/\$\$widget\d+\s/;function Xn(t){var e=t.search(Zn);if(-1!==e){var n=t.substring(e).replace(Zn,"").replace("$$","");t=t.substring(0,e),t+=Xn(n)}return t}function Qn(t,e){var n=Jn[t],r=n.rule,o=n.toDOM,i=Xn(e).match(r);return i&&(e=i[0]),o(e)}var Yn=a(368),tr=/* @__PURE__ */a.n(Yn),er=["iframe","embed"],nr=[];function rr(e,n){return tr().sanitize(e,t({ADD_TAGS:nr,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},n))}var or=/^\s*<\s*\//,ir={paragraph:function(t,e){var n=e.entering,r=e.origin;return e.options.nodeId?{type:n?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:r()},softbreak:function(t){return{type:"html",content:t.prev&&"htmlInline"===t.prev.type&&/<br ?\/?>/.test(t.prev.literal)?"\n":"<br>\n"}},item:function(t,e){if(e.entering){var n={},r=[];return t.listData.task&&(n["data-task"]="",r.push("task-list-item"),t.listData.checked&&(r.push("checked"),n["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:r,attributes:n,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(t){return[{type:"openTag",tagName:"code",attributes:{"data-backticks":String(t.tickCount)}},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(t){var e=t,n=e.fenceLength,r=e.info,o=r?r.split(/\s+/):[],i=[],a={};if(n>3&&(a["data-backticks"]=n),o.length>0&&o[0].length>0){var s=o[0];i.push("lang-"+s),a["data-language"]=s}return[{type:"openTag",tagName:"pre",classNames:i},{type:"openTag",tagName:"code",attributes:a},{type:"text",content:t.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(t,e){var n=e.origin,r=e.entering,o=e.skipChildren,i=t.info;if(-1!==i.indexOf("widget")&&r){o();var a=function(t){for(var e,n="",r=t.walker();e=r.next();){var o=e.node;e.entering&&(o!==t&&"text"!==o.type?(n+=Kn(o),r.resumeAt(t,!1),r.next()):"text"===o.type&&(n+=o.literal))}return n}(t);return[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:Qn(i,a).outerHTML},{type:"closeTag",tagName:"span"}]}return n()}};function ar(e,n){var r=t({},ir);return e&&(r.link=function(n,r){var o=r.entering,i=(0,r.origin)();return o&&(i.attributes=t(t({},i.attributes),e)),i}),n&&Object.keys(n).forEach(function(e){var o=r[e],i=n[e];o&&Wn()(i)?r[e]=function(e,n){var r=t({},n);return r.origin=function(){return o(e,n)},i(e,r)}:Rn(["htmlBlock","htmlInline"],e)&&!Wn()(i)?r[e]=function(e,n){var r=e.literal.match(In);if(r){var o=r[0],a=r[1],s=r[3],l=(a||s).toLowerCase(),c=i[l],u=function(t,e){return t.literal.replace(new RegExp("(<\\s*"+e+"[^>]*>)|(</"+e+"\\s*[>])","ig"),"").trim()}(e,l);if(c){var p=t({},e);return p.attrs=function(t){var e=(t=t.match(In)[0]).match(new RegExp(An,"g"));return e?e.reduce(function(t,e){var n=e.trim().split("="),r=n[0],o=n.slice(1);return o.length&&(t[r]=o.join("=").replace(/'|"/g,"").trim()),t},{}):{}}(o),p.childrenHTML=u,p.type=l,n.entering=!or.test(e.literal),c(p,n)}}return n.origin()}:r[e]=i}),r}var sr=["UL","OL","BLOCKQUOTE"];function lr(t,e){for(var n=0;t&&t!==e&&(Rn(sr,t.tagName)||(n+=t.offsetTop),t.offsetParent!==e.offsetParent);)t=t.parentElement;return n}function cr(t,e,n){return t&&e>n+t.offsetTop?cr(t.nextElementSibling,e,n)||t:null}var ur={};function pr(t){t&&(delete ur[Number(t.getAttribute("data-nodeid"))],xn()(t.children).forEach(function(t){pr(t)}))}var dr=jn("md-preview-highlight"),fr=function(){function t(t,e){var n=document.createElement("div");this.el=n,this.eventEmitter=t,this.isViewer=!!e.isViewer,this.el.className=jn("md-preview");var r=e.linkAttributes,o=e.customHTMLRenderer,i=e.sanitizer,a=e.highlight,s=void 0!==a&&a;this.renderer=new an({gfm:!0,nodeId:!0,convertors:ar(r,o)}),this.cursorNodeId=null,this.sanitizer=i,this.initEvent(s),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return t.prototype.initContentSection=function(){this.previewContent=function(t){var e=document.createElement("div");return Mn()(t)?e.innerHTML=t:e.appendChild(t),e.firstChild}('<div class="'+jn("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},t.prototype.toggleActive=function(t){Un(this.el,"active",t)},t.prototype.initEvent=function(t){var e=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),this.isViewer||(t&&(this.eventEmitter.listen("changeToolbarState",function(t){var n=t.mdNode,r=t.cursorPos;e.updateCursorNode(n,r)}),this.eventEmitter.listen("blur",function(){e.removeHighlight()})),dn()(this.el,"scroll",function(t){e.eventEmitter.emit("scroll","preview",function(t,e){for(var n=e,r=null;n;){var o=n.firstElementChild;if(!o)break;r=n,n=cr(o,t,lr(n,e))}var i=n||r;return i===e?null:i}(t.target.scrollTop,e.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return e.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return e.toggleActive(!1)}))},t.prototype.removeHighlight=function(){if(this.cursorNodeId){var t=this.getElementByNodeId(this.cursorNodeId);t&&yn()(t,dr)}},t.prototype.updateCursorNode=function(t,e){t&&("tableRow"===(t=function(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}(t,function(t){return!function(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}(t)})).type?t=function(t,e){for(var n=t.firstChild;n&&n.next&&!(Gn(n.next)>e+1);)n=n.next;return n}(t,e[1]):"tableBody"===t.type&&(t=null));var n=t?t.id:null;if(this.cursorNodeId!==n){var r=this.getElementByNodeId(this.cursorNodeId),o=this.getElementByNodeId(n);r&&yn()(r,dr),o&&vn()(o,dr),this.cursorNodeId=n}},t.prototype.getElementByNodeId=function(t){return t?this.previewContent.querySelector('[data-nodeid="'+t+'"]'):null},t.prototype.update=function(t){var e=this;t.forEach(function(t){return e.replaceRangeNodes(t)}),this.eventEmitter.emit("afterPreviewRender",this)},t.prototype.replaceRangeNodes=function(t){var e=this,n=t.nodes,r=t.removedNodeRange,o=this.previewContent,i=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(n.map(function(t){return e.renderer.render(t)}).join("")));if(r){var a=r.id,s=a[0],l=a[1],c=this.getElementByNodeId(s),u=this.getElementByNodeId(l);if(c){c.insertAdjacentHTML("beforebegin",i);for(var p=c;p&&p!==u;){var d=p.nextElementSibling;Vn(p),pr(p),p=d}(null==p?void 0:p.parentNode)&&(Vn(p),pr(p))}}else o.insertAdjacentHTML("afterbegin",i)},t.prototype.getRenderer=function(){return this.renderer},t.prototype.destroy=function(){hn()(this.el,"scroll"),this.el=null},t.prototype.getElement=function(){return this.el},t.prototype.getHTML=function(){return this.previewContent.innerHTML},t.prototype.setHTML=function(t){this.previewContent.innerHTML=t},t.prototype.setHeight=function(t){wn()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){wn()(this.el,{minHeight:t+"px"})},t}(),hr=a(814),mr=a(479),vr=a(311),gr=a(43),yr=a(928),br=/* @__PURE__ */a.n(yr),wr=function(){function t(){this.keys=[],this.values=[]}return t.prototype.getKeyIndex=function(t){return br()(t,this.keys)},t.prototype.get=function(t){return this.values[this.getKeyIndex(t)]},t.prototype.set=function(t,e){var n=this.getKeyIndex(t);return n>-1?this.values[n]=e:(this.keys.push(t),this.values.push(e)),this},t.prototype.has=function(t){return this.getKeyIndex(t)>-1},t.prototype.delete=function(t){var e=this.getKeyIndex(t);return e>-1&&(this.keys.splice(e,1),this.values.splice(e,1),!0)},t.prototype.forEach=function(t,e){var n=this;void 0===e&&(e=this),this.values.forEach(function(r,o){r&&n.keys[o]&&t.call(e,r,n.keys[o],n)})},t.prototype.clear=function(){this.keys=[],this.values=[]},t}(),kr=wr,xr="en-US",Cr=function(){function t(){this.code=xr,this.langs=new kr}return t.prototype.setCode=function(t){this.code=t||xr},t.prototype.setLanguage=function(t,e){var n=this;(t=[].concat(t)).forEach(function(t){if(n.langs.has(t)){var r=n.langs.get(t);n.langs.set(t,un()(r,e))}else n.langs.set(t,e)})},t.prototype.get=function(t,e){e||(e=this.code);var n=this.langs.get(e);n||(n=this.langs.get(xr));var r=n[t];if(!r)throw new Error('There is no text key "'+t+'" in '+e);return r},t}(),Tr=new Cr,Er=/* @__PURE__ */new Map,Mr=function(){function t(t,e,n,r){this.table=t,this.tableRows=e,this.tableStartPos=n,this.rowInfo=r}return t.create=function(e){var n=function(t,e){for(var n=t.depth;n;){var r=t.node(n);if(e(r))return{node:r,depth:n,offset:n>0?t.before(n):0};n-=1}return null}(e,function(t){return"table"===t.type.name});if(n){var r=n.node,o=n.depth,i=n.offset,a=Er.get(r);if((null==a?void 0:a.tableStartPos)===i+1)return a;var s=[],l=e.start(o),c=r.child(0),u=r.child(1),p=Nr(c,l),d=Nr(u,l+c.nodeSize);c.forEach(function(t){return s.push(t)}),u.forEach(function(t){return s.push(t)});var f=new t(r,s,l,p.concat(d));return Er.set(r,f),f}return null},Object.defineProperty(t.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),t.prototype.getCellInfo=function(t,e){return this.rowInfo[t][e]},t.prototype.posAt=function(t,e){for(var n=0,r=this.tableStartPos;;n+=1){var o=r+this.tableRows[n].nodeSize;if(n===t){for(var i=e;i<this.totalColumnCount&&this.rowInfo[n][i].offset<r;)i+=1;return i===this.totalColumnCount?o:this.rowInfo[n][i].offset}r=o}},t.prototype.getNodeAndPos=function(t,e){var n=this.rowInfo[t][e];return{node:this.table.nodeAt(n.offset-this.tableStartOffset),pos:n.offset}},t.prototype.extendedRowspan=function(t,e){return!1},t.prototype.extendedColspan=function(t,e){return!1},t.prototype.getRowspanCount=function(t,e){return 0},t.prototype.getColspanCount=function(t,e){return 0},t.prototype.decreaseColspanCount=function(t,e){return 0},t.prototype.decreaseRowspanCount=function(t,e){return 0},t.prototype.getColspanStartInfo=function(t,e){return null},t.prototype.getRowspanStartInfo=function(t,e){return null},t.prototype.getCellStartOffset=function(t,e){var n=this.rowInfo[t][e].offset;return this.extendedRowspan(t,e)?this.posAt(t,e):n},t.prototype.getCellEndOffset=function(t,e){var n=this.rowInfo[t][e],r=n.offset,o=n.nodeSize;return this.extendedRowspan(t,e)?this.posAt(t,e):r+o},t.prototype.getCellIndex=function(t){for(var e=0;e<this.totalRowCount;e+=1)for(var n=this.rowInfo[e],r=0;r<this.totalColumnCount;r+=1)if(n[r].offset+1>t.pos)return[e,r];return[0,0]},t.prototype.getRectOffsets=function(t,e){var n,r,o;void 0===e&&(e=t),t.pos>e.pos&&(t=(n=[e,t])[0],e=n[1]);var i=this.getCellIndex(t),a=i[0],s=i[1],l=this.getCellIndex(e),c=l[0],u=l[1];return a=(r=_n(a,c))[0],c=r[1],s=(o=_n(s,u))[0],u=o[1],this.getSpannedOffsets({startRowIdx:a,startColIdx:s,endRowIdx:c,endColIdx:u})},t.prototype.getSpannedOffsets=function(t){return t},t}(),Nr=function(t,e){var n=[];return t.forEach(function(t,r){var o={rowspanMap:{},colspanMap:{},length:0};t.forEach(function(t,n){for(var i=t.nodeSize,a=0;o[a];)a+=1;o[a]={offset:e+r+n+2,nodeSize:i},o.length+=1}),n.push(o)}),n};function Sr(t,e){return zn(Mr.prototype,t),Nr=e,Mr}var Dr=a(404),Lr=/* @__PURE__ */a.n(Dr),Or=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],Ar=function(){function e(){var e=this;this.events=new kr,this.eventTypes=Or.reduce(function(e,n){return t(t({},e),{type:n})},{}),this.hold=!1,Or.forEach(function(t){e.addEventType(t)})}return e.prototype.listen=function(t,e){var n=this.getTypeInfo(t),r=this.events.get(n.type)||[];if(!this.hasEventType(n.type))throw new Error("There is no event type "+n.type);n.namespace&&(e.namespace=n.namespace),r.push(e),this.events.set(n.type,r)},e.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this.getTypeInfo(t),o=this.events.get(r.type),i=[];return!this.hold&&o&&o.forEach(function(t){var n=t.apply(void 0,e);Sn()(n)||i.push(n)}),i},e.prototype.emitReduce=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.events.get(t);return!this.hold&&o&&o.forEach(function(t){var r=t.apply(void 0,function(t,e,n){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([e],n));Lr()(r)||(e=r)}),e},e.prototype.getTypeInfo=function(t){var e=t.split(".");return{type:e[0],namespace:e[1]}},e.prototype.hasEventType=function(t){return!Sn()(this.eventTypes[this.getTypeInfo(t).type])},e.prototype.addEventType=function(t){if(this.hasEventType(t))throw new Error("There is already have event type "+t);this.eventTypes[t]=t},e.prototype.removeEventHandler=function(t,e){var n=this,r=this.getTypeInfo(t),o=r.type,i=r.namespace;o&&e?this.removeEventHandlerWithHandler(o,e):o&&!i?this.events.delete(o):!o&&i?this.events.forEach(function(t,e){n.removeEventHandlerWithTypeInfo(e,i)}):o&&i&&this.removeEventHandlerWithTypeInfo(o,i)},e.prototype.removeEventHandlerWithHandler=function(t,e){var n=this.events.get(t);if(n){var r=n.indexOf(e);n.indexOf(e)>=0&&n.splice(r,1)}},e.prototype.removeEventHandlerWithTypeInfo=function(t,e){var n=[],r=this.events.get(t);r&&(r.map(function(t){return t.namespace!==e&&n.push(t),null}),this.events.set(t,n))},e.prototype.getEvents=function(){return this.events},e.prototype.holdEventInvoke=function(t){this.hold=!0,t(),this.hold=!1},e}(),Ir=Ar;var Rr=function(){function e(e){var n=this;this.options=un()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},e),this.eventEmitter=new Ir;var r,o,i,a,s=function(t){if(!t)return null;var e={};return Pn.forEach(function(n){Sn()(t[n])||(e[n]=t[n])}),e}(this.options.linkAttributes),l=(r=this.options.plugins,o=this.eventEmitter,i=this.options.usageStatistics,o.listen("mixinTableOffsetMapPrototype",Sr),(null!=r?r:[]).reduce(function(e,n){var r=function(t,e,n){var r={eventEmitter:e,usageStatistics:n,pmState:{Plugin:hr.Plugin,PluginKey:hr.PluginKey,Selection:hr.Selection,TextSelection:hr.TextSelection},pmView:{Decoration:vr.Decoration,DecorationSet:vr.DecorationSet},pmModel:{Fragment:gr.Fragment},pmRules:{InputRule:mr.InputRule,inputRules:mr.inputRules,undoInputRule:mr.undoInputRule},i18n:Tr};if(Tn()(t)){var o=t[0],i=t[1];return o(r,void 0===i?{}:i)}return t(r)}(n,o,i);if(!r)throw new Error("The return value of the executed plugin is empty.");var a=r.markdownParsers,s=r.toHTMLRenderers,l=r.toMarkdownRenderers,c=r.markdownPlugins,u=r.wysiwygPlugins,p=r.wysiwygNodeViews,d=r.markdownCommands,f=r.wysiwygCommands,h=r.toolbarItems;return s&&(e.toHTMLRenderers=Fn(e.toHTMLRenderers,s)),l&&(e.toMarkdownRenderers=Fn(e.toMarkdownRenderers,l)),c&&(e.mdPlugins=e.mdPlugins.concat(c)),u&&(e.wwPlugins=e.wwPlugins.concat(u)),p&&(e.wwNodeViews=t(t({},e.wwNodeViews),p)),d&&(e.mdCommands=t(t({},e.mdCommands),d)),f&&(e.wwCommands=t(t({},e.wwCommands),f)),h&&(e.toolbarItems=e.toolbarItems.concat(h)),a&&(e.markdownParsers=t(t({},e.markdownParsers),a)),e},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})||{}),c=l.toHTMLRenderers,u=l.markdownParsers,p=this.options,d=p.customHTMLRenderer,f=p.extendedAutolinks,h=p.referenceDefinition,m=p.frontMatter,v=p.customHTMLSanitizer,g={linkAttributes:s,customHTMLRenderer:t(t({},c),d),extendedAutolinks:f,referenceDefinition:h,frontMatter:m,sanitizer:v||rr};a=g.customHTMLRenderer,["htmlBlock","htmlInline"].forEach(function(t){a[t]&&Object.keys(a[t]).forEach(function(t){var e;Rn(er,e=t)&&nr.push(e.toLowerCase())})}),this.options.events&&ln()(this.options.events,function(t,e){n.on(e,t)});var y=this.options,b=y.el,w=y.initialValue,k=y.theme,x=b.innerHTML;"light"!==k&&b.classList.add(jn(k)),b.innerHTML="",this.toastMark=new Qe("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:f,referenceDefinition:h,disallowDeepHeading:!0,frontMatter:m,customParser:u}),this.preview=new fr(this.eventEmitter,t(t({},g),{isViewer:!0})),dn()(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),w?this.setMarkdown(w):x&&this.preview.setHTML(x),b.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return e.prototype.toggleTask=function(t){var e=t.target,n=getComputedStyle(e,":before");!e.hasAttribute("data-task-disabled")&&e.hasAttribute("data-task")&&function(t,e,n){var r=parseInt(t.left,10),o=parseInt(t.top,10),i=parseInt(t.width,10)+parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10),a=parseInt(t.height,10)+parseInt(t.paddingTop,10)+parseInt(t.paddingBottom,10);return e>=r&&e<=r+i&&n>=o&&n<=o+a}(n,t.offsetX,t.offsetY)&&(Un(e,"checked"),this.eventEmitter.emit("change",{source:"viewer",date:t}))},e.prototype.setMarkdown=function(t){var e,n=this.toastMark.getLineTexts(),r=[n.length,(e=n)[e.length-1].length+1],o=this.toastMark.editMarkdown([1,1],r,t||"");this.eventEmitter.emit("updatePreview",o)},e.prototype.on=function(t,e){this.eventEmitter.listen(t,e)},e.prototype.off=function(t){this.eventEmitter.removeEventHandler(t)},e.prototype.addHook=function(t,e){this.eventEmitter.removeEventHandler(t),this.eventEmitter.listen(t,e)},e.prototype.destroy=function(){hn()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},e.prototype.isViewer=function(){return!0},e.prototype.isMarkdownMode=function(){return!1},e.prototype.isWysiwygMode=function(){return!1},e}(),Pr=Rr}(),s.default}()},Dy.exports=t(Ly,Oy,Ay,Iy)}();var Ry=Dy.exports,Py=/* @__PURE__ */n.getDefaultExportFromCjs(Ry),By=function(t,e){return(By=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Fy(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}By(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Hy=function(){return Hy=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Hy.apply(this,arguments)},qy=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.rootEl=o.default.createRef(),e}return Fy(e,t),e.prototype.getRootElement=function(){return this.rootEl.current},e.prototype.getInstance=function(){return this.editorInst},e.prototype.getBindingEventNames=function(){var t=this;return Object.keys(this.props).filter(function(t){return/^on[A-Z][a-zA-Z]+/.test(t)}).filter(function(e){return t.props[e]})},e.prototype.bindEventHandlers=function(t){var e=this;this.getBindingEventNames().forEach(function(n){var r=n[2].toLowerCase()+n.slice(3);e.editorInst.off(r),e.editorInst.on(r,t[n])})},e.prototype.getInitEvents=function(){var t=this;return this.getBindingEventNames().reduce(function(e,n){return e[n[2].toLowerCase()+n.slice(3)]=t.props[n],e},{})},e.prototype.componentDidMount=function(){this.editorInst=new Sy(Hy(Hy({el:this.rootEl.current},this.props),{events:this.getInitEvents()}))},e.prototype.shouldComponentUpdate=function(t){var e=this.getInstance(),n=t.height,r=t.previewStyle;return n&&this.props.height!==n&&e.setHeight(n),r&&this.props.previewStyle!==r&&e.changePreviewStyle(r),this.bindEventHandlers(t),!1},e.prototype.render=function(){return o.default.createElement("div",{ref:this.rootEl})},e}(o.default.Component);!function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.rootEl=o.default.createRef(),e}Fy(e,t),e.prototype.getRootElement=function(){return this.rootEl.current},e.prototype.getInstance=function(){return this.viewerInst},e.prototype.getBindingEventNames=function(){var t=this;return Object.keys(this.props).filter(function(t){return/^on[A-Z][a-zA-Z]+/.test(t)}).filter(function(e){return t.props[e]})},e.prototype.bindEventHandlers=function(t){var e=this;this.getBindingEventNames().forEach(function(n){var r=n[2].toLowerCase()+n.slice(3);e.viewerInst.off(r),e.viewerInst.on(r,t[n])})},e.prototype.getInitEvents=function(){var t=this;return this.getBindingEventNames().reduce(function(e,n){return e[n[2].toLowerCase()+n.slice(3)]=t.props[n],e},{})},e.prototype.componentDidMount=function(){this.viewerInst=new Py(Hy(Hy({el:this.rootEl.current},this.props),{events:this.getInitEvents()}))},e.prototype.shouldComponentUpdate=function(t){return this.bindEventHandlers(t),!1},e.prototype.render=function(){return o.default.createElement("div",{ref:this.rootEl})}}(o.default.Component);var zy=/* @__PURE__ */t.styled_default$1("div")({name:"Wrapper",class:"wkyirgj",propsAsIs:!1});exports.default=t=>{const[e,n]=o.useState(t.value.data.markdown),r=o.useCallback(t=>{t.stopPropagation()},[]),i=o.useCallback(()=>{t.onFinishedEditing({...t.value,data:{...t.value.data,markdown:e}})},[t,e]),a=o.useCallback(()=>{t.onFinishedEditing(void 0)},[t]);/* @__PURE__ */
6
6
  return o.createElement(zy,{id:"markdown-wysiwyg",onKeyDown:r},/* @__PURE__ */o.createElement(qy,{initialEditType:"wysiwyg",autofocus:!0,initialValue:t.value.data.markdown,hideModeSwitch:!0,onChange:n,height:"75vh",usageStatistics:!1,toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","link"],["code","codeblock"]]}),/* @__PURE__ */o.createElement("div",{className:"footer"},/* @__PURE__ */o.createElement("button",{className:"close-button",onClick:a},"Close"),/* @__PURE__ */o.createElement("button",{className:"save-button",onClick:i},"Save")))};
7
- //# sourceMappingURL=article-cell-editor-JDI676YI-C7s2Yz0q.js.map
7
+ //# sourceMappingURL=article-cell-editor-JDI676YI-DdLmEDri.js.map