From 1852aa55e4365f9fff28438ac1d1acd9ab600c87 Mon Sep 17 00:00:00 2001 From: Christoph Schweppe Date: Mon, 10 May 2021 10:24:19 +0200 Subject: [PATCH] Update tiptap --- dist/tiptap.umd.js | 2 +- package-lock.json | 46 +++++++++++++++++++++++----------------------- package.json | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/dist/tiptap.umd.js b/dist/tiptap.umd.js index 6d035ab..88aebbb 100644 --- a/dist/tiptap.umd.js +++ b/dist/tiptap.umd.js @@ -1 +1 @@ -var __defProp=Object.defineProperty,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__assign=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__rest=(t,e)=>{var n={};for(var r in t)__hasOwnProp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))e.indexOf(r)<0&&__propIsEnum.call(t,r)&&(n[r]=t[r]);return n},__vite_style__=document.createElement("style");__vite_style__.innerHTML=".ProseMirror div,.ProseMirror li>p:first-child{display:inline}ul[data-type=taskList]{list-style:none;padding:0}ul[data-type=taskList] li{display:flex;align-items:center}ul[data-type=taskList] li>label{flex:0 0 auto;margin-right:.5rem}",document.head.appendChild(__vite_style__),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Vue)}(this,(function(t){"use strict";function e(t){this.content=t}e.prototype={constructor:e,find:function(t){for(var e=0;e>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};var n=e;function r(t,e,n){for(var o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;var i=t.child(o),s=e.child(o);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){var c=r(i.content,s.content,n+1);if(null!=c)return c}n+=i.nodeSize}else n+=i.nodeSize}}function o(t,e,n,r){for(var i=t.childCount,s=e.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:r};var a=t.child(--i),c=e.child(--s),p=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:n,b:r};if(a.isText&&a.text!=c.text){for(var l=0,d=Math.min(a.text.length,c.text.length);lt&&!1!==n(a,r+s,o,i)&&a.content.size){var p=s+1;a.nodesBetween(Math.max(0,t-p),Math.min(a.content.size,e-p),n,r+p)}s=c}},i.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},i.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},i.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);ot)for(var o=0,s=0;st&&((se)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),n.push(a),r+=a.nodeSize),s=c}return new i(n,r)},i.prototype.cutByIndex=function(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))},i.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 i(r,o)},i.prototype.addToStart=function(t){return new i([t].concat(this.content),this.size+t.nodeSize)},i.prototype.addToEnd=function(t){return new i(this.content.concat(t),this.size+t.nodeSize)},i.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.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?c(n+1,o):c(n,r);r=o}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},i.fromJSON=function(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(e.map(t.nodeFromJSON))},i.fromArray=function(t){if(!t.length)return i.empty;for(var e,n=0,r=0;rthis.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},l.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new d("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new d("Inconsistent open depths");return g(t,e,n,0)}function g(t,e,n,r){var o=t.index(r),s=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(i.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return x(s,M(t,c.start,c.end,e,r))}var p=t.parent,l=p.content;return x(p,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}return x(s,S(t,e,r))}function y(t,e){if(!e.type.compatibleContent(t.type))throw new d("Cannot join "+e.type.name+" onto "+t.type.name)}function b(t,e,n){var r=t.node(n);return y(r,e.node(n)),r}function w(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 k(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(w(t.nodeAfter,r),i++));for(var a=i;ao&&b(t,e,o+1),a=r.depth>o&&b(n,r,o+1),c=[];return k(null,t,o,c),s&&a&&e.index(o)==n.index(o)?(y(s,a),w(x(s,M(t,e,n,r,o+1)),c)):(s&&w(x(s,S(t,e,o+1)),c),k(e,n,o,c),a&&w(x(a,S(n,r,o+1)),c)),k(r,null,o,c),new i(c)}function S(t,e,n){var r=[];(k(null,t,n,r),t.depth>n)&&w(x(b(t,e,n+1),S(t,e,n+1)),r);return k(e,null,n,r),new i(r)}h.size.get=function(){return this.content.size-this.openStart-this.openEnd},u.prototype.insertAt=function(t,e){var n=m(this.content,t+this.openStart,e,null);return n&&new u(n,this.openStart,this.openEnd)},u.prototype.removeBetween=function(t,e){return new u(f(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},u.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},u.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},u.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},u.fromJSON=function(t,e){if(!e)return u.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 u(i.fromJSON(t,e.content),n,r)},u.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 u(t,n,r)},Object.defineProperties(u.prototype,h),u.empty=new u(i.empty,0,0);var O=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};O.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},O.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},O.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},O.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},O.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},O.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},O.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]},O.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},O.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;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},O.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new A(this,t,n)},O.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},O.prototype.max=function(t){return t.pos>this.pos?t:this},O.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,p=o-c;if(n.push(i,a,r+c),!p)break;if((i=i.child(a)).isText)break;o=p-1,r+=c+1}return new O(e,n,o)},O.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},R.isBlock.get=function(){return this.type.isBlock},R.isTextblock.get=function(){return this.type.isTextblock},R.inlineContent.get=function(){return this.type.inlineContent},R.isInline.get=function(){return this.type.isInline},R.isText.get=function(){return this.type.isText},R.isLeaf.get=function(){return this.type.isLeaf},R.isAtom.get=function(){return this.type.isAtom},D.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()+")"),I(this.marks,t)},D.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},D.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=i.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c=0;n--)e=t[n].type.name+"("+e+")";return e}var B=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},L={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};B.parse=function(t,e){var n=new P(t,e);if(null==n.next)return B.empty;var r=$(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(U(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];U(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new B(r.indexOf(t.length-1)>-1),s=0;s>1},B.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]}},B.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(B.prototype,L),B.empty=new B(!0);var P=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()},j={next:{configurable:!0}};function $(t){var e=[];do{e.push(F(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function F(t){var e=[];do{e.push(H(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function H(t){for(var e=function(t){if(t.eat("(")){var e=$(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=J(t,e)}return e}function q(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function J(t,e){var n=q(t),r=n;return t.eat(",")&&(r="}"!=t.next?q(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function W(t,e){return e-t}function U(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-1},Y.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var nt=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=n.from(t.nodes),this.spec.marks=n.from(t.marks),this.nodes=Y.compile(this.spec.nodes,this),this.marks=et.compile(this.spec.marks,this);var r=Object.create(null);for(var o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");var i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=r[s]||(r[s]=B.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?rt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var p=this.marks[c],l=p.spec.excludes;p.excluded=null==l?[p]:""==l?[]:rt(this,l.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function rt(t,e){for(var n=[],r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}nt.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof Y))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)},nt.prototype.text=function(t,e){var n=this.nodes.text;return new z(n,n.defaultAttrs,t,l.setFrom(e))},nt.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},nt.prototype.nodeFromJSON=function(t){return D.fromJSON(this,t)},nt.prototype.markFromJSON=function(t){return l.fromJSON(this,t)},nt.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ot=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)}))};ot.prototype.parse=function(t,e){void 0===e&&(e={});var n=new lt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ot.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new lt(this,e,!0);return n.addAll(t,null,e.from,e.to),u.maxOpen(n.finish())},ot.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ot.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},pt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},lt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},lt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},dt.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},lt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-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),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var p=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!p||p.name!=c&&-1==p.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},lt.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}},lt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;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(lt.prototype,dt);var mt=function(t,e){this.nodes=t||{},this.marks=e||{}};function vt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function gt(t){return t.document||window.document}mt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=gt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},mt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&mt.renderSpec(gt(n),r(t,e))},mt.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,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var p in c=2,a)if(null!=a[p]){var l=p.indexOf(" ");l>0?s.setAttributeNS(p.slice(0,l),p.slice(l+1),a[p]):s.setAttribute(p,a[p])}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var h=mt.renderSpec(t,u,n),f=h.dom,m=h.contentDOM;if(s.appendChild(f),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},mt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new mt(this.nodesFromSchema(t),this.marksFromSchema(t)))},mt.nodesFromSchema=function(t){var e=vt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},mt.marksFromSchema=function(t){return vt(t.marks)};var yt=Math.pow(2,16);function bt(t){return 65535&t}var wt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},kt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};kt.prototype.recover=function(t){var e=0,n=bt(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],p=this.ranges[s+i],l=a+c;if(t<=l){var d=a+r+((c?t==a?-1:t==l?1:e:e)<0?0:p);if(n)return d;var u=t==(e<0?a:l)?null:s/3+(t-a)*yt;return new wt(d,e<0?t!=a:t!=l,u)}r+=p-c}return n?t+r:new wt(t+r)},kt.prototype.touches=function(t,e){for(var n=0,r=bt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},kt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},xt.prototype.invert=function(){var t=new xt;return t.appendMappingInverted(this),t},xt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},St.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(St.prototype,Ot);var Nt=Object.create(null),_t=function(){};_t.prototype.apply=function(t){return Ct()},_t.prototype.getMap=function(){return kt.empty},_t.prototype.invert=function(t){return Ct()},_t.prototype.map=function(t){return Ct()},_t.prototype.merge=function(t){return null},_t.prototype.toJSON=function(){return Ct()},_t.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Nt[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},_t.jsonID=function(t,e){if(t in Nt)throw new RangeError("Duplicate use of step JSON ID "+t);return Nt[t]=e,e.prototype.jsonID=t,e};var Tt=function(t,e){this.doc=t,this.failed=e};Tt.ok=function(t){return new Tt(t,null)},Tt.fail=function(t){return new Tt(null,t)},Tt.fromReplace=function(t,e,n,r){try{return Tt.ok(t.replace(e,n,r))}catch(o){if(o instanceof d)return Tt.fail(o.message);throw o}};var At=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&&Vt(t,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new kt([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?u.empty:new u(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?u.empty:new u(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,u.fromJSON(t,n.slice),!!n.structure)},e}(_t);_t.jsonID("replace",At);var Et=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Vt(t,this.from,this.gapFrom)||Vt(t,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Tt.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Tt.fromReplace(t,this.from,this.to,n):Tt.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new kt([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||or.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,u.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(_t);function Vt(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Dt(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Rt(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(ni;a--,c--){var p=o.node(a),l=o.index(a);if(p.type.spec.isolating)return!1;var d=p.content.cutByIndex(l,p.childCount),u=r&&r[c]||p;if(u!=p&&(d=d.replaceChild(0,u.type.create(u.attrs))),!p.canReplace(l+1,p.childCount)||!u.type.validContent(d))return!1}var h=o.indexAfter(i),f=r&&r[0];return o.node(i).canReplaceWith(h,h,f?f.type:o.node(i+1).type)}function Lt(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 Pt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,p=r.index(a)+(c>0?1:0),l=r.node(a),d=!1;if(1==s)d=l.canReplace(p,p,o);else{var u=l.contentMatchAt(p).findWrapping(o.firstChild.type);d=u&&l.canReplaceWith(p,p,u[0])}if(d)return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function jt(t,e,n){for(var r=[],o=0;oe;h--)f||n.index(h)>0?(f=!0,l=i.from(n.node(h).copy(l)),d++):c--;for(var m=i.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)=0;r--)n=i.from(e[r].type.create(e[r].attrs,n));var o=t.start,s=t.end;return this.step(new Et(o,s,o,s,new u(n,0,0),e.length,!0))},St.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 s=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(s).map(e),n)){o.clearIncompatible(o.mapping.slice(s).map(e,1),n);var a=o.mapping.slice(s),c=a.map(e,1),p=a.map(e+t.nodeSize,1);return o.step(new Et(c,p,c+1,p-1,new u(i.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},St.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 s=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,s);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Et(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new u(i.from(s),0,0),1,!0))},St.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=i.empty,s=i.empty,a=r.depth,c=r.depth-e,p=e-1;a>c;a--,p--){o=i.from(r.node(a).copy(o));var l=n&&n[p];s=i.from(l?l.type.create(l.attrs,s):r.node(a).copy(s))}return this.step(new At(t,t,new u(o.append(s),e,e),!0))},St.prototype.join=function(t,e){void 0===e&&(e=1);var n=new At(t-e,t+e,u.empty,!0);return this.step(n)};var $t=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 u(jt(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 Tt.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Ft(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}(_t);_t.jsonID("addMark",$t);var Ft=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 u(jt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Tt.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}(_t);function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}_t.jsonID("removeMark",Ft),St.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,p){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&p.type.allowsMarkType(n.type)){for(var d=Math.max(c,t),u=Math.min(c+r.nodeSize,e),h=n.addToSet(l),f=0;f=0;f--)this.step(o[f]);return this},St.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=u.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=u.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Ht(o,i,r)?new At(e,n,r):new qt(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},St.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new u(i.from(n),0,0))},St.prototype.delete=function(t,e){return this.replace(t,e,u.empty)},St.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var qt=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=i.empty;for(var s=t.depth;s>0;s--)this.placed=i.from(t.node(s).copy(this.placed))},Jt={depth:{configurable:!0}};function Wt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Wt(t.firstChild.content,e-1,n)))}function Ut(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ut(t.lastChild.content,e-1,n)))}function Kt(t,e){for(var n=0;n1&&(r=r.replaceChild(0,Gt(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(i.empty,!0)))),t.copy(r)}function Xt(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(i.empty,!0))}return t}function Qt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}Jt.depth.get=function(){return this.frontier.length-1},qt.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,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new u(i,s,a);return e>-1?new Et(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new At(r.pos,o.pos,c):void 0},qt.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=Kt(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var s=this.frontier[o],a=s.type,c=s.match,p=void 0,l=void 0;if(1==t&&(r?c.matchType(r.type)||(l=c.fillBefore(i.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(p=c.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:p};if(n&&c.matchType(n.type))break}},qt.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Kt(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new u(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},qt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Kt(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new u(Wt(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new u(Wt(e,n,1),n,r)},qt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a1||0==l||b.content.size)&&(m=w,h.push(Gt(b.mark(v.allowedMarks(b.marks)),1==d?l:0,d==p.childCount?y:-1)))}var k=d==p.childCount;k||(y=-1),this.placed=Ut(this.placed,n,i.from(h)),this.frontier[n].match=m,k&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,M=p;x1&&r==this.$to.end(--n);)++r;return r},qt.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=0;a--){var c=this.frontier[a],p=c.match,l=Xt(t,a,c.type,p,!0);if(!l||l.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},qt.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=Ut(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},qt.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Ut(this.placed,this.depth,i.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},qt.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(i.empty,!0);t.childCount&&(this.placed=Ut(this.placed,this.frontier.length,t))},Object.defineProperties(qt.prototype,Jt),St.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new At(t,e,n));var i=Qt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var p=r.node(a).type.spec;if(p.defining||p.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var l=i.indexOf(s),d=[],h=n.openStart,f=n.content,m=0;;m++){var v=f.firstChild;if(d.push(v),m==n.openStart)break;f=v.content}h>0&&d[h-1].type.spec.defining&&r.node(l).type!=d[h-1].type?h-=1:h>=2&&d[h-1].isTextblock&&d[h-2].type.spec.defining&&r.node(l).type!=d[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=d[y];if(b)for(var w=0;w=0&&(this.replace(t,e,n),!(this.steps.length>O));C--){var N=i[C];N<0||(t=r.before(N),e=o.after(N))}return this},St.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Zt=Object.create(null),te=function(t,e,n){this.ranges=n||[new ne(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ee={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ee.anchor.get=function(){return this.$anchor.pos},ee.head.get=function(){return this.$head.pos},ee.from.get=function(){return this.$from.pos},ee.to.get=function(){return this.$to.pos},ee.$from.get=function(){return this.ranges[0].$from},ee.$to.get=function(){return this.ranges[0].$to},ee.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?pe(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):pe(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},te.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ae(t.node(0))},te.atStart=function(t){return pe(t,t,0,0,1)||new ae(t)},te.atEnd=function(t){return pe(t,t,t.content.size,t.childCount,-1)||new ae(t)},te.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Zt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},te.jsonID=function(t,e){if(t in Zt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Zt[t]=e,e.prototype.jsonID=t,e},te.prototype.getBookmark=function(){return re.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(te.prototype,ee),te.prototype.visible=!0;var ne=function(t,e){this.$from=t,this.$to=e},re=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=u.empty),t.prototype.replace.call(this,e,n),n==u.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 oe(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&ie.isSelectable(a))return ie.create(t,n-(o<0?a.nodeSize:0))}else{var c=pe(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function le(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return l.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)||l.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(te.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}(St);function ue(t,e){return e&&t?t.bind(e):t}var he=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},fe=[new he("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new he("selection",{init:function(t,e){return t.selection||te.atStart(e.doc)},apply:function(t){return t.selection}}),new he("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new he("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],me=function(t,e){var n=this;this.schema=t,this.fields=fe.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new he(t.key,t.spec.state,t))}))},ve=function(t){this.config=t},ge={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ge.schema.get=function(){return this.config.schema},ge.plugins.get=function(){return this.config.plugins},ve.prototype.apply=function(t){return this.applyTransaction(t).state},ve.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&ye.splice(e,1)},Object.defineProperties(ve.prototype,ge);var ye=[];function be(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=be(o,e,{})),n[r]=o}return n}var we=function(t){this.props={},t.props&&be(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:xe("plugin")};we.prototype.getState=function(t){return t[this.key]};var ke=Object.create(null);function xe(t){return t in ke?t+"$"+ ++ke[t]:(ke[t]=0,t+"$")}var Me=function(t){void 0===t&&(t="key"),this.key=xe(t)};Me.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Me.prototype.getState=function(t){return t[this.key]};var Se={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Oe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Se.mac=/Mac/.test(navigator.platform);var _e=Se.ie=!!(Ce||Ne||Oe);Se.ie_version=Ce?document.documentMode||6:Ne?+Ne[1]:Oe?+Oe[1]:null,Se.gecko=!_e&&/gecko\/(\d+)/i.test(navigator.userAgent),Se.gecko_version=Se.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Te=!_e&&/Chrome\/(\d+)/.exec(navigator.userAgent);Se.chrome=!!Te,Se.chrome_version=Te&&+Te[1],Se.safari=!_e&&/Apple Computer/.test(navigator.vendor),Se.ios=Se.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Se.android=/Android \d/.test(navigator.userAgent),Se.webkit="webkitFontSmoothing"in document.documentElement.style,Se.webkit_version=Se.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Ae=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Ee=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Ve=null,De=function(t,e,n){var r=Ve||(Ve=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Re=function(t,e,n,r){return n&&(Ie(t,e,n,r,-1)||Ie(t,e,n,r,1))},ze=/^(img|br|input|textarea|hr)$/i;function Ie(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Be(t))){var i=t.parentNode;if(1!=i.nodeType||Le(t)||ze.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Ae(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?Be(t):0}}}function Be(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Le(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 Pe=function(t){var e=t.isCollapsed;return e&&Se.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function je(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function $e(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Fe(t,e){return"number"==typeof t?t:t[e]}function He(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 qe(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=Ee(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?$e(i):He(s),p=0,l=0;if(e.topc.bottom-Fe(r,"bottom")&&(l=e.bottom-c.bottom+Fe(o,"bottom")),e.leftc.right-Fe(r,"right")&&(p=e.right-c.right+Fe(o,"right")),p||l)if(a)i.defaultView.scrollBy(p,l);else{var d=s.scrollLeft,u=s.scrollTop;l&&(s.scrollTop+=l),p&&(s.scrollLeft+=p);var h=s.scrollLeft-d,f=s.scrollTop-u;e={left:e.left-h,top:e.top-f,right:e.right-h,bottom:e.bottom-f}}if(a)break}}function Je(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=Ee(t));return e}function We(t,e){for(var n=0;n=a){s=Math.max(u.bottom,s),a=Math.min(u.top,a);var h=u.left>e.left?u.left-e.left:u.right=(u.left+u.right)/2?1:0));continue}}!n&&(e.left>=u.right&&e.top>=u.top||e.left>=u.left&&e.top>=u.bottom)&&(i=p+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:Ke(n,r)}function Ge(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Xe(t,e,n){var r=t.childNodes.length;if(r&&n.tope.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?p=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(p=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==p&&(p=function(t,e,n){var r=Ke(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,l,e));var f=t.docView.nearestDesc(l,!0);return{pos:p,inside:f?f.posAtStart-f.border:-1}}function Qe(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Ze=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=Se.webkit||Se.gecko;if(3==o.nodeType){if(!s||!Ze.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,p=n<0?1:-1;return n<0&&!i?(c++,p=-1):n>=0&&i==o.nodeValue.length?(a--,p=1):n<0?a--:c++,en(Qe(De(o,a,c),p),p<0)}var l=Qe(De(o,i,i),n);if(Se.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(i&&(n<0||i==Be(o))){var m=o.childNodes[i-1],v=3==m.nodeType?De(m,Be(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return en(Qe(v,1),!1)}if(i=0)}function en(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 nn(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 rn(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 on=/[\u0590-\u08ac]/;var sn=null,an=null,cn=!1;function pn(t,e,n){return sn==e&&an==n?cn:(sn=e,an=n,cn="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return rn(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=tn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=De(s,0,s.nodeValue.length).getClientRects()}for(var c=0;cp.top&&("up"==n?p.bottomi.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return on.test(r.parent.textContent)&&a.modify?rn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var ln=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},dn={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}};ln.prototype.matchesWidget=function(){return!1},ln.prototype.matchesMark=function(){return!1},ln.prototype.matchesNode=function(){return!1},ln.prototype.matchesHack=function(){return!1},dn.beforePosition.get=function(){return!1},ln.prototype.parseRule=function(){return null},ln.prototype.stopEvent=function(){return!1},dn.size.get=function(){for(var t=0,e=0;eAe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var p=t;;p=p.parentNode){if(p==this.dom){a=!0;break}if(p.parentNode.lastChild!=p)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},ln.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}}},ln.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},ln.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},ln.prototype.descAt=function(t){for(var e=0,n=0;e=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},ln.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var p=i+a.border;if(t>=p&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,p);t=i;for(var l=s;l>0;l--){var d=this.children[l-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=Ae(d.dom)+1;break}t-=d.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var u=s+1;ua&&ie){var y=l;l=d,d=y}var b=document.createRange();b.setEnd(d.node,d.offset),b.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(b)}}},ln.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},dn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},ln.prototype.markDirty=function(t,e){for(var n=0,r=0;r=n:tn){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},ln.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty0&&(i=Vn(i,0,t,r));for(var a=0;ai;)p.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c=0&&!a&&s.syncToMarks(i==n.node.childCount?l.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(un,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),kn(this.contentDOM,this.children,t),Se.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof re)||re+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=Be(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e=n){var l=c.lastIndexOf(e,r-a);if(l>=0&&l+e.length+a>=n)return a+l}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new fn(this,i,n,o);t.compositionNodes.push(s),this.children=Vn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!_n(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=On(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}(ln);function gn(t,e,n,r,o){return Nn(r,e,t),new vn(null,t,e,n,r,r,r,o,0)}var yn=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}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)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(vn),bn=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(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ln),wn=function(t){function e(e,n,r,o,i,s,a,c,p,l){t.call(this,e,n,r,o,i,s,a,p,l),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,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}(vn);function kn(t,e,n){for(var r=t.firstChild,o=!1,i=0;i0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function En(t,e){return t.type.side-e.type.side}function Vn(t,e,n,r,o){for(var i=[],s=0,a=0;s=n||l<=e?i.push(c):(pn&&i.push(c.slice(n-p,c.size,r)))}return i}function Dn(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,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,p=r.resolve(s);if(Pe(n)){for(a=p;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&ie.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==Be(t);r||o;){if(t==n)return!0;var i=Ae(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==Be(t)}}(n.focusNode,n.focusOffset,o.dom))){var l=o.posBefore;c=new ie(s==l?p:r.resolve(l))}}else{var d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(d<0)return null;a=r.resolve(d)}c||(c=Fn(t,a,p,"pointer"==e||t.state.selection.head>1,i=Math.min(o,t.length);r-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=mn.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},An.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function Jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Wn(t,e,n){var r=t.state.selection;if(!(r instanceof re)){if(r instanceof ie&&r.node.isInline)return Jn(t,new re(e>0?r.$to:r.$from));var o=qn(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=qn(t.state,e);return!!(i&&i instanceof ie)&&Jn(t,i)}if(!(Se.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var p=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(p))&&!s.contentDOM)&&(ie.isSelectable(c)?Jn(t,new ie(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!Se.webkit&&Jn(t,new re(t.state.doc.resolve(e<0?p:p+c.nodeSize))))}}function Un(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Kn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Gn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(Se.gecko&&1==n.nodeType&&r0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Kn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Yn(n))break;for(var c=n.previousSibling;c&&Kn(c);)o=n.parentNode,i=Ae(c),c=c.previousSibling;if(c)r=Un(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Qn(t,e,n,r):o&&Qn(t,e,o,i)}}function Xn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Un(n);;)if(r-1)return!1;if(Se.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 s=qn(t.state,e);if(s&&s instanceof ie)return Jn(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof ae?te.near(a,e):te.findFrom(a,e);return!!c&&Jn(t,c)}return!1}function tr(t,e){if(!(t.state.selection instanceof re))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function er(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function nr(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||Se.mac&&72==n&&"c"==r?tr(t,-1)||Gn(t):46==n||Se.mac&&68==n&&"c"==r?tr(t,1)||Xn(t):13==n||27==n||(37==n?Wn(t,-1,r)||Gn(t):39==n?Wn(t,1,r)||Xn(t):38==n?Zn(t,-1,r)||Gn(t):40==n?function(t){if(Se.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;er(t,o,!0),setTimeout((function(){return er(t,o,!1)}),20)}}}(t)||Zn(t,1,r)||Xn(t):r==(Se.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function rr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(Se.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||Se.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function or(t,e,n,r,o){if(e<0){var s=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Dn(t,s);if(a&&!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==s?c.setMeta("pointer",!0):"key"==s&&c.scrollIntoView(),t.dispatch(c)}}else{var p=t.state.doc.resolve(e),l=p.sharedDepth(n);e=p.before(l+1),n=t.state.doc.resolve(n).after(l+1);var d=t.state.selection,u=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,p=t.root.getSelection(),l=null,d=p.anchorNode;if(d&&t.dom.contains(1==d.nodeType?d:d.parentNode)&&(l=[{node:d,offset:p.anchorOffset}],Pe(p)||l.push({node:p.focusNode,offset:p.focusOffset})),Se.chrome&&8===t.lastKeyCode)for(var u=s;u>i;u--){var h=o.childNodes[u-1],f=h.pmViewDesc;if("BR"==h.nodeName&&!f){s=u;break}if(!f||f.size)break}var m=t.state.doc,v=t.someProp("domParser")||ot.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:l,ruleFromNode:rr,context:g});if(l&&null!=l[0].pos){var w=l[0].pos,k=l[1]&&l[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(Se.chrome&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from){var h=t.cursorWrapper.deco.type.toDOM.nextSibling,f=h&&h.nodeValue?h.nodeValue.length:1;u.sel={anchor:u.sel.anchor+f,head:u.sel.anchor+f}}var m,v,g=t.state.doc,y=g.slice(u.from,u.to);8===t.lastKeyCode&&Date.now()-100=a?i-r:0)+(c-a),a=i}else if(c=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,u.doc.content,u.from,m,v);if(!b){if(!(r&&d instanceof re&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||u.sel&&u.sel.anchor!=u.sel.head){if((Se.ios&&t.lastIOSEnter>Date.now()-225||Se.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,je(13,"Enter"))})))return void(t.lastIOSEnter=0);if(u.sel){var w=ir(t,t.state.doc,u.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:d.from,endA:d.to,endB:d.to}}t.domChangeCount++,t.state.selection.fromt.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),Se.ie&&Se.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>u.from&&"  "==u.doc.textBetween(b.start-u.from-1,b.start-u.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=u.doc.resolveNoCache(b.start-u.from),M=u.doc.resolveNoCache(b.endB-u.from),S=x.sameParent(M)&&x.parent.inlineContent;if((Se.ios&&t.lastIOSEnter>Date.now()-225&&(!S||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!S&&x.posb.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||sr(r,!0,!1)n||sr(s,!0,!1)e.content.size?null:Fn(t,e.resolve(n.anchor),e.resolve(n.head))}function sr(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 ar(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||mt.fromSchema(t.state.schema),c=mr(),p=c.createElement("div");p.appendChild(a.serializeFragment(r,{document:c}));for(var l,d=p.firstChild;d&&1==d.nodeType&&(l=hr[d.nodeName.toLowerCase()]);){for(var u=l.length-1;u>=0;u--){for(var h=c.createElement(l[u]);p.firstChild;)h.appendChild(p.firstChild);p.appendChild(h)}d=p.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:p,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function cr(t,e,n,r,o){var s,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var p=e&&(r||c||!n);if(p){if(t.someProp("transformPastedText",(function(t){e=t(e,c||r)})),c)return new u(i.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?a=l:(s=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){s.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),s=function(t){var e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=mr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&hr[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return""})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i=0;c-=2){var p=r.nodes[n[c]];if(!p||p.hasRequiredAttrs())break;o=i.from(p.create(n[c+1],o)),s++,a++}return new u(o,s,a)}(function(t,e,n){e=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,i.from(t));return t}function lr(t,e,n,r,o){if(o=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||s<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var hr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},fr=null;function mr(){return fr||(fr=document.implementation.createHTMLDocument("title"))}var vr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gr=Se.ie&&Se.ie_version<=11,yr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};yr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},yr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var br=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;et.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new yr,gr&&(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};br.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},br.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},br.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,vr),gr&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},br.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n-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)&&Hn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a1){var p=s.filter((function(t){return"BR"==t.nodeName}));if(2==p.length){var l=p[0],d=p[1];l.parentNode&&l.parentNode.parentNode==d.parentNode?d.remove():l.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(wr)return;wr=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||zn(this.view),this.currentSelection.set(e))}},br.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;ri.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function _r(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Tr(t,e,n,r,o){return Nr(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 ie&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(ie.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(_r(t,ie.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&ie.isSelectable(r))&&(_r(t,new ie(n),"pointer"),!0)}(t,n))}function Ar(t,e,n,r){return Nr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function Er(t,e,n,r){return Nr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(_r(t,re.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)_r(t,re.create(n,s+1,s+1+i.content.size),"pointer");else{if(!ie.isSelectable(i))continue;_r(t,ie.create(n,s),"pointer")}return!0}}(t,n)}function Vr(t){return Pr(t)}xr.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!zr(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!Se.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||nr(t,e)?e.preventDefault():Mr(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,je(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},xr.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},xr.keypress=function(t,e){if(!(zr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||Se.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof re&&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 Dr=Se.mac?"metaKey":"ctrlKey";kr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=Vr(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[Dr]&&("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(Cr(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Rr(t,i,e,n)):("doubleClick"==o?Ar:Er)(t,i.pos,i.inside,e)?e.preventDefault():Mr(t,"pointer"))};var Rr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Dr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,p=c?t.docView.nearestDesc(c,!0):null;this.target=p?p.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof ie&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Se.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(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Mr(t,"pointer")};function zr(t,e){return!!t.composing||!!(Se.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Rr.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},Rr.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(Cr(t))),this.allowDefault||!e?Mr(this.view,"pointer"):Tr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||Se.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Se.chrome&&!(this.view.state.selection instanceof re)&&(e.pos==this.view.state.selection.from||e.pos==this.view.state.selection.to)?(_r(this.view,te.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Mr(this.view,"pointer")}},Rr.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),Mr(this.view,"pointer"),0==t.buttons&&this.done()},kr.touchdown=function(t){Vr(t),Mr(t,"pointer")},kr.contextmenu=function(t){return Vr(t)};var Ir=Se.android?5e3:-1;function Br(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Pr(t)}),e))}function Lr(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Pr(t,e){if(t.domObserver.forceFlush(),Lr(t),e||t.docView.dirty){var n=Dn(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}xr.compositionstart=xr.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(),Pr(t,!0),t.markCursor=null;else if(Pr(t),Se.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Br(t,Ir)},xr.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Br(t,20))};var jr=Se.ie&&Se.ie_version<15||Se.ios&&Se.webkit_version<604;function $r(t,e,n,r){var o=cr(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||u.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),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}kr.copy=xr.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=jr?null:e.clipboardData,i=ar(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){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,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},xr.paste=function(t,e){var n=jr?null:e.clipboardData;n&&$r(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?$r(t,r.value,null,e):$r(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Fr=function(t,e){this.slice=t,this.move=e},Hr=Se.mac?"altKey":"ctrlKey";for(var qr in kr.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(Cr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof ie?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=ar(t,s),c=a.dom,p=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(jr?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",jr||e.dataTransfer.setData("text/plain",p),t.dragging=new Fr(s,!e[Hr])}},kr.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},xr.dragover=xr.dragenter=function(t,e){return e.preventDefault()},xr.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(Cr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||cr(t,e.dataTransfer.getData(jr?"Text":"text/plain"),jr?null:e.dataTransfer.getData("text/html"),!1,o),s=n&&!e[Hr];if(t.someProp("handleDrop",(function(n){return n(t,e,i||u.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?Pt(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var p=c.mapping.map(a),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=c.doc;if(l?c.replaceRangeWith(p,p,i.content.firstChild):c.replaceRange(p,p,i),!c.doc.eq(d)){var h=c.doc.resolve(p);if(l&&ie.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ie(h));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Fn(t,h,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},kr.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())&&zn(t)}),20))},kr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},kr.beforeinput=function(t,e){if(Se.chrome&&Se.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,je(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)}},xr)kr[qr]=xr[qr];function Jr(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 Wr=function(t,e){this.spec=e||Qr,this.side=this.spec.side||0,this.toDOM=t};Wr.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 Gr(i-n,i-n,this)},Wr.prototype.valid=function(){return!0},Wr.prototype.eq=function(t){return this==t||t instanceof Wr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Jr(this.spec,t.spec))};var Ur=function(t,e){this.spec=e||Qr,this.attrs=t};Ur.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 Gr(o,i,this)},Ur.prototype.valid=function(t,e){return e.from=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;at){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Zr.prototype.map=function(t,e,n){return this==to||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Qr)},Zr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;sc+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(p=r-n-(e-t))&&(a[s]+=p,a[s+1]+=p))}},p=0;p=r.content.size){l=!0;continue}var f=n.map(t[d+1]+i,-1)-o,m=r.content.findIndex(h),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==h&&g+y.nodeSize==f){var b=a[d+2].mapInner(n,y,u+1,t[d]+i+1,s);b!=to?(a[d]=h,a[d+1]=f,a[d+2]=b):(a[d+1]=-2,l=!0)}else l=!0}if(l){var w=io(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;is&&p.to=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;ai&&c.type instanceof Ur){var p=Math.max(i,c.from)-i,l=Math.min(s,c.to)-i;pn&&s.to0;)e++;t.splice(e,0,n)}function po(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=to&&e.push(r)})),t.cursorWrapper&&e.push(Zr.create(t.state.doc,[t.cursorWrapper.deco])),eo.from(e)}eo.prototype.forChild=function(t,e){if(e.isLeaf)return Zr.empty;for(var n=[],r=0;rr.scrollToSelection?"to selection":"preserve",l=o||!this.docView.matchesNode(t.doc,c,a);!l&&t.selection.eq(r.selection)||(i=!0);var d,u,h,f,m,v,g,y,b,w,k,x="preserve"==p&&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,s=o+1;s=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Je(t.dom)}}(this);if(i){this.domObserver.stop();var M=l&&(Se.ie||Se.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(f=r.selection,m=t.selection,v=Math.min(f.$anchor.sharedDepth(f.head),m.$anchor.sharedDepth(m.head)),f.$anchor.start(v)!=m.$anchor.start(v));if(l){var S=Se.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=gn(t.doc,c,a,this.dom,this)),S&&!this.trackWrites&&(M=!0)}M||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(d=this,u=d.docView.domFromPos(d.state.selection.anchor,0),h=d.root.getSelection(),Re(u.node,u.offset,h.anchorNode,h.anchorOffset)))?zn(this,M):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==p)this.dom.scrollTop=0;else if("to selection"==p){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof ie?qe(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),O):qe(this,this.coordsAtPos(t.selection.head,1),O))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,We(w,0==k?0:k-b))},lo.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},lo.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},bo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),wo="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),ko="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),xo="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Mo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),So=bo&&(xo||+bo[1]<57)||ko&&xo,Oo=0;Oo<10;Oo++)go[48+Oo]=go[96+Oo]=String(Oo);for(Oo=1;Oo<=24;Oo++)go[Oo+111]="F"+Oo;for(Oo=65;Oo<=90;Oo++)go[Oo]=String.fromCharCode(Oo+32),yo[Oo]=String.fromCharCode(Oo);for(var Co in go)yo.hasOwnProperty(Co)||(yo[Co]=go[Co]);var No="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _o(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a127)&&(r=go[n.keyCode])&&r!=o){var a=e[To(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[To(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Eo=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Vo(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,p=0;p0))return!1;var o=Po(r);if(!o){var i=r.blockRange(),s=i&&Rt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Xo(t,o,e))return!0;if(0==r.parent.content.size&&(Bo(a,"end")||ie.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Bo(a,"end")?te.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):ie.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}function Bo(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Lo(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=Po(o)}var s=i&&i.nodeBefore;return!(!s||!ie.isSelectable(s))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)}function Po(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 jo(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){var n=t.node(e);if(t.index(e)+11&&n.after()!=n.end(-1)){var r=n.before();if(Bt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Rt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}function Go(t,e){return e&&e(t.tr.setSelection(new ae(t.doc))),!0}function Xo(t,e,n){var r,o,s=e.nodeBefore,a=e.nodeAfter;if(s.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&&!Lt(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 c=e.parent.canReplace(e.index(),e.index()+1);if(c&&(r=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var p=e.pos+a.nodeSize,l=i.empty,d=r.length-1;d>=0;d--)l=i.from(r[d].create(null,l));l=i.from(s.copy(l));var h=t.tr.step(new Et(e.pos-1,p,e.pos,p,new u(l,1,0),r.length,!0)),f=p+2*r.length;Lt(h.doc,f)&&h.join(f),n(h.scrollIntoView())}return!0}var m=te.findFrom(e,1),v=m&&m.$from.blockRange(m.$to),g=v&&Rt(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(c&&a.isTextblock&&Bo(s,"end")){for(var y=s,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;if(y.canReplace(y.childCount,y.childCount,a.content)){if(n){for(var w=i.empty,k=b.length-1;k>=0;k--)w=i.from(b[k].copy(w));n(t.tr.step(new Et(e.pos-b.length,e.pos+a.nodeSize,e.pos+1,e.pos+a.nodeSize-1,new u(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Yo(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&zt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function Qo(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o=2&&s.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==s.index(c.depth-1))return!1;var d=n.doc.resolve(c.start-2);l=new A(d,d,c.depth),c.endIndex=0;a--)s=i.from(n[a].type.create(n[a].attrs,s));t.step(new Et(e.start-(r?2:0),e.end,e.start,e.end,new u(s,0,0),n.length,!0));for(var c=0,p=0;pc;a--)s-=o.child(a).nodeSize,r.delete(s-1,s+1);var p=r.doc.resolve(n.start),l=p.nodeAfter,d=0==n.startIndex,h=n.endIndex==o.childCount,f=p.node(-1),m=p.index(-1);if(!f.canReplace(m+(d?0:1),m+1,l.content.append(h?i.empty:i.from(o))))return!1;var v=p.pos,g=v+l.nodeSize;return r.step(new Et(v-(d?1:0),g+(h?1:0),v+1,g-1,new u((d?i.empty:i.from(o.copy(i.empty))).append(h?i.empty:i.from(o.copy(i.empty))),d?0:1,h?0:1),d?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}function ei(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ni(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ri(t,e){const n=ni(e,t.schema),{from:r,to:o}=t.selection;let i=[];t.doc.nodesBetween(r,o,(t=>{i=[...i,t]}));const s=i.reverse().find((t=>t.type.name===n.name));return s?__assign({},s.attrs):{}}function oi(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function ii(t,e){const n=oi(e,t.schema),{from:r,to:o,empty:i}=t.selection;let s=[];i?s=t.selection.$head.marks():t.doc.nodesBetween(r,o,(t=>{s=[...s,...t.marks]}));const a=s.find((t=>t.type.name===n.name));return a?__assign({},a.attrs):{}}function si(t,e){const n=Object.keys(e);return!n.length||!!n.filter((n=>e[n]===t[n])).length}function ai(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?ni(e,t.schema):null;let a=[];if(t.doc.nodesBetween(r,o,((t,e)=>{if(!t.isText){const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a=[...a,{node:t,from:n,to:i}]}})),i)return!!a.filter((t=>!s||s.name===t.node.type.name)).find((t=>si(t.node.attrs,n)));const c=o-r;return a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>si(t.node.attrs,n))).reduce(((t,e)=>t+(e.to-e.from)),0)>=c}function ci(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?oi(e,t.schema):null;if(i)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!s||s.name===t.type.name)).find((t=>si(t.attrs,n)));let a=0,c=[];if(t.doc.nodesBetween(r,o,((t,e)=>{if(t.isText){const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a+=i-n,c=[...c,...t.marks.map((t=>({mark:t,from:n,to:i})))]}})),0===a)return!1;return c.filter((t=>!s||s.name===t.mark.type.name)).filter((t=>si(t.mark.attrs,n))).reduce(((t,e)=>t+(e.to-e.from)),0)>=a}function pi(t){return(new window.DOMParser).parseFromString(t,"text/html").body}function li(t,e,n){if(n=__assign({slice:!0,parseOptions:{}},n),"object"==typeof t&&null!==t)try{return Array.isArray(t)?i.fromArray(t.map((t=>e.nodeFromJSON(t)))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),li("",e,n)}if("string"==typeof t){const r=ot.fromSchema(e);return n.slice?r.parseSlice(pi(t),n.parseOptions).content:r.parse(pi(t),n.parseOptions)}return li("",e,n)}function di(t,e,n={}){return li(t,e,{slice:!1,parseOptions:n})}Qo(qo,Uo,Ko,(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof ie&&t.selection.node.isBlock)return!(!r.parentOffset||!Bt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var s=o.parentOffset==o.parent.content.size,a=t.tr;(t.selection instanceof re||t.selection instanceof ae)&&a.deleteSelection();var c=0==r.depth?null:Jo(r.node(-1).contentMatchAt(r.indexAfter(-1))),p=s&&c?[{type:c}]:null,l=Bt(a.doc,a.mapping.map(r.pos),1,p);p||l||!Bt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(p=[{type:c}],l=!0),l&&(a.split(a.mapping.map(r.pos),1,p),s||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),i.from([c.create(),r.parent]))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0})),"undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&os.platform();class ui{constructor(t,e){this.editor=t,this.commands=e}createCommands(){const{commands:t,editor:e}=this,{state:n,view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(i);return o.getMeta("preventDispatch")||r.dispatch(o),n}])))}createChain(t,e=!0){const{commands:n,editor:r}=this,{state:o,view:i}=r,s=[],a=!!t,c=t||o.tr,p=__assign(__assign({},Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const r=this.buildProps(c,e),o=n(...t)(r);return s.push(o),p}])))),{run:()=>(a||!e||c.getMeta("preventDispatch")||i.dispatch(c),s.every((t=>!0===t)))});return p}createCan(t){const{commands:e,editor:n}=this,{state:r}=n,o=void 0,i=t||r.tr,s=this.buildProps(i,o),a=Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)(__assign(__assign({},s),{dispatch:o}))])));return __assign(__assign({},a),{chain:()=>this.createChain(i,o)})}buildProps(t,e=!0){const{editor:n,commands:r}=this,{state:o,view:i}=n;o.storedMarks&&t.setStoredMarks(o.storedMarks);const s={tr:t,editor:n,view:i,state:this.chainableState(t,o),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}chainableState(t,e){let{selection:n}=t,{doc:r}=t,{storedMarks:o}=t;return __assign(__assign({},e),{schema:e.schema,plugins:e.plugins,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return n},get doc(){return r},get tr(){return n=t.selection,r=t.doc,o=t.storedMarks,t}})}}function hi(t,e,n={}){if(void 0===t.config[e]&&t.parent)return hi(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind(__assign(__assign({},n),{parent:t.parent?hi(t.parent,e,n):null}))}return t.config[e]}function fi(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function mi(t){const e=[],{nodeExtensions:n,markExtensions:r}=fi(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return t.forEach((t=>{const n=hi(t,"addGlobalAttributes",{name:t.name,options:t.options});if(!n)return;n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,r])=>{e.push({type:n,name:t,attribute:__assign(__assign({},i),r)})}))}))}))})),o.forEach((t=>{const n={name:t.name,options:t.options},r=hi(t,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{e.push({type:t.name,name:n,attribute:__assign(__assign({},i),r)})}))})),e}function vi(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n=__assign({},t);return Object.entries(e).forEach((([t,e])=>{n[t]?n[t]="class"===t?[n[t],e].join(" "):"style"===t?[n[t],e].join("; "):e:n[t]=e})),n}),{})}function gi(t,e){return e.filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>vi(t,e)),{})}function yi(t,e){return t.style?t:__assign(__assign({},t),{getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.filter((t=>t.attribute.rendered)).reduce(((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n)||{}:{[e.name]:(o=n.getAttribute(e.name),"string"!=typeof o?o:o.match(/^\d*(\.\d+)?$/)?Number(o):"true"===o||"false"!==o&&o)};var o;const i=Object.fromEntries(Object.entries(r).filter((([,t])=>null!=t)));return __assign(__assign({},t),i)}),{});return __assign(__assign({},r),o)}})}function bi(t,e,...n){return"function"==typeof t?e?t.bind(e)(...n):t(...n):t}function wi(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e)))}function ki(t,e){return e.nodes[t]?e.nodes[t]:e.marks[t]?e.marks[t]:null}class xi{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=xi.resolve(t),this.schema=function(t){var e;const n=mi(t),{nodeExtensions:r,markExtensions:o}=fi(t),i=null===(e=r.find((t=>hi(t,"topNode"))))||void 0===e?void 0:e.name,s=Object.fromEntries(r.map((e=>{const r=n.filter((t=>t.type===e.name)),o={name:e.name,options:e.options},i=t.reduce(((t,n)=>{const r=hi(n,"extendNodeSchema",o);return __assign(__assign({},t),r?r(e):{})}),{}),s=wi(__assign(__assign({},i),{content:bi(hi(e,"content",o)),marks:bi(hi(e,"marks",o)),group:bi(hi(e,"group",o)),inline:bi(hi(e,"inline",o)),atom:bi(hi(e,"atom",o)),selectable:bi(hi(e,"selectable",o)),draggable:bi(hi(e,"draggable",o)),code:bi(hi(e,"code",o)),defining:bi(hi(e,"defining",o)),isolating:bi(hi(e,"isolating",o)),attrs:Object.fromEntries(r.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))})),a=bi(hi(e,"parseHTML",o));a&&(s.parseDOM=a.map((t=>yi(t,r))));const c=hi(e,"renderHTML",o);return c&&(s.toDOM=t=>c({node:t,HTMLAttributes:gi(t,r)})),[e.name,s]}))),a=Object.fromEntries(o.map((e=>{const r=n.filter((t=>t.type===e.name)),o={name:e.name,options:e.options},i=t.reduce(((t,n)=>{const r=hi(n,"extendMarkSchema",o);return __assign(__assign({},t),r?r(e):{})}),{}),s=wi(__assign(__assign({},i),{inclusive:bi(hi(e,"inclusive",o)),excludes:bi(hi(e,"excludes",o)),group:bi(hi(e,"group",o)),spanning:bi(hi(e,"spanning",o)),attrs:Object.fromEntries(r.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))})),a=bi(hi(e,"parseHTML",o));a&&(s.parseDOM=a.map((t=>yi(t,r))));const c=hi(e,"renderHTML",o);return c&&(s.toDOM=t=>c({mark:t,HTMLAttributes:gi(t,r)})),[e.name,s]})));return new nt({topNode:i,nodes:s,marks:a})}(this.extensions),this.extensions.forEach((t=>{var e;const n={name:t.name,options:t.options,editor:this.editor,type:ki(t.name,this.schema)};if("mark"===t.type){(null===(e=bi(hi(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const r=hi(t,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const o=hi(t,"onCreate",n);o&&this.editor.on("create",o);const i=hi(t,"onUpdate",n);i&&this.editor.on("update",i);const s=hi(t,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);const a=hi(t,"onTransaction",n);a&&this.editor.on("transaction",a);const c=hi(t,"onFocus",n);c&&this.editor.on("focus",c);const p=hi(t,"onBlur",n);p&&this.editor.on("blur",p);const l=hi(t,"onDestroy",n);l&&this.editor.on("destroy",l)}))}static resolve(t){return xi.sort(xi.flatten(t))}static flatten(t){return t.map((t=>{const e=hi(t,"addExtensions",{name:t.name,options:t.options});return e?this.flatten(e()):t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=hi(t,"priority")||100,r=hi(e,"priority")||100;return n>r?-1:n{const n=hi(e,"addCommands",{name:e.name,options:e.options,editor:this.editor,type:ki(e.name,this.schema)});return n?__assign(__assign({},t),n()):t}),{})}get plugins(){return[...this.extensions].reverse().map((t=>{const e={name:t.name,options:t.options,editor:this.editor,type:ki(t.name,this.schema)},n=[],r=hi(t,"addKeyboardShortcuts",e);if(r){const t=function(t){return new we({props:{handleKeyDown:Ao(t)}})}(Object.fromEntries(Object.entries(r()).map((([t,e])=>[t,()=>e({editor:this.editor})]))));n.push(t)}const o=hi(t,"addInputRules",e);if(this.editor.options.enableInputRules&&o){const t=o(),e=t.length?[(i={rules:t},s=i.rules,a=new we({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,e,n,r){return Vo(t,e,n,r,s,a)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var e=t.state.selection.$cursor;e&&Vo(t,e.pos,e.pos,"",s,a)}))}}},isInputRules:!0}),a)]:[];n.push(...e)}var i,s,a;const c=hi(t,"addPasteRules",e);if(this.editor.options.enablePasteRules&&c){const t=c();n.push(...t)}const p=hi(t,"addProseMirrorPlugins",e);if(p){const t=p();n.push(...t)}return n})).flat()}get attributes(){return mi(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter((t=>!!hi(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,editor:t,type:ni(e.name,this.schema)},o=hi(e,"addNodeView",r);if(!o)return[];return[e.name,(r,i,s,a)=>{const c=gi(r,n);return o()({editor:t,node:r,getPos:s,decorations:a,HTMLAttributes:c,extension:e})}]})))}get textSerializers(){const{editor:t}=this,{nodeExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter((t=>!!hi(t,"renderText"))).map((e=>{const n=hi(e,"renderText",{name:e.name,options:e.options,editor:t,type:ni(e.name,this.schema)});if(!n)return[];return[e.name,t=>n(t)]})))}}function Mi(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function Si(t,e){const n=__assign({},t);return Mi(t)&&Mi(e)&&Object.keys(e).forEach((r=>{Mi(e[r])?r in t?n[r]=Si(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})})),n}class Oi{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,priority:100,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Oi(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new Oi(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}const Ci=Oi.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Me("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{from:e,to:n}=t.state.selection;return((t,e,n,r,o)=>{let i="",s=!0;return t.state.doc.nodesBetween(e,n,((a,c)=>{var p;const l=t.extensionManager.textSerializers[a.type.name];l?(i+=l({node:a}),s=!r):a.isText?(i+=null===(p=null==a?void 0:a.text)||void 0===p?void 0:p.slice(Math.max(e,c)-c,n-c),s=!r):a.isLeaf&&o?(i+=o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)}),0),i})(t,e,n,"\n")}}})]}});var Ni=Object.freeze({__proto__:null,blur:()=>({view:t})=>(t.dom.blur(),!0)});var _i=Object.freeze({__proto__:null,clearContent:(t=!1)=>({commands:e})=>e.setContent("",t)});var Ti=Object.freeze({__proto__:null,clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return o.forEach((r=>{t.doc.nodesBetween(r.$from.pos,r.$to.pos,((r,o)=>{if(!r.type.isText){const i=e.doc.resolve(e.mapping.map(o+1)),s=e.doc.resolve(e.mapping.map(o+r.nodeSize-1)),a=i.blockRange(s);if(a){const o=Rt(a);r.type.isTextblock&&n&&e.setNodeMarkup(a.start,t.doc.type.contentMatch.defaultType),(o||0===o)&&n&&e.lift(a,o)}}}))})),!0}});var Ai=Object.freeze({__proto__:null,command:t=>e=>t(e)});var Ei=Object.freeze({__proto__:null,createParagraphNear:()=>({state:t,dispatch:e})=>Uo(t,e)});var Vi=Object.freeze({__proto__:null,deleteRange:t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0}});var Di=Object.freeze({__proto__:null,deleteSelection:()=>({state:t,dispatch:e})=>zo(t,e)});var Ri=Object.freeze({__proto__:null,enter:()=>({commands:t})=>t.keyboardShortcut("Enter")});var zi=Object.freeze({__proto__:null,exitCode:()=>({state:t,dispatch:e})=>Wo(t,e)});function Ii(t,e){if(!t||!e)return;const n=t.parent.childAfter(t.parentOffset);if(!n.node)return;const r=n.node.marks.find((t=>t.type===e));if(!r)return;let o=t.index(),i=t.start()+n.offset,s=o+1,a=i+n.node.nodeSize;for(;o>0&&r.isInSet(t.parent.child(o-1).marks);)o-=1,i-=t.parent.child(o).nodeSize;for(;s({tr:e,state:n,dispatch:r})=>{const o=oi(t,n.schema),{doc:i,selection:s}=e,{$from:a,empty:c}=s;if(c&&r){const t=Ii(a,o);if(t){const n=re.create(i,t.from,t.to);e.setSelection(n)}}return!0}});var Li=Object.freeze({__proto__:null,first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t({editor:e,view:n,tr:r,dispatch:o})=>{if(n.hasFocus()&&null===t||!1===t)return!0;if(o&&null===t&&!ji(e.state.selection))return n.focus(),!0;const{from:i,to:s}=function(t,e=null){if(!e)return null;if("start"===e||!0===e)return{from:0,to:0};if("end"===e){const{size:e}=t.doc.content;return{from:e,to:e}}return{from:e,to:e}}(e.state,t)||e.state.selection,{doc:a,storedMarks:c}=r,p=Pi(i,0,a.content.size),l=Pi(s,0,a.content.size),d=re.create(a,p,l),u=e.state.selection.eq(d);return o&&(r.setSelection(d),u&&c&&r.setStoredMarks(c),n.focus()),!0}});var Fi=Object.freeze({__proto__:null,insertContent:t=>({tr:e,commands:n})=>n.insertContentAt({from:e.selection.from,to:e.selection.to},t)});var Hi=Object.freeze({__proto__:null,insertContentAt:(t,e)=>({tr:n,dispatch:r,editor:o})=>{if(r){const r=li(e,o.schema);n.replaceWith(t.from,t.to,r),function(t,e,n){const r=t.steps.length-1;if(r{0===s&&(s=r)})),t.setSelection(te.near(t.doc.resolve(s),n))}(n,n.steps.length-1,1)}return!0}});var qi=Object.freeze({__proto__:null,joinBackward:()=>({state:t,dispatch:e})=>Io(t,e)});var Ji=Object.freeze({__proto__:null,joinForward:()=>({state:t,dispatch:e})=>jo(t,e)});const Wi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);var Ui=Object.freeze({__proto__:null,keyboardShortcut:t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=function(t){const e=t.split(/-(?!$)/);let n,r,o,i,s=e[e.length-1];"Space"===s&&(s=" ");for(let a=0;a!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==c||c.steps.forEach((t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)})),!0}});var Ki=Object.freeze({__proto__:null,lift:(t,e={})=>({state:n,dispatch:r})=>!!ai(n,ni(t,n.schema),e)&&Ho(n,r)});var Gi=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:t,dispatch:e})=>Ko(t,e)});var Xi=Object.freeze({__proto__:null,liftListItem:t=>({state:e,dispatch:n})=>ti(ni(t,e.schema))(e,n)});var Yi=Object.freeze({__proto__:null,newlineInCode:()=>({state:t,dispatch:e})=>qo(t,e)});var Qi=Object.freeze({__proto__:null,replace:(t,e={})=>({state:n,commands:r})=>{console.warn("[tiptap warn]: replace() is deprecated. please use insertContent() instead.");const{from:o,to:i}=n.selection,s={from:o,to:i};return r.replaceRange(s,t,e)}});var Zi=Object.freeze({__proto__:null,replaceRange:(t,e,n={})=>({tr:r,state:o,dispatch:i})=>{console.warn("[tiptap warn]: replaceRange() is deprecated. please use insertContent() instead.");const s=ni(e,o.schema),{from:a,to:c}=t;return i&&r.replaceRangeWith(a,c,s.create(n)),!0}});function ts(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{})}var es=Object.freeze({__proto__:null,resetAttributes:(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ei("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=ni(t,r.schema)),"mark"===a&&(s=oi(t,r.schema)),o&&n.selection.ranges.forEach((t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,ts(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((o=>{s===o.type&&n.addMark(r,r+t.nodeSize,s.create(ts(o.attrs,e)))}))}))})),!0)}});var ns=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0)});var rs=Object.freeze({__proto__:null,selectAll:()=>({state:t,dispatch:e})=>Go(t,e)});var is=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:t,dispatch:e})=>Lo(t,e)});var ss=Object.freeze({__proto__:null,selectNodeForward:()=>({state:t,dispatch:e})=>$o(t,e)});var as=Object.freeze({__proto__:null,selectParentNode:()=>({state:t,dispatch:e})=>function(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(ie.create(t.doc,n))),!0)}(t,e)});var cs=Object.freeze({__proto__:null,setContent:(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=di(t,o.schema,n),c=re.create(s,0,s.content.size);return i&&r.setSelection(c).replaceSelectionWith(a,!1).setMeta("preventUpdate",!e),!0}});var ps=Object.freeze({__proto__:null,setMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,c=oi(t,r.schema);if(o)if(s){const t=ii(r,c);n.addStoredMark(c.create(__assign(__assign({},t),e)))}else a.forEach((t=>{const o=t.$from.pos,i=t.$to.pos;r.doc.nodesBetween(o,i,((t,r)=>{const s=Math.max(r,o),a=Math.min(r+t.nodeSize,i);t.marks.find((t=>t.type===c))?t.marks.forEach((t=>{c===t.type&&n.addMark(s,a,c.create(__assign(__assign({},t.attrs),e)))})):n.addMark(s,a,c.create(e))}))}));return!0}});var ls=Object.freeze({__proto__:null,setNode:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return(i=o,s=e,function(t,e){var n=t.selection,r=n.from,o=n.to,a=!1;return t.doc.nodesBetween(r,o,(function(e,n){if(a)return!1;if(e.isTextblock&&!e.hasMarkup(i,s))if(e.type==i)a=!0;else{var r=t.doc.resolve(n),o=r.index();a=r.parent.canReplaceWith(o,o+1,i)}})),!!a&&(e&&e(t.tr.setBlockType(r,o,i,s).scrollIntoView()),!0)})(n,r);var i,s}});var ds=Object.freeze({__proto__:null,setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Pi(t,0,n.content.size),o=ie.create(n,r);e.setSelection(o)}return!0}});var us=Object.freeze({__proto__:null,setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Pi(t.from,0,n.content.size),o=Pi(t.to,0,n.content.size),i=re.create(n,r,o);e.setSelection(i)}return!0}});var hs=Object.freeze({__proto__:null,sinkListItem:t=>({state:e,dispatch:n})=>{const r=ni(t,e.schema);return(o=r,function(t,e){var n=t.selection,r=n.$from,s=n.$to,a=r.blockRange(s,(function(t){return t.childCount&&t.firstChild.type==o}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var p=a.parent,l=p.child(c-1);if(l.type!=o)return!1;if(e){var d=l.lastChild&&l.lastChild.type==p.type,h=i.from(d?o.create():null),f=new u(i.from(o.create(null,i.from(p.type.create(null,h)))),d?3:1,0),m=a.start,v=a.end;e(t.tr.step(new Et(m-(d?3:1),v,m,v,f,1,!0)).scrollIntoView())}return!0})(e,n);var o}});function fs(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=t.find((t=>t.type===e&&t.name===n));return!!r&&r.attribute.keepOnSplit})))}function ms(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(r)}}var vs=Object.freeze({__proto__:null,splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:c,$to:p}=s,l=fs(o.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof ie&&s.node.isBlock)return!(!c.parentOffset||!Bt(a,c.pos))&&(r&&(t&&ms(n,o.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;if(r){const r=p.parentOffset===p.parent.content.size;s instanceof re&&e.deleteSelection();const a=0===c.depth?void 0:function(t){for(let e=0;e({tr:e,state:n,dispatch:r,editor:o})=>{var s;const a=ni(t,n.schema),{$from:c,$to:p}=n.selection,l=n.selection.node;if(l&&l.isBlock||c.depth<2||!c.sameParent(p))return!1;const d=c.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let t=i.empty;const n=c.index(-1)>0;for(let e=c.depth-(n?1:2);e>=c.depth-3;e-=1)t=i.from(c.node(e).copy(t));const r=fs(h,c.node().type.name,c.node().attrs),o=(null===(s=a.contentMatch.defaultType)||void 0===s?void 0:s.createAndFill(r))||void 0;t=t.append(i.from(a.createAndFill(null,o)||void 0)),e.replace(c.before(n?void 0:-1),c.after(-3),new u(t,n?3:2,2)).setSelection(re.near(e.doc.resolve(c.pos+(n?3:2)))).scrollIntoView()}return!0}const f=p.pos===c.end()?d.contentMatchAt(0).defaultType:null,m=fs(h,d.type.name,d.attrs),v=fs(h,c.node().type.name,c.node().attrs);e.delete(c.pos,p.pos);const g=f?[{type:a,attrs:m},{type:f,attrs:v}]:[{type:a,attrs:m}];return!!Bt(e.doc,c.pos,2)&&(r&&e.split(c.pos,2,g).scrollIntoView(),!0)}});function ys(t,e){const{nodeExtensions:n}=fi(e),r=n.find((e=>e.name===t));if(!r)return!1;const o=bi(hi(r,"group",{name:r.name,options:r.options}));return"string"==typeof o&&o.split(" ").includes("list")}var bs=Object.freeze({__proto__:null,toggleList:(t,e)=>({editor:n,tr:r,state:o,dispatch:i,chain:s,commands:a,can:c})=>{const{extensions:p}=n.options,l=ni(t,o.schema),d=ni(e,o.schema),{selection:u}=o,{$from:h,$to:f}=u,m=h.blockRange(f);if(!m)return!1;const v=(g=t=>ys(t.type.name,p),t=>function(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}(t.$from,g))(u);var g;if(m.depth>=1&&v&&m.depth-v.depth<=1){if(v.node.type===l)return a.liftListItem(d);if(ys(v.node.type.name,p)&&l.validContent(v.node.content)&&i)return r.setNodeMarkup(v.pos,l),!0}return c().wrapInList(l)?a.wrapInList(l):s().clearNodes().wrapInList(l).run()}});var ws=Object.freeze({__proto__:null,toggleMark:(t,e={})=>({state:n,commands:r})=>{const o=oi(t,n.schema);return ci(n,o,e)?r.unsetMark(o):r.setMark(o,e)}});var ks=Object.freeze({__proto__:null,toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const i=ni(t,r.schema),s=ni(e,r.schema);return ai(r,i,n)?o.setNode(s):o.setNode(i,n)}});var xs=Object.freeze({__proto__:null,toggleWrap:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return ai(n,o,e)?Ho(n,r):Yo(o,e)(n,r)}});var Ms=Object.freeze({__proto__:null,undoInputRule:()=>({state:t,dispatch:e})=>function(t,e){for(var n=t.plugins,r=0;r=0;c--)s.step(a.steps[c].invert(a.docs[c]));if(i.text){var p=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,p))}else s.delete(i.from,i.to);e(s)}return!0}}return!1}(t,e)});var Ss=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:t,state:e,dispatch:n})=>{const{selection:r}=t,{empty:o,ranges:i}=r;return o||n&&Object.entries(e.schema.marks).forEach((([,e])=>{i.forEach((n=>{t.removeMark(n.$from.pos,n.$to.pos,e)}))})),!0}});var Os=Object.freeze({__proto__:null,unsetMark:t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=e,i=oi(t,n.schema),{$from:s,empty:a,ranges:c}=o;if(r){if(a){let{from:t,to:n}=o;const r=Ii(s,i);r&&(t=r.from,n=r.to),e.removeMark(t,n,i)}else c.forEach((t=>{e.removeMark(t.$from.pos,t.$to.pos,i)}));e.removeStoredMark(i)}return!0}});var Cs=Object.freeze({__proto__:null,updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ei("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=ni(t,r.schema)),"mark"===a&&(s=oi(t,r.schema)),o&&n.selection.ranges.forEach((t=>{const o=t.$from.pos,a=t.$to.pos;r.doc.nodesBetween(o,a,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,__assign(__assign({},t.attrs),e)),s&&t.marks.length&&t.marks.forEach((i=>{if(s===i.type){const c=Math.max(r,o),p=Math.min(r+t.nodeSize,a);n.addMark(c,p,s.create(__assign(__assign({},i.attrs),e)))}}))}))})),!0)}});var Ns=Object.freeze({__proto__:null,wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return!ai(n,o,e)&&Yo(o,e)(n,r)}});var _s=Object.freeze({__proto__:null,wrapInList:(t,e={})=>({state:n,dispatch:r})=>Zo(ni(t,n.schema),e)(n,r)});const Ts=Oi.create({name:"commands",addCommands:()=>__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({},Ni),_i),Ti),Ai),Ei),Vi),Di),Ri),zi),Bi),Li),$i),Fi),Hi),qi),Ji),Ui),Ki),Gi),Xi),Yi),Qi),Zi),es),ns),rs),is),ss),as),cs),ps),ls),ds),us),hs),vs),gs),bs),ws),ks),xs),Ms),Ss),Os),Cs),Ns),_s)}),As=Oi.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Me("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Es=Oi.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:new Me("focusEvents"),props:{attributes:{tabindex:"0"},handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Vs=Oi.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.joinForward(),()=>t.selectNodeForward()]));return{Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>t(),"Mod-Backspace":()=>t(),Delete:()=>e(),"Mod-Delete":()=>e()}}});var Ds=Object.freeze({__proto__:null,ClipboardTextSerializer:Ci,Commands:Ts,Editable:As,FocusEvents:Es,Keymap:Vs});class Rs{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,priority:100,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Rs(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new Rs(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}class zs{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,priority:100,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new zs(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new zs(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}function Is(t,e,n){return new Eo(t,((t,r,o,i)=>{const s=n instanceof Function?n(r):n,{tr:a}=t;return r[0]&&a.replaceWith(o-1,i,e.create(s)),a}))}function Bs(t,e,n){return new Eo(t,((t,r,o,i)=>{const s=n instanceof Function?n(r):n,{tr:a}=t,c=r[r.length-1],p=r[0];let l=i;if(c){const n=p.search(/\S/),r=o+p.indexOf(c),d=r+c.length;if(function(t,e,n){let r=[];return n.doc.nodesBetween(t,e,((t,e)=>{r=[...r,...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n})))]})),r}(o,i,t).filter((t=>{const{excluded:n}=t.mark.type;return n.find((t=>t.name===e.name))})).filter((t=>t.to>r)).length)return null;do&&a.delete(o+n,r),l=o+n+c.length,a.addMark(o+n,l,e.create(s)),a.removeStoredMark(e)}return a}))}function Ls(t,e,n){const r=(o,s)=>{const a=[];return o.forEach((o=>{if(o.isText&&o.text){const{text:r}=o;let i,c=0;for(;null!==(i=t.exec(r));){const t=Math.max(i.length-2,0),r=Math.max(i.length-1,0);if(null==s?void 0:s.type.allowsMarkType(e)){const s=i.index+i[0].indexOf(i[t]),p=s+i[t].length,l=s+i[t].lastIndexOf(i[r]),d=l+i[r].length,u=n instanceof Function?n(i):n;s>0&&a.push(o.cut(c,s)),a.push(o.cut(l,d).mark(e.create(u).addToSet(o.marks))),c=p}}cnew u(r(t.content),t.openStart,t.openEnd)}})}function Ps(t,e,n){const r=document.createRange();return r.setEnd(t,"number"==typeof n?n:(t.nodeValue||"").length),r.setStart(t,Math.max(e||0,0)),r}function js(t,e){const n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function $s(t,e,n=!1){const{node:r,offset:o}=t.domAtPos(e);let i=null,s=null;if(3===r.nodeType){const t=r.nodeValue||"";n&&op})}var Hs="top",qs="bottom",Js="right",Ws="left",Us="auto",Ks=[Hs,qs,Js,Ws],Gs="start",Xs="end",Ys="viewport",Qs="popper",Zs=Ks.reduce((function(t,e){return t.concat([e+"-"+Gs,e+"-"+Xs])}),[]),ta=[].concat(Ks,[Us]).reduce((function(t,e){return t.concat([e,e+"-"+Gs,e+"-"+Xs])}),[]),ea=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function na(t){return t?(t.nodeName||"").toLowerCase():null}function ra(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function oa(t){return t instanceof ra(t).Element||t instanceof Element}function ia(t){return t instanceof ra(t).HTMLElement||t instanceof HTMLElement}function sa(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ra(t).ShadowRoot||t instanceof ShadowRoot)}var aa={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},r=e.attributes[t]||{},o=e.elements[t];ia(o)&&na(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(t){var e=r[t];!1===e?o.removeAttribute(t):o.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var r=e.elements[t],o=e.attributes[t]||{},i=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});ia(r)&&na(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]};function ca(t){return t.split("-")[0]}function pa(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function la(t){var e=pa(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function da(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&sa(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ua(t){return ra(t).getComputedStyle(t)}function ha(t){return["table","td","th"].indexOf(na(t))>=0}function fa(t){return((oa(t)?t.ownerDocument:t.document)||window.document).documentElement}function ma(t){return"html"===na(t)?t:t.assignedSlot||t.parentNode||(sa(t)?t.host:null)||fa(t)}function va(t){return ia(t)&&"fixed"!==ua(t).position?t.offsetParent:null}function ga(t){for(var e=ra(t),n=va(t);n&&ha(n)&&"static"===ua(n).position;)n=va(n);return n&&("html"===na(n)||"body"===na(n)&&"static"===ua(n).position)?e:n||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&ia(t)&&"fixed"===ua(t).position)return null;for(var n=ma(t);ia(n)&&["html","body"].indexOf(na(n))<0;){var r=ua(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||e&&"filter"===r.willChange||e&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(t)||e}function ya(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var ba=Math.max,wa=Math.min,ka=Math.round;function xa(t,e,n){return ba(t,wa(e,n))}function Ma(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Sa(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var Oa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Ca(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.offsets,s=t.position,a=t.gpuAcceleration,c=t.adaptive,p=t.roundOffsets,l=!0===p?function(t){var e=t.x,n=t.y,r=window.devicePixelRatio||1;return{x:ka(ka(e*r)/r)||0,y:ka(ka(n*r)/r)||0}}(i):"function"==typeof p?p(i):i,d=l.x,u=void 0===d?0:d,h=l.y,f=void 0===h?0:h,m=i.hasOwnProperty("x"),v=i.hasOwnProperty("y"),g=Ws,y=Hs,b=window;if(c){var w=ga(n),k="clientHeight",x="clientWidth";w===ra(n)&&"static"!==ua(w=fa(n)).position&&(k="scrollHeight",x="scrollWidth"),w=w,o===Hs&&(y=qs,f-=w[k]-r.height,f*=a?1:-1),o===Ws&&(g=Js,u-=w[x]-r.width,u*=a?1:-1)}var M,S=Object.assign({position:s},c&&Oa);return a?Object.assign({},S,((M={})[y]=v?"0":"",M[g]=m?"0":"",M.transform=(b.devicePixelRatio||1)<2?"translate("+u+"px, "+f+"px)":"translate3d("+u+"px, "+f+"px, 0)",M)):Object.assign({},S,((e={})[y]=v?f+"px":"",e[g]=m?u+"px":"",e.transform="",e))}var Na={passive:!0};var _a={left:"right",right:"left",bottom:"top",top:"bottom"};function Ta(t){return t.replace(/left|right|bottom|top/g,(function(t){return _a[t]}))}var Aa={start:"end",end:"start"};function Ea(t){return t.replace(/start|end/g,(function(t){return Aa[t]}))}function Va(t){var e=ra(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Da(t){return pa(fa(t)).left+Va(t).scrollLeft}function Ra(t){var e=ua(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function za(t){return["html","body","#document"].indexOf(na(t))>=0?t.ownerDocument.body:ia(t)&&Ra(t)?t:za(ma(t))}function Ia(t,e){var n;void 0===e&&(e=[]);var r=za(t),o=r===(null==(n=t.ownerDocument)?void 0:n.body),i=ra(r),s=o?[i].concat(i.visualViewport||[],Ra(r)?r:[]):r,a=e.concat(s);return o?a:a.concat(Ia(ma(s)))}function Ba(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function La(t,e){return e===Ys?Ba(function(t){var e=ra(t),n=fa(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,s=0,a=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,a=r.offsetTop)),{width:o,height:i,x:s+Da(t),y:a}}(t)):ia(e)?function(t){var e=pa(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):Ba(function(t){var e,n=fa(t),r=Va(t),o=null==(e=t.ownerDocument)?void 0:e.body,i=ba(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=ba(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+Da(t),c=-r.scrollTop;return"rtl"===ua(o||n).direction&&(a+=ba(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:c}}(fa(t)))}function Pa(t,e,n){var r="clippingParents"===e?function(t){var e=Ia(ma(t)),n=["absolute","fixed"].indexOf(ua(t).position)>=0&&ia(t)?ga(t):t;return oa(n)?e.filter((function(t){return oa(t)&&da(t,n)&&"body"!==na(t)})):[]}(t):[].concat(e),o=[].concat(r,[n]),i=o[0],s=o.reduce((function(e,n){var r=La(t,n);return e.top=ba(r.top,e.top),e.right=wa(r.right,e.right),e.bottom=wa(r.bottom,e.bottom),e.left=ba(r.left,e.left),e}),La(t,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function ja(t){return t.split("-")[1]}function $a(t){var e,n=t.reference,r=t.element,o=t.placement,i=o?ca(o):null,s=o?ja(o):null,a=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case Hs:e={x:a,y:n.y-r.height};break;case qs:e={x:a,y:n.y+n.height};break;case Js:e={x:n.x+n.width,y:c};break;case Ws:e={x:n.x-r.width,y:c};break;default:e={x:n.x,y:n.y}}var p=i?ya(i):null;if(null!=p){var l="y"===p?"height":"width";switch(s){case Gs:e[p]=e[p]-(n[l]/2-r[l]/2);break;case Xs:e[p]=e[p]+(n[l]/2-r[l]/2)}}return e}function Fa(t,e){void 0===e&&(e={});var n=e,r=n.placement,o=void 0===r?t.placement:r,i=n.boundary,s=void 0===i?"clippingParents":i,a=n.rootBoundary,c=void 0===a?Ys:a,p=n.elementContext,l=void 0===p?Qs:p,d=n.altBoundary,u=void 0!==d&&d,h=n.padding,f=void 0===h?0:h,m=Ma("number"!=typeof f?f:Sa(f,Ks)),v=l===Qs?"reference":Qs,g=t.elements.reference,y=t.rects.popper,b=t.elements[u?v:l],w=Pa(oa(b)?b:b.contextElement||fa(t.elements.popper),s,c),k=pa(g),x=$a({reference:k,element:y,strategy:"absolute",placement:o}),M=Ba(Object.assign({},y,x)),S=l===Qs?M:k,O={top:w.top-S.top+m.top,bottom:S.bottom-w.bottom+m.bottom,left:w.left-S.left+m.left,right:S.right-w.right+m.right},C=t.modifiersData.offset;if(l===Qs&&C){var N=C[o];Object.keys(O).forEach((function(t){var e=[Js,qs].indexOf(t)>=0?1:-1,n=[Hs,qs].indexOf(t)>=0?"y":"x";O[t]+=N[n]*e}))}return O}function Ha(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function qa(t){return[Hs,Js,qs,Ws].some((function(e){return t[e]>=0}))}function Ja(t,e,n){void 0===n&&(n=!1);var r,o,i=fa(e),s=pa(t),a=ia(e),c={scrollLeft:0,scrollTop:0},p={x:0,y:0};return(a||!a&&!n)&&(("body"!==na(e)||Ra(i))&&(c=(r=e)!==ra(r)&&ia(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:Va(r)),ia(e)?((p=pa(e)).x+=e.clientLeft,p.y+=e.clientTop):i&&(p.x=Da(i))),{x:s.left+c.scrollLeft-p.x,y:s.top+c.scrollTop-p.y,width:s.width,height:s.height}}function Wa(t){var e=new Map,n=new Set,r=[];function o(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var r=e.get(t);r&&o(r)}})),r.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||o(t)})),r}var Ua={placement:"bottom",modifiers:[],strategy:"absolute"};function Ka(){for(var t=arguments.length,e=new Array(t),n=0;n=0?-1:1,i="function"==typeof n?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Ws,Js].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}(n,e.rects,i),t}),{}),a=s[e.placement],c=a.x,p=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=p),e.modifiersData[r]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0===s||s,c=n.fallbackPlacements,p=n.padding,l=n.boundary,d=n.rootBoundary,u=n.altBoundary,h=n.flipVariations,f=void 0===h||h,m=n.allowedAutoPlacements,v=e.options.placement,g=ca(v),y=c||(g===v||!f?[Ta(v)]:function(t){if(ca(t)===Us)return[];var e=Ta(t);return[Ea(t),e,Ea(e)]}(v)),b=[v].concat(y).reduce((function(t,n){return t.concat(ca(n)===Us?function(t,e){void 0===e&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,p=void 0===c?ta:c,l=ja(r),d=l?a?Zs:Zs.filter((function(t){return ja(t)===l})):Ks,u=d.filter((function(t){return p.indexOf(t)>=0}));0===u.length&&(u=d);var h=u.reduce((function(e,n){return e[n]=Fa(t,{placement:n,boundary:o,rootBoundary:i,padding:s})[ca(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:l,rootBoundary:d,padding:p,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),w=e.rects.reference,k=e.rects.popper,x=new Map,M=!0,S=b[0],O=0;O=0,A=T?"width":"height",E=Fa(e,{placement:C,boundary:l,rootBoundary:d,altBoundary:u,padding:p}),V=T?_?Js:Ws:_?qs:Hs;w[A]>k[A]&&(V=Ta(V));var D=Ta(V),R=[];if(i&&R.push(E[N]<=0),a&&R.push(E[V]<=0,E[D]<=0),R.every((function(t){return t}))){S=C,M=!1;break}x.set(C,R)}if(M)for(var z=function(t){var e=b.find((function(e){var n=x.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return S=e,"break"},I=f?3:1;I>0;I--){if("break"===z(I))break}e.placement!==S&&(e.modifiersData[r]._skip=!0,e.placement=S,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0!==s&&s,c=n.boundary,p=n.rootBoundary,l=n.altBoundary,d=n.padding,u=n.tether,h=void 0===u||u,f=n.tetherOffset,m=void 0===f?0:f,v=Fa(e,{boundary:c,rootBoundary:p,padding:d,altBoundary:l}),g=ca(e.placement),y=ja(e.placement),b=!y,w=ya(g),k="x"===w?"y":"x",x=e.modifiersData.popperOffsets,M=e.rects.reference,S=e.rects.popper,O="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,C={x:0,y:0};if(x){if(i||a){var N="y"===w?Hs:Ws,_="y"===w?qs:Js,T="y"===w?"height":"width",A=x[w],E=x[w]+v[N],V=x[w]-v[_],D=h?-S[T]/2:0,R=y===Gs?M[T]:S[T],z=y===Gs?-S[T]:-M[T],I=e.elements.arrow,B=h&&I?la(I):{width:0,height:0},L=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},P=L[N],j=L[_],$=xa(0,M[T],B[T]),F=b?M[T]/2-D-$-P-O:R-$-P-O,H=b?-M[T]/2+D+$+j+O:z+$+j+O,q=e.elements.arrow&&ga(e.elements.arrow),J=q?"y"===w?q.clientTop||0:q.clientLeft||0:0,W=e.modifiersData.offset?e.modifiersData.offset[e.placement][w]:0,U=x[w]+F-W-J,K=x[w]+H-W;if(i){var G=xa(h?wa(E,U):E,A,h?ba(V,K):V);x[w]=G,C[w]=G-A}if(a){var X="x"===w?Hs:Ws,Y="x"===w?qs:Js,Q=x[k],Z=Q+v[X],tt=Q-v[Y],et=xa(h?wa(Z,U):Z,Q,h?ba(tt,K):tt);x[k]=et,C[k]=et-Q}}e.modifiersData[r]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=ca(n.placement),c=ya(a),p=[Ws,Js].indexOf(a)>=0?"height":"width";if(i&&s){var l=function(t,e){return Ma("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Sa(t,Ks))}(o.padding,n),d=la(i),u="y"===c?Hs:Ws,h="y"===c?qs:Js,f=n.rects.reference[p]+n.rects.reference[c]-s[c]-n.rects.popper[p],m=s[c]-n.rects.reference[c],v=ga(i),g=v?"y"===c?v.clientHeight||0:v.clientWidth||0:0,y=f/2-m/2,b=l[u],w=g-d[p]-l[h],k=g/2-d[p]/2+y,x=xa(b,k,w),M=c;n.modifiersData[r]=((e={})[M]=x,e.centerOffset=x-k,e)}},effect:function(t){var e=t.state,n=t.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=e.elements.popper.querySelector(r)))&&da(e.elements.popper,r)&&(e.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=Fa(e,{elementContext:"reference"}),a=Fa(e,{altBoundary:!0}),c=Ha(s,r),p=Ha(a,o,i),l=qa(c),d=qa(p);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:p,isReferenceHidden:l,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":d})}}]}),Ya="tippy-content",Qa="tippy-arrow",Za="tippy-svg-arrow",tc={passive:!0,capture:!0};function ec(t,e,n){if(Array.isArray(t)){var r=t[e];return null==r?Array.isArray(n)?n[e]:n:r}return t}function nc(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function rc(t,e){return"function"==typeof t?t.apply(void 0,e):t}function oc(t,e){return 0===e?t:function(r){clearTimeout(n),n=setTimeout((function(){t(r)}),e)};var n}function ic(t){return[].concat(t)}function sc(t,e){-1===t.indexOf(e)&&t.push(e)}function ac(t){return[].slice.call(t)}function cc(){return document.createElement("div")}function pc(t){return["Element","Fragment"].some((function(e){return nc(t,e)}))}function lc(t){return pc(t)?[t]:function(t){return nc(t,"NodeList")}(t)?ac(t):Array.isArray(t)?t:ac(document.querySelectorAll(t))}function dc(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function uc(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function hc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[r](e,n)}))}var fc={isTouch:!1},mc=0;function vc(){fc.isTouch||(fc.isTouch=!0,window.performance&&document.addEventListener("mousemove",gc))}function gc(){var t=performance.now();t-mc<20&&(fc.isTouch=!1,document.removeEventListener("mousemove",gc)),mc=t}function yc(){var t,e=document.activeElement;if((t=e)&&t._tippy&&t._tippy.reference===t){var n=e._tippy;e.blur&&!n.state.isVisible&&e.blur()}}var bc="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",wc=/MSIE |Trident\//.test(bc),kc=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),xc=Object.keys(kc);function Mc(t){var e=(t.plugins||[]).reduce((function(e,n){var r=n.name,o=n.defaultValue;return r&&(e[r]=void 0!==t[r]?t[r]:o),e}),{});return Object.assign({},t,{},e)}function Sc(t,e){var n=Object.assign({},e,{content:rc(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(Mc(Object.assign({},kc,{plugins:e}))):xc).reduce((function(e,n){var r=(t.getAttribute("data-tippy-"+n)||"").trim();if(!r)return e;if("content"===n)e[n]=r;else try{e[n]=JSON.parse(r)}catch(o){e[n]=r}return e}),{})}(t,e.plugins));return n.aria=Object.assign({},kc.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}function Oc(t,e){t.innerHTML=e}function Cc(t){var e=cc();return!0===t?e.className=Qa:(e.className=Za,pc(t)?e.appendChild(t):Oc(e,t)),e}function Nc(t,e){pc(e.content)?(Oc(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?Oc(t,e.content):t.textContent=e.content)}function _c(t){var e=t.firstElementChild,n=ac(e.children);return{box:e,content:n.find((function(t){return t.classList.contains(Ya)})),arrow:n.find((function(t){return t.classList.contains(Qa)||t.classList.contains(Za)})),backdrop:n.find((function(t){return t.classList.contains("tippy-backdrop")}))}}function Tc(t){var e=cc(),n=cc();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=cc();function o(n,r){var o=_c(e),i=o.box,s=o.content,a=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||Nc(s,t.props),r.arrow?a?n.arrow!==r.arrow&&(i.removeChild(a),i.appendChild(Cc(r.arrow))):i.appendChild(Cc(r.arrow)):a&&i.removeChild(a)}return r.className=Ya,r.setAttribute("data-state","hidden"),Nc(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props),{popper:e,onUpdate:o}}Tc.$$tippy=!0;var Ac=1,Ec=[],Vc=[];function Dc(t,e){var n,r,o,i,s,a,c,p,l,d=Sc(t,Object.assign({},kc,{},Mc((n=e,Object.keys(n).reduce((function(t,e){return void 0!==n[e]&&(t[e]=n[e]),t}),{}))))),u=!1,h=!1,f=!1,m=!1,v=[],g=oc(K,d.interactiveDebounce),y=Ac++,b=(l=d.plugins).filter((function(t,e){return l.indexOf(t)===e})),w={id:y,reference:t,popper:cc(),popperInstance:null,props:d,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)},setProps:function(e){if(w.state.isDestroyed)return;R("onBeforeUpdate",[w,e]),W();var n=w.props,r=Sc(t,Object.assign({},w.props,{},e,{ignoreAttributes:!0}));w.props=r,J(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),g=oc(K,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?ic(n.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):r.triggerTarget&&t.removeAttribute("aria-expanded");I(),D(),M&&M(n,r);w.popperInstance&&(Q(),tt().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})));R("onAfterUpdate",[w,e])},setContent:function(t){w.setProps({content:t})},show:function(){var t=w.state.isVisible,e=w.state.isDestroyed,n=!w.state.isEnabled,r=fc.isTouch&&!w.props.touch,o=ec(w.props.duration,0,kc.duration);if(t||e||n||r)return;if(T().hasAttribute("disabled"))return;if(R("onShow",[w],!1),!1===w.props.onShow(w))return;w.state.isVisible=!0,_()&&(x.style.visibility="visible");D(),$(),w.state.isMounted||(x.style.transition="none");if(_()){var i=E(),s=i.box,a=i.content;dc([s,a],0)}c=function(){var t;if(w.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=w.props.moveTransition,_()&&w.props.animation){var e=E(),n=e.box,r=e.content;dc([n,r],o),uc([n,r],"visible")}z(),I(),sc(Vc,w),null==(t=w.popperInstance)||t.forceUpdate(),w.state.isMounted=!0,R("onMount",[w]),w.props.animation&&_()&&function(t,e){H(t,e)}(o,(function(){w.state.isShown=!0,R("onShown",[w])}))}},function(){var t,e=w.props.appendTo,n=T();t=w.props.interactive&&e===kc.appendTo||"parent"===e?n.parentNode:rc(e,[n]);t.contains(x)||t.appendChild(x);Q()}()},hide:function(){var t=!w.state.isVisible,e=w.state.isDestroyed,n=!w.state.isEnabled,r=ec(w.props.duration,1,kc.duration);if(t||e||n)return;if(R("onHide",[w],!1),!1===w.props.onHide(w))return;w.state.isVisible=!1,w.state.isShown=!1,m=!1,u=!1,_()&&(x.style.visibility="hidden");if(B(),F(),D(),_()){var o=E(),i=o.box,s=o.content;w.props.animation&&(dc([i,s],r),uc([i,s],"hidden"))}z(),I(),w.props.animation?_()&&function(t,e){H(t,(function(){!w.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}(r,w.unmount):w.unmount()},hideWithInteractivity:function(t){A().addEventListener("mousemove",g),sc(Ec,g),g(t)},enable:function(){w.state.isEnabled=!0},disable:function(){w.hide(),w.state.isEnabled=!1},unmount:function(){w.state.isVisible&&w.hide();if(!w.state.isMounted)return;Z(),tt().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x);Vc=Vc.filter((function(t){return t!==w})),w.state.isMounted=!1,R("onHidden",[w])},destroy:function(){if(w.state.isDestroyed)return;w.clearDelayTimeouts(),w.unmount(),W(),delete t._tippy,w.state.isDestroyed=!0,R("onDestroy",[w])}};if(!d.render)return w;var k=d.render(w),x=k.popper,M=k.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+w.id,w.popper=x,t._tippy=w,x._tippy=w;var S=b.map((function(t){return t.fn(w)})),O=t.hasAttribute("aria-expanded");return J(),I(),D(),R("onCreate",[w]),d.showOnCreate&&et(),x.addEventListener("mouseenter",(function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(t){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&(A().addEventListener("mousemove",g),g(t))})),w;function C(){var t=w.props.touch;return Array.isArray(t)?t:[t,0]}function N(){return"hold"===C()[0]}function _(){var t;return!!(null==(t=w.props.render)?void 0:t.$$tippy)}function T(){return p||t}function A(){var t,e,n=T().parentNode;return n?(null==(e=ic(n)[0])||null==(t=e.ownerDocument)?void 0:t.body)?e.ownerDocument:document:document}function E(){return _c(x)}function V(t){return w.state.isMounted&&!w.state.isVisible||fc.isTouch||s&&"focus"===s.type?0:ec(w.props.delay,t?0:1,kc.delay)}function D(){x.style.pointerEvents=w.props.interactive&&w.state.isVisible?"":"none",x.style.zIndex=""+w.props.zIndex}function R(t,e,n){var r;(void 0===n&&(n=!0),S.forEach((function(n){n[t]&&n[t].apply(void 0,e)})),n)&&(r=w.props)[t].apply(r,e)}function z(){var e=w.props.aria;if(e.content){var n="aria-"+e.content,r=x.id;ic(w.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(n);if(w.state.isVisible)t.setAttribute(n,e?e+" "+r:r);else{var o=e&&e.replace(r,"").trim();o?t.setAttribute(n,o):t.removeAttribute(n)}}))}}function I(){!O&&w.props.aria.expanded&&ic(w.props.triggerTarget||t).forEach((function(t){w.props.interactive?t.setAttribute("aria-expanded",w.state.isVisible&&t===T()?"true":"false"):t.removeAttribute("aria-expanded")}))}function B(){A().removeEventListener("mousemove",g),Ec=Ec.filter((function(t){return t!==g}))}function L(t){if(!(fc.isTouch&&(f||"mousedown"===t.type)||w.props.interactive&&x.contains(t.target))){if(T().contains(t.target)){if(fc.isTouch)return;if(w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[w,t]);!0===w.props.hideOnClick&&(w.clearDelayTimeouts(),w.hide(),h=!0,setTimeout((function(){h=!1})),w.state.isMounted||F())}}function P(){f=!0}function j(){f=!1}function $(){var t=A();t.addEventListener("mousedown",L,!0),t.addEventListener("touchend",L,tc),t.addEventListener("touchstart",j,tc),t.addEventListener("touchmove",P,tc)}function F(){var t=A();t.removeEventListener("mousedown",L,!0),t.removeEventListener("touchend",L,tc),t.removeEventListener("touchstart",j,tc),t.removeEventListener("touchmove",P,tc)}function H(t,e){var n=E().box;function r(t){t.target===n&&(hc(n,"remove",r),e())}if(0===t)return e();hc(n,"remove",a),hc(n,"add",r),a=r}function q(e,n,r){void 0===r&&(r=!1),ic(w.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,n,r),v.push({node:t,eventType:e,handler:n,options:r})}))}function J(){var t;N()&&(q("touchstart",U,{passive:!0}),q("touchend",G,{passive:!0})),(t=w.props.trigger,t.split(/\s+/).filter(Boolean)).forEach((function(t){if("manual"!==t)switch(q(t,U),t){case"mouseenter":q("mouseleave",G);break;case"focus":q(wc?"focusout":"blur",X);break;case"focusin":q("focusout",X)}}))}function W(){v.forEach((function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)})),v=[]}function U(t){var e,n=!1;if(w.state.isEnabled&&!Y(t)&&!h){var r="focus"===(null==(e=s)?void 0:e.type);s=t,p=t.currentTarget,I(),!w.state.isVisible&&nc(t,"MouseEvent")&&Ec.forEach((function(e){return e(t)})),"click"===t.type&&(w.props.trigger.indexOf("mouseenter")<0||u)&&!1!==w.props.hideOnClick&&w.state.isVisible?n=!0:et(t),"click"===t.type&&(u=!n),n&&!r&&nt(t)}}function K(t){var e=t.target,n=T().contains(e)||x.contains(e);"mousemove"===t.type&&n||function(t,e){var n=e.clientX,r=e.clientY;return t.every((function(t){var e=t.popperRect,o=t.popperState,i=t.props.interactiveBorder,s=o.placement.split("-")[0],a=o.modifiersData.offset;if(!a)return!0;var c="bottom"===s?a.top.y:0,p="top"===s?a.bottom.y:0,l="right"===s?a.left.x:0,d="left"===s?a.right.x:0,u=e.top-r+c>i,h=r-e.bottom-p>i,f=e.left-n+l>i,m=n-e.right-d>i;return u||h||f||m}))}(tt().concat(x).map((function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:d}:null})).filter(Boolean),t)&&(B(),nt(t))}function G(t){Y(t)||w.props.trigger.indexOf("click")>=0&&u||(w.props.interactive?w.hideWithInteractivity(t):nt(t))}function X(t){w.props.trigger.indexOf("focusin")<0&&t.target!==T()||w.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||nt(t)}function Y(t){return!!fc.isTouch&&N()!==t.type.indexOf("touch")>=0}function Q(){Z();var e=w.props,n=e.popperOptions,r=e.placement,o=e.offset,i=e.getReferenceClientRect,s=e.moveTransition,a=_()?_c(x).arrow:null,p=i?{getBoundingClientRect:i,contextElement:i.contextElement||T()}:t,l=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(_()){var n=E().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];_()&&a&&l.push({name:"arrow",options:{element:a,padding:3}}),l.push.apply(l,(null==n?void 0:n.modifiers)||[]),w.popperInstance=Xa(p,x,Object.assign({},n,{placement:r,onFirstUpdate:c,modifiers:l}))}function Z(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function tt(){return ac(x.querySelectorAll("[data-tippy-root]"))}function et(t){w.clearDelayTimeouts(),t&&R("onTrigger",[w,t]),$();var e=V(!0),n=C(),o=n[0],i=n[1];fc.isTouch&&"hold"===o&&i&&(e=i),e?r=setTimeout((function(){w.show()}),e):w.show()}function nt(t){if(w.clearDelayTimeouts(),R("onUntrigger",[w,t]),w.state.isVisible){if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&u)){var e=V(!1);e?o=setTimeout((function(){w.state.isVisible&&w.hide()}),e):i=requestAnimationFrame((function(){w.hide()}))}}else F()}}function Rc(t,e){void 0===e&&(e={});var n=kc.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",vc,tc),window.addEventListener("blur",yc);var r=Object.assign({},e,{plugins:n}),o=lc(t).reduce((function(t,e){var n=e&&Dc(e,r);return n&&t.push(n),t}),[]);return pc(t)?o[0]:o}Rc.defaultProps=kc,Rc.setDefaultProps=function(t){Object.keys(t).forEach((function(e){kc[e]=t[e]}))},Rc.currentInput=fc,Object.assign({},aa,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),Rc.setDefaultProps({render:Tc});class zc{constructor({editor:t,element:e,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout((()=>this.update(this.editor.view)))},this.blurHandler=({event:t})=>{var e;this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null===(e=this.element.parentNode)||void 0===e?void 0:e.contains(t.relatedTarget))||this.hide()},this.editor=t,this.element=e,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(t={}){this.tippy=Rc(this.view.dom,__assign({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle"},t))}update(t,e){const{state:n,composing:r}=t,{doc:o,selection:i}=n,s=e&&e.doc.eq(o)&&e.selection.eq(i);if(r||s)return;const{empty:a,$anchor:c,ranges:p}=i,l=Math.min(...p.map((t=>t.$from.pos))),d=Math.max(...p.map((t=>t.$to.pos)));!a&&c.parent.textContent?(this.tippy.setProps({getReferenceClientRect:()=>Fs(t,l,d)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Ic=new Me("menuBubble"),Bc=t=>new we({key:Ic,view:e=>new zc(__assign({view:e},t))});Oi.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Bc({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});class Lc{constructor({editor:t,element:e,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout((()=>this.update(this.editor.view)))},this.blurHandler=({event:t})=>{var e;this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null===(e=this.element.parentNode)||void 0===e?void 0:e.contains(t.relatedTarget))||this.hide()},this.editor=t,this.element=e,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(t={}){this.tippy=Rc(this.view.dom,__assign({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle"},t))}update(t,e){const{state:n,composing:r}=t,{doc:o,selection:i}=n,s=e&&e.doc.eq(o)&&e.selection.eq(i);if(r||s)return;const{$anchor:a,empty:c,from:p,to:l}=i,d=1===a.depth,u=!i.$anchor.parent.isLeaf&&!i.$anchor.parent.textContent;c&&(d&&u)?(this.tippy.setProps({getReferenceClientRect:()=>Fs(t,p,l)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Pc=new Me("menuFloating"),jc=t=>new we({key:Pc,view:e=>new Lc(__assign({view:e},t))});Oi.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[jc({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});const $c=t.defineComponent({name:"BubbleMenu",props:{editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})}},setup(e,{slots:n}){const r=t.ref(null);return t.onMounted((()=>{const{editor:t,tippyOptions:n}=e;t.registerPlugin(Bc({editor:t,element:r.value,tippyOptions:n}))})),t.onBeforeUnmount((()=>{const{editor:t}=e;t.unregisterPlugin(Ic)})),()=>{var e;return t.h("div",{ref:r},null===(e=n.default)||void 0===e?void 0:e.call(n))}}});class Fc extends class extends class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}{constructor(t={}){super(),this.isFocused=!1,this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout((()=>{this.commands.focus(this.options.autofocus),this.emit("create",{editor:this})}),0)}get commands(){return this.commandManager.createCommands()}chain(){return this.commandManager.createChain()}can(){return this.commandManager.createCan()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(t){const e=document.createElement("style");return e.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(e),e}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}'))}setOptions(t={}){this.options=__assign(__assign({},this.options),t)}setEditable(t){this.setOptions({editable:t}),this.view&&this.state&&!this.isDestroyed&&this.view.updateState(this.state)}get isEditable(){return this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n="function"==typeof e?e(t,this.state.plugins):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(t){if(this.isDestroyed)return;const e="string"==typeof t?`${t}$`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter((t=>!t.key.startsWith(e)))});this.view.updateState(n)}createExtensionManager(){const t=[...Object.entries(Ds).map((([,t])=>t)),...this.options.extensions].filter((t=>["extension","node","mark"].includes(null==t?void 0:t.type)));this.extensionManager=new xi(t,this)}createCommandManager(){this.commandManager=new ui(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new lo(this.options.element,__assign(__assign({},this.options.editorProps),{dispatchTransaction:this.dispatchTransaction.bind(this),state:ve.create({doc:di(this.options.content,this.schema,this.options.parseOptions)})}));const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews();this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach((t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)})):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this});const r=t.getMeta("focus"),o=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event}),o&&this.emit("blur",{editor:this,event:o.event}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return function(t,e){const n=ei("string"==typeof e?e:e.name,t.schema);return"node"===n?ri(t,e):"mark"===n?ii(t,e):{}}(this.state,t)}getNodeAttributes(t){return console.warn("[tiptap warn]: editor.getNodeAttributes() is deprecated. please use editor.getAttributes() instead."),ri(this.state,t)}getMarkAttributes(t){return console.warn("[tiptap warn]: editor.getMarkAttributes() is deprecated. please use editor.getAttributes() instead."),ii(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,r="string"==typeof t?e:t;return function(t,e,n={}){if(!e)return ai(t,null,n)||ci(t,null,n);const r=ei(e,t.schema);return"node"===r?ai(t,e,n):"mark"===r&&ci(t,e,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return function(t,e){const n=mt.fromSchema(e).serializeFragment(t.content),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}(this.state.doc,this.schema)}get isEmpty(){return function(t){var e;const n=null===(e=t.type.createAndFill())||void 0===e?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){var t;this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),(t=this.css)&&t.parentNode&&t.parentNode.removeChild(t)}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}}{constructor(e={}){var n;return super(e),this.vueRenderers=t.reactive(new Map),this.contentComponent=null,this.reactiveState=(n=this.view.state,t.customRef(((t,e)=>({get:()=>(t(),n),set(t){n=t,requestAnimationFrame((()=>{requestAnimationFrame((()=>{e()}))}))}})))),this.on("transaction",(()=>{this.reactiveState.value=this.view.state})),t.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}registerPlugin(t,e){super.registerPlugin(t,e),this.reactiveState.value=this.view.state}unregisterPlugin(t){super.unregisterPlugin(t),this.reactiveState.value=this.view.state}}const Hc=t.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const n=t.ref(),r=t.getCurrentInstance();return t.watchEffect((()=>{const o=e.editor;o&&o.options.element&&n.value&&t.nextTick((()=>{if(!n.value||!o.options.element.firstChild)return;const e=t.unref(n.value);n.value.appendChild(o.options.element.firstChild),o.contentComponent=r.ctx._,o.setOptions({element:e}),o.createNodeViews()}))})),t.onBeforeUnmount((()=>{const t=e.editor;if(t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild)return;const n=document.createElement("div");n.appendChild(t.options.element.firstChild),t.setOptions({element:n})})),{rootEl:n}},render(){const e=[];return this.editor&&this.editor.vueRenderers.forEach((n=>{const r=t.h(t.Teleport,{to:n.teleportElement,key:n.id},t.h(n.component,__assign({ref:n.id},n.props)));e.push(r)})),t.h("div",{ref:t=>{this.rootEl=t}},...e)}});t.defineComponent({name:"FloatingMenu",props:{editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})}},setup(e,{slots:n}){const r=t.ref(null);return t.onMounted((()=>{const{editor:t,tippyOptions:n}=e;t.registerPlugin(jc({editor:t,element:r.value,tippyOptions:n}))})),t.onBeforeUnmount((()=>{const{editor:t}=e;t.unregisterPlugin(Pc)})),()=>{var e;return t.h("div",{ref:r},null===(e=n.default)||void 0===e?void 0:e.call(n))}}}),t.defineComponent({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var e,n;return t.h(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragStart:this.onDragStart},null===(n=(e=this.$slots).default)||void 0===n?void 0:n.call(e))}}),t.defineComponent({props:{as:{type:String,default:"div"}},render(){return t.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const qc=/^```(?[a-z]*)? $/,Jc=/^~~~(?[a-z]*)? $/,Wc=Rs.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const n=null===(e=t.firstElementChild)||void 0===e?void 0:e.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:t=>t.language?{class:this.options.languageClassPrefix+t.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:t}){return["pre",this.options.HTMLAttributes,["code",t,0]]},addCommands:()=>({setCodeBlock:t=>({commands:e})=>e.setNode("codeBlock",t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode("codeBlock","paragraph",t)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=1===e.pos;return!(!t||e.parent.type.name!==this.name)&&(!(!n&&e.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[Ro(qc,this.type,(({groups:t})=>t)),Ro(Jc,this.type,(({groups:t})=>t))]}}),Uc=zs.create({name:"underline",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("underline")&&{}}],renderHTML({HTMLAttributes:t}){return["u",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setUnderline:()=>({commands:t})=>t.setMark("underline"),toggleUnderline:()=>({commands:t})=>t.toggleMark("underline"),unsetUnderline:()=>({commands:t})=>t.unsetMark("underline")}),addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline()}}});function Kc(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 a=Kc(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function Gc(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 s=t.child(--o),a=e.child(--i),c=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var p=0,l=Math.min(s.text.length,a.text.length);pt&&!1!==n(a,r+s,o,i)&&a.content.size){var p=s+1;a.nodesBetween(Math.max(0,t-p),Math.min(a.content.size,e-p),n,r+p)}s=c}},Xc.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},Xc.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},Xc.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);ot)for(var o=0,i=0;it&&((ie)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Xc(n,r)},Xc.prototype.cutByIndex=function(t,e){return t==e?Xc.empty:0==t&&e==this.content.length?this:new Xc(this.content.slice(t,e))},Xc.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 Xc(r,o)},Xc.prototype.addToStart=function(t){return new Xc([t].concat(this.content),this.size+t.nodeSize)},Xc.prototype.addToEnd=function(t){return new Xc(this.content.concat(t),this.size+t.nodeSize)},Xc.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.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?Zc(n+1,o):Zc(n,r);r=o}},Xc.prototype.toString=function(){return"<"+this.toStringInner()+">"},Xc.prototype.toStringInner=function(){return this.content.join(", ")},Xc.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},Xc.fromJSON=function(t,e){if(!e)return Xc.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new Xc(e.map(t.nodeFromJSON))},Xc.fromArray=function(t){if(!t.length)return Xc.empty;for(var e,n=0,r=0;rthis.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},ep.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new np("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new np("Inconsistent open depths");return cp(t,e,n,0)}function cp(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(Xc.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return hp(i,fp(t,a.start,a.end,e,r))}var c=t.parent,p=c.content;return hp(c,p.cut(0,t.parentOffset).append(n.content).append(p.cut(e.parentOffset)))}return hp(i,mp(t,e,r))}function pp(t,e){if(!e.type.compatibleContent(t.type))throw new np("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){var r=t.node(n);return pp(r,e.node(n)),r}function dp(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 up(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(dp(t.nodeAfter,r),i++));for(var a=i;ao&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return up(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(pp(i,s),dp(hp(i,fp(t,e,n,r,o+1)),a)):(i&&dp(hp(i,mp(t,e,o+1)),a),up(e,n,o,a),s&&dp(hp(s,mp(n,r,o+1)),a)),up(r,null,o,a),new Xc(a)}function mp(t,e,n){var r=[];(up(null,t,n,r),t.depth>n)&&dp(hp(lp(t,e,n+1),mp(t,e,n+1)),r);return up(e,null,n,r),new Xc(r)}op.size.get=function(){return this.content.size-this.openStart-this.openEnd},rp.prototype.insertAt=function(t,e){var n=sp(this.content,t+this.openStart,e,null);return n&&new rp(n,this.openStart,this.openEnd)},rp.prototype.removeBetween=function(t,e){return new rp(ip(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},rp.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},rp.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},rp.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},rp.fromJSON=function(t,e){if(!e)return rp.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 rp(Xc.fromJSON(t,e.content),n,r)},rp.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 rp(t,n,r)},Object.defineProperties(rp.prototype,op),rp.empty=new rp(Xc.empty,0,0);var vp=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},gp={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};vp.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},gp.parent.get=function(){return this.node(this.depth)},gp.doc.get=function(){return this.node(0)},vp.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},vp.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},vp.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},vp.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},vp.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},vp.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]},vp.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},gp.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},gp.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},gp.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)},vp.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;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},vp.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new kp(this,t,n)},vp.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},vp.prototype.max=function(t){return t.pos>this.pos?t:this},vp.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,p=o-c;if(n.push(i,a,r+c),!p)break;if((i=i.child(a)).isText)break;o=p-1,r+=c+1}return new vp(e,n,o)},vp.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},Op.isBlock.get=function(){return this.type.isBlock},Op.isTextblock.get=function(){return this.type.isTextblock},Op.inlineContent.get=function(){return this.type.inlineContent},Op.isInline.get=function(){return this.type.isInline},Op.isText.get=function(){return this.type.isText},Op.isLeaf.get=function(){return this.type.isLeaf},Op.isAtom.get=function(){return this.type.isAtom},Sp.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()+")"),function(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}(this.marks,t)},Sp.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},Sp.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=Xc.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var a=r;a-1&&o[i+1];Ip(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new Cp(r.indexOf(t.length-1)>-1),s=0;s>1},Cp.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]}},Cp.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(Cp.prototype,Np),Cp.empty=new Cp(!0);var _p=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()},Tp={next:{configurable:!0}};function Ap(t){var e=[];do{e.push(Ep(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function Ep(t){var e=[];do{e.push(Vp(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function Vp(t){for(var e=function(t){if(t.eat("(")){var e=Ap(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=Rp(t,e)}return e}function Dp(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function Rp(t,e){var n=Dp(t),r=n;return t.eat(",")&&(r="}"!=t.next?Dp(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function zp(t,e){return e-t}function Ip(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-1},jp.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var Jp=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)}))};Jp.prototype.parse=function(t,e){void 0===e&&(e={});var n=new Yp(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},Jp.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new Yp(this,e,!0);return n.addAll(t,null,e.from,e.to),rp.maxOpen(n.finish())},Jp.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},Jp.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Xp.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},Yp.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},Yp.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},Qp.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},Yp.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-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),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var p=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!p||p.name!=c&&-1==p.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},Yp.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}},Yp.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;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(Yp.prototype,Qp);var nl=function(t,e){this.nodes=t||{},this.marks=e||{}};function rl(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ol(t){return t.document||window.document}nl.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=ol(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},nl.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&nl.renderSpec(ol(n),r(t,e))},nl.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,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var p in c=2,a)if(null!=a[p]){var l=p.indexOf(" ");l>0?s.setAttributeNS(p.slice(0,l),p.slice(l+1),a[p]):s.setAttribute(p,a[p])}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var h=nl.renderSpec(t,u,n),f=h.dom,m=h.contentDOM;if(s.appendChild(f),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},nl.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new nl(this.nodesFromSchema(t),this.marksFromSchema(t)))},nl.nodesFromSchema=function(t){var e=rl(t.nodes);return e.text||(e.text=function(t){return t.text}),e},nl.marksFromSchema=function(t){return rl(t.marks)};var il=Math.pow(2,16);function sl(t){return 65535&t}var al=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},cl=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};cl.prototype.recover=function(t){var e=0,n=sl(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],p=this.ranges[s+i],l=a+c;if(t<=l){var d=a+r+((c?t==a?-1:t==l?1:e:e)<0?0:p);if(n)return d;var u=t==(e<0?a:l)?null:s/3+(t-a)*il;return new al(d,e<0?t!=a:t!=l,u)}r+=p-c}return n?t+r:new al(t+r)},cl.prototype.touches=function(t,e){for(var n=0,r=sl(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},cl.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},pl.prototype.invert=function(){var t=new pl;return t.appendMappingInverted(this),t},pl.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},dl.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(dl.prototype,ul);var fl=Object.create(null),ml=function(){};ml.prototype.apply=function(t){return hl()},ml.prototype.getMap=function(){return cl.empty},ml.prototype.invert=function(t){return hl()},ml.prototype.map=function(t){return hl()},ml.prototype.merge=function(t){return null},ml.prototype.toJSON=function(){return hl()},ml.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=fl[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},ml.jsonID=function(t,e){if(t in fl)throw new RangeError("Duplicate use of step JSON ID "+t);return fl[t]=e,e.prototype.jsonID=t,e};var vl=function(t,e){this.doc=t,this.failed=e};vl.ok=function(t){return new vl(t,null)},vl.fail=function(t){return new vl(null,t)},vl.fromReplace=function(t,e,n,r){try{return vl.ok(t.replace(e,n,r))}catch(o){if(o instanceof np)return vl.fail(o.message);throw o}};var gl=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&&bl(t,this.from,this.to)?vl.fail("Structure replace would overwrite content"):vl.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new cl([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?rp.empty:new rp(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?rp.empty:new rp(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,rp.fromJSON(t,n.slice),!!n.structure)},e}(ml);ml.jsonID("replace",gl);var yl=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(bl(t,this.from,this.gapFrom)||bl(t,this.gapTo,this.to)))return vl.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return vl.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?vl.fromReplace(t,this.from,this.to,n):vl.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new cl([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||or.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,rp.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(ml);function bl(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function wl(t,e,n){for(var r=[],o=0;oe;d--)u||n.index(d)>0?(u=!0,p=Xc.from(n.node(d).copy(p)),l++):a--;for(var h=Xc.empty,f=0,m=o,v=!1;m>e;m--)v||r.after(m+1)=0;r--)n=Xc.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new yl(o,i,o,i,new rp(n,0,0),e.length,!0))},dl.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 s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new yl(a,c,a+1,c-1,new rp(Xc.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},dl.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 yl(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new rp(Xc.from(i),0,0),1,!0))},dl.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=Xc.empty,i=Xc.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=Xc.from(r.node(s).copy(o));var p=n&&n[c];i=Xc.from(p?p.type.create(p.attrs,i):r.node(s).copy(i))}return this.step(new gl(t,t,new rp(o.append(i),e,e),!0))},dl.prototype.join=function(t,e){void 0===e&&(e=1);var n=new gl(t-e,t+e,rp.empty,!0);return this.step(n)};var kl=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 rp(wl(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 vl.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new xl(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}(ml);ml.jsonID("addMark",kl);var xl=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 rp(wl(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return vl.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new kl(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}(ml);function Ml(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}ml.jsonID("removeMark",xl),dl.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,p){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&p.type.allowsMarkType(n.type)){for(var d=Math.max(c,t),u=Math.min(c+r.nodeSize,e),h=n.addToSet(l),f=0;f=0;u--)this.step(o[u]);return this},dl.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=rp.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=rp.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Ml(o,i,r)?new gl(e,n,r):new Sl(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},dl.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new rp(Xc.from(n),0,0))},dl.prototype.delete=function(t,e){return this.replace(t,e,rp.empty)},dl.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Sl=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=Xc.empty;for(var i=t.depth;i>0;i--)this.placed=Xc.from(t.node(i).copy(this.placed))},Ol={depth:{configurable:!0}};function Cl(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Cl(t.firstChild.content,e-1,n)))}function Nl(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Nl(t.lastChild.content,e-1,n)))}function _l(t,e){for(var n=0;n1&&(r=r.replaceChild(0,Tl(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(Xc.empty,!0)))),t.copy(r)}function Al(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(Xc.empty,!0))}return t}function Vl(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}Ol.depth.get=function(){return this.frontier.length-1},Sl.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,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new rp(i,s,a);return e>-1?new yl(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new gl(r.pos,o.pos,c):void 0},Sl.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=_l(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,p=void 0;if(1==t&&(r?a.matchType(r.type)||(p=a.fillBefore(Xc.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:p};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},Sl.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=_l(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new rp(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},Sl.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=_l(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new rp(Cl(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new rp(Cl(e,n,1),n,r)},Sl.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 s=0;s1||0==p||g.content.size)&&(h=y,d.push(Tl(g.mark(f.allowedMarks(g.marks)),1==l?p:0,l==c.childCount?v:-1)))}var b=l==c.childCount;b||(v=-1),this.placed=Nl(this.placed,n,Xc.from(d)),this.frontier[n].match=h,b&&v<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var w=0,k=c;w1&&r==this.$to.end(--n);)++r;return r},Sl.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=0;a--){var c=this.frontier[a],p=c.match,l=Al(t,a,c.type,p,!0);if(!l||l.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},Sl.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=Nl(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},Sl.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Nl(this.placed,this.depth,Xc.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Sl.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(Xc.empty,!0);t.childCount&&(this.placed=Nl(this.placed,this.frontier.length,t))},Object.defineProperties(Sl.prototype,Ol),dl.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(Ml(r,o,n))return this.step(new gl(t,e,n));var i=Vl(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var p=r.node(a).type.spec;if(p.defining||p.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var l=i.indexOf(s),d=[],u=n.openStart,h=n.content,f=0;;f++){var m=h.firstChild;if(d.push(m),f==n.openStart)break;h=m.content}u>0&&d[u-1].type.spec.defining&&r.node(l).type!=d[u-1].type?u-=1:u>=2&&d[u-1].isTextblock&&d[u-2].type.spec.defining&&r.node(l).type!=d[u-2].type&&(u-=2);for(var v=n.openStart;v>=0;v--){var g=(v+u+1)%(n.openStart+1),y=d[g];if(y)for(var b=0;b=0&&(this.replace(t,e,n),!(this.steps.length>S));O--){var C=i[O];C<0||(t=r.before(C),e=o.after(C))}return this},dl.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Dl=Object.create(null),Rl=function(t,e,n){this.ranges=n||[new Il(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},zl={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};zl.anchor.get=function(){return this.$anchor.pos},zl.head.get=function(){return this.$head.pos},zl.from.get=function(){return this.$from.pos},zl.to.get=function(){return this.$to.pos},zl.$from.get=function(){return this.ranges[0].$from},zl.$to.get=function(){return this.ranges[0].$to},zl.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?Hl(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):Hl(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Rl.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new $l(t.node(0))},Rl.atStart=function(t){return Hl(t,t,0,0,1)||new $l(t)},Rl.atEnd=function(t){return Hl(t,t,t.content.size,t.childCount,-1)||new $l(t)},Rl.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Dl[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Rl.jsonID=function(t,e){if(t in Dl)throw new RangeError("Duplicate use of selection JSON ID "+t);return Dl[t]=e,e.prototype.jsonID=t,e},Rl.prototype.getBookmark=function(){return Bl.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Rl.prototype,zl),Rl.prototype.visible=!0;var Il=function(t,e){this.$from=t,this.$to=e},Bl=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=rp.empty),t.prototype.replace.call(this,e,n),n==rp.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 Ll(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&Pl.isSelectable(a))return Pl.create(t,n-(o<0?a.nodeSize:0))}else{var c=Hl(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ql(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return ep.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)||ep.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(Rl.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}(dl);function Wl(t,e){return e&&t?t.bind(e):t}var Ul=function(t,e,n){this.name=t,this.init=Wl(e.init,n),this.apply=Wl(e.apply,n)},Kl=[new Ul("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new Ul("selection",{init:function(t,e){return t.selection||Rl.atStart(e.doc)},apply:function(t){return t.selection}}),new Ul("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ul("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],Gl=function(t,e){var n=this;this.schema=t,this.fields=Kl.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new Ul(t.key,t.spec.state,t))}))},Xl=function(t){this.config=t},Yl={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};Yl.schema.get=function(){return this.config.schema},Yl.plugins.get=function(){return this.config.plugins},Xl.prototype.apply=function(t){return this.applyTransaction(t).state},Xl.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&Ql.splice(e,1)},Object.defineProperties(Xl.prototype,Yl);var Ql=[];function Zl(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Zl(o,e,{})),n[r]=o}return n}var td=function(t){this.props={},t.props&&Zl(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:nd("plugin")};td.prototype.getState=function(t){return t[this.key]};var ed=Object.create(null);function nd(t){return t in ed?t+"$"+ ++ed[t]:(ed[t]=0,t+"$")}var rd=function(t){void 0===t&&(t="key"),this.key=nd(t)};rd.prototype.get=function(t){return t.config.pluginsByKey[this.key]},rd.prototype.getState=function(t){return t[this.key]};const od=new rd("characterLimit"),id=Oi.create({name:"characterCount",defaultOptions:{limit:0},addProseMirrorPlugins(){const{options:t}=this;return[new td({key:od,appendTransaction:(e,n,r)=>{const o=r.doc.content.size;if(t.limit&&o>t.limit)return r.tr.insertText("",t.limit+1,o)}})]}}),sd=Oi.create({name:"textAlign",defaultOptions:{types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,renderHTML:t=>({style:`text-align: ${t.textAlign}`}),parseHTML:t=>({textAlign:t.style.textAlign||this.options.defaultAlignment})}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>!!this.options.alignments.includes(t)&&this.options.types.every((n=>e.updateAttributes(n,{textAlign:t}))),unsetTextAlign:()=>({commands:t})=>this.options.types.every((e=>t.resetAttributes(e,"textAlign")))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),ad=Rs.create({name:"horizontalRule",defaultOptions:{HTMLAttributes:{}},group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t})=>t().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{var n;if(e){const{parent:e,pos:r}=t.selection.$from,o=r+1;if(!t.doc.nodeAt(o)){const r=null===(n=e.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(t.insert(o,r),t.setSelection(re.create(t.doc,o)))}t.scrollIntoView()}return!0})).run()}},addInputRules(){return[Is(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}}),cd=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/;Rs.create({name:"image",defaultOptions:{inline:!1,HTMLAttributes:{}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML:()=>[{tag:"img[src]"}],renderHTML({HTMLAttributes:t}){return["img",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Is(cd,this.type,(t=>{const[,e,n,r]=t;return{src:n,alt:e,title:r}}))]}});const pd=/^\s*([-+*])\s$/,ld=Rs.create({name:"bulletList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({toggleBulletList:()=>({commands:t})=>t.toggleList("bulletList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[Do(pd,this.type)]}}),dd=/^(\d+)\.\s$/,ud=Rs.create({name:"orderedList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",addAttributes:()=>({start:{default:1,parseHTML:t=>({start:t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1})}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e}=t,n=__rest(t,["start"]);return 1===e?["ol",vi(this.options.HTMLAttributes,n),0]:["ol",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({toggleOrderedList:()=>({commands:t})=>t.toggleList("orderedList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[Do(dd,this.type,(t=>({order:+t[1]})),((t,e)=>e.childCount+e.attrs.order===+t[1]))]}}),hd=Rs.create({name:"taskList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"taskItem+",parseHTML:()=>[{tag:'ul[data-type="taskList"]',priority:51}],renderHTML:({HTMLAttributes:t})=>["ul",vi(t,{"data-type":"taskList"}),0],addCommands:()=>({toggleTaskList:()=>({commands:t})=>t.toggleList("taskList","taskItem")}),addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),fd=/^\s*(\[([ |x])\])\s$/,md=Rs.create({name:"taskItem",defaultOptions:{nested:!1,HTMLAttributes:{}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,parseHTML:t=>({checked:"true"===t.getAttribute("data-checked")}),renderHTML:t=>({"data-checked":t.checked}),keepOnSplit:!1}}),parseHTML:()=>[{tag:'li[data-type="taskItem"]',priority:51}],renderHTML({HTMLAttributes:t}){return["li",vi(this.options.HTMLAttributes,t,{"data-type":"taskItem"}),0]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem("taskItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("taskItem")};return this.options.nested?__assign(__assign({},t),{Tab:()=>this.editor.commands.sinkListItem("taskItem")}):t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",(t=>{const{checked:e}=t.target;"function"==typeof n&&r.chain().focus().command((({tr:t})=>(t.setNodeMarkup(n(),void 0,{checked:e}),!0))).run()})),t.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,s),o.append(i,c),Object.entries(e).forEach((([t,e])=>{o.setAttribute(t,e)})),{dom:o,contentDOM:c,update:t=>t.type===this.type&&(t.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[Do(fd,this.type,(t=>({checked:"x"===t[t.length-1]})))]}});var vd=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};vd.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},vd.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},vd.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},vd.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,c,p=this.editorView.dom.offsetParent;if(this.element||(this.element=p.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!p||p==document.body&&"static"==getComputedStyle(p).position)a=-pageXOffset,c=-pageYOffset;else{var l=p.getBoundingClientRect();a=l.left-p.scrollLeft,c=l.top-p.scrollTop}this.element.style.left=t.left-a+"px",this.element.style.top=t.top-c+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},vd.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},vd.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Pt(this.editorView.state.doc,n,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}},vd.prototype.dragend=function(){this.scheduleRemoval(20)},vd.prototype.drop=function(){this.scheduleRemoval(20)},vd.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};const gd=Oi.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[(t=this.options,void 0===t&&(t={}),new we({view:function(e){return new vd(e,t)}}))];var t}});var yd=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return u.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new bd(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).child(n-1);;r=r.lastChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){t:for(;;){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;;){var p=n>0?i.firstChild:i.lastChild;if(!p){if(i.isAtom&&!i.isText&&!ie.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue t}break}i=p,o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null}},e}(te);yd.prototype.visible=!1,te.jsonID("gapcursor",yd);var bd=function(t){this.pos=t};bd.prototype.map=function(t){return new bd(t.map(this.pos))},bd.prototype.resolve=function(t){var e=t.resolve(this.pos);return yd.valid(e)?new yd(e):te.near(e)};var wd=Ao({ArrowLeft:kd("horiz",-1),ArrowRight:kd("horiz",1),ArrowUp:kd("vert",-1),ArrowDown:kd("vert",1)});function kd(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof re){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=yd.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new yd(c))),!0)}}function xd(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!yd.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&ie.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new yd(r))),!0)}function Md(t){if(!(t.selection instanceof yd))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Zr.create(t.doc,[Gr.widget(t.selection.head,e,{key:"gapcursor"})])}const Sd=Oi.create({name:"gapCursor",addProseMirrorPlugins:()=>[new we({props:{decorations:Md,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&yd.valid(n))return new yd(n)},handleClick:xd,handleKeyDown:wd}})],extendNodeSchema(t){var e;return{allowGapCursor:null!==(e=bi(hi(t,"allowGapCursor",{name:t.name,options:t.options})))&&void 0!==e?e:null}}}),Od=Rs.create({name:"doc",topNode:!0,content:"block+"}),Cd=Rs.create({name:"paragraph",priority:1e3,defaultOptions:{HTMLAttributes:{}},group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setParagraph:()=>({commands:t})=>t.toggleNode("paragraph","paragraph")}),addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Nd=Rs.create({name:"text",group:"inline"});var _d=200,Td=function(){};Td.prototype.append=function(t){return t.length?(t=Td.from(t),!this.length&&t||t.length<_d&&this.leafAppend(t)||this.length<_d&&t.leafPrepend(this)||this.appendInner(t)):this},Td.prototype.prepend=function(t){return t.length?Td.from(t).append(this):this},Td.prototype.appendInner=function(t){return new Ed(this,t)},Td.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Td.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Td.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Td.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)},Td.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},Td.from=function(t){return t instanceof Td?t:t&&t.length?new Ad(t):Td.empty};var Ad=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.leafAppend=function(t){if(this.length+t.length<=_d)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=_d)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}(Td);Td.empty=new Ad([]);var Ed=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 to&&!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=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}(Td),Vd=Td,Dd=function(t,e){this.items=t,this.eventCount=e};Dd.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,p=[],l=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void l.push(t);if(r){l.push(new Rd(t.map));var d,u=t.step.map(r.slice(o));u&&c.maybeStep(u).doc&&(d=c.mapping.maps[c.mapping.maps.length-1],p.push(new Rd(d,null,null,p.length+l.length))),o--,d&&r.appendMap(d,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Dd(n.items.slice(0,i).append(l.reverse().concat(p)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Dd.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;cId&&(h=m,(u=s).forEach((function(t,e){if(t.selection&&0==h--)return f=e,!1})),s=u.slice(f),i-=m),new Dd(s.append(o),i)},Dd.prototype.remapping=function(t,e){var n=new xt;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},Dd.prototype.addMaps=function(t){return 0==this.eventCount?this:new Dd(this.items.append(t.map((function(t){return new Rd(t)}))),this.eventCount)},Dd.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var p=t.steps[r].invert(t.docs[r]),l=e.selection&&e.selection.map(o.slice(a+1,r));l&&s++,n.push(new Rd(c,p,l))}else n.push(new Rd(c))}}),r);for(var c=[],p=e;p500&&(d=d.compress(this.items.length-n.length)),d},Dd.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Dd.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var p=i.selection&&i.selection.map(e.slice(n));p&&o++;var l,d=new Rd(c.invert(),a,p),u=r.length-1;(l=r.length&&r[u].merge(d))?r[u]=l:r.push(d)}}else i.map&&n--}),this.items.length,0),new Dd(Vd.from(r.reverse()),o)},Dd.empty=new Dd(Vd.empty,0);var Rd=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Rd.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Rd(e.getMap().invert(),e,this.selection)}};var zd=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},Id=20;function Bd(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ld(t,e){if(!t)return null;for(var n=[],r=0;r=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ld(t.prevRanges,n.mapping):Bd(n.mapping.maps[n.steps.length-1]);return new zd(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Fd(e)),Dd.empty,c,n.time)}(n,r,e,t)}},config:t})}const Wd=Oi.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands:()=>({undo:()=>({state:t,dispatch:e})=>function(t,e){var n=Hd.getState(t);return!(!n||0==n.done.eventCount||(e&&Pd(n,t,e,!1),0))}(t,e),redo:()=>({state:t,dispatch:e})=>function(t,e){var n=Hd.getState(t);return!(!n||0==n.undone.eventCount||(e&&Pd(n,t,e,!0),0))}(t,e)}),addProseMirrorPlugins(){return[Jd(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}}}),Ud=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,Kd=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Gd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,Xd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm,Yd=zs.create({name:"bold",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setBold:()=>({commands:t})=>t.setMark("bold"),toggleBold:()=>({commands:t})=>t.toggleMark("bold"),unsetBold:()=>({commands:t})=>t.unsetMark("bold")}),addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Bs(Ud,this.type),Bs(Gd,this.type)]},addPasteRules(){return[Ls(Kd,this.type),Ls(Xd,this.type)]}}),Qd=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,Zd=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,tu=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,eu=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm,nu=zs.create({name:"italic",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setItalic:()=>({commands:t})=>t.setMark("italic"),toggleItalic:()=>({commands:t})=>t.toggleMark("italic"),unsetItalic:()=>({commands:t})=>t.unsetMark("italic")}),addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Bs(Qd,this.type),Bs(tu,this.type)]},addPasteRules(){return[Ls(Zd,this.type),Ls(eu,this.type)]}}),ru=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm,ou=zs.create({name:"code",defaultOptions:{HTMLAttributes:{}},excludes:"_",parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setCode:()=>({commands:t})=>t.setMark("code"),toggleCode:()=>({commands:t})=>t.toggleMark("code"),unsetCode:()=>({commands:t})=>t.unsetMark("code")}),addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Bs(ru,this.type)]},addPasteRules(){return[Ls(ru,this.type)]}}),iu=Rs.create({name:"heading",defaultOptions:{levels:[1,2,3,4,5,6],HTMLAttributes:{}},content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,vi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode("heading",t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode("heading","paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>__assign(__assign({},t),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>Ro(new RegExp(`^(#{1,${t}})\\s$`),this.type,{level:t})))}}),su=Rs.create({name:"hardBreak",defaultOptions:{HTMLAttributes:{}},inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setHardBreak:()=>({commands:t})=>t.first([()=>t.exitCode(),()=>t.insertContent({type:this.name})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),au=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm,cu=zs.create({name:"strike",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("line-through")&&{}}],renderHTML({HTMLAttributes:t}){return["s",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setStrike:()=>({commands:t})=>t.setMark("strike"),toggleStrike:()=>({commands:t})=>t.toggleMark("strike"),unsetStrike:()=>({commands:t})=>t.unsetMark("strike")}),addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Bs(au,this.type)]},addPasteRules(){return[Ls(au,this.type)]}}),pu=/^\s*>\s$/gm,lu=Rs.create({name:"blockquote",defaultOptions:{HTMLAttributes:{}},content:"block*",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return["blockquote",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setBlockquote:()=>({commands:t})=>t.wrapIn("blockquote"),toggleBlockquote:()=>({commands:t})=>t.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:t})=>t.lift("blockquote")}),addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Do(pu,this.type)]}}),du=Rs.create({name:"listItem",defaultOptions:{HTMLAttributes:{}},content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",vi(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}}),uu=Oi.create({name:"starterKit",addExtensions(){var t,e,n,r,o,i,s,a,c,p,l,d,u,h,f,m,v,g;const y=[];return!1!==this.options.blockquote&&y.push(lu.configure(null===(t=this.options)||void 0===t?void 0:t.blockquote)),!1!==this.options.bold&&y.push(Yd.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.bulletList&&y.push(ld.configure(null===(n=this.options)||void 0===n?void 0:n.bulletList)),!1!==this.options.code&&y.push(ou.configure(null===(r=this.options)||void 0===r?void 0:r.code)),!1!==this.options.codeBlock&&y.push(Wc.configure(null===(o=this.options)||void 0===o?void 0:o.codeBlock)),!1!==this.options.document&&y.push(Od.configure(null===(i=this.options)||void 0===i?void 0:i.document)),!1!==this.options.dropcursor&&y.push(gd.configure(null===(s=this.options)||void 0===s?void 0:s.dropcursor)),!1!==this.options.gapcursor&&y.push(Sd.configure(null===(a=this.options)||void 0===a?void 0:a.gapcursor)),!1!==this.options.hardBreak&&y.push(su.configure(null===(c=this.options)||void 0===c?void 0:c.hardBreak)),!1!==this.options.heading&&y.push(iu.configure(null===(p=this.options)||void 0===p?void 0:p.heading)),!1!==this.options.history&&y.push(Wd.configure(null===(l=this.options)||void 0===l?void 0:l.history)),!1!==this.options.horizontalRule&&y.push(ad.configure(null===(d=this.options)||void 0===d?void 0:d.horizontalRule)),!1!==this.options.italic&&y.push(nu.configure(null===(u=this.options)||void 0===u?void 0:u.italic)),!1!==this.options.listItem&&y.push(du.configure(null===(h=this.options)||void 0===h?void 0:h.listItem)),!1!==this.options.orderedList&&y.push(ud.configure(null===(f=this.options)||void 0===f?void 0:f.orderedList)),!1!==this.options.paragraph&&y.push(Cd.configure(null===(m=this.options)||void 0===m?void 0:m.paragraph)),!1!==this.options.strike&&y.push(cu.configure(null===(v=this.options)||void 0===v?void 0:v.strike)),!1!==this.options.text&&y.push(Nd.configure(null===(g=this.options)||void 0===g?void 0:g.text)),y}});const hu={components:{EditorContent:Hc,BubbleMenu:$c},props:{modelValue:{type:String,default:""},maxChars:{type:Number,default:0},bubbleMenu:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bold:{type:Boolean,default:!0},italic:{type:Boolean,default:!0},strike:{type:Boolean,default:!0},underline:{type:Boolean,default:!0},code:{type:Boolean,default:!0},codeBlock:{type:Boolean,default:!0},blockquote:{type:Boolean,default:!0},bulletList:{type:Boolean,default:!0},orderedList:{type:Boolean,default:!0},taskList:{type:Boolean,default:!0},heading:{type:Boolean,default:!0},textAlign:{type:Boolean,default:!0},horizontalRule:{type:Boolean,default:!0},undoRedo:{type:Boolean,default:!0}},data:()=>({editor:null,headingOpen:!1,alignOpen:!1}),watch:{modelValue(t){this.editor.getHTML()!==t&&this.editor.commands.setContent(this.modelValue,!1)},disabled(t){this.editor&&this.editor.setEditable(!t)}},methods:{insertImageFromURL(t){this.editor.chain().focus().setImage({src:t},!1).run()}},computed:{extensions(){return[uu,Uc,sd,Wc,ud.configure({class:"inline-flex"}),ld.configure({class:"inline-flex"}),id.configure({limit:this.maxChars}),hd,md]},hasTextAlign(){return this.editor.isActive({textAlign:"left"})||this.editor.isActive({textAlign:"right"})||this.editor.isActive({textAlign:"center"})||this.editor.isActive({textAlign:"justify"})},charPercentage(){return Math.round(100/this.maxChars*this.editor.getCharacterCount())}},mounted(){this.editor=new Fc({content:this.modelValue,extensions:this.extensions,editorProps:{attributes:{class:"h-full overflow-y-auto input"}},editable:!this.disabled}).on("update",(({editor:t})=>{this.$emit("update:modelValue",t.getHTML())}))},beforeUnmount(){this.editor.destroy()}},fu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),t.createVNode("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})],-1),mu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"11",y1:"5",x2:"17",y2:"5"}),t.createVNode("line",{x1:"7",y1:"19",x2:"13",y2:"19"}),t.createVNode("line",{x1:"14",y1:"5",x2:"10",y2:"19"})],-1),vu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5v9a5 5 0 0 0 10 0v-9"}),t.createVNode("path",{d:"M4 12h16"})],-1),gu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),t.createVNode("path",{d:"M5 19h14"})],-1),yu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("polyline",{points:"7 8 3 12 7 16"}),t.createVNode("polyline",{points:"17 8 21 12 17 16"}),t.createVNode("line",{x1:"14",y1:"4",x2:"10",y2:"20"})],-1),bu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),t.createVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),t.createVNode("path",{d:"M10 13l-1 2l1 2"}),t.createVNode("path",{d:"M14 13l1 2l-1 2"})],-1),wu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M6 15h15"}),t.createVNode("path",{d:"M21 19h-15"}),t.createVNode("path",{d:"M15 11h6"}),t.createVNode("path",{d:"M21 7h-6"}),t.createVNode("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),t.createVNode("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})],-1),ku=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),t.createVNode("line",{x1:"5",y1:"6",x2:"5",y2:"6.01"}),t.createVNode("line",{x1:"5",y1:"12",x2:"5",y2:"12.01"}),t.createVNode("line",{x1:"5",y1:"18",x2:"5",y2:"18.01"})],-1),xu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M11 6h9"}),t.createVNode("path",{d:"M11 12h9"}),t.createVNode("path",{d:"M12 18h8"}),t.createVNode("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),t.createVNode("path",{d:"M6 10v-6l-2 2"})],-1),Mu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),t.createVNode("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),t.createVNode("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),t.createVNode("line",{x1:"11",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"11",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"11",y1:"18",x2:"20",y2:"18"})],-1),Su={key:10},Ou=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 12h10"}),t.createVNode("path",{d:"M7 4v16"}),t.createVNode("path",{d:"M17 4v16"}),t.createVNode("path",{d:"M15 20h4"}),t.createVNode("path",{d:"M15 4h4"}),t.createVNode("path",{d:"M5 20h4"}),t.createVNode("path",{d:"M5 4h4"})],-1),Cu={key:0,class:"inline-flex"},Nu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M19 18v-8l-2 2"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),_u=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 -.001"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Tu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),t.createVNode("path",{d:"M17 16a2 2 0 1 0 2 -2"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Au=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M20 18v-8l-4 6h5"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Eu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Vu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("circle",{transform:"rotate(180 19 16)",cx:"19",cy:"16",r:"2"}),t.createVNode("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Du={key:11},Ru=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1),zu={key:0,class:"inline-flex"},Iu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12"}),t.createVNode("line",{x1:"4",y1:"18",x2:"18",y2:"18"})],-1),Bu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1),Lu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"20",y2:"18"})],-1),Pu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"4",y1:"18",x2:"16",y2:"18"})],-1),ju=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),t.createVNode("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),t.createVNode("line",{x1:"14",y1:"11",x2:"14",y2:"17"}),t.createVNode("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),t.createVNode("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})],-1),$u=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"4",y1:"4",x2:"4",y2:"4.01"}),t.createVNode("line",{x1:"8",y1:"4",x2:"8",y2:"4.01"}),t.createVNode("line",{x1:"12",y1:"4",x2:"12",y2:"4.01"}),t.createVNode("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),t.createVNode("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),t.createVNode("line",{x1:"4",y1:"8",x2:"4",y2:"8.01"}),t.createVNode("line",{x1:"12",y1:"8",x2:"12",y2:"8.01"}),t.createVNode("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),t.createVNode("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),t.createVNode("line",{x1:"12",y1:"16",x2:"12",y2:"16.01"}),t.createVNode("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),t.createVNode("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),t.createVNode("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),t.createVNode("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),t.createVNode("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),t.createVNode("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})],-1),Fu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"})],-1),Hu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"})],-1);hu.render=function(e,n,r,o,i,s){const a=t.resolveComponent("collapse-x-transition"),c=t.resolveComponent("editor-content"),p=t.resolveDirective("tooltip");return t.openBlock(),t.createBlock("div",null,[t.createVNode("div",null,[i.editor?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.bubbleMenu?"bubble-menu":"div"),{key:0,editor:i.editor,class:["flex-wrap space-x-1",r.bubbleMenu?"bg-gray-600 rounded dark p-1":"mb-2"]},{default:t.withCtx((()=>[r.bold?t.withDirectives((t.openBlock(),t.createBlock("button",{key:0,onClick:n[1]||(n[1]=t=>i.editor.chain().focus().toggleBold().run()),class:["button",{accent:i.editor.isActive("bold")}]},[fu],2)),[[p,e.__("tiptap::tiptap.bold")]]):t.createCommentVNode("",!0),r.italic?t.withDirectives((t.openBlock(),t.createBlock("button",{key:1,onClick:n[2]||(n[2]=t=>i.editor.chain().focus().toggleItalic().run()),class:["button",{accent:i.editor.isActive("italic")}]},[mu],2)),[[p,e.__("tiptap::tiptap.italic")]]):t.createCommentVNode("",!0),r.strike?t.withDirectives((t.openBlock(),t.createBlock("button",{key:2,onClick:n[3]||(n[3]=t=>i.editor.chain().focus().toggleStrike().run()),class:["button",{accent:i.editor.isActive("strike")}]},[vu],2)),[[p,e.__("tiptap::tiptap.strike")]]):t.createCommentVNode("",!0),r.underline?t.withDirectives((t.openBlock(),t.createBlock("button",{key:3,onClick:n[4]||(n[4]=t=>i.editor.chain().focus().toggleUnderline().run()),class:["button",{accent:i.editor.isActive("underline")}]},[gu],2)),[[p,e.__("tiptap::tiptap.underline")]]):t.createCommentVNode("",!0),r.code?t.withDirectives((t.openBlock(),t.createBlock("button",{key:4,onClick:n[5]||(n[5]=t=>i.editor.chain().focus().toggleCode().run()),class:["button",{accent:i.editor.isActive("code")}]},[yu],2)),[[p,e.__("tiptap::tiptap.code")]]):t.createCommentVNode("",!0),r.codeBlock?t.withDirectives((t.openBlock(),t.createBlock("button",{key:5,onClick:n[6]||(n[6]=t=>i.editor.chain().focus().toggleCodeBlock().run()),class:["button",{accent:i.editor.isActive("codeBlock")}]},[bu],2)),[[p,e.__("tiptap::tiptap.code_block")]]):t.createCommentVNode("",!0),r.blockquote?t.withDirectives((t.openBlock(),t.createBlock("button",{key:6,onClick:n[7]||(n[7]=t=>i.editor.chain().focus().toggleBlockquote().run()),class:["button",{accent:i.editor.isActive("blockquote")}]},[wu],2)),[[p,e.__("tiptap::tiptap.blockquote")]]):t.createCommentVNode("",!0),r.bulletList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:7,onClick:n[8]||(n[8]=t=>i.editor.chain().focus().toggleBulletList().run()),class:["button",{accent:i.editor.isActive("bulletList")}]},[ku],2)),[[p,e.__("tiptap::tiptap.bullet_list")]]):t.createCommentVNode("",!0),r.orderedList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:8,onClick:n[9]||(n[9]=t=>i.editor.chain().focus().toggleOrderedList().run()),class:["button",{accent:i.editor.isActive("orderedList")}]},[xu],2)),[[p,e.__("tiptap::tiptap.ordered_list")]]):t.createCommentVNode("",!0),r.taskList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:9,onClick:n[10]||(n[10]=t=>i.editor.chain().focus().toggleTaskList().run()),class:["button",{accent:i.editor.isActive("taskList")}]},[Mu],2)),[[p,e.__("tiptap::tiptap.task_list")]]):t.createCommentVNode("",!0),r.heading?(t.openBlock(),t.createBlock("span",Su,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading")}],onClick:n[11]||(n[11]=t=>{i.headingOpen=!i.headingOpen,i.alignOpen=!1})},[Ou],2),[[p,e.__("tiptap::tiptap.heading")]]),t.createVNode(a,null,{default:t.withCtx((()=>[i.headingOpen?(t.openBlock(),t.createBlock("div",Cu,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:1})}],onClick:n[12]||(n[12]=t=>i.editor.chain().focus().toggleHeading({level:1}).run())},[Nu],2),[[p,`${e.__("tiptap::tiptap.heading")} 1`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:2})}],onClick:n[13]||(n[13]=t=>i.editor.chain().focus().toggleHeading({level:2}).run())},[_u],2),[[p,`${e.__("tiptap::tiptap.heading")} 2`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:3})}],onClick:n[14]||(n[14]=t=>i.editor.chain().focus().toggleHeading({level:3}).run())},[Tu],2),[[p,`${e.__("tiptap::tiptap.heading")} 3`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:4})}],onClick:n[15]||(n[15]=t=>i.editor.chain().focus().toggleHeading({level:4}).run())},[Au],2),[[p,`${e.__("tiptap::tiptap.heading")} 4`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:5})}],onClick:n[16]||(n[16]=t=>i.editor.chain().focus().toggleHeading({level:5}).run())},[Eu],2),[[p,`${e.__("tiptap::tiptap.heading")} 5`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:6})}],onClick:n[17]||(n[17]=t=>i.editor.chain().focus().toggleHeading({level:6}).run())},[Vu],2),[[p,`${e.__("tiptap::tiptap.heading")} 6`]])])):t.createCommentVNode("",!0)])),_:1})])):t.createCommentVNode("",!0),r.textAlign?(t.openBlock(),t.createBlock("span",Du,[t.withDirectives(t.createVNode("button",{class:["button",{accent:s.hasTextAlign}],onClick:n[18]||(n[18]=t=>{i.alignOpen=!i.alignOpen,i.headingOpen=!1})},[Ru],2),[[p,e.__("tiptap::tiptap.text_align")]]),t.createVNode(a,null,{default:t.withCtx((()=>[i.alignOpen?(t.openBlock(),t.createBlock("div",zu,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"left"})}],onClick:n[19]||(n[19]=t=>i.editor.chain().focus().setTextAlign("left").run())},[Iu],2),[[p,e.__("tiptap::tiptap.left")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"center"})}],onClick:n[20]||(n[20]=t=>i.editor.chain().focus().setTextAlign("center").run())},[Bu],2),[[p,e.__("tiptap::tiptap.center")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"right"})}],onClick:n[21]||(n[21]=t=>i.editor.chain().focus().setTextAlign("right").run())},[Lu],2),[[p,e.__("tiptap::tiptap.right")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"justify"})}],onClick:n[22]||(n[22]=t=>i.editor.chain().focus().setTextAlign("justify").run())},[Pu],2),[[p,e.__("tiptap::tiptap.justify")]]),t.withDirectives(t.createVNode("button",{class:"button",onClick:n[23]||(n[23]=t=>i.editor.chain().focus().unsetTextAlign().run())},[ju],512),[[p,e.__("tiptap::tiptap.clear")]])])):t.createCommentVNode("",!0)])),_:1})])):t.createCommentVNode("",!0),r.horizontalRule?t.withDirectives((t.openBlock(),t.createBlock("button",{key:12,onClick:n[24]||(n[24]=t=>i.editor.chain().focus().setHorizontalRule().run()),class:"button"},[$u],512)),[[p,e.__("tiptap::tiptap.horizontal_rule")]]):t.createCommentVNode("",!0),r.undoRedo?t.withDirectives((t.openBlock(),t.createBlock("button",{key:13,onClick:n[25]||(n[25]=t=>i.editor.chain().focus().undo().run()),class:"button"},[Fu],512)),[[p,e.__("tiptap::tiptap.undo")]]):t.createCommentVNode("",!0),r.undoRedo?t.withDirectives((t.openBlock(),t.createBlock("button",{key:14,onClick:n[26]||(n[26]=t=>i.editor.chain().focus().redo().run()),class:"button"},[Hu],512)),[[p,e.__("tiptap::tiptap.redo")]]):t.createCommentVNode("",!0)])),_:1},8,["editor","class"])):t.createCommentVNode("",!0)]),t.createVNode(c,{editor:i.editor,class:"min-h-64 h-64",onClick:n[27]||(n[27]=t=>{i.headingOpen=!1,i.alignOpen=!1})},null,8,["editor"]),i.editor&&r.maxChars>0?(t.openBlock(),t.createBlock("div",{key:0,class:["w-full",s.charPercentage>90?"text-red-500":s.charPercentage>75?"text-yellow-500":null]},t.toDisplayString(e.__("tiptap::tiptap.character_count",{chars:i.editor.getCharacterCount(),max:r.maxChars})),3)):t.createCommentVNode("",!0)])};const qu={components:{Tiptap:hu},data:()=>({bubbleMenu:!1,maxChars:280,content:"

This is tiptap 2 in Voyager II using Vue 3 🎉

",disabled:!1,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0})},Ju={class:"flex space-x-2"},Wu={class:"input-group"},Uu=t.createVNode("label",{for:"bubble",class:"label"},"Bubble menu",-1),Ku={class:"mt-1"},Gu={class:"input-group"},Xu=t.createVNode("label",{for:"maxChars",class:"label"},"Max characters (0 = infinite)",-1),Yu={class:"mt-1"},Qu={class:"input-group"},Zu=t.createVNode("label",{for:"disabled",class:"label"},"Disabled",-1),th={class:"mt-1"},eh={class:"flex flex-wrap space-x-2 mt-4"},nh={class:"input-group"},rh={for:"bold",class:"label"},oh={class:"mt-1"},ih={class:"input-group"},sh={for:"italic",class:"label"},ah={class:"mt-1"},ch={class:"input-group"},ph={for:"strike",class:"label"},lh={class:"mt-1"},dh={class:"input-group"},uh={for:"underline",class:"label"},hh={class:"mt-1"},fh={class:"input-group"},mh={for:"code",class:"label"},vh={class:"mt-1"},gh={class:"input-group"},yh={for:"codeBlock",class:"label"},bh={class:"mt-1"},wh={class:"input-group"},kh={for:"blockquote",class:"label"},xh={class:"mt-1"},Mh={class:"input-group"},Sh={for:"bulletList",class:"label"},Oh={class:"mt-1"},Ch={class:"input-group"},Nh={for:"orderedList",class:"label"},_h={class:"mt-1"},Th={class:"input-group"},Ah={for:"taskList",class:"label"},Eh={class:"mt-1"},Vh={class:"input-group"},Dh={for:"heading",class:"label"},Rh={class:"mt-1"},zh={class:"input-group"},Ih={for:"textAlign",class:"label"},Bh={class:"mt-1"},Lh={class:"input-group"},Ph={for:"horizontalRule",class:"label"},jh={class:"mt-1"},$h={class:"input-group"},Fh={for:"undoRedo",class:"label"},Hh={class:"mt-1"};qu.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap"),c=t.resolveComponent("collapsible");return t.openBlock(),t.createBlock(t.Fragment,null,[t.createVNode(a,{bubbleMenu:i.bubbleMenu,maxChars:i.maxChars,modelValue:i.content,"onUpdate:modelValue":n[1]||(n[1]=t=>i.content=t),disabled:i.disabled,bold:i.bold,italic:i.italic,strike:i.strike,underline:i.underline,code:i.code,codeBlock:i.codeBlock,blockquote:i.blockquote,bulletList:i.bulletList,orderedList:i.orderedList,taskList:i.taskList,heading:i.heading,textAlign:i.textAlign,horizontalRule:i.horizontalRule,undoRedo:i.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","disabled","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"]),t.createVNode(c,{title:"Options"},{default:t.withCtx((()=>[t.createVNode("div",Ju,[t.createVNode("div",Wu,[Uu,t.createVNode("div",Ku,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[2]||(n[2]=t=>i.bubbleMenu=t),id:"bubble"},null,512),[[t.vModelCheckbox,i.bubbleMenu]])])]),t.createVNode("div",Gu,[Xu,t.createVNode("div",Yu,[t.withDirectives(t.createVNode("input",{type:"number",class:"input","onUpdate:modelValue":n[3]||(n[3]=t=>i.maxChars=t),min:"0",id:"maxChars"},null,512),[[t.vModelText,i.maxChars,void 0,{number:!0}]])])]),t.createVNode("div",Qu,[Zu,t.createVNode("div",th,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[4]||(n[4]=t=>i.disabled=t),id:"disabled"},null,512),[[t.vModelCheckbox,i.disabled]])])])]),t.createVNode("div",eh,[t.createVNode("div",nh,[t.createVNode("label",rh,t.toDisplayString(e.__("tiptap::tiptap.bold")),1),t.createVNode("div",oh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[5]||(n[5]=t=>i.bold=t),id:"bold"},null,512),[[t.vModelCheckbox,i.bold]])])]),t.createVNode("div",ih,[t.createVNode("label",sh,t.toDisplayString(e.__("tiptap::tiptap.italic")),1),t.createVNode("div",ah,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[6]||(n[6]=t=>i.italic=t),id:"italic"},null,512),[[t.vModelCheckbox,i.italic]])])]),t.createVNode("div",ch,[t.createVNode("label",ph,t.toDisplayString(e.__("tiptap::tiptap.strike")),1),t.createVNode("div",lh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[7]||(n[7]=t=>i.strike=t),id:"strike"},null,512),[[t.vModelCheckbox,i.strike]])])]),t.createVNode("div",dh,[t.createVNode("label",uh,t.toDisplayString(e.__("tiptap::tiptap.underline")),1),t.createVNode("div",hh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[8]||(n[8]=t=>i.underline=t),id:"underline"},null,512),[[t.vModelCheckbox,i.underline]])])]),t.createVNode("div",fh,[t.createVNode("label",mh,t.toDisplayString(e.__("tiptap::tiptap.code")),1),t.createVNode("div",vh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[9]||(n[9]=t=>i.code=t),id:"code"},null,512),[[t.vModelCheckbox,i.code]])])]),t.createVNode("div",gh,[t.createVNode("label",yh,t.toDisplayString(e.__("tiptap::tiptap.code_block")),1),t.createVNode("div",bh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[10]||(n[10]=t=>i.codeBlock=t),id:"codeBlock"},null,512),[[t.vModelCheckbox,i.codeBlock]])])]),t.createVNode("div",wh,[t.createVNode("label",kh,t.toDisplayString(e.__("tiptap::tiptap.blockquote")),1),t.createVNode("div",xh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[11]||(n[11]=t=>i.blockquote=t),id:"blockquote"},null,512),[[t.vModelCheckbox,i.blockquote]])])]),t.createVNode("div",Mh,[t.createVNode("label",Sh,t.toDisplayString(e.__("tiptap::tiptap.bullet_list")),1),t.createVNode("div",Oh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[12]||(n[12]=t=>i.bulletList=t),id:"bulletList"},null,512),[[t.vModelCheckbox,i.bulletList]])])]),t.createVNode("div",Ch,[t.createVNode("label",Nh,t.toDisplayString(e.__("tiptap::tiptap.ordered_list")),1),t.createVNode("div",_h,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[13]||(n[13]=t=>i.orderedList=t),id:"orderedList"},null,512),[[t.vModelCheckbox,i.orderedList]])])]),t.createVNode("div",Th,[t.createVNode("label",Ah,t.toDisplayString(e.__("tiptap::tiptap.task_list")),1),t.createVNode("div",Eh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[14]||(n[14]=t=>i.taskList=t),id:"taskList"},null,512),[[t.vModelCheckbox,i.taskList]])])]),t.createVNode("div",Vh,[t.createVNode("label",Dh,t.toDisplayString(e.__("tiptap::tiptap.heading")),1),t.createVNode("div",Rh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[15]||(n[15]=t=>i.heading=t),id:"heading"},null,512),[[t.vModelCheckbox,i.heading]])])]),t.createVNode("div",zh,[t.createVNode("label",Ih,t.toDisplayString(e.__("tiptap::tiptap.text_align")),1),t.createVNode("div",Bh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[16]||(n[16]=t=>i.textAlign=t),id:"textAlign"},null,512),[[t.vModelCheckbox,i.textAlign]])])]),t.createVNode("div",Lh,[t.createVNode("label",Ph,t.toDisplayString(e.__("tiptap::tiptap.horizontal_rule")),1),t.createVNode("div",jh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[17]||(n[17]=t=>i.horizontalRule=t),id:"horizontalRule"},null,512),[[t.vModelCheckbox,i.horizontalRule]])])]),t.createVNode("div",$h,[t.createVNode("label",Fh,t.toDisplayString(e.__("tiptap::tiptap.undo"))+"/"+t.toDisplayString(e.__("tiptap::tiptap.redo")),1),t.createVNode("div",Hh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[18]||(n[18]=t=>i.undoRedo=t),id:"undoRedo"},null,512),[[t.vModelCheckbox,i.undoRedo]])])])])])),_:1}),t.createVNode(c,{title:"HTML Output"},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("textarea",{class:"input w-full min-h-64","onUpdate:modelValue":n[19]||(n[19]=t=>i.content=t)},null,512),[[t.vModelText,i.content]])])),_:1})],64)};const qh={mixins:[voyager.formfieldMixin]},Jh={key:1},Wh={key:2};qh.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap");return"query"==e.action?t.renderSlot(e.$slots,"default",{key:0}):"add"==e.action||"edit"==e.action?(t.openBlock(),t.createBlock("div",Jh,[t.createVNode(a,{bubbleMenu:e.options.bubbleMenu,maxChars:e.options.maxChars,modelValue:e.modelValue,"onUpdate:modelValue":n[1]||(n[1]=t=>e.$emit("update:modelValue",t)),bold:e.options.bold,italic:e.options.italic,strike:e.options.strike,underline:e.options.underline,code:e.options.code,codeBlock:e.options.codeBlock,blockquote:e.options.blockquote,bulletList:e.options.bulletList,orderedList:e.options.orderedList,taskList:e.options.taskList,heading:e.options.heading,textAlign:e.options.textAlign,horizontalRule:e.options.horizontalRule,undoRedo:e.options.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):"browse"==e.action?(t.openBlock(),t.createBlock("div",Wh,t.toDisplayString(e.modelValue),1)):t.createCommentVNode("",!0)};const Uh={mixins:[voyager.formfieldBuilderMixin],computed:{defaultListOptions:()=>({display_length:150}),defaultViewOptions:()=>({bubbleMenu:!1,maxChars:0,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0})}},Kh={key:0},Gh={for:"length",class:"label"},Xh={key:1},Yh={class:"mt-2"},Qh={for:"maxChars",class:"label"},Zh={class:"grid grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 gap-2 mt-2"},tf={class:"flex items-center space-x-1"},ef={for:"bubble",class:"label"},nf={class:"flex items-center space-x-1"},rf={for:"bold",class:"label"},of={class:"flex items-center space-x-1"},sf={for:"italic",class:"label"},af={class:"flex items-center space-x-1"},cf={for:"strike",class:"label"},pf={class:"flex items-center space-x-1"},lf={for:"underline",class:"label"},df={class:"flex items-center space-x-1"},uf={for:"code",class:"label"},hf={class:"flex items-center space-x-1"},ff={for:"codeBlock",class:"label"},mf={class:"flex items-center space-x-1"},vf={for:"blockquote",class:"label"},gf={class:"flex items-center space-x-1"},yf={for:"bulletList",class:"label"},bf={class:"flex items-center space-x-1"},wf={for:"orderedList",class:"label"},kf={class:"flex items-center space-x-1"},xf={for:"taskList",class:"label"},Mf={class:"flex items-center space-x-1"},Sf={for:"heading",class:"label"},Of={class:"flex items-center space-x-1"},Cf={for:"textAlign",class:"label"},Nf={class:"flex items-center space-x-1"},_f={for:"horizontalRule",class:"label"},Tf={class:"flex items-center space-x-1"},Af={for:"undoRedo",class:"label"},Ef={key:2};Uh.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap");return"list-options"==e.action?(t.openBlock(),t.createBlock("div",Kh,[t.createVNode("label",Gh,t.toDisplayString(e.__("voyager::generic.display_length")),1),t.withDirectives(t.createVNode("input",{type:"number",id:"length",class:"input w-full","onUpdate:modelValue":n[1]||(n[1]=t=>e.options.display_length=t)},null,512),[[t.vModelText,e.options.display_length,void 0,{number:!0}]])])):"view-options"==e.action?(t.openBlock(),t.createBlock("div",Xh,[t.createVNode("div",Yh,[t.createVNode("label",Qh,t.toDisplayString(e.__("tiptap::tiptap.max_characters")),1),t.withDirectives(t.createVNode("input",{type:"number",class:"input w-full","onUpdate:modelValue":n[2]||(n[2]=t=>e.options.maxChars=t),min:"0",id:"maxChars"},null,512),[[t.vModelText,e.options.maxChars,void 0,{number:!0}]])]),t.createVNode("div",Zh,[t.createVNode("div",tf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[3]||(n[3]=t=>e.options.bubbleMenu=t),id:"bubble"},null,512),[[t.vModelCheckbox,e.options.bubbleMenu]]),t.createVNode("label",ef,t.toDisplayString(e.__("tiptap::tiptap.bubble_menu")),1)]),t.createVNode("div",nf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[4]||(n[4]=t=>e.options.bold=t),id:"bold"},null,512),[[t.vModelCheckbox,e.options.bold]]),t.createVNode("label",rf,t.toDisplayString(e.__("tiptap::tiptap.bold")),1)]),t.createVNode("div",of,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[5]||(n[5]=t=>e.options.italic=t),id:"italic"},null,512),[[t.vModelCheckbox,e.options.italic]]),t.createVNode("label",sf,t.toDisplayString(e.__("tiptap::tiptap.italic")),1)]),t.createVNode("div",af,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[6]||(n[6]=t=>e.options.strike=t),id:"strike"},null,512),[[t.vModelCheckbox,e.options.strike]]),t.createVNode("label",cf,t.toDisplayString(e.__("tiptap::tiptap.strike")),1)]),t.createVNode("div",pf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[7]||(n[7]=t=>e.options.underline=t),id:"underline"},null,512),[[t.vModelCheckbox,e.options.underline]]),t.createVNode("label",lf,t.toDisplayString(e.__("tiptap::tiptap.underline")),1)]),t.createVNode("div",df,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[8]||(n[8]=t=>e.options.code=t),id:"code"},null,512),[[t.vModelCheckbox,e.options.code]]),t.createVNode("label",uf,t.toDisplayString(e.__("tiptap::tiptap.code")),1)]),t.createVNode("div",hf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[9]||(n[9]=t=>e.options.codeBlock=t),id:"codeBlock"},null,512),[[t.vModelCheckbox,e.options.codeBlock]]),t.createVNode("label",ff,t.toDisplayString(e.__("tiptap::tiptap.code_block")),1)]),t.createVNode("div",mf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[10]||(n[10]=t=>e.options.blockquote=t),id:"blockquote"},null,512),[[t.vModelCheckbox,e.options.blockquote]]),t.createVNode("label",vf,t.toDisplayString(e.__("tiptap::tiptap.blockquote")),1)]),t.createVNode("div",gf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[11]||(n[11]=t=>e.options.bulletList=t),id:"bulletList"},null,512),[[t.vModelCheckbox,e.options.bulletList]]),t.createVNode("label",yf,t.toDisplayString(e.__("tiptap::tiptap.bullet_list")),1)]),t.createVNode("div",bf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[12]||(n[12]=t=>e.options.orderedList=t),id:"orderedList"},null,512),[[t.vModelCheckbox,e.options.orderedList]]),t.createVNode("label",wf,t.toDisplayString(e.__("tiptap::tiptap.ordered_list")),1)]),t.createVNode("div",kf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[13]||(n[13]=t=>e.options.taskList=t),id:"taskList"},null,512),[[t.vModelCheckbox,e.options.taskList]]),t.createVNode("label",xf,t.toDisplayString(e.__("tiptap::tiptap.task_list")),1)]),t.createVNode("div",Mf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[14]||(n[14]=t=>e.options.heading=t),id:"heading"},null,512),[[t.vModelCheckbox,e.options.heading]]),t.createVNode("label",Sf,t.toDisplayString(e.__("tiptap::tiptap.heading")),1)]),t.createVNode("div",Of,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[15]||(n[15]=t=>e.options.textAlign=t),id:"textAlign"},null,512),[[t.vModelCheckbox,e.options.textAlign]]),t.createVNode("label",Cf,t.toDisplayString(e.__("tiptap::tiptap.text_align")),1)]),t.createVNode("div",Nf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[16]||(n[16]=t=>e.options.horizontalRule=t),id:"horizontalRule"},null,512),[[t.vModelCheckbox,e.options.horizontalRule]]),t.createVNode("label",_f,t.toDisplayString(e.__("tiptap::tiptap.horizontal_rule")),1)]),t.createVNode("div",Tf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[17]||(n[17]=t=>e.options.undoRedo=t),id:"undoRedo"},null,512),[[t.vModelCheckbox,e.options.undoRedo]]),t.createVNode("label",Af,t.toDisplayString(e.__("tiptap::tiptap.undo"))+"/"+t.toDisplayString(e.__("tiptap::tiptap.redo")),1)])])])):"view"==e.action?(t.openBlock(),t.createBlock("div",Ef,[t.createVNode(a,{bubbleMenu:e.options.bubbleMenu,maxChars:e.options.maxChars,value:"''",bold:e.options.bold,italic:e.options.italic,strike:e.options.strike,underline:e.options.underline,code:e.options.code,codeBlock:e.options.codeBlock,blockquote:e.options.blockquote,bulletList:e.options.bulletList,orderedList:e.options.orderedList,taskList:e.options.taskList,heading:e.options.heading,textAlign:e.options.textAlign,horizontalRule:e.options.horizontalRule,undoRedo:e.options.undoRedo},null,8,["bubbleMenu","maxChars","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):t.createCommentVNode("",!0)},voyager.component("tiptap",hu),voyager.component("tiptap-demo",qu),voyager.component("tiptap-formfield",qh),voyager.component("tiptap-builder",Uh),voyager.addToUI("Tiptap","tiptap-demo")})); +var __defProp=Object.defineProperty,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__assign=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__rest=(t,e)=>{var n={};for(var r in t)__hasOwnProp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))e.indexOf(r)<0&&__propIsEnum.call(t,r)&&(n[r]=t[r]);return n},__vite_style__=document.createElement("style");__vite_style__.innerHTML=".ProseMirror div,.ProseMirror li>p:first-child{display:inline}ul[data-type=taskList]{list-style:none;padding:0}ul[data-type=taskList] li{display:flex;align-items:center}ul[data-type=taskList] li>label{flex:0 0 auto;margin-right:.5rem}",document.head.appendChild(__vite_style__),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Vue)}(this,(function(t){"use strict";function e(t){this.content=t}e.prototype={constructor:e,find:function(t){for(var e=0;e>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};var n=e;function r(t,e,n){for(var o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;var i=t.child(o),s=e.child(o);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){var c=r(i.content,s.content,n+1);if(null!=c)return c}n+=i.nodeSize}else n+=i.nodeSize}}function o(t,e,n,r){for(var i=t.childCount,s=e.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:r};var a=t.child(--i),c=e.child(--s),p=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:n,b:r};if(a.isText&&a.text!=c.text){for(var l=0,d=Math.min(a.text.length,c.text.length);lt&&!1!==n(a,r+s,o,i)&&a.content.size){var p=s+1;a.nodesBetween(Math.max(0,t-p),Math.min(a.content.size,e-p),n,r+p)}s=c}},i.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},i.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},i.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);ot)for(var o=0,s=0;st&&((se)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),n.push(a),r+=a.nodeSize),s=c}return new i(n,r)},i.prototype.cutByIndex=function(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))},i.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 i(r,o)},i.prototype.addToStart=function(t){return new i([t].concat(this.content),this.size+t.nodeSize)},i.prototype.addToEnd=function(t){return new i(this.content.concat(t),this.size+t.nodeSize)},i.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.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?c(n+1,o):c(n,r);r=o}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},i.fromJSON=function(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(e.map(t.nodeFromJSON))},i.fromArray=function(t){if(!t.length)return i.empty;for(var e,n=0,r=0;rthis.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},l.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new d("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new d("Inconsistent open depths");return g(t,e,n,0)}function g(t,e,n,r){var o=t.index(r),s=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(i.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return x(s,M(t,c.start,c.end,e,r))}var p=t.parent,l=p.content;return x(p,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}return x(s,S(t,e,r))}function y(t,e){if(!e.type.compatibleContent(t.type))throw new d("Cannot join "+e.type.name+" onto "+t.type.name)}function b(t,e,n){var r=t.node(n);return y(r,e.node(n)),r}function w(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 k(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(w(t.nodeAfter,r),i++));for(var a=i;ao&&b(t,e,o+1),a=r.depth>o&&b(n,r,o+1),c=[];return k(null,t,o,c),s&&a&&e.index(o)==n.index(o)?(y(s,a),w(x(s,M(t,e,n,r,o+1)),c)):(s&&w(x(s,S(t,e,o+1)),c),k(e,n,o,c),a&&w(x(a,S(n,r,o+1)),c)),k(r,null,o,c),new i(c)}function S(t,e,n){var r=[];(k(null,t,n,r),t.depth>n)&&w(x(b(t,e,n+1),S(t,e,n+1)),r);return k(e,null,n,r),new i(r)}h.size.get=function(){return this.content.size-this.openStart-this.openEnd},u.prototype.insertAt=function(t,e){var n=m(this.content,t+this.openStart,e,null);return n&&new u(n,this.openStart,this.openEnd)},u.prototype.removeBetween=function(t,e){return new u(f(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},u.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},u.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},u.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},u.fromJSON=function(t,e){if(!e)return u.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 u(i.fromJSON(t,e.content),n,r)},u.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 u(t,n,r)},Object.defineProperties(u.prototype,h),u.empty=new u(i.empty,0,0);var O=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},C={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};O.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},C.parent.get=function(){return this.node(this.depth)},C.doc.get=function(){return this.node(0)},O.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},O.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},O.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},O.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},O.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},O.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]},O.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},C.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},C.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},C.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},O.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;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},O.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new A(this,t,n)},O.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},O.prototype.max=function(t){return t.pos>this.pos?t:this},O.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,p=o-c;if(n.push(i,a,r+c),!p)break;if((i=i.child(a)).isText)break;o=p-1,r+=c+1}return new O(e,n,o)},O.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},R.isBlock.get=function(){return this.type.isBlock},R.isTextblock.get=function(){return this.type.isTextblock},R.inlineContent.get=function(){return this.type.inlineContent},R.isInline.get=function(){return this.type.isInline},R.isText.get=function(){return this.type.isText},R.isLeaf.get=function(){return this.type.isLeaf},R.isAtom.get=function(){return this.type.isAtom},D.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()+")"),I(this.marks,t)},D.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},D.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=i.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c=0;n--)e=t[n].type.name+"("+e+")";return e}var B=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},L={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};B.parse=function(t,e){var n=new P(t,e);if(null==n.next)return B.empty;var r=$(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(U(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];U(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new B(r.indexOf(t.length-1)>-1),s=0;s>1},B.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]}},B.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(B.prototype,L),B.empty=new B(!0);var P=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()},j={next:{configurable:!0}};function $(t){var e=[];do{e.push(F(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function F(t){var e=[];do{e.push(H(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function H(t){for(var e=function(t){if(t.eat("(")){var e=$(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=J(t,e)}return e}function q(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function J(t,e){var n=q(t),r=n;return t.eat(",")&&(r="}"!=t.next?q(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function W(t,e){return e-t}function U(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-1},Y.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var nt=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=n.from(t.nodes),this.spec.marks=n.from(t.marks),this.nodes=Y.compile(this.spec.nodes,this),this.marks=et.compile(this.spec.marks,this);var r=Object.create(null);for(var o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");var i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=r[s]||(r[s]=B.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?rt(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var p=this.marks[c],l=p.spec.excludes;p.excluded=null==l?[p]:""==l?[]:rt(this,l.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function rt(t,e){for(var n=[],r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}nt.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof Y))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)},nt.prototype.text=function(t,e){var n=this.nodes.text;return new z(n,n.defaultAttrs,t,l.setFrom(e))},nt.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},nt.prototype.nodeFromJSON=function(t){return D.fromJSON(this,t)},nt.prototype.markFromJSON=function(t){return l.fromJSON(this,t)},nt.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ot=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)}))};ot.prototype.parse=function(t,e){void 0===e&&(e={});var n=new lt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ot.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new lt(this,e,!0);return n.addAll(t,null,e.from,e.to),u.maxOpen(n.finish())},ot.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ot.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},pt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},lt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},lt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},dt.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},lt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-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),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var p=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!p||p.name!=c&&-1==p.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},lt.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}},lt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;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(lt.prototype,dt);var mt=function(t,e){this.nodes=t||{},this.marks=e||{}};function vt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function gt(t){return t.document||window.document}mt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=gt(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},mt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&mt.renderSpec(gt(n),r(t,e))},mt.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,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var p in c=2,a)if(null!=a[p]){var l=p.indexOf(" ");l>0?s.setAttributeNS(p.slice(0,l),p.slice(l+1),a[p]):s.setAttribute(p,a[p])}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var h=mt.renderSpec(t,u,n),f=h.dom,m=h.contentDOM;if(s.appendChild(f),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},mt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new mt(this.nodesFromSchema(t),this.marksFromSchema(t)))},mt.nodesFromSchema=function(t){var e=vt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},mt.marksFromSchema=function(t){return vt(t.marks)};var yt=Math.pow(2,16);function bt(t){return 65535&t}var wt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},kt=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};kt.prototype.recover=function(t){var e=0,n=bt(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],p=this.ranges[s+i],l=a+c;if(t<=l){var d=a+r+((c?t==a?-1:t==l?1:e:e)<0?0:p);if(n)return d;var u=t==(e<0?a:l)?null:s/3+(t-a)*yt;return new wt(d,e<0?t!=a:t!=l,u)}r+=p-c}return n?t+r:new wt(t+r)},kt.prototype.touches=function(t,e){for(var n=0,r=bt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},kt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},xt.prototype.invert=function(){var t=new xt;return t.appendMappingInverted(this),t},xt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},St.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(St.prototype,Ot);var Nt=Object.create(null),_t=function(){};_t.prototype.apply=function(t){return Ct()},_t.prototype.getMap=function(){return kt.empty},_t.prototype.invert=function(t){return Ct()},_t.prototype.map=function(t){return Ct()},_t.prototype.merge=function(t){return null},_t.prototype.toJSON=function(){return Ct()},_t.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Nt[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},_t.jsonID=function(t,e){if(t in Nt)throw new RangeError("Duplicate use of step JSON ID "+t);return Nt[t]=e,e.prototype.jsonID=t,e};var Tt=function(t,e){this.doc=t,this.failed=e};Tt.ok=function(t){return new Tt(t,null)},Tt.fail=function(t){return new Tt(null,t)},Tt.fromReplace=function(t,e,n,r){try{return Tt.ok(t.replace(e,n,r))}catch(o){if(o instanceof d)return Tt.fail(o.message);throw o}};var At=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&&Vt(t,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new kt([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?u.empty:new u(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?u.empty:new u(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,u.fromJSON(t,n.slice),!!n.structure)},e}(_t);_t.jsonID("replace",At);var Et=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Vt(t,this.from,this.gapFrom)||Vt(t,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Tt.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Tt.fromReplace(t,this.from,this.to,n):Tt.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new kt([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||or.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,u.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(_t);function Vt(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Dt(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Rt(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(ni;a--,c--){var p=o.node(a),l=o.index(a);if(p.type.spec.isolating)return!1;var d=p.content.cutByIndex(l,p.childCount),u=r&&r[c]||p;if(u!=p&&(d=d.replaceChild(0,u.type.create(u.attrs))),!p.canReplace(l+1,p.childCount)||!u.type.validContent(d))return!1}var h=o.indexAfter(i),f=r&&r[0];return o.node(i).canReplaceWith(h,h,f?f.type:o.node(i+1).type)}function Lt(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 Pt(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,p=r.index(a)+(c>0?1:0),l=r.node(a),d=!1;if(1==s)d=l.canReplace(p,p,o);else{var u=l.contentMatchAt(p).findWrapping(o.firstChild.type);d=u&&l.canReplaceWith(p,p,u[0])}if(d)return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function jt(t,e,n){for(var r=[],o=0;oe;h--)f||n.index(h)>0?(f=!0,l=i.from(n.node(h).copy(l)),d++):c--;for(var m=i.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)=0;r--)n=i.from(e[r].type.create(e[r].attrs,n));var o=t.start,s=t.end;return this.step(new Et(o,s,o,s,new u(n,0,0),e.length,!0))},St.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 s=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(s).map(e),n)){o.clearIncompatible(o.mapping.slice(s).map(e,1),n);var a=o.mapping.slice(s),c=a.map(e,1),p=a.map(e+t.nodeSize,1);return o.step(new Et(c,p,c+1,p-1,new u(i.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},St.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 s=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,s);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Et(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new u(i.from(s),0,0),1,!0))},St.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=i.empty,s=i.empty,a=r.depth,c=r.depth-e,p=e-1;a>c;a--,p--){o=i.from(r.node(a).copy(o));var l=n&&n[p];s=i.from(l?l.type.create(l.attrs,s):r.node(a).copy(s))}return this.step(new At(t,t,new u(o.append(s),e,e),!0))},St.prototype.join=function(t,e){void 0===e&&(e=1);var n=new At(t-e,t+e,u.empty,!0);return this.step(n)};var $t=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 u(jt(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 Tt.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Ft(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}(_t);_t.jsonID("addMark",$t);var Ft=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 u(jt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Tt.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}(_t);function Ht(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}_t.jsonID("removeMark",Ft),St.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,p){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&p.type.allowsMarkType(n.type)){for(var d=Math.max(c,t),u=Math.min(c+r.nodeSize,e),h=n.addToSet(l),f=0;f=0;f--)this.step(o[f]);return this},St.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=u.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=u.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Ht(o,i,r)?new At(e,n,r):new qt(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},St.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new u(i.from(n),0,0))},St.prototype.delete=function(t,e){return this.replace(t,e,u.empty)},St.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var qt=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=i.empty;for(var s=t.depth;s>0;s--)this.placed=i.from(t.node(s).copy(this.placed))},Jt={depth:{configurable:!0}};function Wt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Wt(t.firstChild.content,e-1,n)))}function Ut(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ut(t.lastChild.content,e-1,n)))}function Kt(t,e){for(var n=0;n1&&(r=r.replaceChild(0,Gt(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(i.empty,!0)))),t.copy(r)}function Xt(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(i.empty,!0))}return t}function Qt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}Jt.depth.get=function(){return this.frontier.length-1},qt.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,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new u(i,s,a);return e>-1?new Et(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new At(r.pos,o.pos,c):void 0},qt.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=Kt(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var s=this.frontier[o],a=s.type,c=s.match,p=void 0,l=void 0;if(1==t&&(r?c.matchType(r.type)||(l=c.fillBefore(i.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(p=c.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:p};if(n&&c.matchType(n.type))break}},qt.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Kt(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new u(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},qt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Kt(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new u(Wt(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new u(Wt(e,n,1),n,r)},qt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a1||0==l||b.content.size)&&(m=w,h.push(Gt(b.mark(v.allowedMarks(b.marks)),1==d?l:0,d==p.childCount?y:-1)))}var k=d==p.childCount;k||(y=-1),this.placed=Ut(this.placed,n,i.from(h)),this.frontier[n].match=m,k&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,M=p;x1&&r==this.$to.end(--n);)++r;return r},qt.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=0;a--){var c=this.frontier[a],p=c.match,l=Xt(t,a,c.type,p,!0);if(!l||l.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},qt.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=Ut(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},qt.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Ut(this.placed,this.depth,i.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},qt.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(i.empty,!0);t.childCount&&(this.placed=Ut(this.placed,this.frontier.length,t))},Object.defineProperties(qt.prototype,Jt),St.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Ht(r,o,n))return this.step(new At(t,e,n));var i=Qt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var p=r.node(a).type.spec;if(p.defining||p.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var l=i.indexOf(s),d=[],h=n.openStart,f=n.content,m=0;;m++){var v=f.firstChild;if(d.push(v),m==n.openStart)break;f=v.content}h>0&&d[h-1].type.spec.defining&&r.node(l).type!=d[h-1].type?h-=1:h>=2&&d[h-1].isTextblock&&d[h-2].type.spec.defining&&r.node(l).type!=d[h-2].type&&(h-=2);for(var g=n.openStart;g>=0;g--){var y=(g+h+1)%(n.openStart+1),b=d[y];if(b)for(var w=0;w=0&&(this.replace(t,e,n),!(this.steps.length>O));C--){var N=i[C];N<0||(t=r.before(N),e=o.after(N))}return this},St.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Zt=Object.create(null),te=function(t,e,n){this.ranges=n||[new ne(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ee={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ee.anchor.get=function(){return this.$anchor.pos},ee.head.get=function(){return this.$head.pos},ee.from.get=function(){return this.$from.pos},ee.to.get=function(){return this.$to.pos},ee.$from.get=function(){return this.ranges[0].$from},ee.$to.get=function(){return this.ranges[0].$to},ee.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?pe(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):pe(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},te.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ae(t.node(0))},te.atStart=function(t){return pe(t,t,0,0,1)||new ae(t)},te.atEnd=function(t){return pe(t,t,t.content.size,t.childCount,-1)||new ae(t)},te.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Zt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},te.jsonID=function(t,e){if(t in Zt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Zt[t]=e,e.prototype.jsonID=t,e},te.prototype.getBookmark=function(){return re.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(te.prototype,ee),te.prototype.visible=!0;var ne=function(t,e){this.$from=t,this.$to=e},re=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=u.empty),t.prototype.replace.call(this,e,n),n==u.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 oe(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&ie.isSelectable(a))return ie.create(t,n-(o<0?a.nodeSize:0))}else{var c=pe(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function le(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return l.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)||l.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(te.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}(St);function ue(t,e){return e&&t?t.bind(e):t}var he=function(t,e,n){this.name=t,this.init=ue(e.init,n),this.apply=ue(e.apply,n)},fe=[new he("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new he("selection",{init:function(t,e){return t.selection||te.atStart(e.doc)},apply:function(t){return t.selection}}),new he("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new he("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],me=function(t,e){var n=this;this.schema=t,this.fields=fe.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new he(t.key,t.spec.state,t))}))},ve=function(t){this.config=t},ge={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ge.schema.get=function(){return this.config.schema},ge.plugins.get=function(){return this.config.plugins},ve.prototype.apply=function(t){return this.applyTransaction(t).state},ve.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&ye.splice(e,1)},Object.defineProperties(ve.prototype,ge);var ye=[];function be(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=be(o,e,{})),n[r]=o}return n}var we=function(t){this.props={},t.props&&be(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:xe("plugin")};we.prototype.getState=function(t){return t[this.key]};var ke=Object.create(null);function xe(t){return t in ke?t+"$"+ ++ke[t]:(ke[t]=0,t+"$")}var Me=function(t){void 0===t&&(t="key"),this.key=xe(t)};Me.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Me.prototype.getState=function(t){return t[this.key]};var Se={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var Oe=/Edge\/(\d+)/.exec(navigator.userAgent),Ce=/MSIE \d/.test(navigator.userAgent),Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);Se.mac=/Mac/.test(navigator.platform);var _e=Se.ie=!!(Ce||Ne||Oe);Se.ie_version=Ce?document.documentMode||6:Ne?+Ne[1]:Oe?+Oe[1]:null,Se.gecko=!_e&&/gecko\/(\d+)/i.test(navigator.userAgent),Se.gecko_version=Se.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Te=!_e&&/Chrome\/(\d+)/.exec(navigator.userAgent);Se.chrome=!!Te,Se.chrome_version=Te&&+Te[1],Se.safari=!_e&&/Apple Computer/.test(navigator.vendor),Se.ios=Se.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),Se.android=/Android \d/.test(navigator.userAgent),Se.webkit="webkitFontSmoothing"in document.documentElement.style,Se.webkit_version=Se.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Ae=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},Ee=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Ve=null,De=function(t,e,n){var r=Ve||(Ve=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Re=function(t,e,n,r){return n&&(Ie(t,e,n,r,-1)||Ie(t,e,n,r,1))},ze=/^(img|br|input|textarea|hr)$/i;function Ie(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Be(t))){var i=t.parentNode;if(1!=i.nodeType||Le(t)||ze.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Ae(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?Be(t):0}}}function Be(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Le(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 Pe=function(t){var e=t.isCollapsed;return e&&Se.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function je(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function $e(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Fe(t,e){return"number"==typeof t?t:t[e]}function He(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 qe(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=Ee(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?$e(i):He(s),p=0,l=0;if(e.topc.bottom-Fe(r,"bottom")&&(l=e.bottom-c.bottom+Fe(o,"bottom")),e.leftc.right-Fe(r,"right")&&(p=e.right-c.right+Fe(o,"right")),p||l)if(a)i.defaultView.scrollBy(p,l);else{var d=s.scrollLeft,u=s.scrollTop;l&&(s.scrollTop+=l),p&&(s.scrollLeft+=p);var h=s.scrollLeft-d,f=s.scrollTop-u;e={left:e.left-h,top:e.top-f,right:e.right-h,bottom:e.bottom-f}}if(a)break}}function Je(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=Ee(t));return e}function We(t,e){for(var n=0;n=a){s=Math.max(u.bottom,s),a=Math.min(u.top,a);var h=u.left>e.left?u.left-e.left:u.right=(u.left+u.right)/2?1:0));continue}}!n&&(e.left>=u.right&&e.top>=u.top||e.left>=u.left&&e.top>=u.bottom)&&(i=p+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:Ke(n,r)}function Ge(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Xe(t,e,n){var r=t.childNodes.length;if(r&&n.tope.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?p=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(p=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==p&&(p=function(t,e,n){var r=Ke(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,l,e));var f=t.docView.nearestDesc(l,!0);return{pos:p,inside:f?f.posAtStart-f.border:-1}}function Qe(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Ze=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=Se.webkit||Se.gecko;if(3==o.nodeType){if(!s||!Ze.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,p=n<0?1:-1;return n<0&&!i?(c++,p=-1):n>=0&&i==o.nodeValue.length?(a--,p=1):n<0?a--:c++,en(Qe(De(o,a,c),p),p<0)}var l=Qe(De(o,i,i),n);if(Se.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(i&&(n<0||i==Be(o))){var m=o.childNodes[i-1],v=3==m.nodeType?De(m,Be(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return en(Qe(v,1),!1)}if(i=0)}function en(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 nn(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 rn(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 on=/[\u0590-\u08ac]/;var sn=null,an=null,cn=!1;function pn(t,e,n){return sn==e&&an==n?cn:(sn=e,an=n,cn="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return rn(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=tn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=De(s,0,s.nodeValue.length).getClientRects()}for(var c=0;cp.top&&("up"==n?p.bottomi.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return on.test(r.parent.textContent)&&a.modify?rn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var ln=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},dn={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}};ln.prototype.matchesWidget=function(){return!1},ln.prototype.matchesMark=function(){return!1},ln.prototype.matchesNode=function(){return!1},ln.prototype.matchesHack=function(){return!1},dn.beforePosition.get=function(){return!1},ln.prototype.parseRule=function(){return null},ln.prototype.stopEvent=function(){return!1},dn.size.get=function(){for(var t=0,e=0;eAe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var p=t;;p=p.parentNode){if(p==this.dom){a=!0;break}if(p.parentNode.lastChild!=p)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},ln.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}}},ln.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},ln.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},ln.prototype.descAt=function(t){for(var e=0,n=0;e=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},ln.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var p=i+a.border;if(t>=p&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,p);t=i;for(var l=s;l>0;l--){var d=this.children[l-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=Ae(d.dom)+1;break}t-=d.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var u=s+1;ua&&ie){var y=l;l=d,d=y}var b=document.createRange();b.setEnd(d.node,d.offset),b.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(b)}}},ln.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},dn.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},ln.prototype.markDirty=function(t,e){for(var n=0,r=0;r=n:tn){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},ln.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty0&&(i=Vn(i,0,t,r));for(var a=0;ai;)p.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c=0&&!a&&s.syncToMarks(i==n.node.childCount?l.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(un,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),kn(this.contentDOM,this.children,t),Se.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof re)||re+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=Be(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e=n){var l=c.lastIndexOf(e,r-a);if(l>=0&&l+e.length+a>=n)return a+l}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new fn(this,i,n,o);t.compositionNodes.push(s),this.children=Vn(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!_n(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=On(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}(ln);function gn(t,e,n,r,o){return Nn(r,e,t),new vn(null,t,e,n,r,r,r,o,0)}var yn=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}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)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(vn),bn=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(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ln),wn=function(t){function e(e,n,r,o,i,s,a,c,p,l){t.call(this,e,n,r,o,i,s,a,p,l),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,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}(vn);function kn(t,e,n){for(var r=t.firstChild,o=!1,i=0;i0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function En(t,e){return t.type.side-e.type.side}function Vn(t,e,n,r,o){for(var i=[],s=0,a=0;s=n||l<=e?i.push(c):(pn&&i.push(c.slice(n-p,c.size,r)))}return i}function Dn(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,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,p=r.resolve(s);if(Pe(n)){for(a=p;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&ie.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==Be(t);r||o;){if(t==n)return!0;var i=Ae(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==Be(t)}}(n.focusNode,n.focusOffset,o.dom))){var l=o.posBefore;c=new ie(s==l?p:r.resolve(l))}}else{var d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(d<0)return null;a=r.resolve(d)}c||(c=Fn(t,a,p,"pointer"==e||t.state.selection.head>1,i=Math.min(o,t.length);r-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=mn.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},An.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function Jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Wn(t,e,n){var r=t.state.selection;if(!(r instanceof re)){if(r instanceof ie&&r.node.isInline)return Jn(t,new re(e>0?r.$to:r.$from));var o=qn(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=qn(t.state,e);return!!(i&&i instanceof ie)&&Jn(t,i)}if(!(Se.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var p=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(p))&&!s.contentDOM)&&(ie.isSelectable(c)?Jn(t,new ie(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!Se.webkit&&Jn(t,new re(t.state.doc.resolve(e<0?p:p+c.nodeSize))))}}function Un(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Kn(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Gn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(Se.gecko&&1==n.nodeType&&r0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Kn(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Yn(n))break;for(var c=n.previousSibling;c&&Kn(c);)o=n.parentNode,i=Ae(c),c=c.previousSibling;if(c)r=Un(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Qn(t,e,n,r):o&&Qn(t,e,o,i)}}function Xn(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Un(n);;)if(r-1)return!1;if(Se.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 s=qn(t.state,e);if(s&&s instanceof ie)return Jn(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof ae?te.near(a,e):te.findFrom(a,e);return!!c&&Jn(t,c)}return!1}function tr(t,e){if(!(t.state.selection instanceof re))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function er(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function nr(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||Se.mac&&72==n&&"c"==r?tr(t,-1)||Gn(t):46==n||Se.mac&&68==n&&"c"==r?tr(t,1)||Xn(t):13==n||27==n||(37==n?Wn(t,-1,r)||Gn(t):39==n?Wn(t,1,r)||Xn(t):38==n?Zn(t,-1,r)||Gn(t):40==n?function(t){if(Se.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;er(t,o,!0),setTimeout((function(){return er(t,o,!1)}),20)}}}(t)||Zn(t,1,r)||Xn(t):r==(Se.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function rr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(Se.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||Se.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function or(t,e,n,r,o){if(e<0){var s=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=Dn(t,s);if(a&&!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==s?c.setMeta("pointer",!0):"key"==s&&c.scrollIntoView(),t.dispatch(c)}}else{var p=t.state.doc.resolve(e),l=p.sharedDepth(n);e=p.before(l+1),n=t.state.doc.resolve(n).after(l+1);var d=t.state.selection,u=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,p=t.root.getSelection(),l=null,d=p.anchorNode;if(d&&t.dom.contains(1==d.nodeType?d:d.parentNode)&&(l=[{node:d,offset:p.anchorOffset}],Pe(p)||l.push({node:p.focusNode,offset:p.focusOffset})),Se.chrome&&8===t.lastKeyCode)for(var u=s;u>i;u--){var h=o.childNodes[u-1],f=h.pmViewDesc;if("BR"==h.nodeName&&!f){s=u;break}if(!f||f.size)break}var m=t.state.doc,v=t.someProp("domParser")||ot.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:l,ruleFromNode:rr,context:g});if(l&&null!=l[0].pos){var w=l[0].pos,k=l[1]&&l[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(Se.chrome&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from){var h=t.cursorWrapper.deco.type.toDOM.nextSibling,f=h&&h.nodeValue?h.nodeValue.length:1;u.sel={anchor:u.sel.anchor+f,head:u.sel.anchor+f}}var m,v,g=t.state.doc,y=g.slice(u.from,u.to);8===t.lastKeyCode&&Date.now()-100=a?i-r:0)+(c-a),a=i}else if(c=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,u.doc.content,u.from,m,v);if(!b){if(!(r&&d instanceof re&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||u.sel&&u.sel.anchor!=u.sel.head){if((Se.ios&&t.lastIOSEnter>Date.now()-225||Se.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,je(13,"Enter"))})))return void(t.lastIOSEnter=0);if(u.sel){var w=ir(t,t.state.doc,u.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:d.from,endA:d.to,endB:d.to}}t.domChangeCount++,t.state.selection.fromt.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),Se.ie&&Se.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>u.from&&"  "==u.doc.textBetween(b.start-u.from-1,b.start-u.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=u.doc.resolveNoCache(b.start-u.from),M=u.doc.resolveNoCache(b.endB-u.from),S=x.sameParent(M)&&x.parent.inlineContent;if((Se.ios&&t.lastIOSEnter>Date.now()-225&&(!S||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!S&&x.posb.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||sr(r,!0,!1)n||sr(s,!0,!1)e.content.size?null:Fn(t,e.resolve(n.anchor),e.resolve(n.head))}function sr(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 ar(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||mt.fromSchema(t.state.schema),c=mr(),p=c.createElement("div");p.appendChild(a.serializeFragment(r,{document:c}));for(var l,d=p.firstChild;d&&1==d.nodeType&&(l=hr[d.nodeName.toLowerCase()]);){for(var u=l.length-1;u>=0;u--){for(var h=c.createElement(l[u]);p.firstChild;)h.appendChild(p.firstChild);p.appendChild(h)}d=p.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:p,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function cr(t,e,n,r,o){var s,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var p=e&&(r||c||!n);if(p){if(t.someProp("transformPastedText",(function(t){e=t(e,c||r)})),c)return new u(i.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?a=l:(s=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){s.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),s=function(t){var e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=mr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&hr[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return""})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i=0;c-=2){var p=r.nodes[n[c]];if(!p||p.hasRequiredAttrs())break;o=i.from(p.create(n[c+1],o)),s++,a++}return new u(o,s,a)}(function(t,e,n){e=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,i.from(t));return t}function lr(t,e,n,r,o){if(o=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||s<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}var hr={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},fr=null;function mr(){return fr||(fr=document.implementation.createHTMLDocument("title"))}var vr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gr=Se.ie&&Se.ie_version<=11,yr=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};yr.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},yr.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var br=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;et.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new yr,gr&&(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};br.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},br.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},br.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,vr),gr&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},br.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n-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)&&Hn(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a1){var p=s.filter((function(t){return"BR"==t.nodeName}));if(2==p.length){var l=p[0],d=p[1];l.parentNode&&l.parentNode.parentNode==d.parentNode?d.remove():l.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(wr)return;wr=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||zn(this.view),this.currentSelection.set(e))}},br.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;ri.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function _r(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Tr(t,e,n,r,o){return Nr(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 ie&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(ie.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(_r(t,ie.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&ie.isSelectable(r))&&(_r(t,new ie(n),"pointer"),!0)}(t,n))}function Ar(t,e,n,r){return Nr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function Er(t,e,n,r){return Nr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(_r(t,re.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)_r(t,re.create(n,s+1,s+1+i.content.size),"pointer");else{if(!ie.isSelectable(i))continue;_r(t,ie.create(n,s),"pointer")}return!0}}(t,n)}function Vr(t){return Pr(t)}xr.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!zr(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!Se.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||nr(t,e)?e.preventDefault():Mr(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,je(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},xr.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},xr.keypress=function(t,e){if(!(zr(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||Se.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof re&&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 Dr=Se.mac?"metaKey":"ctrlKey";kr.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=Vr(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[Dr]&&("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(Cr(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Rr(t,i,e,n)):("doubleClick"==o?Ar:Er)(t,i.pos,i.inside,e)?e.preventDefault():Mr(t,"pointer"))};var Rr=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Dr],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,p=c?t.docView.nearestDesc(c,!0):null;this.target=p?p.dom:null,(o.type.spec.draggable&&!1!==o.type.spec.selectable||t.state.selection instanceof ie&&i==t.state.selection.from)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&Se.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(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Mr(t,"pointer")};function zr(t,e){return!!t.composing||!!(Se.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Rr.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},Rr.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(Cr(t))),this.allowDefault||!e?Mr(this.view,"pointer"):Tr(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||Se.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||Se.chrome&&!(this.view.state.selection instanceof re)&&(e.pos==this.view.state.selection.from||e.pos==this.view.state.selection.to)?(_r(this.view,te.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Mr(this.view,"pointer")}},Rr.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),Mr(this.view,"pointer"),0==t.buttons&&this.done()},kr.touchdown=function(t){Vr(t),Mr(t,"pointer")},kr.contextmenu=function(t){return Vr(t)};var Ir=Se.android?5e3:-1;function Br(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Pr(t)}),e))}function Lr(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Pr(t,e){if(t.domObserver.forceFlush(),Lr(t),e||t.docView.dirty){var n=Dn(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}xr.compositionstart=xr.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(),Pr(t,!0),t.markCursor=null;else if(Pr(t),Se.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Br(t,Ir)},xr.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Br(t,20))};var jr=Se.ie&&Se.ie_version<15||Se.ios&&Se.webkit_version<604;function $r(t,e,n,r){var o=cr(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||u.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),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}kr.copy=xr.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=jr?null:e.clipboardData,i=ar(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){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,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},xr.paste=function(t,e){var n=jr?null:e.clipboardData;n&&$r(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?$r(t,r.value,null,e):$r(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Fr=function(t,e){this.slice=t,this.move=e},Hr=Se.mac?"altKey":"ctrlKey";for(var qr in kr.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(Cr(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof ie?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=ar(t,s),c=a.dom,p=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(jr?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",jr||e.dataTransfer.setData("text/plain",p),t.dragging=new Fr(s,!e[Hr])}},kr.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},xr.dragover=xr.dragenter=function(t,e){return e.preventDefault()},xr.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(Cr(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice||cr(t,e.dataTransfer.getData(jr?"Text":"text/plain"),jr?null:e.dataTransfer.getData("text/html"),!1,o),s=n&&!e[Hr];if(t.someProp("handleDrop",(function(n){return n(t,e,i||u.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?Pt(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var p=c.mapping.map(a),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=c.doc;if(l?c.replaceRangeWith(p,p,i.content.firstChild):c.replaceRange(p,p,i),!c.doc.eq(d)){var h=c.doc.resolve(p);if(l&&ie.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ie(h));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Fn(t,h,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},kr.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())&&zn(t)}),20))},kr.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},kr.beforeinput=function(t,e){if(Se.chrome&&Se.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,je(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)}},xr)kr[qr]=xr[qr];function Jr(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 Wr=function(t,e){this.spec=e||Qr,this.side=this.spec.side||0,this.toDOM=t};Wr.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 Gr(i-n,i-n,this)},Wr.prototype.valid=function(){return!0},Wr.prototype.eq=function(t){return this==t||t instanceof Wr&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Jr(this.spec,t.spec))};var Ur=function(t,e){this.spec=e||Qr,this.attrs=t};Ur.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 Gr(o,i,this)},Ur.prototype.valid=function(t,e){return e.from=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;at){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Zr.prototype.map=function(t,e,n){return this==to||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Qr)},Zr.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;sc+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(p=r-n-(e-t))&&(a[s]+=p,a[s+1]+=p))}},p=0;p=r.content.size){l=!0;continue}var f=n.map(t[d+1]+i,-1)-o,m=r.content.findIndex(h),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==h&&g+y.nodeSize==f){var b=a[d+2].mapInner(n,y,u+1,t[d]+i+1,s);b!=to?(a[d]=h,a[d+1]=f,a[d+2]=b):(a[d+1]=-2,l=!0)}else l=!0}if(l){var w=io(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;is&&p.to=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;ai&&c.type instanceof Ur){var p=Math.max(i,c.from)-i,l=Math.min(s,c.to)-i;pn&&s.to0;)e++;t.splice(e,0,n)}function po(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=to&&e.push(r)})),t.cursorWrapper&&e.push(Zr.create(t.state.doc,[t.cursorWrapper.deco])),eo.from(e)}eo.prototype.forChild=function(t,e){if(e.isLeaf)return Zr.empty;for(var n=[],r=0;rr.scrollToSelection?"to selection":"preserve",l=o||!this.docView.matchesNode(t.doc,c,a);!l&&t.selection.eq(r.selection)||(i=!0);var d,u,h,f,m,v,g,y,b,w,k,x="preserve"==p&&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,s=o+1;s=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Je(t.dom)}}(this);if(i){this.domObserver.stop();var M=l&&(Se.ie||Se.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(f=r.selection,m=t.selection,v=Math.min(f.$anchor.sharedDepth(f.head),m.$anchor.sharedDepth(m.head)),f.$anchor.start(v)!=m.$anchor.start(v));if(l){var S=Se.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=gn(t.doc,c,a,this.dom,this)),S&&!this.trackWrites&&(M=!0)}M||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(d=this,u=d.docView.domFromPos(d.state.selection.anchor,0),h=d.root.getSelection(),Re(u.node,u.offset,h.anchorNode,h.anchorOffset)))?zn(this,M):(jn(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==p)this.dom.scrollTop=0;else if("to selection"==p){var O=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof ie?qe(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),O):qe(this,this.coordsAtPos(t.selection.head,1),O))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,We(w,0==k?0:k-b))},lo.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},lo.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},bo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),wo="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),ko="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),xo="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Mo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),So=bo&&(xo||+bo[1]<57)||ko&&xo,Oo=0;Oo<10;Oo++)go[48+Oo]=go[96+Oo]=String(Oo);for(Oo=1;Oo<=24;Oo++)go[Oo+111]="F"+Oo;for(Oo=65;Oo<=90;Oo++)go[Oo]=String.fromCharCode(Oo+32),yo[Oo]=String.fromCharCode(Oo);for(var Co in go)yo.hasOwnProperty(Co)||(yo[Co]=go[Co]);var No="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function _o(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a127)&&(r=go[n.keyCode])&&r!=o){var a=e[To(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[To(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var Eo=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Vo(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,p=0;p0))return!1;var o=Po(r);if(!o){var i=r.blockRange(),s=i&&Rt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Xo(t,o,e))return!0;if(0==r.parent.content.size&&(Bo(a,"end")||ie.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Bo(a,"end")?te.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):ie.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}function Bo(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Lo(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=Po(o)}var s=i&&i.nodeBefore;return!(!s||!ie.isSelectable(s))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)}function Po(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 jo(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){var n=t.node(e);if(t.index(e)+11&&n.after()!=n.end(-1)){var r=n.before();if(Bt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Rt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}function Go(t,e){return e&&e(t.tr.setSelection(new ae(t.doc))),!0}function Xo(t,e,n){var r,o,s=e.nodeBefore,a=e.nodeAfter;if(s.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&&!Lt(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 c=e.parent.canReplace(e.index(),e.index()+1);if(c&&(r=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var p=e.pos+a.nodeSize,l=i.empty,d=r.length-1;d>=0;d--)l=i.from(r[d].create(null,l));l=i.from(s.copy(l));var h=t.tr.step(new Et(e.pos-1,p,e.pos,p,new u(l,1,0),r.length,!0)),f=p+2*r.length;Lt(h.doc,f)&&h.join(f),n(h.scrollIntoView())}return!0}var m=te.findFrom(e,1),v=m&&m.$from.blockRange(m.$to),g=v&&Rt(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(c&&a.isTextblock&&Bo(s,"end")){for(var y=s,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;if(y.canReplace(y.childCount,y.childCount,a.content)){if(n){for(var w=i.empty,k=b.length-1;k>=0;k--)w=i.from(b[k].copy(w));n(t.tr.step(new Et(e.pos-b.length,e.pos+a.nodeSize,e.pos+1,e.pos+a.nodeSize-1,new u(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Yo(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&zt(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function Qo(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o=2&&s.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==s.index(c.depth-1))return!1;var d=n.doc.resolve(c.start-2);l=new A(d,d,c.depth),c.endIndex=0;a--)s=i.from(n[a].type.create(n[a].attrs,s));t.step(new Et(e.start-(r?2:0),e.end,e.start,e.end,new u(s,0,0),n.length,!0));for(var c=0,p=0;pc;a--)s-=o.child(a).nodeSize,r.delete(s-1,s+1);var p=r.doc.resolve(n.start),l=p.nodeAfter,d=0==n.startIndex,h=n.endIndex==o.childCount,f=p.node(-1),m=p.index(-1);if(!f.canReplace(m+(d?0:1),m+1,l.content.append(h?i.empty:i.from(o))))return!1;var v=p.pos,g=v+l.nodeSize;return r.step(new Et(v-(d?1:0),g+(h?1:0),v+1,g-1,new u((d?i.empty:i.from(o.copy(i.empty))).append(h?i.empty:i.from(o.copy(i.empty))),d?0:1,h?0:1),d?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}function ei(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ni(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ri(t,e){const n=ni(e,t.schema),{from:r,to:o}=t.selection;let i=[];t.doc.nodesBetween(r,o,(t=>{i=[...i,t]}));const s=i.reverse().find((t=>t.type.name===n.name));return s?__assign({},s.attrs):{}}function oi(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function ii(t,e){const n=oi(e,t.schema),{from:r,to:o,empty:i}=t.selection;let s=[];i?s=t.selection.$head.marks():t.doc.nodesBetween(r,o,(t=>{s=[...s,...t.marks]}));const a=s.find((t=>t.type.name===n.name));return a?__assign({},a.attrs):{}}function si(t,e){const n=Object.keys(e);return!n.length||!!n.filter((n=>e[n]===t[n])).length}function ai(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?ni(e,t.schema):null;let a=[];if(t.doc.nodesBetween(r,o,((t,e)=>{if(!t.isText){const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a=[...a,{node:t,from:n,to:i}]}})),i)return!!a.filter((t=>!s||s.name===t.node.type.name)).find((t=>si(t.node.attrs,n)));const c=o-r;return a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>si(t.node.attrs,n))).reduce(((t,e)=>t+(e.to-e.from)),0)>=c}function ci(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?oi(e,t.schema):null;if(i)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!s||s.name===t.type.name)).find((t=>si(t.attrs,n)));let a=0,c=[];if(t.doc.nodesBetween(r,o,((t,e)=>{if(t.isText){const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a+=i-n,c=[...c,...t.marks.map((t=>({mark:t,from:n,to:i})))]}})),0===a)return!1;return c.filter((t=>!s||s.name===t.mark.type.name)).filter((t=>si(t.mark.attrs,n))).reduce(((t,e)=>t+(e.to-e.from)),0)>=a}function pi(t){return(new window.DOMParser).parseFromString(t,"text/html").body}function li(t,e,n){if(n=__assign({slice:!0,parseOptions:{}},n),"object"==typeof t&&null!==t)try{return Array.isArray(t)?i.fromArray(t.map((t=>e.nodeFromJSON(t)))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),li("",e,n)}if("string"==typeof t){const r=ot.fromSchema(e);return n.slice?r.parseSlice(pi(t),n.parseOptions).content:r.parse(pi(t),n.parseOptions)}return li("",e,n)}function di(t,e,n={}){return li(t,e,{slice:!1,parseOptions:n})}Qo(qo,Uo,Ko,(function(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof ie&&t.selection.node.isBlock)return!(!r.parentOffset||!Bt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var s=o.parentOffset==o.parent.content.size,a=t.tr;(t.selection instanceof re||t.selection instanceof ae)&&a.deleteSelection();var c=0==r.depth?null:Jo(r.node(-1).contentMatchAt(r.indexAfter(-1))),p=s&&c?[{type:c}]:null,l=Bt(a.doc,a.mapping.map(r.pos),1,p);p||l||!Bt(a.doc,a.mapping.map(r.pos),1,c&&[{type:c}])||(p=[{type:c}],l=!0),l&&(a.split(a.mapping.map(r.pos),1,p),s||r.parentOffset||r.parent.type==c||!r.node(-1).canReplace(r.index(-1),r.indexAfter(-1),i.from([c.create(),r.parent]))||a.setNodeMarkup(a.mapping.map(r.before()),c)),e(a.scrollIntoView())}return!0})),"undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&os.platform();class ui{constructor(t,e){this.editor=t,this.commands=e}createCommands(){const{commands:t,editor:e}=this,{state:n,view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(i);return o.getMeta("preventDispatch")||r.dispatch(o),n}])))}createChain(t,e=!0){const{commands:n,editor:r}=this,{state:o,view:i}=r,s=[],a=!!t,c=t||o.tr,p=__assign(__assign({},Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const r=this.buildProps(c,e),o=n(...t)(r);return s.push(o),p}])))),{run:()=>(a||!e||c.getMeta("preventDispatch")||i.dispatch(c),s.every((t=>!0===t)))});return p}createCan(t){const{commands:e,editor:n}=this,{state:r}=n,o=void 0,i=t||r.tr,s=this.buildProps(i,o),a=Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)(__assign(__assign({},s),{dispatch:o}))])));return __assign(__assign({},a),{chain:()=>this.createChain(i,o)})}buildProps(t,e=!0){const{editor:n,commands:r}=this,{state:o,view:i}=n;o.storedMarks&&t.setStoredMarks(o.storedMarks);const s={tr:t,editor:n,view:i,state:this.chainableState(t,o),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}chainableState(t,e){let{selection:n}=t,{doc:r}=t,{storedMarks:o}=t;return __assign(__assign({},e),{schema:e.schema,plugins:e.plugins,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return n},get doc(){return r},get tr(){return n=t.selection,r=t.doc,o=t.storedMarks,t}})}}function hi(t,e,n={}){if(void 0===t.config[e]&&t.parent)return hi(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind(__assign(__assign({},n),{parent:t.parent?hi(t.parent,e,n):null}))}return t.config[e]}function fi(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function mi(t){const e=[],{nodeExtensions:n,markExtensions:r}=fi(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return t.forEach((t=>{const n=hi(t,"addGlobalAttributes",{name:t.name,options:t.options});if(!n)return;n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,r])=>{e.push({type:n,name:t,attribute:__assign(__assign({},i),r)})}))}))}))})),o.forEach((t=>{const n={name:t.name,options:t.options},r=hi(t,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{e.push({type:t.name,name:n,attribute:__assign(__assign({},i),r)})}))})),e}function vi(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n=__assign({},t);return Object.entries(e).forEach((([t,e])=>{n[t]?n[t]="class"===t?[n[t],e].join(" "):"style"===t?[n[t],e].join("; "):e:n[t]=e})),n}),{})}function gi(t,e){return e.filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>vi(t,e)),{})}function yi(t,e){return t.style?t:__assign(__assign({},t),{getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.filter((t=>t.attribute.rendered)).reduce(((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n)||{}:{[e.name]:(o=n.getAttribute(e.name),"string"!=typeof o?o:o.match(/^\d*(\.\d+)?$/)?Number(o):"true"===o||"false"!==o&&o)};var o;const i=Object.fromEntries(Object.entries(r).filter((([,t])=>null!=t)));return __assign(__assign({},t),i)}),{});return __assign(__assign({},r),o)}})}function bi(t,e,...n){return"function"==typeof t?e?t.bind(e)(...n):t(...n):t}function wi(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e)))}function ki(t,e){return e.nodes[t]?e.nodes[t]:e.marks[t]?e.marks[t]:null}class xi{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=xi.resolve(t),this.schema=function(t){var e;const n=mi(t),{nodeExtensions:r,markExtensions:o}=fi(t),i=null===(e=r.find((t=>hi(t,"topNode"))))||void 0===e?void 0:e.name,s=Object.fromEntries(r.map((e=>{const r=n.filter((t=>t.type===e.name)),o={name:e.name,options:e.options},i=t.reduce(((t,n)=>{const r=hi(n,"extendNodeSchema",o);return __assign(__assign({},t),r?r(e):{})}),{}),s=wi(__assign(__assign({},i),{content:bi(hi(e,"content",o)),marks:bi(hi(e,"marks",o)),group:bi(hi(e,"group",o)),inline:bi(hi(e,"inline",o)),atom:bi(hi(e,"atom",o)),selectable:bi(hi(e,"selectable",o)),draggable:bi(hi(e,"draggable",o)),code:bi(hi(e,"code",o)),defining:bi(hi(e,"defining",o)),isolating:bi(hi(e,"isolating",o)),attrs:Object.fromEntries(r.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))})),a=bi(hi(e,"parseHTML",o));a&&(s.parseDOM=a.map((t=>yi(t,r))));const c=hi(e,"renderHTML",o);return c&&(s.toDOM=t=>c({node:t,HTMLAttributes:gi(t,r)})),[e.name,s]}))),a=Object.fromEntries(o.map((e=>{const r=n.filter((t=>t.type===e.name)),o={name:e.name,options:e.options},i=t.reduce(((t,n)=>{const r=hi(n,"extendMarkSchema",o);return __assign(__assign({},t),r?r(e):{})}),{}),s=wi(__assign(__assign({},i),{inclusive:bi(hi(e,"inclusive",o)),excludes:bi(hi(e,"excludes",o)),group:bi(hi(e,"group",o)),spanning:bi(hi(e,"spanning",o)),attrs:Object.fromEntries(r.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))})),a=bi(hi(e,"parseHTML",o));a&&(s.parseDOM=a.map((t=>yi(t,r))));const c=hi(e,"renderHTML",o);return c&&(s.toDOM=t=>c({mark:t,HTMLAttributes:gi(t,r)})),[e.name,s]})));return new nt({topNode:i,nodes:s,marks:a})}(this.extensions),this.extensions.forEach((t=>{var e;const n={name:t.name,options:t.options,editor:this.editor,type:ki(t.name,this.schema)};if("mark"===t.type){(null===(e=bi(hi(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const r=hi(t,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const o=hi(t,"onCreate",n);o&&this.editor.on("create",o);const i=hi(t,"onUpdate",n);i&&this.editor.on("update",i);const s=hi(t,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);const a=hi(t,"onTransaction",n);a&&this.editor.on("transaction",a);const c=hi(t,"onFocus",n);c&&this.editor.on("focus",c);const p=hi(t,"onBlur",n);p&&this.editor.on("blur",p);const l=hi(t,"onDestroy",n);l&&this.editor.on("destroy",l)}))}static resolve(t){return xi.sort(xi.flatten(t))}static flatten(t){return t.map((t=>{const e=hi(t,"addExtensions",{name:t.name,options:t.options});return e?this.flatten(e()):t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=hi(t,"priority")||100,r=hi(e,"priority")||100;return n>r?-1:n{const n=hi(e,"addCommands",{name:e.name,options:e.options,editor:this.editor,type:ki(e.name,this.schema)});return n?__assign(__assign({},t),n()):t}),{})}get plugins(){return[...this.extensions].reverse().map((t=>{const e={name:t.name,options:t.options,editor:this.editor,type:ki(t.name,this.schema)},n=[],r=hi(t,"addKeyboardShortcuts",e);if(r){const t=function(t){return new we({props:{handleKeyDown:Ao(t)}})}(Object.fromEntries(Object.entries(r()).map((([t,e])=>[t,()=>e({editor:this.editor})]))));n.push(t)}const o=hi(t,"addInputRules",e);if(this.editor.options.enableInputRules&&o){const t=o(),e=t.length?[(i={rules:t},s=i.rules,a=new we({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,e,n,r){return Vo(t,e,n,r,s,a)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var e=t.state.selection.$cursor;e&&Vo(t,e.pos,e.pos,"",s,a)}))}}},isInputRules:!0}),a)]:[];n.push(...e)}var i,s,a;const c=hi(t,"addPasteRules",e);if(this.editor.options.enablePasteRules&&c){const t=c();n.push(...t)}const p=hi(t,"addProseMirrorPlugins",e);if(p){const t=p();n.push(...t)}return n})).flat()}get attributes(){return mi(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter((t=>!!hi(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,editor:t,type:ni(e.name,this.schema)},o=hi(e,"addNodeView",r);if(!o)return[];return[e.name,(r,i,s,a)=>{const c=gi(r,n);return o()({editor:t,node:r,getPos:s,decorations:a,HTMLAttributes:c,extension:e})}]})))}get textSerializers(){const{editor:t}=this,{nodeExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter((t=>!!hi(t,"renderText"))).map((e=>{const n=hi(e,"renderText",{name:e.name,options:e.options,editor:t,type:ni(e.name,this.schema)});if(!n)return[];return[e.name,t=>n(t)]})))}}function Mi(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function Si(t,e){const n=__assign({},t);return Mi(t)&&Mi(e)&&Object.keys(e).forEach((r=>{Mi(e[r])?r in t?n[r]=Si(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})})),n}class Oi{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Oi(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new Oi(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}const Ci=Oi.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Me("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{from:e,to:n}=t.state.selection;return((t,e,n,r,o)=>{let i="",s=!0;return t.state.doc.nodesBetween(e,n,((a,c)=>{var p;const l=t.extensionManager.textSerializers[a.type.name];l?(i+=l({node:a}),s=!r):a.isText?(i+=null===(p=null==a?void 0:a.text)||void 0===p?void 0:p.slice(Math.max(e,c)-c,n-c),s=!r):a.isLeaf&&o?(i+=o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)}),0),i})(t,e,n,"\n")}}})]}});var Ni=Object.freeze({__proto__:null,blur:()=>({view:t})=>(t.dom.blur(),!0)});var _i=Object.freeze({__proto__:null,clearContent:(t=!1)=>({commands:e})=>e.setContent("",t)});var Ti=Object.freeze({__proto__:null,clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return o.forEach((r=>{t.doc.nodesBetween(r.$from.pos,r.$to.pos,((r,o)=>{if(!r.type.isText){const i=e.doc.resolve(e.mapping.map(o+1)),s=e.doc.resolve(e.mapping.map(o+r.nodeSize-1)),a=i.blockRange(s);if(a){const o=Rt(a);r.type.isTextblock&&n&&e.setNodeMarkup(a.start,t.doc.type.contentMatch.defaultType),(o||0===o)&&n&&e.lift(a,o)}}}))})),!0}});var Ai=Object.freeze({__proto__:null,command:t=>e=>t(e)});var Ei=Object.freeze({__proto__:null,createParagraphNear:()=>({state:t,dispatch:e})=>Uo(t,e)});var Vi=Object.freeze({__proto__:null,deleteRange:t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0}});var Di=Object.freeze({__proto__:null,deleteSelection:()=>({state:t,dispatch:e})=>zo(t,e)});var Ri=Object.freeze({__proto__:null,enter:()=>({commands:t})=>t.keyboardShortcut("Enter")});var zi=Object.freeze({__proto__:null,exitCode:()=>({state:t,dispatch:e})=>Wo(t,e)});function Ii(t,e){if(!t||!e)return;const n=t.parent.childAfter(t.parentOffset);if(!n.node)return;const r=n.node.marks.find((t=>t.type===e));if(!r)return;let o=t.index(),i=t.start()+n.offset,s=o+1,a=i+n.node.nodeSize;for(;o>0&&r.isInSet(t.parent.child(o-1).marks);)o-=1,i-=t.parent.child(o).nodeSize;for(;s({tr:e,state:n,dispatch:r})=>{const o=oi(t,n.schema),{doc:i,selection:s}=e,{$from:a,empty:c}=s;if(c&&r){const t=Ii(a,o);if(t){const n=re.create(i,t.from,t.to);e.setSelection(n)}}return!0}});var Li=Object.freeze({__proto__:null,first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t({editor:e,view:n,tr:r,dispatch:o})=>{if(n.hasFocus()&&null===t||!1===t)return!0;if(o&&null===t&&!ji(e.state.selection))return n.focus(),!0;const{from:i,to:s}=function(t,e=null){if(!e)return null;if("start"===e||!0===e)return{from:0,to:0};if("end"===e){const{size:e}=t.doc.content;return{from:e,to:e}}return{from:e,to:e}}(e.state,t)||e.state.selection,{doc:a,storedMarks:c}=r,p=Pi(i,0,a.content.size),l=Pi(s,0,a.content.size),d=re.create(a,p,l),u=e.state.selection.eq(d);return o&&(r.setSelection(d),u&&c&&r.setStoredMarks(c),n.focus()),!0}});var Fi=Object.freeze({__proto__:null,insertContent:t=>({tr:e,commands:n})=>n.insertContentAt({from:e.selection.from,to:e.selection.to},t)});var Hi=Object.freeze({__proto__:null,insertContentAt:(t,e)=>({tr:n,dispatch:r,editor:o})=>{if(r){const r=li(e,o.schema);n.replaceWith(t.from,t.to,r),function(t,e,n){const r=t.steps.length-1;if(r{0===s&&(s=r)})),t.setSelection(te.near(t.doc.resolve(s),n))}(n,n.steps.length-1,1)}return!0}});var qi=Object.freeze({__proto__:null,joinBackward:()=>({state:t,dispatch:e})=>Io(t,e)});var Ji=Object.freeze({__proto__:null,joinForward:()=>({state:t,dispatch:e})=>jo(t,e)});const Wi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);var Ui=Object.freeze({__proto__:null,keyboardShortcut:t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=function(t){const e=t.split(/-(?!$)/);let n,r,o,i,s=e[e.length-1];"Space"===s&&(s=" ");for(let a=0;a!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==c||c.steps.forEach((t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)})),!0}});var Ki=Object.freeze({__proto__:null,lift:(t,e={})=>({state:n,dispatch:r})=>!!ai(n,ni(t,n.schema),e)&&Ho(n,r)});var Gi=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:t,dispatch:e})=>Ko(t,e)});var Xi=Object.freeze({__proto__:null,liftListItem:t=>({state:e,dispatch:n})=>ti(ni(t,e.schema))(e,n)});var Yi=Object.freeze({__proto__:null,newlineInCode:()=>({state:t,dispatch:e})=>qo(t,e)});var Qi=Object.freeze({__proto__:null,replace:(t,e={})=>({state:n,commands:r})=>{console.warn("[tiptap warn]: replace() is deprecated. please use insertContent() instead.");const{from:o,to:i}=n.selection,s={from:o,to:i};return r.replaceRange(s,t,e)}});var Zi=Object.freeze({__proto__:null,replaceRange:(t,e,n={})=>({tr:r,state:o,dispatch:i})=>{console.warn("[tiptap warn]: replaceRange() is deprecated. please use insertContent() instead.");const s=ni(e,o.schema),{from:a,to:c}=t;return i&&r.replaceRangeWith(a,c,s.create(n)),!0}});function ts(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{})}var es=Object.freeze({__proto__:null,resetAttributes:(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ei("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=ni(t,r.schema)),"mark"===a&&(s=oi(t,r.schema)),o&&n.selection.ranges.forEach((t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,ts(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((o=>{s===o.type&&n.addMark(r,r+t.nodeSize,s.create(ts(o.attrs,e)))}))}))})),!0)}});var ns=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0)});var rs=Object.freeze({__proto__:null,selectAll:()=>({state:t,dispatch:e})=>Go(t,e)});var is=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:t,dispatch:e})=>Lo(t,e)});var ss=Object.freeze({__proto__:null,selectNodeForward:()=>({state:t,dispatch:e})=>$o(t,e)});var as=Object.freeze({__proto__:null,selectParentNode:()=>({state:t,dispatch:e})=>function(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(ie.create(t.doc,n))),!0)}(t,e)});var cs=Object.freeze({__proto__:null,setContent:(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=di(t,o.schema,n),c=re.create(s,0,s.content.size);return i&&r.setSelection(c).replaceSelectionWith(a,!1).setMeta("preventUpdate",!e),!0}});var ps=Object.freeze({__proto__:null,setMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,c=oi(t,r.schema);if(o)if(s){const t=ii(r,c);n.addStoredMark(c.create(__assign(__assign({},t),e)))}else a.forEach((t=>{const o=t.$from.pos,i=t.$to.pos;r.doc.nodesBetween(o,i,((t,r)=>{const s=Math.max(r,o),a=Math.min(r+t.nodeSize,i);t.marks.find((t=>t.type===c))?t.marks.forEach((t=>{c===t.type&&n.addMark(s,a,c.create(__assign(__assign({},t.attrs),e)))})):n.addMark(s,a,c.create(e))}))}));return!0}});var ls=Object.freeze({__proto__:null,setNode:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return(i=o,s=e,function(t,e){var n=t.selection,r=n.from,o=n.to,a=!1;return t.doc.nodesBetween(r,o,(function(e,n){if(a)return!1;if(e.isTextblock&&!e.hasMarkup(i,s))if(e.type==i)a=!0;else{var r=t.doc.resolve(n),o=r.index();a=r.parent.canReplaceWith(o,o+1,i)}})),!!a&&(e&&e(t.tr.setBlockType(r,o,i,s).scrollIntoView()),!0)})(n,r);var i,s}});var ds=Object.freeze({__proto__:null,setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Pi(t,0,n.content.size),o=ie.create(n,r);e.setSelection(o)}return!0}});var us=Object.freeze({__proto__:null,setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Pi(t.from,0,n.content.size),o=Pi(t.to,0,n.content.size),i=re.create(n,r,o);e.setSelection(i)}return!0}});var hs=Object.freeze({__proto__:null,sinkListItem:t=>({state:e,dispatch:n})=>{const r=ni(t,e.schema);return(o=r,function(t,e){var n=t.selection,r=n.$from,s=n.$to,a=r.blockRange(s,(function(t){return t.childCount&&t.firstChild.type==o}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var p=a.parent,l=p.child(c-1);if(l.type!=o)return!1;if(e){var d=l.lastChild&&l.lastChild.type==p.type,h=i.from(d?o.create():null),f=new u(i.from(o.create(null,i.from(p.type.create(null,h)))),d?3:1,0),m=a.start,v=a.end;e(t.tr.step(new Et(m-(d?3:1),v,m,v,f,1,!0)).scrollIntoView())}return!0})(e,n);var o}});function fs(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=t.find((t=>t.type===e&&t.name===n));return!!r&&r.attribute.keepOnSplit})))}function ms(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(r)}}var vs=Object.freeze({__proto__:null,splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:c,$to:p}=s,l=fs(o.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof ie&&s.node.isBlock)return!(!c.parentOffset||!Bt(a,c.pos))&&(r&&(t&&ms(n,o.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;if(r){const r=p.parentOffset===p.parent.content.size;s instanceof re&&e.deleteSelection();const a=0===c.depth?void 0:function(t){for(let e=0;e({tr:e,state:n,dispatch:r,editor:o})=>{var s;const a=ni(t,n.schema),{$from:c,$to:p}=n.selection,l=n.selection.node;if(l&&l.isBlock||c.depth<2||!c.sameParent(p))return!1;const d=c.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let t=i.empty;const n=c.index(-1)>0;for(let e=c.depth-(n?1:2);e>=c.depth-3;e-=1)t=i.from(c.node(e).copy(t));const r=fs(h,c.node().type.name,c.node().attrs),o=(null===(s=a.contentMatch.defaultType)||void 0===s?void 0:s.createAndFill(r))||void 0;t=t.append(i.from(a.createAndFill(null,o)||void 0)),e.replace(c.before(n?void 0:-1),c.after(-3),new u(t,n?3:2,2)).setSelection(re.near(e.doc.resolve(c.pos+(n?3:2)))).scrollIntoView()}return!0}const f=p.pos===c.end()?d.contentMatchAt(0).defaultType:null,m=fs(h,d.type.name,d.attrs),v=fs(h,c.node().type.name,c.node().attrs);e.delete(c.pos,p.pos);const g=f?[{type:a,attrs:m},{type:f,attrs:v}]:[{type:a,attrs:m}];return!!Bt(e.doc,c.pos,2)&&(r&&e.split(c.pos,2,g).scrollIntoView(),!0)}});function ys(t,e){const{nodeExtensions:n}=fi(e),r=n.find((e=>e.name===t));if(!r)return!1;const o=bi(hi(r,"group",{name:r.name,options:r.options}));return"string"==typeof o&&o.split(" ").includes("list")}var bs=Object.freeze({__proto__:null,toggleList:(t,e)=>({editor:n,tr:r,state:o,dispatch:i,chain:s,commands:a,can:c})=>{const{extensions:p}=n.options,l=ni(t,o.schema),d=ni(e,o.schema),{selection:u}=o,{$from:h,$to:f}=u,m=h.blockRange(f);if(!m)return!1;const v=(g=t=>ys(t.type.name,p),t=>function(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}(t.$from,g))(u);var g;if(m.depth>=1&&v&&m.depth-v.depth<=1){if(v.node.type===l)return a.liftListItem(d);if(ys(v.node.type.name,p)&&l.validContent(v.node.content)&&i)return r.setNodeMarkup(v.pos,l),!0}return c().wrapInList(l)?a.wrapInList(l):s().clearNodes().wrapInList(l).run()}});var ws=Object.freeze({__proto__:null,toggleMark:(t,e={})=>({state:n,commands:r})=>{const o=oi(t,n.schema);return ci(n,o,e)?r.unsetMark(o):r.setMark(o,e)}});var ks=Object.freeze({__proto__:null,toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const i=ni(t,r.schema),s=ni(e,r.schema);return ai(r,i,n)?o.setNode(s):o.setNode(i,n)}});var xs=Object.freeze({__proto__:null,toggleWrap:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return ai(n,o,e)?Ho(n,r):Yo(o,e)(n,r)}});var Ms=Object.freeze({__proto__:null,undoInputRule:()=>({state:t,dispatch:e})=>function(t,e){for(var n=t.plugins,r=0;r=0;c--)s.step(a.steps[c].invert(a.docs[c]));if(i.text){var p=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,p))}else s.delete(i.from,i.to);e(s)}return!0}}return!1}(t,e)});var Ss=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:t,state:e,dispatch:n})=>{const{selection:r}=t,{empty:o,ranges:i}=r;return o||n&&Object.entries(e.schema.marks).forEach((([,e])=>{i.forEach((n=>{t.removeMark(n.$from.pos,n.$to.pos,e)}))})),!0}});var Os=Object.freeze({__proto__:null,unsetMark:t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=e,i=oi(t,n.schema),{$from:s,empty:a,ranges:c}=o;if(r){if(a){let{from:t,to:n}=o;const r=Ii(s,i);r&&(t=r.from,n=r.to),e.removeMark(t,n,i)}else c.forEach((t=>{e.removeMark(t.$from.pos,t.$to.pos,i)}));e.removeStoredMark(i)}return!0}});var Cs=Object.freeze({__proto__:null,updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ei("string"==typeof t?t:t.name,r.schema);return!!a&&("node"===a&&(i=ni(t,r.schema)),"mark"===a&&(s=oi(t,r.schema)),o&&n.selection.ranges.forEach((t=>{const o=t.$from.pos,a=t.$to.pos;r.doc.nodesBetween(o,a,((t,r)=>{i&&i===t.type&&n.setNodeMarkup(r,void 0,__assign(__assign({},t.attrs),e)),s&&t.marks.length&&t.marks.forEach((i=>{if(s===i.type){const c=Math.max(r,o),p=Math.min(r+t.nodeSize,a);n.addMark(c,p,s.create(__assign(__assign({},i.attrs),e)))}}))}))})),!0)}});var Ns=Object.freeze({__proto__:null,wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const o=ni(t,n.schema);return!ai(n,o,e)&&Yo(o,e)(n,r)}});var _s=Object.freeze({__proto__:null,wrapInList:(t,e={})=>({state:n,dispatch:r})=>Zo(ni(t,n.schema),e)(n,r)});const Ts=Oi.create({name:"commands",addCommands:()=>__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({},Ni),_i),Ti),Ai),Ei),Vi),Di),Ri),zi),Bi),Li),$i),Fi),Hi),qi),Ji),Ui),Ki),Gi),Xi),Yi),Qi),Zi),es),ns),rs),is),ss),as),cs),ps),ls),ds),us),hs),vs),gs),bs),ws),ks),xs),Ms),Ss),Os),Cs),Ns),_s)}),As=Oi.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Me("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Es=Oi.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:new Me("focusEvents"),props:{attributes:{tabindex:"0"},handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Vs=Oi.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.joinForward(),()=>t.selectNodeForward()]));return{Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>t(),"Mod-Backspace":()=>t(),Delete:()=>e(),"Mod-Delete":()=>e()}}});var Ds=Object.freeze({__proto__:null,ClipboardTextSerializer:Ci,Commands:Ts,Editable:As,FocusEvents:Es,Keymap:Vs});class Rs{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Rs(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new Rs(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}class zs{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=__assign(__assign({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new zs(t)}configure(t={}){return this.options=Si(this.options,t),this}extend(t={}){const e=new zs(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,e.options=t.defaultOptions?t.defaultOptions:e.parent.options,e}}function Is(t,e,n){return new Eo(t,((t,r,o,i)=>{const s=n instanceof Function?n(r):n,{tr:a}=t;return r[0]&&a.replaceWith(o-1,i,e.create(s)),a}))}function Bs(t,e,n){return new Eo(t,((t,r,o,i)=>{const s=n instanceof Function?n(r):n,{tr:a}=t,c=r[r.length-1],p=r[0];let l=i;if(c){const n=p.search(/\S/),r=o+p.indexOf(c),d=r+c.length;if(function(t,e,n){let r=[];return n.doc.nodesBetween(t,e,((t,e)=>{r=[...r,...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n})))]})),r}(o,i,t).filter((t=>{const{excluded:n}=t.mark.type;return n.find((t=>t.name===e.name))})).filter((t=>t.to>r)).length)return null;do&&a.delete(o+n,r),l=o+n+c.length,a.addMark(o+n,l,e.create(s)),a.removeStoredMark(e)}return a}))}function Ls(t,e,n){const r=(o,s)=>{const a=[];return o.forEach((o=>{if(o.isText&&o.text){const{text:r}=o;let i,c=0;for(;null!==(i=t.exec(r));){const t=Math.max(i.length-2,0),r=Math.max(i.length-1,0);if(null==s?void 0:s.type.allowsMarkType(e)){const s=i.index+i[0].indexOf(i[t]),p=s+i[t].length,l=s+i[t].lastIndexOf(i[r]),d=l+i[r].length,u=n instanceof Function?n(i):n;s>0&&a.push(o.cut(c,s)),a.push(o.cut(l,d).mark(e.create(u).addToSet(o.marks))),c=p}}cnew u(r(t.content),t.openStart,t.openEnd)}})}function Ps(t,e,n){const r=document.createRange();return r.setEnd(t,"number"==typeof n?n:(t.nodeValue||"").length),r.setStart(t,Math.max(e||0,0)),r}function js(t,e){const n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}function $s(t,e,n=!1){const{node:r,offset:o}=t.domAtPos(e);let i=null,s=null;if(3===r.nodeType){const t=r.nodeValue||"";n&&op})}var Hs="top",qs="bottom",Js="right",Ws="left",Us="auto",Ks=[Hs,qs,Js,Ws],Gs="start",Xs="end",Ys="viewport",Qs="popper",Zs=Ks.reduce((function(t,e){return t.concat([e+"-"+Gs,e+"-"+Xs])}),[]),ta=[].concat(Ks,[Us]).reduce((function(t,e){return t.concat([e,e+"-"+Gs,e+"-"+Xs])}),[]),ea=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function na(t){return t?(t.nodeName||"").toLowerCase():null}function ra(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function oa(t){return t instanceof ra(t).Element||t instanceof Element}function ia(t){return t instanceof ra(t).HTMLElement||t instanceof HTMLElement}function sa(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ra(t).ShadowRoot||t instanceof ShadowRoot)}var aa={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},r=e.attributes[t]||{},o=e.elements[t];ia(o)&&na(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(t){var e=r[t];!1===e?o.removeAttribute(t):o.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var r=e.elements[t],o=e.attributes[t]||{},i=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});ia(r)&&na(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]};function ca(t){return t.split("-")[0]}function pa(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function la(t){var e=pa(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function da(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&sa(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ua(t){return ra(t).getComputedStyle(t)}function ha(t){return["table","td","th"].indexOf(na(t))>=0}function fa(t){return((oa(t)?t.ownerDocument:t.document)||window.document).documentElement}function ma(t){return"html"===na(t)?t:t.assignedSlot||t.parentNode||(sa(t)?t.host:null)||fa(t)}function va(t){return ia(t)&&"fixed"!==ua(t).position?t.offsetParent:null}function ga(t){for(var e=ra(t),n=va(t);n&&ha(n)&&"static"===ua(n).position;)n=va(n);return n&&("html"===na(n)||"body"===na(n)&&"static"===ua(n).position)?e:n||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&ia(t)&&"fixed"===ua(t).position)return null;for(var n=ma(t);ia(n)&&["html","body"].indexOf(na(n))<0;){var r=ua(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||e&&"filter"===r.willChange||e&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(t)||e}function ya(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var ba=Math.max,wa=Math.min,ka=Math.round;function xa(t,e,n){return ba(t,wa(e,n))}function Ma(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Sa(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var Oa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Ca(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.offsets,s=t.position,a=t.gpuAcceleration,c=t.adaptive,p=t.roundOffsets,l=!0===p?function(t){var e=t.x,n=t.y,r=window.devicePixelRatio||1;return{x:ka(ka(e*r)/r)||0,y:ka(ka(n*r)/r)||0}}(i):"function"==typeof p?p(i):i,d=l.x,u=void 0===d?0:d,h=l.y,f=void 0===h?0:h,m=i.hasOwnProperty("x"),v=i.hasOwnProperty("y"),g=Ws,y=Hs,b=window;if(c){var w=ga(n),k="clientHeight",x="clientWidth";w===ra(n)&&"static"!==ua(w=fa(n)).position&&(k="scrollHeight",x="scrollWidth"),w=w,o===Hs&&(y=qs,f-=w[k]-r.height,f*=a?1:-1),o===Ws&&(g=Js,u-=w[x]-r.width,u*=a?1:-1)}var M,S=Object.assign({position:s},c&&Oa);return a?Object.assign({},S,((M={})[y]=v?"0":"",M[g]=m?"0":"",M.transform=(b.devicePixelRatio||1)<2?"translate("+u+"px, "+f+"px)":"translate3d("+u+"px, "+f+"px, 0)",M)):Object.assign({},S,((e={})[y]=v?f+"px":"",e[g]=m?u+"px":"",e.transform="",e))}var Na={passive:!0};var _a={left:"right",right:"left",bottom:"top",top:"bottom"};function Ta(t){return t.replace(/left|right|bottom|top/g,(function(t){return _a[t]}))}var Aa={start:"end",end:"start"};function Ea(t){return t.replace(/start|end/g,(function(t){return Aa[t]}))}function Va(t){var e=ra(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Da(t){return pa(fa(t)).left+Va(t).scrollLeft}function Ra(t){var e=ua(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function za(t){return["html","body","#document"].indexOf(na(t))>=0?t.ownerDocument.body:ia(t)&&Ra(t)?t:za(ma(t))}function Ia(t,e){var n;void 0===e&&(e=[]);var r=za(t),o=r===(null==(n=t.ownerDocument)?void 0:n.body),i=ra(r),s=o?[i].concat(i.visualViewport||[],Ra(r)?r:[]):r,a=e.concat(s);return o?a:a.concat(Ia(ma(s)))}function Ba(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function La(t,e){return e===Ys?Ba(function(t){var e=ra(t),n=fa(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,s=0,a=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,a=r.offsetTop)),{width:o,height:i,x:s+Da(t),y:a}}(t)):ia(e)?function(t){var e=pa(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):Ba(function(t){var e,n=fa(t),r=Va(t),o=null==(e=t.ownerDocument)?void 0:e.body,i=ba(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=ba(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+Da(t),c=-r.scrollTop;return"rtl"===ua(o||n).direction&&(a+=ba(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:c}}(fa(t)))}function Pa(t,e,n){var r="clippingParents"===e?function(t){var e=Ia(ma(t)),n=["absolute","fixed"].indexOf(ua(t).position)>=0&&ia(t)?ga(t):t;return oa(n)?e.filter((function(t){return oa(t)&&da(t,n)&&"body"!==na(t)})):[]}(t):[].concat(e),o=[].concat(r,[n]),i=o[0],s=o.reduce((function(e,n){var r=La(t,n);return e.top=ba(r.top,e.top),e.right=wa(r.right,e.right),e.bottom=wa(r.bottom,e.bottom),e.left=ba(r.left,e.left),e}),La(t,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function ja(t){return t.split("-")[1]}function $a(t){var e,n=t.reference,r=t.element,o=t.placement,i=o?ca(o):null,s=o?ja(o):null,a=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case Hs:e={x:a,y:n.y-r.height};break;case qs:e={x:a,y:n.y+n.height};break;case Js:e={x:n.x+n.width,y:c};break;case Ws:e={x:n.x-r.width,y:c};break;default:e={x:n.x,y:n.y}}var p=i?ya(i):null;if(null!=p){var l="y"===p?"height":"width";switch(s){case Gs:e[p]=e[p]-(n[l]/2-r[l]/2);break;case Xs:e[p]=e[p]+(n[l]/2-r[l]/2)}}return e}function Fa(t,e){void 0===e&&(e={});var n=e,r=n.placement,o=void 0===r?t.placement:r,i=n.boundary,s=void 0===i?"clippingParents":i,a=n.rootBoundary,c=void 0===a?Ys:a,p=n.elementContext,l=void 0===p?Qs:p,d=n.altBoundary,u=void 0!==d&&d,h=n.padding,f=void 0===h?0:h,m=Ma("number"!=typeof f?f:Sa(f,Ks)),v=l===Qs?"reference":Qs,g=t.elements.reference,y=t.rects.popper,b=t.elements[u?v:l],w=Pa(oa(b)?b:b.contextElement||fa(t.elements.popper),s,c),k=pa(g),x=$a({reference:k,element:y,strategy:"absolute",placement:o}),M=Ba(Object.assign({},y,x)),S=l===Qs?M:k,O={top:w.top-S.top+m.top,bottom:S.bottom-w.bottom+m.bottom,left:w.left-S.left+m.left,right:S.right-w.right+m.right},C=t.modifiersData.offset;if(l===Qs&&C){var N=C[o];Object.keys(O).forEach((function(t){var e=[Js,qs].indexOf(t)>=0?1:-1,n=[Hs,qs].indexOf(t)>=0?"y":"x";O[t]+=N[n]*e}))}return O}function Ha(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function qa(t){return[Hs,Js,qs,Ws].some((function(e){return t[e]>=0}))}function Ja(t,e,n){void 0===n&&(n=!1);var r,o,i=fa(e),s=pa(t),a=ia(e),c={scrollLeft:0,scrollTop:0},p={x:0,y:0};return(a||!a&&!n)&&(("body"!==na(e)||Ra(i))&&(c=(r=e)!==ra(r)&&ia(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:Va(r)),ia(e)?((p=pa(e)).x+=e.clientLeft,p.y+=e.clientTop):i&&(p.x=Da(i))),{x:s.left+c.scrollLeft-p.x,y:s.top+c.scrollTop-p.y,width:s.width,height:s.height}}function Wa(t){var e=new Map,n=new Set,r=[];function o(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var r=e.get(t);r&&o(r)}})),r.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||o(t)})),r}var Ua={placement:"bottom",modifiers:[],strategy:"absolute"};function Ka(){for(var t=arguments.length,e=new Array(t),n=0;n=0?-1:1,i="function"==typeof n?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Ws,Js].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}(n,e.rects,i),t}),{}),a=s[e.placement],c=a.x,p=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=p),e.modifiersData[r]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0===s||s,c=n.fallbackPlacements,p=n.padding,l=n.boundary,d=n.rootBoundary,u=n.altBoundary,h=n.flipVariations,f=void 0===h||h,m=n.allowedAutoPlacements,v=e.options.placement,g=ca(v),y=c||(g===v||!f?[Ta(v)]:function(t){if(ca(t)===Us)return[];var e=Ta(t);return[Ea(t),e,Ea(e)]}(v)),b=[v].concat(y).reduce((function(t,n){return t.concat(ca(n)===Us?function(t,e){void 0===e&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,p=void 0===c?ta:c,l=ja(r),d=l?a?Zs:Zs.filter((function(t){return ja(t)===l})):Ks,u=d.filter((function(t){return p.indexOf(t)>=0}));0===u.length&&(u=d);var h=u.reduce((function(e,n){return e[n]=Fa(t,{placement:n,boundary:o,rootBoundary:i,padding:s})[ca(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:l,rootBoundary:d,padding:p,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),w=e.rects.reference,k=e.rects.popper,x=new Map,M=!0,S=b[0],O=0;O=0,A=T?"width":"height",E=Fa(e,{placement:C,boundary:l,rootBoundary:d,altBoundary:u,padding:p}),V=T?_?Js:Ws:_?qs:Hs;w[A]>k[A]&&(V=Ta(V));var D=Ta(V),R=[];if(i&&R.push(E[N]<=0),a&&R.push(E[V]<=0,E[D]<=0),R.every((function(t){return t}))){S=C,M=!1;break}x.set(C,R)}if(M)for(var z=function(t){var e=b.find((function(e){var n=x.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return S=e,"break"},I=f?3:1;I>0;I--){if("break"===z(I))break}e.placement!==S&&(e.modifiersData[r]._skip=!0,e.placement=S,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0!==s&&s,c=n.boundary,p=n.rootBoundary,l=n.altBoundary,d=n.padding,u=n.tether,h=void 0===u||u,f=n.tetherOffset,m=void 0===f?0:f,v=Fa(e,{boundary:c,rootBoundary:p,padding:d,altBoundary:l}),g=ca(e.placement),y=ja(e.placement),b=!y,w=ya(g),k="x"===w?"y":"x",x=e.modifiersData.popperOffsets,M=e.rects.reference,S=e.rects.popper,O="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,C={x:0,y:0};if(x){if(i||a){var N="y"===w?Hs:Ws,_="y"===w?qs:Js,T="y"===w?"height":"width",A=x[w],E=x[w]+v[N],V=x[w]-v[_],D=h?-S[T]/2:0,R=y===Gs?M[T]:S[T],z=y===Gs?-S[T]:-M[T],I=e.elements.arrow,B=h&&I?la(I):{width:0,height:0},L=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},P=L[N],j=L[_],$=xa(0,M[T],B[T]),F=b?M[T]/2-D-$-P-O:R-$-P-O,H=b?-M[T]/2+D+$+j+O:z+$+j+O,q=e.elements.arrow&&ga(e.elements.arrow),J=q?"y"===w?q.clientTop||0:q.clientLeft||0:0,W=e.modifiersData.offset?e.modifiersData.offset[e.placement][w]:0,U=x[w]+F-W-J,K=x[w]+H-W;if(i){var G=xa(h?wa(E,U):E,A,h?ba(V,K):V);x[w]=G,C[w]=G-A}if(a){var X="x"===w?Hs:Ws,Y="x"===w?qs:Js,Q=x[k],Z=Q+v[X],tt=Q-v[Y],et=xa(h?wa(Z,U):Z,Q,h?ba(tt,K):tt);x[k]=et,C[k]=et-Q}}e.modifiersData[r]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=ca(n.placement),c=ya(a),p=[Ws,Js].indexOf(a)>=0?"height":"width";if(i&&s){var l=function(t,e){return Ma("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Sa(t,Ks))}(o.padding,n),d=la(i),u="y"===c?Hs:Ws,h="y"===c?qs:Js,f=n.rects.reference[p]+n.rects.reference[c]-s[c]-n.rects.popper[p],m=s[c]-n.rects.reference[c],v=ga(i),g=v?"y"===c?v.clientHeight||0:v.clientWidth||0:0,y=f/2-m/2,b=l[u],w=g-d[p]-l[h],k=g/2-d[p]/2+y,x=xa(b,k,w),M=c;n.modifiersData[r]=((e={})[M]=x,e.centerOffset=x-k,e)}},effect:function(t){var e=t.state,n=t.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=e.elements.popper.querySelector(r)))&&da(e.elements.popper,r)&&(e.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=Fa(e,{elementContext:"reference"}),a=Fa(e,{altBoundary:!0}),c=Ha(s,r),p=Ha(a,o,i),l=qa(c),d=qa(p);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:p,isReferenceHidden:l,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":d})}}]}),Ya="tippy-content",Qa="tippy-arrow",Za="tippy-svg-arrow",tc={passive:!0,capture:!0};function ec(t,e,n){if(Array.isArray(t)){var r=t[e];return null==r?Array.isArray(n)?n[e]:n:r}return t}function nc(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function rc(t,e){return"function"==typeof t?t.apply(void 0,e):t}function oc(t,e){return 0===e?t:function(r){clearTimeout(n),n=setTimeout((function(){t(r)}),e)};var n}function ic(t){return[].concat(t)}function sc(t,e){-1===t.indexOf(e)&&t.push(e)}function ac(t){return[].slice.call(t)}function cc(){return document.createElement("div")}function pc(t){return["Element","Fragment"].some((function(e){return nc(t,e)}))}function lc(t){return pc(t)?[t]:function(t){return nc(t,"NodeList")}(t)?ac(t):Array.isArray(t)?t:ac(document.querySelectorAll(t))}function dc(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function uc(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function hc(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[r](e,n)}))}var fc={isTouch:!1},mc=0;function vc(){fc.isTouch||(fc.isTouch=!0,window.performance&&document.addEventListener("mousemove",gc))}function gc(){var t=performance.now();t-mc<20&&(fc.isTouch=!1,document.removeEventListener("mousemove",gc)),mc=t}function yc(){var t,e=document.activeElement;if((t=e)&&t._tippy&&t._tippy.reference===t){var n=e._tippy;e.blur&&!n.state.isVisible&&e.blur()}}var bc="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",wc=/MSIE |Trident\//.test(bc),kc=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),xc=Object.keys(kc);function Mc(t){var e=(t.plugins||[]).reduce((function(e,n){var r=n.name,o=n.defaultValue;return r&&(e[r]=void 0!==t[r]?t[r]:o),e}),{});return Object.assign({},t,{},e)}function Sc(t,e){var n=Object.assign({},e,{content:rc(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(Mc(Object.assign({},kc,{plugins:e}))):xc).reduce((function(e,n){var r=(t.getAttribute("data-tippy-"+n)||"").trim();if(!r)return e;if("content"===n)e[n]=r;else try{e[n]=JSON.parse(r)}catch(o){e[n]=r}return e}),{})}(t,e.plugins));return n.aria=Object.assign({},kc.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}function Oc(t,e){t.innerHTML=e}function Cc(t){var e=cc();return!0===t?e.className=Qa:(e.className=Za,pc(t)?e.appendChild(t):Oc(e,t)),e}function Nc(t,e){pc(e.content)?(Oc(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?Oc(t,e.content):t.textContent=e.content)}function _c(t){var e=t.firstElementChild,n=ac(e.children);return{box:e,content:n.find((function(t){return t.classList.contains(Ya)})),arrow:n.find((function(t){return t.classList.contains(Qa)||t.classList.contains(Za)})),backdrop:n.find((function(t){return t.classList.contains("tippy-backdrop")}))}}function Tc(t){var e=cc(),n=cc();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=cc();function o(n,r){var o=_c(e),i=o.box,s=o.content,a=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||Nc(s,t.props),r.arrow?a?n.arrow!==r.arrow&&(i.removeChild(a),i.appendChild(Cc(r.arrow))):i.appendChild(Cc(r.arrow)):a&&i.removeChild(a)}return r.className=Ya,r.setAttribute("data-state","hidden"),Nc(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props),{popper:e,onUpdate:o}}Tc.$$tippy=!0;var Ac=1,Ec=[],Vc=[];function Dc(t,e){var n,r,o,i,s,a,c,p,l,d=Sc(t,Object.assign({},kc,{},Mc((n=e,Object.keys(n).reduce((function(t,e){return void 0!==n[e]&&(t[e]=n[e]),t}),{}))))),u=!1,h=!1,f=!1,m=!1,v=[],g=oc(K,d.interactiveDebounce),y=Ac++,b=(l=d.plugins).filter((function(t,e){return l.indexOf(t)===e})),w={id:y,reference:t,popper:cc(),popperInstance:null,props:d,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)},setProps:function(e){if(w.state.isDestroyed)return;R("onBeforeUpdate",[w,e]),W();var n=w.props,r=Sc(t,Object.assign({},w.props,{},e,{ignoreAttributes:!0}));w.props=r,J(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),g=oc(K,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?ic(n.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):r.triggerTarget&&t.removeAttribute("aria-expanded");I(),D(),M&&M(n,r);w.popperInstance&&(Q(),tt().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})));R("onAfterUpdate",[w,e])},setContent:function(t){w.setProps({content:t})},show:function(){var t=w.state.isVisible,e=w.state.isDestroyed,n=!w.state.isEnabled,r=fc.isTouch&&!w.props.touch,o=ec(w.props.duration,0,kc.duration);if(t||e||n||r)return;if(T().hasAttribute("disabled"))return;if(R("onShow",[w],!1),!1===w.props.onShow(w))return;w.state.isVisible=!0,_()&&(x.style.visibility="visible");D(),$(),w.state.isMounted||(x.style.transition="none");if(_()){var i=E(),s=i.box,a=i.content;dc([s,a],0)}c=function(){var t;if(w.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=w.props.moveTransition,_()&&w.props.animation){var e=E(),n=e.box,r=e.content;dc([n,r],o),uc([n,r],"visible")}z(),I(),sc(Vc,w),null==(t=w.popperInstance)||t.forceUpdate(),w.state.isMounted=!0,R("onMount",[w]),w.props.animation&&_()&&function(t,e){H(t,e)}(o,(function(){w.state.isShown=!0,R("onShown",[w])}))}},function(){var t,e=w.props.appendTo,n=T();t=w.props.interactive&&e===kc.appendTo||"parent"===e?n.parentNode:rc(e,[n]);t.contains(x)||t.appendChild(x);Q()}()},hide:function(){var t=!w.state.isVisible,e=w.state.isDestroyed,n=!w.state.isEnabled,r=ec(w.props.duration,1,kc.duration);if(t||e||n)return;if(R("onHide",[w],!1),!1===w.props.onHide(w))return;w.state.isVisible=!1,w.state.isShown=!1,m=!1,u=!1,_()&&(x.style.visibility="hidden");if(B(),F(),D(),_()){var o=E(),i=o.box,s=o.content;w.props.animation&&(dc([i,s],r),uc([i,s],"hidden"))}z(),I(),w.props.animation?_()&&function(t,e){H(t,(function(){!w.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}(r,w.unmount):w.unmount()},hideWithInteractivity:function(t){A().addEventListener("mousemove",g),sc(Ec,g),g(t)},enable:function(){w.state.isEnabled=!0},disable:function(){w.hide(),w.state.isEnabled=!1},unmount:function(){w.state.isVisible&&w.hide();if(!w.state.isMounted)return;Z(),tt().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x);Vc=Vc.filter((function(t){return t!==w})),w.state.isMounted=!1,R("onHidden",[w])},destroy:function(){if(w.state.isDestroyed)return;w.clearDelayTimeouts(),w.unmount(),W(),delete t._tippy,w.state.isDestroyed=!0,R("onDestroy",[w])}};if(!d.render)return w;var k=d.render(w),x=k.popper,M=k.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+w.id,w.popper=x,t._tippy=w,x._tippy=w;var S=b.map((function(t){return t.fn(w)})),O=t.hasAttribute("aria-expanded");return J(),I(),D(),R("onCreate",[w]),d.showOnCreate&&et(),x.addEventListener("mouseenter",(function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(t){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&(A().addEventListener("mousemove",g),g(t))})),w;function C(){var t=w.props.touch;return Array.isArray(t)?t:[t,0]}function N(){return"hold"===C()[0]}function _(){var t;return!!(null==(t=w.props.render)?void 0:t.$$tippy)}function T(){return p||t}function A(){var t,e,n=T().parentNode;return n?(null==(e=ic(n)[0])||null==(t=e.ownerDocument)?void 0:t.body)?e.ownerDocument:document:document}function E(){return _c(x)}function V(t){return w.state.isMounted&&!w.state.isVisible||fc.isTouch||s&&"focus"===s.type?0:ec(w.props.delay,t?0:1,kc.delay)}function D(){x.style.pointerEvents=w.props.interactive&&w.state.isVisible?"":"none",x.style.zIndex=""+w.props.zIndex}function R(t,e,n){var r;(void 0===n&&(n=!0),S.forEach((function(n){n[t]&&n[t].apply(void 0,e)})),n)&&(r=w.props)[t].apply(r,e)}function z(){var e=w.props.aria;if(e.content){var n="aria-"+e.content,r=x.id;ic(w.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(n);if(w.state.isVisible)t.setAttribute(n,e?e+" "+r:r);else{var o=e&&e.replace(r,"").trim();o?t.setAttribute(n,o):t.removeAttribute(n)}}))}}function I(){!O&&w.props.aria.expanded&&ic(w.props.triggerTarget||t).forEach((function(t){w.props.interactive?t.setAttribute("aria-expanded",w.state.isVisible&&t===T()?"true":"false"):t.removeAttribute("aria-expanded")}))}function B(){A().removeEventListener("mousemove",g),Ec=Ec.filter((function(t){return t!==g}))}function L(t){if(!(fc.isTouch&&(f||"mousedown"===t.type)||w.props.interactive&&x.contains(t.target))){if(T().contains(t.target)){if(fc.isTouch)return;if(w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[w,t]);!0===w.props.hideOnClick&&(w.clearDelayTimeouts(),w.hide(),h=!0,setTimeout((function(){h=!1})),w.state.isMounted||F())}}function P(){f=!0}function j(){f=!1}function $(){var t=A();t.addEventListener("mousedown",L,!0),t.addEventListener("touchend",L,tc),t.addEventListener("touchstart",j,tc),t.addEventListener("touchmove",P,tc)}function F(){var t=A();t.removeEventListener("mousedown",L,!0),t.removeEventListener("touchend",L,tc),t.removeEventListener("touchstart",j,tc),t.removeEventListener("touchmove",P,tc)}function H(t,e){var n=E().box;function r(t){t.target===n&&(hc(n,"remove",r),e())}if(0===t)return e();hc(n,"remove",a),hc(n,"add",r),a=r}function q(e,n,r){void 0===r&&(r=!1),ic(w.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,n,r),v.push({node:t,eventType:e,handler:n,options:r})}))}function J(){var t;N()&&(q("touchstart",U,{passive:!0}),q("touchend",G,{passive:!0})),(t=w.props.trigger,t.split(/\s+/).filter(Boolean)).forEach((function(t){if("manual"!==t)switch(q(t,U),t){case"mouseenter":q("mouseleave",G);break;case"focus":q(wc?"focusout":"blur",X);break;case"focusin":q("focusout",X)}}))}function W(){v.forEach((function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)})),v=[]}function U(t){var e,n=!1;if(w.state.isEnabled&&!Y(t)&&!h){var r="focus"===(null==(e=s)?void 0:e.type);s=t,p=t.currentTarget,I(),!w.state.isVisible&&nc(t,"MouseEvent")&&Ec.forEach((function(e){return e(t)})),"click"===t.type&&(w.props.trigger.indexOf("mouseenter")<0||u)&&!1!==w.props.hideOnClick&&w.state.isVisible?n=!0:et(t),"click"===t.type&&(u=!n),n&&!r&&nt(t)}}function K(t){var e=t.target,n=T().contains(e)||x.contains(e);"mousemove"===t.type&&n||function(t,e){var n=e.clientX,r=e.clientY;return t.every((function(t){var e=t.popperRect,o=t.popperState,i=t.props.interactiveBorder,s=o.placement.split("-")[0],a=o.modifiersData.offset;if(!a)return!0;var c="bottom"===s?a.top.y:0,p="top"===s?a.bottom.y:0,l="right"===s?a.left.x:0,d="left"===s?a.right.x:0,u=e.top-r+c>i,h=r-e.bottom-p>i,f=e.left-n+l>i,m=n-e.right-d>i;return u||h||f||m}))}(tt().concat(x).map((function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:d}:null})).filter(Boolean),t)&&(B(),nt(t))}function G(t){Y(t)||w.props.trigger.indexOf("click")>=0&&u||(w.props.interactive?w.hideWithInteractivity(t):nt(t))}function X(t){w.props.trigger.indexOf("focusin")<0&&t.target!==T()||w.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||nt(t)}function Y(t){return!!fc.isTouch&&N()!==t.type.indexOf("touch")>=0}function Q(){Z();var e=w.props,n=e.popperOptions,r=e.placement,o=e.offset,i=e.getReferenceClientRect,s=e.moveTransition,a=_()?_c(x).arrow:null,p=i?{getBoundingClientRect:i,contextElement:i.contextElement||T()}:t,l=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(_()){var n=E().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];_()&&a&&l.push({name:"arrow",options:{element:a,padding:3}}),l.push.apply(l,(null==n?void 0:n.modifiers)||[]),w.popperInstance=Xa(p,x,Object.assign({},n,{placement:r,onFirstUpdate:c,modifiers:l}))}function Z(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function tt(){return ac(x.querySelectorAll("[data-tippy-root]"))}function et(t){w.clearDelayTimeouts(),t&&R("onTrigger",[w,t]),$();var e=V(!0),n=C(),o=n[0],i=n[1];fc.isTouch&&"hold"===o&&i&&(e=i),e?r=setTimeout((function(){w.show()}),e):w.show()}function nt(t){if(w.clearDelayTimeouts(),R("onUntrigger",[w,t]),w.state.isVisible){if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&u)){var e=V(!1);e?o=setTimeout((function(){w.state.isVisible&&w.hide()}),e):i=requestAnimationFrame((function(){w.hide()}))}}else F()}}function Rc(t,e){void 0===e&&(e={});var n=kc.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",vc,tc),window.addEventListener("blur",yc);var r=Object.assign({},e,{plugins:n}),o=lc(t).reduce((function(t,e){var n=e&&Dc(e,r);return n&&t.push(n),t}),[]);return pc(t)?o[0]:o}Rc.defaultProps=kc,Rc.setDefaultProps=function(t){Object.keys(t).forEach((function(e){kc[e]=t[e]}))},Rc.currentInput=fc,Object.assign({},aa,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),Rc.setDefaultProps({render:Tc});class zc{constructor({editor:t,element:e,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout((()=>this.update(this.editor.view)))},this.blurHandler=({event:t})=>{var e;this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null===(e=this.element.parentNode)||void 0===e?void 0:e.contains(t.relatedTarget))||this.hide()},this.editor=t,this.element=e,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(t={}){this.tippy=Rc(this.view.dom,__assign({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle"},t))}update(t,e){const{state:n,composing:r}=t,{doc:o,selection:i}=n,s=e&&e.doc.eq(o)&&e.selection.eq(i);if(r||s)return;const{empty:a,$anchor:c,ranges:p}=i,l=Math.min(...p.map((t=>t.$from.pos))),d=Math.max(...p.map((t=>t.$to.pos)));!a&&c.parent.textContent?(this.tippy.setProps({getReferenceClientRect:()=>Fs(t,l,d)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Ic=new Me("menuBubble"),Bc=t=>new we({key:Ic,view:e=>new zc(__assign({view:e},t))});Oi.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[Bc({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});class Lc{constructor({editor:t,element:e,view:n,tippyOptions:r}){this.preventHide=!1,this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout((()=>this.update(this.editor.view)))},this.blurHandler=({event:t})=>{var e;this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null===(e=this.element.parentNode)||void 0===e?void 0:e.contains(t.relatedTarget))||this.hide()},this.editor=t,this.element=e,this.view=n,this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.createTooltip(r),this.element.style.visibility="visible"}createTooltip(t={}){this.tippy=Rc(this.view.dom,__assign({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle"},t))}update(t,e){const{state:n,composing:r}=t,{doc:o,selection:i}=n,s=e&&e.doc.eq(o)&&e.selection.eq(i);if(r||s)return;const{$anchor:a,empty:c,from:p,to:l}=i,d=1===a.depth,u=!i.$anchor.parent.isLeaf&&!i.$anchor.parent.textContent;c&&(d&&u)?(this.tippy.setProps({getReferenceClientRect:()=>Fs(t,p,l)}),this.show()):this.hide()}show(){this.tippy.show()}hide(){this.tippy.hide()}destroy(){this.tippy.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Pc=new Me("menuFloating"),jc=t=>new we({key:Pc,view:e=>new Lc(__assign({view:e},t))});Oi.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{}},addProseMirrorPlugins(){return this.options.element?[jc({editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions})]:[]}});const $c=t.defineComponent({name:"BubbleMenu",props:{editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})}},setup(e,{slots:n}){const r=t.ref(null);return t.onMounted((()=>{const{editor:t,tippyOptions:n}=e;t.registerPlugin(Bc({editor:t,element:r.value,tippyOptions:n}))})),t.onBeforeUnmount((()=>{const{editor:t}=e;t.unregisterPlugin(Ic)})),()=>{var e;return t.h("div",{ref:r},null===(e=n.default)||void 0===e?void 0:e.call(n))}}});class Fc extends class extends class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}{constructor(t={}){super(),this.isFocused=!1,this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout((()=>{this.commands.focus(this.options.autofocus),this.emit("create",{editor:this})}),0)}get commands(){return this.commandManager.createCommands()}chain(){return this.commandManager.createChain()}can(){return this.commandManager.createCan()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(t){const e=document.createElement("style");return e.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(e),e}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}'))}setOptions(t={}){this.options=__assign(__assign({},this.options),t)}setEditable(t){this.setOptions({editable:t}),this.view&&this.state&&!this.isDestroyed&&this.view.updateState(this.state)}get isEditable(){return this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n="function"==typeof e?e(t,this.state.plugins):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(t){if(this.isDestroyed)return;const e="string"==typeof t?`${t}$`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter((t=>!t.key.startsWith(e)))});this.view.updateState(n)}createExtensionManager(){const t=[...Object.entries(Ds).map((([,t])=>t)),...this.options.extensions].filter((t=>["extension","node","mark"].includes(null==t?void 0:t.type)));this.extensionManager=new xi(t,this)}createCommandManager(){this.commandManager=new ui(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new lo(this.options.element,__assign(__assign({},this.options.editorProps),{dispatchTransaction:this.dispatchTransaction.bind(this),state:ve.create({doc:di(this.options.content,this.schema,this.options.parseOptions)})}));const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews();this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach((t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)})):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this});const r=t.getMeta("focus"),o=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event}),o&&this.emit("blur",{editor:this,event:o.event}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return function(t,e){const n=ei("string"==typeof e?e:e.name,t.schema);return"node"===n?ri(t,e):"mark"===n?ii(t,e):{}}(this.state,t)}getNodeAttributes(t){return console.warn("[tiptap warn]: editor.getNodeAttributes() is deprecated. please use editor.getAttributes() instead."),ri(this.state,t)}getMarkAttributes(t){return console.warn("[tiptap warn]: editor.getMarkAttributes() is deprecated. please use editor.getAttributes() instead."),ii(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,r="string"==typeof t?e:t;return function(t,e,n={}){if(!e)return ai(t,null,n)||ci(t,null,n);const r=ei(e,t.schema);return"node"===r?ai(t,e,n):"mark"===r&&ci(t,e,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return function(t,e){const n=mt.fromSchema(e).serializeFragment(t.content),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}(this.state.doc,this.schema)}get isEmpty(){return function(t){var e;const n=null===(e=t.type.createAndFill())||void 0===e?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){var t;this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),(t=this.css)&&t.parentNode&&t.parentNode.removeChild(t)}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}}{constructor(e={}){var n;return super(e),this.vueRenderers=t.reactive(new Map),this.contentComponent=null,this.reactiveState=(n=this.view.state,t.customRef(((t,e)=>({get:()=>(t(),n),set(t){n=t,requestAnimationFrame((()=>{requestAnimationFrame((()=>{e()}))}))}})))),this.on("transaction",(()=>{this.reactiveState.value=this.view.state})),t.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}registerPlugin(t,e){super.registerPlugin(t,e),this.reactiveState.value=this.view.state}unregisterPlugin(t){super.unregisterPlugin(t),this.reactiveState.value=this.view.state}}const Hc=t.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const n=t.ref(),r=t.getCurrentInstance();return t.watchEffect((()=>{const o=e.editor;o&&o.options.element&&n.value&&t.nextTick((()=>{if(!n.value||!o.options.element.firstChild)return;const e=t.unref(n.value);n.value.appendChild(o.options.element.firstChild),o.contentComponent=r.ctx._,o.setOptions({element:e}),o.createNodeViews()}))})),t.onBeforeUnmount((()=>{const t=e.editor;if(t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild)return;const n=document.createElement("div");n.appendChild(t.options.element.firstChild),t.setOptions({element:n})})),{rootEl:n}},render(){const e=[];return this.editor&&this.editor.vueRenderers.forEach((n=>{const r=t.h(t.Teleport,{to:n.teleportElement,key:n.id},t.h(n.component,__assign({ref:n.id},n.props)));e.push(r)})),t.h("div",{ref:t=>{this.rootEl=t}},...e)}});t.defineComponent({name:"FloatingMenu",props:{editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})}},setup(e,{slots:n}){const r=t.ref(null);return t.onMounted((()=>{const{editor:t,tippyOptions:n}=e;t.registerPlugin(jc({editor:t,element:r.value,tippyOptions:n}))})),t.onBeforeUnmount((()=>{const{editor:t}=e;t.unregisterPlugin(Pc)})),()=>{var e;return t.h("div",{ref:r},null===(e=n.default)||void 0===e?void 0:e.call(n))}}}),t.defineComponent({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var e,n;return t.h(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragStart:this.onDragStart},null===(n=(e=this.$slots).default)||void 0===n?void 0:n.call(e))}}),t.defineComponent({props:{as:{type:String,default:"div"}},render(){return t.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const qc=/^```(?[a-z]*)? $/,Jc=/^~~~(?[a-z]*)? $/,Wc=Rs.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const n=null===(e=t.firstElementChild)||void 0===e?void 0:e.getAttribute("class");if(!n)return null;const r=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:n.replace(r,"")}},renderHTML:t=>t.language?{class:this.options.languageClassPrefix+t.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:t}){return["pre",this.options.HTMLAttributes,["code",t,0]]},addCommands:()=>({setCodeBlock:t=>({commands:e})=>e.setNode("codeBlock",t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode("codeBlock","paragraph",t)}),addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=1===e.pos;return!(!t||e.parent.type.name!==this.name)&&(!(!n&&e.parent.textContent.length)&&this.editor.commands.clearNodes())}}},addInputRules(){return[Ro(qc,this.type,(({groups:t})=>t)),Ro(Jc,this.type,(({groups:t})=>t))]}}),Uc=zs.create({name:"underline",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("underline")&&{}}],renderHTML({HTMLAttributes:t}){return["u",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setUnderline:()=>({commands:t})=>t.setMark("underline"),toggleUnderline:()=>({commands:t})=>t.toggleMark("underline"),unsetUnderline:()=>({commands:t})=>t.unsetMark("underline")}),addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline()}}});function Kc(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 a=Kc(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function Gc(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 s=t.child(--o),a=e.child(--i),c=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var p=0,l=Math.min(s.text.length,a.text.length);pt&&!1!==n(a,r+s,o,i)&&a.content.size){var p=s+1;a.nodesBetween(Math.max(0,t-p),Math.min(a.content.size,e-p),n,r+p)}s=c}},Xc.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},Xc.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},Xc.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);ot)for(var o=0,i=0;it&&((ie)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Xc(n,r)},Xc.prototype.cutByIndex=function(t,e){return t==e?Xc.empty:0==t&&e==this.content.length?this:new Xc(this.content.slice(t,e))},Xc.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 Xc(r,o)},Xc.prototype.addToStart=function(t){return new Xc([t].concat(this.content),this.size+t.nodeSize)},Xc.prototype.addToEnd=function(t){return new Xc(this.content.concat(t),this.size+t.nodeSize)},Xc.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.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?Zc(n+1,o):Zc(n,r);r=o}},Xc.prototype.toString=function(){return"<"+this.toStringInner()+">"},Xc.prototype.toStringInner=function(){return this.content.join(", ")},Xc.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},Xc.fromJSON=function(t,e){if(!e)return Xc.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new Xc(e.map(t.nodeFromJSON))},Xc.fromArray=function(t){if(!t.length)return Xc.empty;for(var e,n=0,r=0;rthis.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},ep.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new np("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new np("Inconsistent open depths");return cp(t,e,n,0)}function cp(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(Xc.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return hp(i,fp(t,a.start,a.end,e,r))}var c=t.parent,p=c.content;return hp(c,p.cut(0,t.parentOffset).append(n.content).append(p.cut(e.parentOffset)))}return hp(i,mp(t,e,r))}function pp(t,e){if(!e.type.compatibleContent(t.type))throw new np("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){var r=t.node(n);return pp(r,e.node(n)),r}function dp(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 up(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(dp(t.nodeAfter,r),i++));for(var a=i;ao&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return up(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(pp(i,s),dp(hp(i,fp(t,e,n,r,o+1)),a)):(i&&dp(hp(i,mp(t,e,o+1)),a),up(e,n,o,a),s&&dp(hp(s,mp(n,r,o+1)),a)),up(r,null,o,a),new Xc(a)}function mp(t,e,n){var r=[];(up(null,t,n,r),t.depth>n)&&dp(hp(lp(t,e,n+1),mp(t,e,n+1)),r);return up(e,null,n,r),new Xc(r)}op.size.get=function(){return this.content.size-this.openStart-this.openEnd},rp.prototype.insertAt=function(t,e){var n=sp(this.content,t+this.openStart,e,null);return n&&new rp(n,this.openStart,this.openEnd)},rp.prototype.removeBetween=function(t,e){return new rp(ip(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},rp.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},rp.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},rp.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},rp.fromJSON=function(t,e){if(!e)return rp.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 rp(Xc.fromJSON(t,e.content),n,r)},rp.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 rp(t,n,r)},Object.defineProperties(rp.prototype,op),rp.empty=new rp(Xc.empty,0,0);var vp=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},gp={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};vp.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},gp.parent.get=function(){return this.node(this.depth)},gp.doc.get=function(){return this.node(0)},vp.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},vp.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},vp.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},vp.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},vp.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},vp.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]},vp.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},gp.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},gp.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},gp.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)},vp.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;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},vp.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new kp(this,t,n)},vp.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},vp.prototype.max=function(t){return t.pos>this.pos?t:this},vp.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,p=o-c;if(n.push(i,a,r+c),!p)break;if((i=i.child(a)).isText)break;o=p-1,r+=c+1}return new vp(e,n,o)},vp.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},Op.isBlock.get=function(){return this.type.isBlock},Op.isTextblock.get=function(){return this.type.isTextblock},Op.inlineContent.get=function(){return this.type.inlineContent},Op.isInline.get=function(){return this.type.isInline},Op.isText.get=function(){return this.type.isText},Op.isLeaf.get=function(){return this.type.isLeaf},Op.isAtom.get=function(){return this.type.isAtom},Sp.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()+")"),function(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}(this.marks,t)},Sp.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},Sp.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=Xc.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var a=r;a-1&&o[i+1];Ip(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new Cp(r.indexOf(t.length-1)>-1),s=0;s>1},Cp.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]}},Cp.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(Cp.prototype,Np),Cp.empty=new Cp(!0);var _p=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()},Tp={next:{configurable:!0}};function Ap(t){var e=[];do{e.push(Ep(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function Ep(t){var e=[];do{e.push(Vp(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function Vp(t){for(var e=function(t){if(t.eat("(")){var e=Ap(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=Rp(t,e)}return e}function Dp(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function Rp(t,e){var n=Dp(t),r=n;return t.eat(",")&&(r="}"!=t.next?Dp(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function zp(t,e){return e-t}function Ip(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-1},jp.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var Jp=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)}))};Jp.prototype.parse=function(t,e){void 0===e&&(e={});var n=new Yp(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},Jp.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new Yp(this,e,!0);return n.addAll(t,null,e.from,e.to),rp.maxOpen(n.finish())},Jp.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},Jp.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Xp.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},Yp.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},Yp.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},Qp.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},Yp.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-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),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var p=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!p||p.name!=c&&-1==p.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},Yp.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}},Yp.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;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(Yp.prototype,Qp);var nl=function(t,e){this.nodes=t||{},this.marks=e||{}};function rl(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ol(t){return t.document||window.document}nl.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=ol(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},nl.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&nl.renderSpec(ol(n),r(t,e))},nl.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,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var p in c=2,a)if(null!=a[p]){var l=p.indexOf(" ");l>0?s.setAttributeNS(p.slice(0,l),p.slice(l+1),a[p]):s.setAttribute(p,a[p])}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var h=nl.renderSpec(t,u,n),f=h.dom,m=h.contentDOM;if(s.appendChild(f),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},nl.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new nl(this.nodesFromSchema(t),this.marksFromSchema(t)))},nl.nodesFromSchema=function(t){var e=rl(t.nodes);return e.text||(e.text=function(t){return t.text}),e},nl.marksFromSchema=function(t){return rl(t.marks)};var il=Math.pow(2,16);function sl(t){return 65535&t}var al=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},cl=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};cl.prototype.recover=function(t){var e=0,n=sl(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],p=this.ranges[s+i],l=a+c;if(t<=l){var d=a+r+((c?t==a?-1:t==l?1:e:e)<0?0:p);if(n)return d;var u=t==(e<0?a:l)?null:s/3+(t-a)*il;return new al(d,e<0?t!=a:t!=l,u)}r+=p-c}return n?t+r:new al(t+r)},cl.prototype.touches=function(t,e){for(var n=0,r=sl(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},cl.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},pl.prototype.invert=function(){var t=new pl;return t.appendMappingInverted(this),t},pl.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},dl.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(dl.prototype,ul);var fl=Object.create(null),ml=function(){};ml.prototype.apply=function(t){return hl()},ml.prototype.getMap=function(){return cl.empty},ml.prototype.invert=function(t){return hl()},ml.prototype.map=function(t){return hl()},ml.prototype.merge=function(t){return null},ml.prototype.toJSON=function(){return hl()},ml.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=fl[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},ml.jsonID=function(t,e){if(t in fl)throw new RangeError("Duplicate use of step JSON ID "+t);return fl[t]=e,e.prototype.jsonID=t,e};var vl=function(t,e){this.doc=t,this.failed=e};vl.ok=function(t){return new vl(t,null)},vl.fail=function(t){return new vl(null,t)},vl.fromReplace=function(t,e,n,r){try{return vl.ok(t.replace(e,n,r))}catch(o){if(o instanceof np)return vl.fail(o.message);throw o}};var gl=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&&bl(t,this.from,this.to)?vl.fail("Structure replace would overwrite content"):vl.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new cl([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?rp.empty:new rp(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?rp.empty:new rp(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,rp.fromJSON(t,n.slice),!!n.structure)},e}(ml);ml.jsonID("replace",gl);var yl=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(bl(t,this.from,this.gapFrom)||bl(t,this.gapTo,this.to)))return vl.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return vl.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?vl.fromReplace(t,this.from,this.to,n):vl.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new cl([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||or.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,rp.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(ml);function bl(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function wl(t,e,n){for(var r=[],o=0;oe;d--)u||n.index(d)>0?(u=!0,p=Xc.from(n.node(d).copy(p)),l++):a--;for(var h=Xc.empty,f=0,m=o,v=!1;m>e;m--)v||r.after(m+1)=0;r--)n=Xc.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new yl(o,i,o,i,new rp(n,0,0),e.length,!0))},dl.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 s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new yl(a,c,a+1,c-1,new rp(Xc.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},dl.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 yl(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new rp(Xc.from(i),0,0),1,!0))},dl.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=Xc.empty,i=Xc.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=Xc.from(r.node(s).copy(o));var p=n&&n[c];i=Xc.from(p?p.type.create(p.attrs,i):r.node(s).copy(i))}return this.step(new gl(t,t,new rp(o.append(i),e,e),!0))},dl.prototype.join=function(t,e){void 0===e&&(e=1);var n=new gl(t-e,t+e,rp.empty,!0);return this.step(n)};var kl=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 rp(wl(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 vl.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new xl(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}(ml);ml.jsonID("addMark",kl);var xl=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 rp(wl(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return vl.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new kl(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}(ml);function Ml(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}ml.jsonID("removeMark",xl),dl.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,p){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&p.type.allowsMarkType(n.type)){for(var d=Math.max(c,t),u=Math.min(c+r.nodeSize,e),h=n.addToSet(l),f=0;f=0;u--)this.step(o[u]);return this},dl.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=rp.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=rp.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Ml(o,i,r)?new gl(e,n,r):new Sl(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},dl.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new rp(Xc.from(n),0,0))},dl.prototype.delete=function(t,e){return this.replace(t,e,rp.empty)},dl.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Sl=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=Xc.empty;for(var i=t.depth;i>0;i--)this.placed=Xc.from(t.node(i).copy(this.placed))},Ol={depth:{configurable:!0}};function Cl(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Cl(t.firstChild.content,e-1,n)))}function Nl(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Nl(t.lastChild.content,e-1,n)))}function _l(t,e){for(var n=0;n1&&(r=r.replaceChild(0,Tl(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(Xc.empty,!0)))),t.copy(r)}function Al(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(Xc.empty,!0))}return t}function Vl(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}Ol.depth.get=function(){return this.frontier.length-1},Sl.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,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new rp(i,s,a);return e>-1?new yl(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new gl(r.pos,o.pos,c):void 0},Sl.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=_l(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,p=void 0;if(1==t&&(r?a.matchType(r.type)||(p=a.fillBefore(Xc.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:p};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},Sl.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=_l(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new rp(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},Sl.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=_l(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new rp(Cl(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new rp(Cl(e,n,1),n,r)},Sl.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 s=0;s1||0==p||g.content.size)&&(h=y,d.push(Tl(g.mark(f.allowedMarks(g.marks)),1==l?p:0,l==c.childCount?v:-1)))}var b=l==c.childCount;b||(v=-1),this.placed=Nl(this.placed,n,Xc.from(d)),this.frontier[n].match=h,b&&v<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var w=0,k=c;w1&&r==this.$to.end(--n);)++r;return r},Sl.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=0;a--){var c=this.frontier[a],p=c.match,l=Al(t,a,c.type,p,!0);if(!l||l.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},Sl.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=Nl(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},Sl.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Nl(this.placed,this.depth,Xc.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Sl.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(Xc.empty,!0);t.childCount&&(this.placed=Nl(this.placed,this.frontier.length,t))},Object.defineProperties(Sl.prototype,Ol),dl.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(Ml(r,o,n))return this.step(new gl(t,e,n));var i=Vl(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var p=r.node(a).type.spec;if(p.defining||p.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var l=i.indexOf(s),d=[],u=n.openStart,h=n.content,f=0;;f++){var m=h.firstChild;if(d.push(m),f==n.openStart)break;h=m.content}u>0&&d[u-1].type.spec.defining&&r.node(l).type!=d[u-1].type?u-=1:u>=2&&d[u-1].isTextblock&&d[u-2].type.spec.defining&&r.node(l).type!=d[u-2].type&&(u-=2);for(var v=n.openStart;v>=0;v--){var g=(v+u+1)%(n.openStart+1),y=d[g];if(y)for(var b=0;b=0&&(this.replace(t,e,n),!(this.steps.length>S));O--){var C=i[O];C<0||(t=r.before(C),e=o.after(C))}return this},dl.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Dl=Object.create(null),Rl=function(t,e,n){this.ranges=n||[new Il(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},zl={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};zl.anchor.get=function(){return this.$anchor.pos},zl.head.get=function(){return this.$head.pos},zl.from.get=function(){return this.$from.pos},zl.to.get=function(){return this.$to.pos},zl.$from.get=function(){return this.ranges[0].$from},zl.$to.get=function(){return this.ranges[0].$to},zl.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?Hl(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):Hl(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Rl.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new $l(t.node(0))},Rl.atStart=function(t){return Hl(t,t,0,0,1)||new $l(t)},Rl.atEnd=function(t){return Hl(t,t,t.content.size,t.childCount,-1)||new $l(t)},Rl.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Dl[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Rl.jsonID=function(t,e){if(t in Dl)throw new RangeError("Duplicate use of selection JSON ID "+t);return Dl[t]=e,e.prototype.jsonID=t,e},Rl.prototype.getBookmark=function(){return Bl.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Rl.prototype,zl),Rl.prototype.visible=!0;var Il=function(t,e){this.$from=t,this.$to=e},Bl=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=rp.empty),t.prototype.replace.call(this,e,n),n==rp.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 Ll(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&Pl.isSelectable(a))return Pl.create(t,n-(o<0?a.nodeSize:0))}else{var c=Hl(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function ql(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return ep.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)||ep.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(Rl.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}(dl);function Wl(t,e){return e&&t?t.bind(e):t}var Ul=function(t,e,n){this.name=t,this.init=Wl(e.init,n),this.apply=Wl(e.apply,n)},Kl=[new Ul("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new Ul("selection",{init:function(t,e){return t.selection||Rl.atStart(e.doc)},apply:function(t){return t.selection}}),new Ul("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ul("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],Gl=function(t,e){var n=this;this.schema=t,this.fields=Kl.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new Ul(t.key,t.spec.state,t))}))},Xl=function(t){this.config=t},Yl={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};Yl.schema.get=function(){return this.config.schema},Yl.plugins.get=function(){return this.config.plugins},Xl.prototype.apply=function(t){return this.applyTransaction(t).state},Xl.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&Ql.splice(e,1)},Object.defineProperties(Xl.prototype,Yl);var Ql=[];function Zl(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=Zl(o,e,{})),n[r]=o}return n}var td=function(t){this.props={},t.props&&Zl(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:nd("plugin")};td.prototype.getState=function(t){return t[this.key]};var ed=Object.create(null);function nd(t){return t in ed?t+"$"+ ++ed[t]:(ed[t]=0,t+"$")}var rd=function(t){void 0===t&&(t="key"),this.key=nd(t)};rd.prototype.get=function(t){return t.config.pluginsByKey[this.key]},rd.prototype.getState=function(t){return t[this.key]};const od=new rd("characterLimit"),id=Oi.create({name:"characterCount",defaultOptions:{limit:0},addProseMirrorPlugins(){const{options:t}=this;return[new td({key:od,appendTransaction:(e,n,r)=>{const o=r.doc.content.size;if(t.limit&&o>t.limit)return r.tr.insertText("",t.limit+1,o)}})]}}),sd=Oi.create({name:"textAlign",defaultOptions:{types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,renderHTML:t=>({style:`text-align: ${t.textAlign}`}),parseHTML:t=>({textAlign:t.style.textAlign||this.options.defaultAlignment})}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>!!this.options.alignments.includes(t)&&this.options.types.every((n=>e.updateAttributes(n,{textAlign:t}))),unsetTextAlign:()=>({commands:t})=>this.options.types.every((e=>t.resetAttributes(e,"textAlign")))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),ad=Rs.create({name:"horizontalRule",defaultOptions:{HTMLAttributes:{}},group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t})=>t().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{var n;if(e){const{parent:e,pos:r}=t.selection.$from,o=r+1;if(!t.doc.nodeAt(o)){const r=null===(n=e.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(t.insert(o,r),t.setSelection(re.create(t.doc,o)))}t.scrollIntoView()}return!0})).run()}},addInputRules(){return[Is(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}}),cd=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/;Rs.create({name:"image",defaultOptions:{inline:!1,HTMLAttributes:{}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML:()=>[{tag:"img[src]"}],renderHTML({HTMLAttributes:t}){return["img",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Is(cd,this.type,(t=>{const[,e,n,r]=t;return{src:n,alt:e,title:r}}))]}});const pd=/^\s*([-+*])\s$/,ld=Rs.create({name:"bulletList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({toggleBulletList:()=>({commands:t})=>t.toggleList("bulletList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[Do(pd,this.type)]}}),dd=/^(\d+)\.\s$/,ud=Rs.create({name:"orderedList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",addAttributes:()=>({start:{default:1,parseHTML:t=>({start:t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1})}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e}=t,n=__rest(t,["start"]);return 1===e?["ol",vi(this.options.HTMLAttributes,n),0]:["ol",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({toggleOrderedList:()=>({commands:t})=>t.toggleList("orderedList","listItem")}),addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[Do(dd,this.type,(t=>({order:+t[1]})),((t,e)=>e.childCount+e.attrs.order===+t[1]))]}}),hd=Rs.create({name:"taskList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"taskItem+",parseHTML:()=>[{tag:'ul[data-type="taskList"]',priority:51}],renderHTML:({HTMLAttributes:t})=>["ul",vi(t,{"data-type":"taskList"}),0],addCommands:()=>({toggleTaskList:()=>({commands:t})=>t.toggleList("taskList","taskItem")}),addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),fd=/^\s*(\[([ |x])\])\s$/,md=Rs.create({name:"taskItem",defaultOptions:{nested:!1,HTMLAttributes:{}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,parseHTML:t=>({checked:"true"===t.getAttribute("data-checked")}),renderHTML:t=>({"data-checked":t.checked}),keepOnSplit:!1}}),parseHTML:()=>[{tag:'li[data-type="taskItem"]',priority:51}],renderHTML({HTMLAttributes:t}){return["li",vi(this.options.HTMLAttributes,t,{"data-type":"taskItem"}),0]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem("taskItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("taskItem")};return this.options.nested?__assign(__assign({},t),{Tab:()=>this.editor.commands.sinkListItem("taskItem")}):t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",(t=>{const{checked:e}=t.target;"function"==typeof n&&r.chain().focus().command((({tr:t})=>(t.setNodeMarkup(n(),void 0,{checked:e}),!0))).run()})),t.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,s),o.append(i,c),Object.entries(e).forEach((([t,e])=>{o.setAttribute(t,e)})),{dom:o,contentDOM:c,update:t=>t.type===this.type&&(t.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[Do(fd,this.type,(t=>({checked:"x"===t[t.length-1]})))]}});var vd=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};vd.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},vd.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&this.updateOverlay()},vd.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},vd.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,c,p=this.editorView.dom.offsetParent;if(this.element||(this.element=p.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!p||p==document.body&&"static"==getComputedStyle(p).position)a=-pageXOffset,c=-pageYOffset;else{var l=p.getBoundingClientRect();a=l.left-p.scrollLeft,c=l.top-p.scrollTop}this.element.style.left=t.left-a+"px",this.element.style.top=t.top-c+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},vd.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},vd.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var n=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(n=Pt(this.editorView.state.doc,n,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}},vd.prototype.dragend=function(){this.scheduleRemoval(20)},vd.prototype.drop=function(){this.scheduleRemoval(20)},vd.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};const gd=Oi.create({name:"dropCursor",defaultOptions:{color:"black",width:1,class:null},addProseMirrorPlugins(){return[(t=this.options,void 0===t&&(t={}),new we({view:function(e){return new vd(e,t)}}))];var t}});var yd=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return u.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new bd(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e);if(0!=n)for(var r=t.node(e).child(n-1);;r=r.lastChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){t:for(;;){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;;){var p=n>0?i.firstChild:i.lastChild;if(!p){if(i.isAtom&&!i.isText&&!ie.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue t}break}i=p,o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null}},e}(te);yd.prototype.visible=!1,te.jsonID("gapcursor",yd);var bd=function(t){this.pos=t};bd.prototype.map=function(t){return new bd(t.map(this.pos))},bd.prototype.resolve=function(t){var e=t.resolve(this.pos);return yd.valid(e)?new yd(e):te.near(e)};var wd=Ao({ArrowLeft:kd("horiz",-1),ArrowRight:kd("horiz",1),ArrowUp:kd("vert",-1),ArrowDown:kd("vert",1)});function kd(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof re){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=yd.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new yd(c))),!0)}}function xd(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!yd.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&ie.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new yd(r))),!0)}function Md(t){if(!(t.selection instanceof yd))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Zr.create(t.doc,[Gr.widget(t.selection.head,e,{key:"gapcursor"})])}const Sd=Oi.create({name:"gapCursor",addProseMirrorPlugins:()=>[new we({props:{decorations:Md,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&yd.valid(n))return new yd(n)},handleClick:xd,handleKeyDown:wd}})],extendNodeSchema(t){var e;return{allowGapCursor:null!==(e=bi(hi(t,"allowGapCursor",{name:t.name,options:t.options})))&&void 0!==e?e:null}}}),Od=Rs.create({name:"doc",topNode:!0,content:"block+"}),Cd=Rs.create({name:"paragraph",priority:1e3,defaultOptions:{HTMLAttributes:{}},group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setParagraph:()=>({commands:t})=>t.toggleNode("paragraph","paragraph")}),addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Nd=Rs.create({name:"text",group:"inline"});var _d=200,Td=function(){};Td.prototype.append=function(t){return t.length?(t=Td.from(t),!this.length&&t||t.length<_d&&this.leafAppend(t)||this.length<_d&&t.leafPrepend(this)||this.appendInner(t)):this},Td.prototype.prepend=function(t){return t.length?Td.from(t).append(this):this},Td.prototype.appendInner=function(t){return new Ed(this,t)},Td.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Td.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Td.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Td.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)},Td.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},Td.from=function(t){return t instanceof Td?t:t&&t.length?new Ad(t):Td.empty};var Ad=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.leafAppend=function(t){if(this.length+t.length<=_d)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=_d)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}(Td);Td.empty=new Ad([]);var Ed=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 to&&!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=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}(Td),Vd=Td,Dd=function(t,e){this.items=t,this.eventCount=e};Dd.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,p=[],l=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void l.push(t);if(r){l.push(new Rd(t.map));var d,u=t.step.map(r.slice(o));u&&c.maybeStep(u).doc&&(d=c.mapping.maps[c.mapping.maps.length-1],p.push(new Rd(d,null,null,p.length+l.length))),o--,d&&r.appendMap(d,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Dd(n.items.slice(0,i).append(l.reverse().concat(p)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Dd.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;cId&&(h=m,(u=s).forEach((function(t,e){if(t.selection&&0==h--)return f=e,!1})),s=u.slice(f),i-=m),new Dd(s.append(o),i)},Dd.prototype.remapping=function(t,e){var n=new xt;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},Dd.prototype.addMaps=function(t){return 0==this.eventCount?this:new Dd(this.items.append(t.map((function(t){return new Rd(t)}))),this.eventCount)},Dd.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var p=t.steps[r].invert(t.docs[r]),l=e.selection&&e.selection.map(o.slice(a+1,r));l&&s++,n.push(new Rd(c,p,l))}else n.push(new Rd(c))}}),r);for(var c=[],p=e;p500&&(d=d.compress(this.items.length-n.length)),d},Dd.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Dd.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var p=i.selection&&i.selection.map(e.slice(n));p&&o++;var l,d=new Rd(c.invert(),a,p),u=r.length-1;(l=r.length&&r[u].merge(d))?r[u]=l:r.push(d)}}else i.map&&n--}),this.items.length,0),new Dd(Vd.from(r.reverse()),o)},Dd.empty=new Dd(Vd.empty,0);var Rd=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};Rd.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Rd(e.getMap().invert(),e,this.selection)}};var zd=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},Id=20;function Bd(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function Ld(t,e){if(!t)return null;for(var n=[],r=0;r=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?Ld(t.prevRanges,n.mapping):Bd(n.mapping.maps[n.steps.length-1]);return new zd(t.done.addTransform(n,a?e.selection.getBookmark():null,r,Fd(e)),Dd.empty,c,n.time)}(n,r,e,t)}},config:t})}const Wd=Oi.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands:()=>({undo:()=>({state:t,dispatch:e})=>function(t,e){var n=Hd.getState(t);return!(!n||0==n.done.eventCount||(e&&Pd(n,t,e,!1),0))}(t,e),redo:()=>({state:t,dispatch:e})=>function(t,e){var n=Hd.getState(t);return!(!n||0==n.undone.eventCount||(e&&Pd(n,t,e,!0),0))}(t,e)}),addProseMirrorPlugins(){return[Jd(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}}}),Ud=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,Kd=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Gd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,Xd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm,Yd=zs.create({name:"bold",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setBold:()=>({commands:t})=>t.setMark("bold"),toggleBold:()=>({commands:t})=>t.toggleMark("bold"),unsetBold:()=>({commands:t})=>t.unsetMark("bold")}),addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Bs(Ud,this.type),Bs(Gd,this.type)]},addPasteRules(){return[Ls(Kd,this.type),Ls(Xd,this.type)]}}),Qd=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,Zd=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,tu=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,eu=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm,nu=zs.create({name:"italic",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setItalic:()=>({commands:t})=>t.setMark("italic"),toggleItalic:()=>({commands:t})=>t.toggleMark("italic"),unsetItalic:()=>({commands:t})=>t.unsetMark("italic")}),addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Bs(Qd,this.type),Bs(tu,this.type)]},addPasteRules(){return[Ls(Zd,this.type),Ls(eu,this.type)]}}),ru=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm,ou=zs.create({name:"code",defaultOptions:{HTMLAttributes:{}},excludes:"_",parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setCode:()=>({commands:t})=>t.setMark("code"),toggleCode:()=>({commands:t})=>t.toggleMark("code"),unsetCode:()=>({commands:t})=>t.unsetMark("code")}),addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Bs(ru,this.type)]},addPasteRules(){return[Ls(ru,this.type)]}}),iu=Rs.create({name:"heading",defaultOptions:{levels:[1,2,3,4,5,6],HTMLAttributes:{}},content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,vi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode("heading",t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode("heading","paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>__assign(__assign({},t),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>Ro(new RegExp(`^(#{1,${t}})\\s$`),this.type,{level:t})))}}),su=Rs.create({name:"hardBreak",defaultOptions:{HTMLAttributes:{}},inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",vi(this.options.HTMLAttributes,t)]},addCommands(){return{setHardBreak:()=>({commands:t})=>t.first([()=>t.exitCode(),()=>t.insertContent({type:this.name})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),au=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm,cu=zs.create({name:"strike",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("line-through")&&{}}],renderHTML({HTMLAttributes:t}){return["s",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setStrike:()=>({commands:t})=>t.setMark("strike"),toggleStrike:()=>({commands:t})=>t.toggleMark("strike"),unsetStrike:()=>({commands:t})=>t.unsetMark("strike")}),addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Bs(au,this.type)]},addPasteRules(){return[Ls(au,this.type)]}}),pu=/^\s*>\s$/gm,lu=Rs.create({name:"blockquote",defaultOptions:{HTMLAttributes:{}},content:"block*",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return["blockquote",vi(this.options.HTMLAttributes,t),0]},addCommands:()=>({setBlockquote:()=>({commands:t})=>t.wrapIn("blockquote"),toggleBlockquote:()=>({commands:t})=>t.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:t})=>t.lift("blockquote")}),addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Do(pu,this.type)]}}),du=Rs.create({name:"listItem",defaultOptions:{HTMLAttributes:{}},content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",vi(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}}),uu=Oi.create({name:"starterKit",addExtensions(){var t,e,n,r,o,i,s,a,c,p,l,d,u,h,f,m,v,g;const y=[];return!1!==this.options.blockquote&&y.push(lu.configure(null===(t=this.options)||void 0===t?void 0:t.blockquote)),!1!==this.options.bold&&y.push(Yd.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.bulletList&&y.push(ld.configure(null===(n=this.options)||void 0===n?void 0:n.bulletList)),!1!==this.options.code&&y.push(ou.configure(null===(r=this.options)||void 0===r?void 0:r.code)),!1!==this.options.codeBlock&&y.push(Wc.configure(null===(o=this.options)||void 0===o?void 0:o.codeBlock)),!1!==this.options.document&&y.push(Od.configure(null===(i=this.options)||void 0===i?void 0:i.document)),!1!==this.options.dropcursor&&y.push(gd.configure(null===(s=this.options)||void 0===s?void 0:s.dropcursor)),!1!==this.options.gapcursor&&y.push(Sd.configure(null===(a=this.options)||void 0===a?void 0:a.gapcursor)),!1!==this.options.hardBreak&&y.push(su.configure(null===(c=this.options)||void 0===c?void 0:c.hardBreak)),!1!==this.options.heading&&y.push(iu.configure(null===(p=this.options)||void 0===p?void 0:p.heading)),!1!==this.options.history&&y.push(Wd.configure(null===(l=this.options)||void 0===l?void 0:l.history)),!1!==this.options.horizontalRule&&y.push(ad.configure(null===(d=this.options)||void 0===d?void 0:d.horizontalRule)),!1!==this.options.italic&&y.push(nu.configure(null===(u=this.options)||void 0===u?void 0:u.italic)),!1!==this.options.listItem&&y.push(du.configure(null===(h=this.options)||void 0===h?void 0:h.listItem)),!1!==this.options.orderedList&&y.push(ud.configure(null===(f=this.options)||void 0===f?void 0:f.orderedList)),!1!==this.options.paragraph&&y.push(Cd.configure(null===(m=this.options)||void 0===m?void 0:m.paragraph)),!1!==this.options.strike&&y.push(cu.configure(null===(v=this.options)||void 0===v?void 0:v.strike)),!1!==this.options.text&&y.push(Nd.configure(null===(g=this.options)||void 0===g?void 0:g.text)),y}});const hu={components:{EditorContent:Hc,BubbleMenu:$c},props:{modelValue:{type:String,default:""},maxChars:{type:Number,default:0},bubbleMenu:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bold:{type:Boolean,default:!0},italic:{type:Boolean,default:!0},strike:{type:Boolean,default:!0},underline:{type:Boolean,default:!0},code:{type:Boolean,default:!0},codeBlock:{type:Boolean,default:!0},blockquote:{type:Boolean,default:!0},bulletList:{type:Boolean,default:!0},orderedList:{type:Boolean,default:!0},taskList:{type:Boolean,default:!0},heading:{type:Boolean,default:!0},textAlign:{type:Boolean,default:!0},horizontalRule:{type:Boolean,default:!0},undoRedo:{type:Boolean,default:!0}},data:()=>({editor:null,headingOpen:!1,alignOpen:!1}),watch:{modelValue(t){this.editor.getHTML()!==t&&this.editor.commands.setContent(this.modelValue,!1)},disabled(t){this.editor&&this.editor.setEditable(!t)}},methods:{insertImageFromURL(t){this.editor.chain().focus().setImage({src:t},!1).run()}},computed:{extensions(){return[uu,Uc,sd,Wc,ud.configure({class:"inline-flex"}),ld.configure({class:"inline-flex"}),id.configure({limit:this.maxChars}),hd,md]},hasTextAlign(){return this.editor.isActive({textAlign:"left"})||this.editor.isActive({textAlign:"right"})||this.editor.isActive({textAlign:"center"})||this.editor.isActive({textAlign:"justify"})},charPercentage(){return Math.round(100/this.maxChars*this.editor.getCharacterCount())}},mounted(){this.editor=new Fc({content:this.modelValue,extensions:this.extensions,editorProps:{attributes:{class:"h-full overflow-y-auto input"}},editable:!this.disabled}).on("update",(({editor:t})=>{this.$emit("update:modelValue",t.getHTML())}))},beforeUnmount(){this.editor.destroy()}},fu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),t.createVNode("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})],-1),mu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"11",y1:"5",x2:"17",y2:"5"}),t.createVNode("line",{x1:"7",y1:"19",x2:"13",y2:"19"}),t.createVNode("line",{x1:"14",y1:"5",x2:"10",y2:"19"})],-1),vu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5v9a5 5 0 0 0 10 0v-9"}),t.createVNode("path",{d:"M4 12h16"})],-1),gu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),t.createVNode("path",{d:"M5 19h14"})],-1),yu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("polyline",{points:"7 8 3 12 7 16"}),t.createVNode("polyline",{points:"17 8 21 12 17 16"}),t.createVNode("line",{x1:"14",y1:"4",x2:"10",y2:"20"})],-1),bu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),t.createVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),t.createVNode("path",{d:"M10 13l-1 2l1 2"}),t.createVNode("path",{d:"M14 13l1 2l-1 2"})],-1),wu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M6 15h15"}),t.createVNode("path",{d:"M21 19h-15"}),t.createVNode("path",{d:"M15 11h6"}),t.createVNode("path",{d:"M21 7h-6"}),t.createVNode("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),t.createVNode("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})],-1),ku=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),t.createVNode("line",{x1:"5",y1:"6",x2:"5",y2:"6.01"}),t.createVNode("line",{x1:"5",y1:"12",x2:"5",y2:"12.01"}),t.createVNode("line",{x1:"5",y1:"18",x2:"5",y2:"18.01"})],-1),xu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M11 6h9"}),t.createVNode("path",{d:"M11 12h9"}),t.createVNode("path",{d:"M12 18h8"}),t.createVNode("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),t.createVNode("path",{d:"M6 10v-6l-2 2"})],-1),Mu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),t.createVNode("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),t.createVNode("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),t.createVNode("line",{x1:"11",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"11",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"11",y1:"18",x2:"20",y2:"18"})],-1),Su={key:10},Ou=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M7 12h10"}),t.createVNode("path",{d:"M7 4v16"}),t.createVNode("path",{d:"M17 4v16"}),t.createVNode("path",{d:"M15 20h4"}),t.createVNode("path",{d:"M15 4h4"}),t.createVNode("path",{d:"M5 20h4"}),t.createVNode("path",{d:"M5 4h4"})],-1),Cu={key:0,class:"inline-flex"},Nu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M19 18v-8l-2 2"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),_u=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 -.001"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Tu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),t.createVNode("path",{d:"M17 16a2 2 0 1 0 2 -2"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Au=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M20 18v-8l-4 6h5"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Eu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Vu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("circle",{transform:"rotate(180 19 16)",cx:"19",cy:"16",r:"2"}),t.createVNode("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),t.createVNode("path",{d:"M4 6v12"}),t.createVNode("path",{d:"M12 6v12"}),t.createVNode("path",{d:"M11 18h2"}),t.createVNode("path",{d:"M3 18h2"}),t.createVNode("path",{d:"M4 12h8"}),t.createVNode("path",{d:"M3 6h2"}),t.createVNode("path",{d:"M11 6h2"})],-1),Du={key:11},Ru=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1),zu={key:0,class:"inline-flex"},Iu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12"}),t.createVNode("line",{x1:"4",y1:"18",x2:"18",y2:"18"})],-1),Bu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1),Lu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"6",y1:"18",x2:"20",y2:"18"})],-1),Pu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),t.createVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"4",y1:"18",x2:"16",y2:"18"})],-1),ju=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),t.createVNode("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),t.createVNode("line",{x1:"14",y1:"11",x2:"14",y2:"17"}),t.createVNode("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),t.createVNode("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})],-1),$u=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),t.createVNode("line",{x1:"4",y1:"4",x2:"4",y2:"4.01"}),t.createVNode("line",{x1:"8",y1:"4",x2:"8",y2:"4.01"}),t.createVNode("line",{x1:"12",y1:"4",x2:"12",y2:"4.01"}),t.createVNode("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),t.createVNode("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),t.createVNode("line",{x1:"4",y1:"8",x2:"4",y2:"8.01"}),t.createVNode("line",{x1:"12",y1:"8",x2:"12",y2:"8.01"}),t.createVNode("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),t.createVNode("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),t.createVNode("line",{x1:"12",y1:"16",x2:"12",y2:"16.01"}),t.createVNode("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),t.createVNode("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),t.createVNode("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),t.createVNode("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),t.createVNode("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),t.createVNode("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})],-1),Fu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"})],-1),Hu=t.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[t.createVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),t.createVNode("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"})],-1);hu.render=function(e,n,r,o,i,s){const a=t.resolveComponent("collapse-x-transition"),c=t.resolveComponent("editor-content"),p=t.resolveDirective("tooltip");return t.openBlock(),t.createBlock("div",null,[t.createVNode("div",null,[i.editor?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.bubbleMenu?"bubble-menu":"div"),{key:0,editor:i.editor,class:["flex-wrap space-x-1",r.bubbleMenu?"bg-gray-600 rounded dark p-1":"mb-2"]},{default:t.withCtx((()=>[r.bold?t.withDirectives((t.openBlock(),t.createBlock("button",{key:0,onClick:n[1]||(n[1]=t=>i.editor.chain().focus().toggleBold().run()),class:["button",{accent:i.editor.isActive("bold")}]},[fu],2)),[[p,e.__("tiptap::tiptap.bold")]]):t.createCommentVNode("",!0),r.italic?t.withDirectives((t.openBlock(),t.createBlock("button",{key:1,onClick:n[2]||(n[2]=t=>i.editor.chain().focus().toggleItalic().run()),class:["button",{accent:i.editor.isActive("italic")}]},[mu],2)),[[p,e.__("tiptap::tiptap.italic")]]):t.createCommentVNode("",!0),r.strike?t.withDirectives((t.openBlock(),t.createBlock("button",{key:2,onClick:n[3]||(n[3]=t=>i.editor.chain().focus().toggleStrike().run()),class:["button",{accent:i.editor.isActive("strike")}]},[vu],2)),[[p,e.__("tiptap::tiptap.strike")]]):t.createCommentVNode("",!0),r.underline?t.withDirectives((t.openBlock(),t.createBlock("button",{key:3,onClick:n[4]||(n[4]=t=>i.editor.chain().focus().toggleUnderline().run()),class:["button",{accent:i.editor.isActive("underline")}]},[gu],2)),[[p,e.__("tiptap::tiptap.underline")]]):t.createCommentVNode("",!0),r.code?t.withDirectives((t.openBlock(),t.createBlock("button",{key:4,onClick:n[5]||(n[5]=t=>i.editor.chain().focus().toggleCode().run()),class:["button",{accent:i.editor.isActive("code")}]},[yu],2)),[[p,e.__("tiptap::tiptap.code")]]):t.createCommentVNode("",!0),r.codeBlock?t.withDirectives((t.openBlock(),t.createBlock("button",{key:5,onClick:n[6]||(n[6]=t=>i.editor.chain().focus().toggleCodeBlock().run()),class:["button",{accent:i.editor.isActive("codeBlock")}]},[bu],2)),[[p,e.__("tiptap::tiptap.code_block")]]):t.createCommentVNode("",!0),r.blockquote?t.withDirectives((t.openBlock(),t.createBlock("button",{key:6,onClick:n[7]||(n[7]=t=>i.editor.chain().focus().toggleBlockquote().run()),class:["button",{accent:i.editor.isActive("blockquote")}]},[wu],2)),[[p,e.__("tiptap::tiptap.blockquote")]]):t.createCommentVNode("",!0),r.bulletList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:7,onClick:n[8]||(n[8]=t=>i.editor.chain().focus().toggleBulletList().run()),class:["button",{accent:i.editor.isActive("bulletList")}]},[ku],2)),[[p,e.__("tiptap::tiptap.bullet_list")]]):t.createCommentVNode("",!0),r.orderedList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:8,onClick:n[9]||(n[9]=t=>i.editor.chain().focus().toggleOrderedList().run()),class:["button",{accent:i.editor.isActive("orderedList")}]},[xu],2)),[[p,e.__("tiptap::tiptap.ordered_list")]]):t.createCommentVNode("",!0),r.taskList?t.withDirectives((t.openBlock(),t.createBlock("button",{key:9,onClick:n[10]||(n[10]=t=>i.editor.chain().focus().toggleTaskList().run()),class:["button",{accent:i.editor.isActive("taskList")}]},[Mu],2)),[[p,e.__("tiptap::tiptap.task_list")]]):t.createCommentVNode("",!0),r.heading?(t.openBlock(),t.createBlock("span",Su,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading")}],onClick:n[11]||(n[11]=t=>{i.headingOpen=!i.headingOpen,i.alignOpen=!1})},[Ou],2),[[p,e.__("tiptap::tiptap.heading")]]),t.createVNode(a,null,{default:t.withCtx((()=>[i.headingOpen?(t.openBlock(),t.createBlock("div",Cu,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:1})}],onClick:n[12]||(n[12]=t=>i.editor.chain().focus().toggleHeading({level:1}).run())},[Nu],2),[[p,`${e.__("tiptap::tiptap.heading")} 1`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:2})}],onClick:n[13]||(n[13]=t=>i.editor.chain().focus().toggleHeading({level:2}).run())},[_u],2),[[p,`${e.__("tiptap::tiptap.heading")} 2`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:3})}],onClick:n[14]||(n[14]=t=>i.editor.chain().focus().toggleHeading({level:3}).run())},[Tu],2),[[p,`${e.__("tiptap::tiptap.heading")} 3`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:4})}],onClick:n[15]||(n[15]=t=>i.editor.chain().focus().toggleHeading({level:4}).run())},[Au],2),[[p,`${e.__("tiptap::tiptap.heading")} 4`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:5})}],onClick:n[16]||(n[16]=t=>i.editor.chain().focus().toggleHeading({level:5}).run())},[Eu],2),[[p,`${e.__("tiptap::tiptap.heading")} 5`]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive("heading",{level:6})}],onClick:n[17]||(n[17]=t=>i.editor.chain().focus().toggleHeading({level:6}).run())},[Vu],2),[[p,`${e.__("tiptap::tiptap.heading")} 6`]])])):t.createCommentVNode("",!0)])),_:1})])):t.createCommentVNode("",!0),r.textAlign?(t.openBlock(),t.createBlock("span",Du,[t.withDirectives(t.createVNode("button",{class:["button",{accent:s.hasTextAlign}],onClick:n[18]||(n[18]=t=>{i.alignOpen=!i.alignOpen,i.headingOpen=!1})},[Ru],2),[[p,e.__("tiptap::tiptap.text_align")]]),t.createVNode(a,null,{default:t.withCtx((()=>[i.alignOpen?(t.openBlock(),t.createBlock("div",zu,[t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"left"})}],onClick:n[19]||(n[19]=t=>i.editor.chain().focus().setTextAlign("left").run())},[Iu],2),[[p,e.__("tiptap::tiptap.left")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"center"})}],onClick:n[20]||(n[20]=t=>i.editor.chain().focus().setTextAlign("center").run())},[Bu],2),[[p,e.__("tiptap::tiptap.center")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"right"})}],onClick:n[21]||(n[21]=t=>i.editor.chain().focus().setTextAlign("right").run())},[Lu],2),[[p,e.__("tiptap::tiptap.right")]]),t.withDirectives(t.createVNode("button",{class:["button",{accent:i.editor.isActive({textAlign:"justify"})}],onClick:n[22]||(n[22]=t=>i.editor.chain().focus().setTextAlign("justify").run())},[Pu],2),[[p,e.__("tiptap::tiptap.justify")]]),t.withDirectives(t.createVNode("button",{class:"button",onClick:n[23]||(n[23]=t=>i.editor.chain().focus().unsetTextAlign().run())},[ju],512),[[p,e.__("tiptap::tiptap.clear")]])])):t.createCommentVNode("",!0)])),_:1})])):t.createCommentVNode("",!0),r.horizontalRule?t.withDirectives((t.openBlock(),t.createBlock("button",{key:12,onClick:n[24]||(n[24]=t=>i.editor.chain().focus().setHorizontalRule().run()),class:"button"},[$u],512)),[[p,e.__("tiptap::tiptap.horizontal_rule")]]):t.createCommentVNode("",!0),r.undoRedo?t.withDirectives((t.openBlock(),t.createBlock("button",{key:13,onClick:n[25]||(n[25]=t=>i.editor.chain().focus().undo().run()),class:"button"},[Fu],512)),[[p,e.__("tiptap::tiptap.undo")]]):t.createCommentVNode("",!0),r.undoRedo?t.withDirectives((t.openBlock(),t.createBlock("button",{key:14,onClick:n[26]||(n[26]=t=>i.editor.chain().focus().redo().run()),class:"button"},[Hu],512)),[[p,e.__("tiptap::tiptap.redo")]]):t.createCommentVNode("",!0)])),_:1},8,["editor","class"])):t.createCommentVNode("",!0)]),t.createVNode(c,{editor:i.editor,class:"min-h-64 h-64",onClick:n[27]||(n[27]=t=>{i.headingOpen=!1,i.alignOpen=!1})},null,8,["editor"]),i.editor&&r.maxChars>0?(t.openBlock(),t.createBlock("div",{key:0,class:["w-full",s.charPercentage>90?"text-red-500":s.charPercentage>75?"text-yellow-500":null]},t.toDisplayString(e.__("tiptap::tiptap.character_count",{chars:i.editor.getCharacterCount(),max:r.maxChars})),3)):t.createCommentVNode("",!0)])};const qu={components:{Tiptap:hu},data:()=>({bubbleMenu:!1,maxChars:280,content:"

This is tiptap 2 in Voyager II using Vue 3 🎉

",disabled:!1,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0})},Ju={class:"flex space-x-2"},Wu={class:"input-group"},Uu=t.createVNode("label",{for:"bubble",class:"label"},"Bubble menu",-1),Ku={class:"mt-1"},Gu={class:"input-group"},Xu=t.createVNode("label",{for:"maxChars",class:"label"},"Max characters (0 = infinite)",-1),Yu={class:"mt-1"},Qu={class:"input-group"},Zu=t.createVNode("label",{for:"disabled",class:"label"},"Disabled",-1),th={class:"mt-1"},eh={class:"flex flex-wrap space-x-2 mt-4"},nh={class:"input-group"},rh={for:"bold",class:"label"},oh={class:"mt-1"},ih={class:"input-group"},sh={for:"italic",class:"label"},ah={class:"mt-1"},ch={class:"input-group"},ph={for:"strike",class:"label"},lh={class:"mt-1"},dh={class:"input-group"},uh={for:"underline",class:"label"},hh={class:"mt-1"},fh={class:"input-group"},mh={for:"code",class:"label"},vh={class:"mt-1"},gh={class:"input-group"},yh={for:"codeBlock",class:"label"},bh={class:"mt-1"},wh={class:"input-group"},kh={for:"blockquote",class:"label"},xh={class:"mt-1"},Mh={class:"input-group"},Sh={for:"bulletList",class:"label"},Oh={class:"mt-1"},Ch={class:"input-group"},Nh={for:"orderedList",class:"label"},_h={class:"mt-1"},Th={class:"input-group"},Ah={for:"taskList",class:"label"},Eh={class:"mt-1"},Vh={class:"input-group"},Dh={for:"heading",class:"label"},Rh={class:"mt-1"},zh={class:"input-group"},Ih={for:"textAlign",class:"label"},Bh={class:"mt-1"},Lh={class:"input-group"},Ph={for:"horizontalRule",class:"label"},jh={class:"mt-1"},$h={class:"input-group"},Fh={for:"undoRedo",class:"label"},Hh={class:"mt-1"};qu.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap"),c=t.resolveComponent("collapsible");return t.openBlock(),t.createBlock(t.Fragment,null,[t.createVNode(a,{bubbleMenu:i.bubbleMenu,maxChars:i.maxChars,modelValue:i.content,"onUpdate:modelValue":n[1]||(n[1]=t=>i.content=t),disabled:i.disabled,bold:i.bold,italic:i.italic,strike:i.strike,underline:i.underline,code:i.code,codeBlock:i.codeBlock,blockquote:i.blockquote,bulletList:i.bulletList,orderedList:i.orderedList,taskList:i.taskList,heading:i.heading,textAlign:i.textAlign,horizontalRule:i.horizontalRule,undoRedo:i.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","disabled","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"]),t.createVNode(c,{title:"Options"},{default:t.withCtx((()=>[t.createVNode("div",Ju,[t.createVNode("div",Wu,[Uu,t.createVNode("div",Ku,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[2]||(n[2]=t=>i.bubbleMenu=t),id:"bubble"},null,512),[[t.vModelCheckbox,i.bubbleMenu]])])]),t.createVNode("div",Gu,[Xu,t.createVNode("div",Yu,[t.withDirectives(t.createVNode("input",{type:"number",class:"input","onUpdate:modelValue":n[3]||(n[3]=t=>i.maxChars=t),min:"0",id:"maxChars"},null,512),[[t.vModelText,i.maxChars,void 0,{number:!0}]])])]),t.createVNode("div",Qu,[Zu,t.createVNode("div",th,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[4]||(n[4]=t=>i.disabled=t),id:"disabled"},null,512),[[t.vModelCheckbox,i.disabled]])])])]),t.createVNode("div",eh,[t.createVNode("div",nh,[t.createVNode("label",rh,t.toDisplayString(e.__("tiptap::tiptap.bold")),1),t.createVNode("div",oh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[5]||(n[5]=t=>i.bold=t),id:"bold"},null,512),[[t.vModelCheckbox,i.bold]])])]),t.createVNode("div",ih,[t.createVNode("label",sh,t.toDisplayString(e.__("tiptap::tiptap.italic")),1),t.createVNode("div",ah,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[6]||(n[6]=t=>i.italic=t),id:"italic"},null,512),[[t.vModelCheckbox,i.italic]])])]),t.createVNode("div",ch,[t.createVNode("label",ph,t.toDisplayString(e.__("tiptap::tiptap.strike")),1),t.createVNode("div",lh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[7]||(n[7]=t=>i.strike=t),id:"strike"},null,512),[[t.vModelCheckbox,i.strike]])])]),t.createVNode("div",dh,[t.createVNode("label",uh,t.toDisplayString(e.__("tiptap::tiptap.underline")),1),t.createVNode("div",hh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[8]||(n[8]=t=>i.underline=t),id:"underline"},null,512),[[t.vModelCheckbox,i.underline]])])]),t.createVNode("div",fh,[t.createVNode("label",mh,t.toDisplayString(e.__("tiptap::tiptap.code")),1),t.createVNode("div",vh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[9]||(n[9]=t=>i.code=t),id:"code"},null,512),[[t.vModelCheckbox,i.code]])])]),t.createVNode("div",gh,[t.createVNode("label",yh,t.toDisplayString(e.__("tiptap::tiptap.code_block")),1),t.createVNode("div",bh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[10]||(n[10]=t=>i.codeBlock=t),id:"codeBlock"},null,512),[[t.vModelCheckbox,i.codeBlock]])])]),t.createVNode("div",wh,[t.createVNode("label",kh,t.toDisplayString(e.__("tiptap::tiptap.blockquote")),1),t.createVNode("div",xh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[11]||(n[11]=t=>i.blockquote=t),id:"blockquote"},null,512),[[t.vModelCheckbox,i.blockquote]])])]),t.createVNode("div",Mh,[t.createVNode("label",Sh,t.toDisplayString(e.__("tiptap::tiptap.bullet_list")),1),t.createVNode("div",Oh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[12]||(n[12]=t=>i.bulletList=t),id:"bulletList"},null,512),[[t.vModelCheckbox,i.bulletList]])])]),t.createVNode("div",Ch,[t.createVNode("label",Nh,t.toDisplayString(e.__("tiptap::tiptap.ordered_list")),1),t.createVNode("div",_h,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[13]||(n[13]=t=>i.orderedList=t),id:"orderedList"},null,512),[[t.vModelCheckbox,i.orderedList]])])]),t.createVNode("div",Th,[t.createVNode("label",Ah,t.toDisplayString(e.__("tiptap::tiptap.task_list")),1),t.createVNode("div",Eh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[14]||(n[14]=t=>i.taskList=t),id:"taskList"},null,512),[[t.vModelCheckbox,i.taskList]])])]),t.createVNode("div",Vh,[t.createVNode("label",Dh,t.toDisplayString(e.__("tiptap::tiptap.heading")),1),t.createVNode("div",Rh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[15]||(n[15]=t=>i.heading=t),id:"heading"},null,512),[[t.vModelCheckbox,i.heading]])])]),t.createVNode("div",zh,[t.createVNode("label",Ih,t.toDisplayString(e.__("tiptap::tiptap.text_align")),1),t.createVNode("div",Bh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[16]||(n[16]=t=>i.textAlign=t),id:"textAlign"},null,512),[[t.vModelCheckbox,i.textAlign]])])]),t.createVNode("div",Lh,[t.createVNode("label",Ph,t.toDisplayString(e.__("tiptap::tiptap.horizontal_rule")),1),t.createVNode("div",jh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[17]||(n[17]=t=>i.horizontalRule=t),id:"horizontalRule"},null,512),[[t.vModelCheckbox,i.horizontalRule]])])]),t.createVNode("div",$h,[t.createVNode("label",Fh,t.toDisplayString(e.__("tiptap::tiptap.undo"))+"/"+t.toDisplayString(e.__("tiptap::tiptap.redo")),1),t.createVNode("div",Hh,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[18]||(n[18]=t=>i.undoRedo=t),id:"undoRedo"},null,512),[[t.vModelCheckbox,i.undoRedo]])])])])])),_:1}),t.createVNode(c,{title:"HTML Output"},{default:t.withCtx((()=>[t.withDirectives(t.createVNode("textarea",{class:"input w-full min-h-64","onUpdate:modelValue":n[19]||(n[19]=t=>i.content=t)},null,512),[[t.vModelText,i.content]])])),_:1})],64)};const qh={mixins:[voyager.formfieldMixin]},Jh={key:1},Wh={key:2};qh.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap");return"query"==e.action?t.renderSlot(e.$slots,"default",{key:0}):"add"==e.action||"edit"==e.action?(t.openBlock(),t.createBlock("div",Jh,[t.createVNode(a,{bubbleMenu:e.options.bubbleMenu,maxChars:e.options.maxChars,modelValue:e.modelValue,"onUpdate:modelValue":n[1]||(n[1]=t=>e.$emit("update:modelValue",t)),bold:e.options.bold,italic:e.options.italic,strike:e.options.strike,underline:e.options.underline,code:e.options.code,codeBlock:e.options.codeBlock,blockquote:e.options.blockquote,bulletList:e.options.bulletList,orderedList:e.options.orderedList,taskList:e.options.taskList,heading:e.options.heading,textAlign:e.options.textAlign,horizontalRule:e.options.horizontalRule,undoRedo:e.options.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):"browse"==e.action?(t.openBlock(),t.createBlock("div",Wh,t.toDisplayString(e.modelValue),1)):t.createCommentVNode("",!0)};const Uh={mixins:[voyager.formfieldBuilderMixin],computed:{defaultListOptions:()=>({display_length:150}),defaultViewOptions:()=>({bubbleMenu:!1,maxChars:0,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0})}},Kh={key:0},Gh={for:"length",class:"label"},Xh={key:1},Yh={class:"mt-2"},Qh={for:"maxChars",class:"label"},Zh={class:"grid grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 gap-2 mt-2"},tf={class:"flex items-center space-x-1"},ef={for:"bubble",class:"label"},nf={class:"flex items-center space-x-1"},rf={for:"bold",class:"label"},of={class:"flex items-center space-x-1"},sf={for:"italic",class:"label"},af={class:"flex items-center space-x-1"},cf={for:"strike",class:"label"},pf={class:"flex items-center space-x-1"},lf={for:"underline",class:"label"},df={class:"flex items-center space-x-1"},uf={for:"code",class:"label"},hf={class:"flex items-center space-x-1"},ff={for:"codeBlock",class:"label"},mf={class:"flex items-center space-x-1"},vf={for:"blockquote",class:"label"},gf={class:"flex items-center space-x-1"},yf={for:"bulletList",class:"label"},bf={class:"flex items-center space-x-1"},wf={for:"orderedList",class:"label"},kf={class:"flex items-center space-x-1"},xf={for:"taskList",class:"label"},Mf={class:"flex items-center space-x-1"},Sf={for:"heading",class:"label"},Of={class:"flex items-center space-x-1"},Cf={for:"textAlign",class:"label"},Nf={class:"flex items-center space-x-1"},_f={for:"horizontalRule",class:"label"},Tf={class:"flex items-center space-x-1"},Af={for:"undoRedo",class:"label"},Ef={key:2};Uh.render=function(e,n,r,o,i,s){const a=t.resolveComponent("tiptap");return"list-options"==e.action?(t.openBlock(),t.createBlock("div",Kh,[t.createVNode("label",Gh,t.toDisplayString(e.__("voyager::generic.display_length")),1),t.withDirectives(t.createVNode("input",{type:"number",id:"length",class:"input w-full","onUpdate:modelValue":n[1]||(n[1]=t=>e.options.display_length=t)},null,512),[[t.vModelText,e.options.display_length,void 0,{number:!0}]])])):"view-options"==e.action?(t.openBlock(),t.createBlock("div",Xh,[t.createVNode("div",Yh,[t.createVNode("label",Qh,t.toDisplayString(e.__("tiptap::tiptap.max_characters")),1),t.withDirectives(t.createVNode("input",{type:"number",class:"input w-full","onUpdate:modelValue":n[2]||(n[2]=t=>e.options.maxChars=t),min:"0",id:"maxChars"},null,512),[[t.vModelText,e.options.maxChars,void 0,{number:!0}]])]),t.createVNode("div",Zh,[t.createVNode("div",tf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[3]||(n[3]=t=>e.options.bubbleMenu=t),id:"bubble"},null,512),[[t.vModelCheckbox,e.options.bubbleMenu]]),t.createVNode("label",ef,t.toDisplayString(e.__("tiptap::tiptap.bubble_menu")),1)]),t.createVNode("div",nf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[4]||(n[4]=t=>e.options.bold=t),id:"bold"},null,512),[[t.vModelCheckbox,e.options.bold]]),t.createVNode("label",rf,t.toDisplayString(e.__("tiptap::tiptap.bold")),1)]),t.createVNode("div",of,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[5]||(n[5]=t=>e.options.italic=t),id:"italic"},null,512),[[t.vModelCheckbox,e.options.italic]]),t.createVNode("label",sf,t.toDisplayString(e.__("tiptap::tiptap.italic")),1)]),t.createVNode("div",af,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[6]||(n[6]=t=>e.options.strike=t),id:"strike"},null,512),[[t.vModelCheckbox,e.options.strike]]),t.createVNode("label",cf,t.toDisplayString(e.__("tiptap::tiptap.strike")),1)]),t.createVNode("div",pf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[7]||(n[7]=t=>e.options.underline=t),id:"underline"},null,512),[[t.vModelCheckbox,e.options.underline]]),t.createVNode("label",lf,t.toDisplayString(e.__("tiptap::tiptap.underline")),1)]),t.createVNode("div",df,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[8]||(n[8]=t=>e.options.code=t),id:"code"},null,512),[[t.vModelCheckbox,e.options.code]]),t.createVNode("label",uf,t.toDisplayString(e.__("tiptap::tiptap.code")),1)]),t.createVNode("div",hf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[9]||(n[9]=t=>e.options.codeBlock=t),id:"codeBlock"},null,512),[[t.vModelCheckbox,e.options.codeBlock]]),t.createVNode("label",ff,t.toDisplayString(e.__("tiptap::tiptap.code_block")),1)]),t.createVNode("div",mf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[10]||(n[10]=t=>e.options.blockquote=t),id:"blockquote"},null,512),[[t.vModelCheckbox,e.options.blockquote]]),t.createVNode("label",vf,t.toDisplayString(e.__("tiptap::tiptap.blockquote")),1)]),t.createVNode("div",gf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[11]||(n[11]=t=>e.options.bulletList=t),id:"bulletList"},null,512),[[t.vModelCheckbox,e.options.bulletList]]),t.createVNode("label",yf,t.toDisplayString(e.__("tiptap::tiptap.bullet_list")),1)]),t.createVNode("div",bf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[12]||(n[12]=t=>e.options.orderedList=t),id:"orderedList"},null,512),[[t.vModelCheckbox,e.options.orderedList]]),t.createVNode("label",wf,t.toDisplayString(e.__("tiptap::tiptap.ordered_list")),1)]),t.createVNode("div",kf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[13]||(n[13]=t=>e.options.taskList=t),id:"taskList"},null,512),[[t.vModelCheckbox,e.options.taskList]]),t.createVNode("label",xf,t.toDisplayString(e.__("tiptap::tiptap.task_list")),1)]),t.createVNode("div",Mf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[14]||(n[14]=t=>e.options.heading=t),id:"heading"},null,512),[[t.vModelCheckbox,e.options.heading]]),t.createVNode("label",Sf,t.toDisplayString(e.__("tiptap::tiptap.heading")),1)]),t.createVNode("div",Of,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[15]||(n[15]=t=>e.options.textAlign=t),id:"textAlign"},null,512),[[t.vModelCheckbox,e.options.textAlign]]),t.createVNode("label",Cf,t.toDisplayString(e.__("tiptap::tiptap.text_align")),1)]),t.createVNode("div",Nf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[16]||(n[16]=t=>e.options.horizontalRule=t),id:"horizontalRule"},null,512),[[t.vModelCheckbox,e.options.horizontalRule]]),t.createVNode("label",_f,t.toDisplayString(e.__("tiptap::tiptap.horizontal_rule")),1)]),t.createVNode("div",Tf,[t.withDirectives(t.createVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":n[17]||(n[17]=t=>e.options.undoRedo=t),id:"undoRedo"},null,512),[[t.vModelCheckbox,e.options.undoRedo]]),t.createVNode("label",Af,t.toDisplayString(e.__("tiptap::tiptap.undo"))+"/"+t.toDisplayString(e.__("tiptap::tiptap.redo")),1)])])])):"view"==e.action?(t.openBlock(),t.createBlock("div",Ef,[t.createVNode(a,{bubbleMenu:e.options.bubbleMenu,maxChars:e.options.maxChars,value:"''",bold:e.options.bold,italic:e.options.italic,strike:e.options.strike,underline:e.options.underline,code:e.options.code,codeBlock:e.options.codeBlock,blockquote:e.options.blockquote,bulletList:e.options.bulletList,orderedList:e.options.orderedList,taskList:e.options.taskList,heading:e.options.heading,textAlign:e.options.textAlign,horizontalRule:e.options.horizontalRule,undoRedo:e.options.undoRedo},null,8,["bubbleMenu","maxChars","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):t.createCommentVNode("",!0)},voyager.component("tiptap",hu),voyager.component("tiptap-demo",qu),voyager.component("tiptap-formfield",qh),voyager.component("tiptap-builder",Uh),voyager.addToUI("Tiptap","tiptap-demo")})); diff --git a/package-lock.json b/package-lock.json index adc382e..9ef1a6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,8 +8,8 @@ "name": "tiptap-vite", "version": "0.0.0", "dependencies": { - "@tabler/icons": "^1.41.1", - "@tiptap/core": "^2.0.0-beta.53", + "@tabler/icons": "^1.41.2", + "@tiptap/core": "^2.0.0-beta.54", "@tiptap/extension-blockquote": "^2.0.0-beta.11", "@tiptap/extension-bullet-list": "^2.0.0-beta.11", "@tiptap/extension-character-count": "^2.0.0-beta.10", @@ -28,7 +28,7 @@ "@tiptap/extension-text-align": "^2.0.0-beta.14", "@tiptap/extension-typography": "^2.0.0-beta.10", "@tiptap/extension-underline": "^2.0.0-beta.12", - "@tiptap/starter-kit": "^2.0.0-beta.50", + "@tiptap/starter-kit": "^2.0.0-beta.51", "@tiptap/vue-3": "^2.0.0-beta.33", "vue": "^3.0.11" }, @@ -74,9 +74,9 @@ } }, "node_modules/@tabler/icons": { - "version": "1.41.1", - "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.41.1.tgz", - "integrity": "sha512-joQWZDeKepzIz8CSmSNIFA5kDW1XuzCFi3sITr5+jD6rGaRlIGcjzqppFfgiGesmidoelZj0IFYz07/XJ2X+HA==", + "version": "1.41.2", + "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.41.2.tgz", + "integrity": "sha512-X6cQmMC24hiwg0p2BzasvU3IeCCdOk0f/9d6gNNtJM4lzG2TCloTns1bVvU5MAFkITGukxUqjPFE3Ecd6kGsfw==", "funding": { "type": "github", "url": "https://github.com/sponsors/codecalm" @@ -87,9 +87,9 @@ } }, "node_modules/@tiptap/core": { - "version": "2.0.0-beta.53", - "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.53.tgz", - "integrity": "sha512-zspO2tGlMW8tRZNfLIhcIis0ZSwhAGfdcwvPfJtksN4u1OXgtzvH261DwKdN9OrV6kwOPuN5WiSyRxgAoRXcMA==", + "version": "2.0.0-beta.54", + "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.54.tgz", + "integrity": "sha512-N89gA7MKxbXXN/aoe9Qp9fyzgg26Sm+7t+/ADB2HqCvVJhN0fQI0MhNdwOTvxHSxo3AASBMgo7Yj1Zw29TfG1Q==", "dependencies": { "@types/prosemirror-commands": "^1.0.4", "@types/prosemirror-inputrules": "^1.0.4", @@ -498,11 +498,11 @@ } }, "node_modules/@tiptap/starter-kit": { - "version": "2.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.50.tgz", - "integrity": "sha512-oio13vCfL9VmM4OedkwxX4hRtDHp7tw4shZxoi1uUIfAEJ369Yn/U50GDQF+zXa1MQLiyo2mmbA56rJKCqeXZg==", + "version": "2.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.51.tgz", + "integrity": "sha512-mpbtq/CbER0k9OTpz5e6b+v1g/JH7LsZJRyTI9Fckg8i8ao+gp1oZAB34vzEGpvqT6mVfKF9Ukm5jAGNvhY/HQ==", "dependencies": { - "@tiptap/core": "^2.0.0-beta.53", + "@tiptap/core": "^2.0.0-beta.54", "@tiptap/extension-blockquote": "^2.0.0-beta.11", "@tiptap/extension-bold": "^2.0.0-beta.11", "@tiptap/extension-bullet-list": "^2.0.0-beta.11", @@ -1601,15 +1601,15 @@ "integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==" }, "@tabler/icons": { - "version": "1.41.1", - "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.41.1.tgz", - "integrity": "sha512-joQWZDeKepzIz8CSmSNIFA5kDW1XuzCFi3sITr5+jD6rGaRlIGcjzqppFfgiGesmidoelZj0IFYz07/XJ2X+HA==", + "version": "1.41.2", + "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.41.2.tgz", + "integrity": "sha512-X6cQmMC24hiwg0p2BzasvU3IeCCdOk0f/9d6gNNtJM4lzG2TCloTns1bVvU5MAFkITGukxUqjPFE3Ecd6kGsfw==", "requires": {} }, "@tiptap/core": { - "version": "2.0.0-beta.53", - "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.53.tgz", - "integrity": "sha512-zspO2tGlMW8tRZNfLIhcIis0ZSwhAGfdcwvPfJtksN4u1OXgtzvH261DwKdN9OrV6kwOPuN5WiSyRxgAoRXcMA==", + "version": "2.0.0-beta.54", + "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.54.tgz", + "integrity": "sha512-N89gA7MKxbXXN/aoe9Qp9fyzgg26Sm+7t+/ADB2HqCvVJhN0fQI0MhNdwOTvxHSxo3AASBMgo7Yj1Zw29TfG1Q==", "requires": { "@types/prosemirror-commands": "^1.0.4", "@types/prosemirror-inputrules": "^1.0.4", @@ -1832,11 +1832,11 @@ "requires": {} }, "@tiptap/starter-kit": { - "version": "2.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.50.tgz", - "integrity": "sha512-oio13vCfL9VmM4OedkwxX4hRtDHp7tw4shZxoi1uUIfAEJ369Yn/U50GDQF+zXa1MQLiyo2mmbA56rJKCqeXZg==", + "version": "2.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.51.tgz", + "integrity": "sha512-mpbtq/CbER0k9OTpz5e6b+v1g/JH7LsZJRyTI9Fckg8i8ao+gp1oZAB34vzEGpvqT6mVfKF9Ukm5jAGNvhY/HQ==", "requires": { - "@tiptap/core": "^2.0.0-beta.53", + "@tiptap/core": "^2.0.0-beta.54", "@tiptap/extension-blockquote": "^2.0.0-beta.11", "@tiptap/extension-bold": "^2.0.0-beta.11", "@tiptap/extension-bullet-list": "^2.0.0-beta.11", diff --git a/package.json b/package.json index c35eb84..90e0cff 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "watch": "vite build --mode development --watch" }, "dependencies": { - "@tabler/icons": "^1.41.1", - "@tiptap/core": "^2.0.0-beta.53", + "@tabler/icons": "^1.41.2", + "@tiptap/core": "^2.0.0-beta.54", "@tiptap/extension-blockquote": "^2.0.0-beta.11", "@tiptap/extension-bullet-list": "^2.0.0-beta.11", "@tiptap/extension-character-count": "^2.0.0-beta.10", @@ -26,7 +26,7 @@ "@tiptap/extension-text-align": "^2.0.0-beta.14", "@tiptap/extension-typography": "^2.0.0-beta.10", "@tiptap/extension-underline": "^2.0.0-beta.12", - "@tiptap/starter-kit": "^2.0.0-beta.50", + "@tiptap/starter-kit": "^2.0.0-beta.51", "@tiptap/vue-3": "^2.0.0-beta.33", "vue": "^3.0.11" },