PageSourceSearch

https://pltt.ai/_next/static/chunks/2kj8sd510-0qp.js

js pltt.ai collected 2026-10-05 15:19:32 UTC 613,666 bytes, 90 lines download raw bytes

vendor: 4,458 bytes, line 1
1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,708584,10552,727612,750570,89128,330325,279743,283086,453901,523278,248120,510096,850050,399993,968575,765381,297907,849074,560050,709646,616009,732200,e=>{"use strict";let t,n,r,i,s,o;var l=e.i(843476),a=e.i(317230),c=e.i(271645),d=e.i(247167),h=c,u=e.i(174080),p=e.i(802239),f=Object.defineProperty;function m(e){this.content=e}function g(e){return e>=56320&&e<57344}function y(e){return e>=55296&&e<56320}m.prototype={constructor:m,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return -1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new m(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new m(n)},addToStart:function(e,t){return new m([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new m(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(-1==s?i.length:s,0,t,n),new m(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=m.from(e)).size?new m(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=m.from(e)).size?new m(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=m.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},m.from=function(e){if(e instanceof m)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new m(t)};class b{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;if(a>e&&!1!==n(l,r+o,i||null,s)&&l.content.size){let i=o+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}o=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",s=!0;return this.nodesBetween(e,t,(o,l)=>{let a=o.isText?o.text.slice(Math.max(e,l)-l,t-l):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&a||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new b(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let o=this.content[i],l=s+o.nodeSize;l>e&&((s<e||l>t)&&(o=o.isText?o.cut(Math.max(0,e-s),Math.min(o.text.length,t-s)):o.cut(Math.max(0,e-s-1),Math.min(o.content.size,t-s-1))),n.push(o),r+=o.nodeSize),s=l}return new b(n,r)}cutByIndex(e,t){return e==t?b.empty:0==e&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new b(r,i)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let s=t.child(i),o=n.child(i);if(s==o){r+=s.nodeSize;continue}if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){let e=s.text,t=o.text,n=0;for(;e[n]==t[n];
1n++)r++;return n&&n<e.length&&n<t.length&&y(e.charCodeAt(n-1))&&g(e.charCodeAt(n))&&r--,r}if(s.content.size||o.content.size){let t=e(s.content,o.content,r+1);if(null!=t)return t}r+=s.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let s=t.childCount,o=n.childCount;;){if(0==s||0==o)return s==o?null:{a:r,b:i};let l=t.child(--s),a=n.child(--o),c=l.nodeSize;if(l==a){r-=c,i-=c;continue}if(!l.sameMarkup(a))return{a:r,b:i};if(l.isText&&l.text!=a.text){let e=l.text,t=a.text,n=e.length,s=t.length;for(;n>0&&s>0&&e[n-1]==t[s-1];)n--,s--,r--,i--;return n&&s&&n<e.length&&y(e.charCodeAt(n-1))&&g(e.charCodeAt(n))&&(r++,i++),{a:r,b:i}}if(l.content.size||a.content.size){let t=e(l.content,a.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return v(0,e);if(e==this.size)return v(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return v(t+1,r);return v(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return b.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new b(t||e,n)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);let w={index:0,offset:0};function v(e,t){return w.index=e,w.offset=t,w}function k(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!k(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!k(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class x{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&k(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return x.none;if(e instanceof x)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}x.none=[];class S extends Error{}class C{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,s,o){let{index:l,offset:a}=t.findIndex(n),c=t.maybeChild(l);if(a==n||c.isText)return o&&i<=0&&s<=0&&!o.canReplace(l,l,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-a-1,r,0==l?i-1:0,l==t.childCount-1?s-1:0,c);return d&&t.replaceChild(l,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new C(n,this.openStart,this.openEnd)}removeBetween(e,t){return new C(function e(t,n,r){let{index:i,offset:s}=t.findIndex(n),o=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(s==n||o.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,o.copy(e(o.content,n-s-1,r-s-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return C.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new C(b.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new C(e,n,r)}}function M(e,t){if(!t.type.compatibleContent(e.type))throw new S("Cannot join "+t.type.name+" onto "+e.type.n
vendor: 4,756 bytes, line 1
1ame)}function A(e,t,n){let r=e.node(n);return M(r,t.node(n)),r}function E(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function T(e,t,n,r){let i=(t||e).node(n),s=0,o=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(E(e.nodeAfter,r),s++));for(let e=s;e<o;e++)E(i.child(e),r);t&&t.depth==n&&t.textOffset&&E(t.nodeBefore,r)}function O(e,t){if(!e.type.validContent(t))throw new S("Invalid content for node "+e.type.name);return e.copy(t)}function N(e,t,n){let r=[];return T(null,e,n,r),e.depth>n&&E(O(A(e,t,n+1),N(e,t,n+1)),r),T(t,null,n,r),new b(r)}C.empty=new C(b.empty,0,0);class D{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return x.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new _(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:s}=t.content.findIndex(i),o=i-s;if(n.push(t,e,r+s),!o||(t=t.child(e)).isText)break;i=o-1,r+=s+1}return new D(t,n,i)}static resolveCached(e,t){let n=L.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else L.set(e,n=new R);let r=n.elts[n.i]=D.resolve(e,t);return n.i=(n.i+1)%I,r}}class R{constructor(){this.elts=[],this.i=0}}let I=12,L=new WeakMap;class _{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let P=Object.create(null);class j{constructor(e,t,n,r=x.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||b.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}
1textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&k(this.attrs,t||e.defaultAttrs||P)&&x.sameSet(this.marks,n||x.none)}copy(e=null){return e==this.content?this:new j(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new j(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return C.empty;let r=this.resolve(e),i=this.resolve(t),s=n?0:r.sharedDepth(t),o=r.start(s);return new C(r.node(s).content.cut(r.pos-o,i.pos-o),r.depth-s,i.depth-s)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new S("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new S("Inconsistent open depths");return function e(t,n,r,i){let s=t.index(i),o=t.node(i);if(s==n.index(i)&&i<t.depth-r.openStart){let l=e(t,n,r,i+1);return o.copy(o.content.replaceChild(s,l))}if(!r.content.size)return O(o,N(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){let{start:e,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(b.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return O(o,function e(t,n,r,i,s){let o=t.depth>s&&A(t,n,s+1),l=i.depth>s&&A(r,i,s+1),a=[];return T(null,t,s,a),o&&l&&n.index(s)==r.index(s)?(M(o,l),E(O(o,e(t,n,r,i,s+1)),a)):(o&&E(O(o,N(t,n,s+1)),a),T(n,r,s,a),l&&E(O(l,N(r,i,s+1)),a)),T(i,null,s,a),new b(a)}(t,e,s,n,i))}{let e=t.parent,i=e.content;return O(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return D.resolveCached(this,e)}resolveNoCache(e){return D.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),$(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=b.empty,r=0,i=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),s=i&&i.matchFragment(this.content,t);return!!s&&s.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=x.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!x.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
1e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=b.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}j.prototype.text=void 0;class z extends j{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new z(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new z(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class B{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new V(e,t);if(null==i.next)return B.empty;let s=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(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==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=H(e),r=n;return e.eat(",")&&(r="}"!=e.next?H(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let o=(n=function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,s)),[]);if("seq"==t.type)for(let r=0;;r++){let o=e(t.exprs[r],s);if(r==t.exprs.length-1)return o;i(o,s=n())}else if("star"==t.type){let o=n();return r(s,o),i(e(t.expr,o),o),[r(o)]}else if("plus"==t.type){let o=n();return i(e(t.expr,s),o),i(e(t.expr,o),o),[r(o)]}else if("opt"==t.type)return[r(s)].concat(e(t.expr,s));else if("range"==t.type){let o=s;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,o),r),o=r}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=n();r(o,s),i(e(t.expr,o),s),o=s}return[r(o)]}else if("name"==t.type)return[r(s,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(s),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);U(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let s=r[t.join(",")]=new B(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(F);s.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return s}(U(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];s.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,i),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}
vendor: 4,607 bytes, line 1
1matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(s,o){let l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return b.from(o.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}B.empty=new B(!0);class V{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function H(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function F(e,t){return t-e}function U(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:s}=i[e];r||-1!=n.indexOf(s)||t(s)}}(t),n.sort(F)}function W(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function q(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function K(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function J(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new X(e,r,t[r]);return n}class G{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=J(e,n.attrs),this.defaultAttrs=W(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==B.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new j(this,this.computeAttrs(e),b.from(t),x.setFrom(n))}createChecked(e=null,t,n){return t=b.from(t),this.checkContent(t),new j(this,this.computeAttrs(e),t,x.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=b.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(b.empty,!0);return i?new j(this,e,t.append(i),x.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
1if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){K(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:x.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new G(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class X{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Y{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=J(e,r.attrs),this.excluded=null;let i=W(this.attrs);this.instance=i?new x(this,i):null}create(e=null){return!e&&this.instance?this.instance:new x(this,q(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new Y(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){K(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Q{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=m.from(e.nodes),t.marks=m.from(e.marks||{}),this.nodes=G.compile(this.spec.nodes,this),this.marks=Y.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=B.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?Z(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Z(this,n.split(" "))}this.nodeFromJSON=e=>j.fromJSON(this,e),this.markFromJSON=e=>x.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof G){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new z(n,n.defaultAttrs,e,x.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function Z(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],o=s;if(s)n.push(s);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class ee{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];
1t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new eo(this,t,!1);return n.addAll(e,x.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new eo(this,t,!0);return n.addAll(e,x.none,t.from,t.to),C.maxOpen(n.finish())}matchTag(e,t,n){for(let s=n?this.tags.indexOf(n)+1:0;s<this.tags.length;s++){var r,i;let n=this.tags[s];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(0==s.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(s.length>e.length)||61==s.charCodeAt(e.length)&&s.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=el(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=el(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ee(e,ee.schemaRules(e)))}}let et={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},en={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},er={ol:!0,ul:!0};function ei(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class es{constructor(e,t,n,r,i,s){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=x.none,this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!et.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class eo{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=ei(null,t.preserveWhitespace,0)|4*!!n;i=r?new es(r.type,r.attrs,x.none,!0,t.topMatch||r.type.contentMatch,s):n?new es(null,null,x.none,!0,null,s):new es(e.schema.topNodeType,null,x.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:s}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(s.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(s.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(s.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;er.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&er.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));e:if(l?l.ignore:en.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(et.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let o=l&&l.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,s;
vendor: 4,111 bytes, line 1
1if(t.node)if((s=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(s.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(s,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let s=n?e.childNodes[n]:e.firstChild,o=null==r?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,s=0;t>=0;t--){let o=this.nodes[t],l=o.findWrapping(e);if(l&&(!r||r.length>l.length+s)&&(r=l,i=o,!l.length))break;if(o.solid){if(n)break;s+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=x.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):ea(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=ei(e,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let l=x.none;return n=n.filter(t=>(s.type?!s.type.allowsMarkType(t.type):!ea(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new es(e,t,l,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,s=(e,o)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(s(e-1,o))return!0;return!1}{let e=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;o--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];
1if(t.isTextblock&&t.defaultAttrs)return t}}}function el(e){let t={};for(let n in e)t[n]=e[n];return t}function ea(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let s=[],o=e=>{s.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>s.indexOf(i)&&o(i))return!0}};if(o(i.contentMatch))return!0}}class ec{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=eh(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,s=0;for(;n<i.length&&s<e.marks.length;){let t=e.marks[s];if(!this.marks[t.type.name]){s++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,s++}for(;n<i.length;)r=i.pop()[1];for(;s<e.marks.length;){let n=e.marks[s++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return eh(t).createTextNode(e.text);let{dom:n,contentDOM:r}=ep(eh(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&ep(eh(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:ep(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ec(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ed(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ed(e.marks)}}function ed(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function eh(e){return e.document||window.document}let eu=new WeakMap;function ep(e,t,n,r){let i,s,o;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(s=eu.get(r))&&eu.set(r,(o=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])o||(o=[]),o.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),s=o)),a=s)&&a.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=l.indexOf(" ");c>0&&(n=l.slice(0,c),l=l.slice(c+1));let d=n?e.createElementNS(n,l):e.createElement(l),h=t[1],u=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){for(let e in u=2,h)if(null!=h[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),h[e]):"style"==e&&d.style?d.style.cssText=h[e]:d.setAttribute(e,h[e])}}for(let s=u;s<t.length;s++){let o=t[s];if(0===o){if(s<t.length-1||s>u)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof o)d.appendChild(e.createTextNode(o));else{let{dom:t,contentDOM:s}=ep(e,o,n,r);if(d.appendChild(t),s){if(i)throw RangeError("Multiple content holes");i=s}}}return{dom:d,contentDOM:i}}class ef{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class em{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&em.empty)return em.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[o+i],c=this.ranges[o+s],d=l+a;if(e<=d){let i=a?e==l?-1:e==d?1:t:t,s=l+r+(i<0?0:c);if(n)return s;
vendor: 4,152 bytes, line 1
1let h=e==(t<0?l:d)?null:o/3+(e-l)*65536,u=e==l?2:e==d?1:4;return(t<0?e!=l:e!=d)&&(u|=8),new ef(s,u,h)}r+=c-a}return n?e+r:new ef(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let l=this.ranges[t+i];if(e<=o+l&&t==3*r)return!0;n+=this.ranges[t+s]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),a=this.ranges[r+t],c=this.ranges[r+n];e(o,o+a,l,l+c),i+=c-a}}invert(){return new em(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?em.empty:new em(e<0?[0,-e,0]:[0,0,e])}}em.empty=new em([]);class eg{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new eg(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new eg;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ef(e,r,null)}}let ey=Object.create(null);class eb{getMap(){return em.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=ey[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ey)throw RangeError("Duplicate use of step JSON ID "+e);return ey[e]=t,t.prototype.jsonID=e,t}}class ew{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ew(e,null)}static fail(e){return new ew(null,e)}static fromReplace(e,t,n,r){try{return ew.ok(e.replace(t,n,r))}catch(e){if(e instanceof S)return ew.fail(e.message);throw e}}}function ev(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(ev(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return b.fromArray(r)}class ek extends eb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new C(ev(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return ew.fromReplace(e,this.from,this.to,i)}invert(){return new ex(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ek(t.pos,n.pos,this.mark)}merge(e){return e instanceof ek&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ek(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new ek(t.from,t.to,e.markFromJSON(t.mark))}}eb.jsonID("addMark",ek);class ex extends eb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}
vendor: 21,689 bytes, line 1
1apply(e){let t=e.slice(this.from,this.to),n=new C(ev(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ew.fromReplace(e,this.from,this.to,n)}invert(){return new ek(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ex(t.pos,n.pos,this.mark)}merge(e){return e instanceof ex&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ex(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ex(t.from,t.to,e.markFromJSON(t.mark))}}eb.jsonID("removeMark",ex);class eS extends eb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ew.fromReplace(e,this.pos,this.pos+1,new C(b.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new eS(this.pos,t.marks[n]);return new eS(this.pos,this.mark)}}return new eC(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eS(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new eS(t.pos,e.markFromJSON(t.mark))}}eb.jsonID("addNodeMark",eS);class eC extends eb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ew.fromReplace(e,this.pos,this.pos+1,new C(b.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new eS(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eC(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new eC(t.pos,e.markFromJSON(t.mark))}}eb.jsonID("removeNodeMark",eC);class eM extends eb{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&eE(e,this.from,this.to)?ew.fail("Structure replace would overwrite content"):ew.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new em([this.from,this.to-this.from,this.slice.size])}invert(e){return new eM(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&eM.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new eM(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eM)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?C.empty:new C(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eM(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?C.empty:new C(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eM(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eM(t.from,t.to,C.fromJSON(e,t.slice),!!t.structure)}}eM.MAP_BIAS=1,eb.jsonID("replace",eM);class eA extends eb{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(eE(e,this.from,this.gapFrom)||eE(e,this.gapTo,this.to)))return ew.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ew.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?ew.fromReplace(e,this.from,this.to,n):ew.fail("Content does not fit in gap")}getMap(){return new em([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eA(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eA(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eA(t.from,t.to,t.gapFrom,t.gapTo,C.fromJSON(e,t.slice),t.insert,!!t.structure)}}function eE(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function eT(e,t,n,r=n.contentMatch,i=!0){let s=e.doc.nodeAt(t),o=[],l=t+1;for(let t=0;t<s.childCount;t++){let a=s.child(t),c=l+a.nodeSize,d=r.matchType(a.type);if(d){r=d;for(let t=0;t<a.marks.length;t++)n.allowsMarkType(a.marks[t].type)||e.step(new ex(l,c,a.marks[t]));if(i&&a.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(a.text);)r||(r=new C(b.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),o.push(new eM(l+e.index,l+e.index+e[0].length,r))}}else o.push(new eM(l,c,C.empty));l=c}if(!r.validEnd){let t=r.fillBefore(b.empty,!0);e.replace(l,l,new C(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function eO(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let s=e.$from.node(n),o=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n<e.depth&&s.canReplace(o,l,t))return n;if(0==n||s.type.spec.isolating||!((0==o||s.canReplace(o,s.childCount))&&(l==s.childCount||s.canReplace(0,l))))break;o&&(r=1),l<s.childCount&&(i=1)}return null}function eN(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.contentMatchAt(r).findWrapping(t);if(!s)return null;let o=s.length?s[0]:t;return n.canReplaceWith(r,i,o)?s:null}(e,t),s=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.child(r),o=t.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?o:null}(r,t);return s?i.map(eD).concat({type:t,attrs:n}).concat(s.map(eD)):null}function eD(e){return{type:e,attrs:null}}function eR(e,t,n,r){t.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+s+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function eI(e,t,n,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+s);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function eL(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>s;e--,t--){let n=i.node(e),s=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(s,n.childCount),l=r&&r[t+1];l&&(o=o.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(s+1,n.childCount)||!a.type.validContent(o))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function e_(e,t){let n=e.resolve(t),r=n.index();return eP(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eP(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),o=s.type==r?e.type.schema.nodes.text:s.type;if(!(n=n.matchType(o))||!e.type.allowsMarks(s.marks))return!1}return n.validEnd}(e,t))}function ej(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,s,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(e+1),o++,s=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),s=r.node(e+1)),i&&!i.isTextblock&&eP(i,s)&&r.node(e).canReplace(o,o+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function ez(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,s=r.index(t)+ +(n>0),o=r.node(t),l=!1;if(1==e)l=o.canReplace(s,s,i);else{let e=o.contentMatchAt(s).findWrapping(i.firstChild.type);l=e&&o.canReplaceWith(s,s,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function e$(e,t,n=t,r=C.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return eB(i,s,r)?new eM(t,n,r):new eV(i,s,r).fit()}function eB(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}eb.jsonID("replaceAround",eA);class eV{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=b.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=b.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let l=new C(i,s,o);return e>-1?new eA(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new eM(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=eU(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:s,match:o}=this.frontier[i],l,a=null;if(1==t&&(r?o.matchType(r.type)||(a=o.fillBefore(b.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:a};if(2==t&&r&&(l=o.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:l};if(e&&o.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return!(eq(e,-1)<=t)&&(this.unplaced.size>1&&eq(e,1)>n&&n++,this.unplaced=new C(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eU(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new C(eH(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new C(eH(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,o=n?n.content:s.content,l=s.openStart-e,a=0,c=[],{match:d,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let u=o.size+e-(s.content.size-s.openEnd);for(;a<o.childCount;){let e=o.child(a),t=d.matchType(e.type);if(!t)break;(++a>1||0==l||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(b.empty,!0)))),t.copy(i)}(e.mark(h.allowedMarks(e.marks)),1==a?l:0,a==o.childCount?u:-1)))}let p=a==o.childCount;p||(u=-1),this.placed=eF(this.placed,t,b.from(c)),this.frontier[t].match=d,p&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?C.empty:new C(eH(s.content,e-1,1),e-1,u<0?s.openEnd:e-1):new C(eH(s.content,e,a),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eW(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=eW(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eW(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eF(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=eF(this.placed,this.depth,b.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(b.empty,!0);e.childCount&&(this.placed=eF(this.placed,this.frontier.length,e))}}function eH(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eH(e.firstChild.content,t-1,n)))}function eF(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eF(e.lastChild.content,t-1,n)))}function eU(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eW(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,s.content,o)?l:null}function eq(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function eK(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class eJ extends eb{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ew.fromReplace(e,this.pos,this.pos+1,new C(b.from(r),0,+!t.isLeaf))}getMap(){return em.empty}invert(e){return new eJ(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eJ(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new eJ(t.pos,t.attr,t.value)}}eb.jsonID("attr",eJ);class eG extends eb{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ew.ok(n)}getMap(){return em.empty}invert(e){return new eG(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eG(t.attr,t.value)}}eb.jsonID("docAttr",eG);let eX=class extends Error{};(eX=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eX.prototype.constructor=eX,eX.prototype.name="TransformError";class eY{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new eg}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eX(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,s)=>{e=Math.min(e,i),t=Math.max(t,s)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=C.empty){let r=e$(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new C(b.from(n),0,0))}delete(e,t){return this.replace(e,t,C.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(eB(i,s,r))return e.step(new eM(t,n,r));let o=eK(i,s);0==o[o.length-1]&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?l=e:i.before(e)==t&&o.splice(1,0,-e)}let a=o.indexOf(l),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var h;let t=c[e],n=(h=t.type).spec.defining||h.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(l)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+d+1)%(r.openStart+1),h=c[l];if(h)for(let t=0;t<o.length;t++){let c=o[(t+a)%o.length],d=!0;c<0&&(d=!1,c=-c);let u=i.node(c-1),p=i.index(c-1);if(u.canReplaceWith(p,p,h.type,h.marks))return e.replace(i.before(c),d?s.after(c):n,new C(function e(t,n,r,i,s){if(n<r){let s=t.firstChild;t=t.replaceChild(0,s.copy(e(s.content,n+1,r,i,s)))}if(n>i){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(b.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let u=e.steps.length;for(let l=o.length-1;l>=0&&(e.replace(t,n,r),!(e.steps.length>u));l--){let e=o[l];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=i=e)}return this.replaceRange(r,i,new C(b.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let s=r.sharedDepth(n),o=!1;for(let e=r.depth;e>s;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>s;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let s=eK(r,i);for(let t=0;t<s.length;t++){let n=s[t],o=t==s.length-1;if(o&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:s}=t,o=r.before(s+1),l=i.after(s+1),a=o,c=l,d=b.empty,h=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>
10?(t=!0,d=b.from(r.node(e).copy(d)),h++):a--;let u=b.empty,p=0;for(let e=s,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,u=b.from(i.node(e).copy(u)),p++):c++;e.step(new eA(a,c,o,l,new C(d.append(u),h,p),d.size-h,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,s=e.doc.resolve(t-n),o=s.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);eI(e,r.node(),r.before(),l)}o.inlineContent&&eT(e,t+n-1,o,s.node().contentMatchAt(s.index()),null==r);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new eM(c,a.map(t+n,-1),C.empty,!0)),!0===r){let t=e.doc.resolve(c);eR(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=b.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(n[e].type.create(n[e].attrs,r))}let i=t.start,s=t.end;e.step(new eA(i,s,i,s,new C(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var o,l,a;let c,d,h="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,h)&&(o=i.doc,l=i.mapping.slice(s).map(t),a=n,d=(c=o.resolve(l)).index(),c.parent.canReplaceWith(d,d+1,a))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&eI(i,e,t,s),eT(i,i.mapping.slice(s).map(t,1),n,void 0,null===r);let o=i.mapping.slice(s),l=o.map(t,1),a=o.map(t+e.nodeSize,1);return i.step(new eA(l,a,l+1,a-1,new C(b.from(n.create(h,null,e.marks)),0,0),1,!0)),!0===r&&eR(i,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,o);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new eA(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new C(b.from(o),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new eJ(e,t,n)),this}setDocAttribute(e,t){return this.step(new eG(e,t)),this}addNodeMark(e,t){return this.step(new eS(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof x)t.isInSet(n.marks)&&this.step(new eC(e,t));else{let r=n.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new eC(e,i)),r=i.removeFromSet(r);for(let e=s.length-1;e>=0;e--)this.step(s[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),s=b.empty,o=b.empty;for(let e=i.depth,t=i.depth-n,l=n-1;e>t;e--,l--){s=b.from(i.node(e).copy(s));let t=r&&r[l];o=b.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new eM(t,t,new C(s.append(o),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,s,o,l;return r=this,o=[],l=[],r.doc.nodesBetween(e,t,(r,a,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(a,e),h=Math.min(a+r.nodeSize,t),u=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(u)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=h:o.push(i=new ex(c,h,d[e])));s&&s.to==c?s.to=h:l.push(s=new ek(c,h,n))}}),o.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,s;return r=this,i=[],s=0,r.doc.nodesBetween(e,t,(r,o)=>{if(!r.isInline)return;s++;let l=null;if(n instanceof Y){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(o+r.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],a;for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&r.eq(i[e].style)&&(a=t)}a?(a.to=n,a.step=s):i.push({style:r,from:Math.max(o,e),to:n,step:s})}}}
vendor: 7,968 bytes, line 1
1),i.forEach(e=>r.step(new ex(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return eT(this,e,t,n),this}}let eQ=Object.create(null);class eZ{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e0(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=C.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:a}=s[o],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(a.pos),o?C.empty:t),0==o&&te(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],l=e.mapping.slice(n),a=l.map(s.pos),c=l.map(o.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),te(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new e3(e):e7(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?e7(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):e7(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new e8(e.node(0))}static atStart(e){return e7(e,e,0,0,1)||new e8(e)}static atEnd(e){return e7(e,e,e.content.size,e.childCount,-1)||new e8(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=eQ[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in eQ)throw RangeError("Duplicate use of selection JSON ID "+e);return eQ[e]=t,t.prototype.jsonID=e,t}getBookmark(){return e3.between(this.$anchor,this.$head).getBookmark()}}eZ.prototype.visible=!0;class e0{constructor(e,t){this.$from=e,this.$to=t}}let e1=!1;function e2(e){e1||e.parent.inlineContent||(e1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class e3 extends eZ{constructor(e,t=e){e2(e),e2(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return eZ.near(n);let r=e.resolve(t.map(this.anchor));return new e3(r.parent.inlineContent?r:n,n)}replace(e,t=C.empty){if(super.replace(e,t),t==C.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof e3&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new e4(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new e3(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=eZ.findFrom(t,n,!0)||eZ.findFrom(t,-n,!0);if(!e)return eZ.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(eZ.findFrom(e,-n,!0)||eZ.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new e3(e,t)}}eZ.jsonID("text",e3);class e4{constructor(e,t){this.anchor=e,this.head=t}map(e){return new e4(e.map(this.anchor),e.map(this.head))}resolve(e){return e3.between(e.resolve(this.anchor),e.resolve(this.head))}}class e5 extends eZ{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?eZ.near(i):new e5(i)}content(){return new C(b.from(this.node),0,0)}eq(e){return e instanceof e5&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new e6(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new e5(e.resolve(t.anchor))}static create(e,t){return new e5(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}e5.prototype.visible=!1,eZ.jsonID("node",e5);class e6{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new e4(n,n):new e6(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&e5.isSelectable(n)?new e5(t):eZ.near(t)}}class e8 extends eZ{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=C.empty){if(t==C.empty){e.delete(0,e.doc.content.size);let t=eZ.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new e8(e)}map(e){return new e8(e)}eq(e){return e instanceof e8}getBookmark(){return e9}}eZ.jsonID("all",e8);let e9={map(){return this},resolve:e=>new e8(e)};function e7(e,t,n,r,i,s=!1){if(t.inlineContent)return e3.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(r.isAtom){if(!s&&e5.isSelectable(r))return e5.create(e,n-(i<0?r.nodeSize:0))}else{let t=e7(e,r,n+i,i<0?r.childCount:0,i,s);if(t)return t}n+=r.nodeSize*i}return null}function te(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let s=e.steps[i];(s instanceof eM||s instanceof eA)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(eZ.near(e.doc.resolve(r),n)))}class tt extends eY{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return x.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||x.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(eZ.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function tn(e,t){return t&&e?e.bind(t):e}class tr{constructor(e,t,n){this.name=e,this.init=tn(t.init,n),this.apply=tn(t.a
1pply,n)}}let ti=[new tr("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new tr("selection",{init:(e,t)=>e.selection||eZ.atStart(t.doc),apply:e=>e.selection}),new tr("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new tr("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class ts{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ti.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new tr(e.key,e.spec.state,e))})}}class to{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=r?r[s].n:0,a=r?r[s].state:this,c=l<t.length&&o.spec.appendTransaction.call(o,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<s?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[s]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new to(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new tt(this)}static create(e){let t=new ts(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new to(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new ts(this.schema,e.plugins),n=t.fields,r=new to(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new ts(e.schema,e.plugins),i=new to(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=j.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=eZ.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let s in n){let o=n[s],l=o.spec.state;if(o.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,s)){i[r.name]=l.fromJSON.call(o,e,t[s],i);return}}i[r.name]=r.init(e,i)}}),i}}class tl{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let s=t[i];s instanceof Function?s=s.bind(n):"handleDOMEvents"==i&&(s=e(s,n,{})),r[i]=s}return r}(e.props,this,this.props),this.key=e.key?e.key.key:tc("plugin")}getState(e){return e[this.key]}}let ta=Object.create(null);function tc(e){return e in ta?e+"$"+ ++ta[e]:(ta[e]=0,e+"$")}class td{constructor(e="key"){this.key=tc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let th=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function tu(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let tp=(e,t,n)=>{let r=tu(e,n);if(!r)return!1;let i=ty(r);if(!i){let n=r.blockRange(),i=n&&eO(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let s=i.nodeBefore;if(tE(e,i,t,-1))return!0;
1if(0==r.parent.content.size&&(tm(s,"end")||e5.isSelectable(s)))for(let n=r.depth;;n--){let o=e$(e.doc,r.before(n),r.after(n),C.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(tm(s,"end")?eZ.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):e5.create(n.doc,i.pos-s.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!s.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0)};function tf(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let s=t.nodeAfter,o=t.pos+1;for(;!s.isTextblock;o++){if(s.type.spec.isolating)return!1;let e=s.firstChild;if(!e)return!1;s=e}let l=e$(e.doc,i,o,C.empty);if(!l||l.from!=i||l instanceof eM&&l.slice.size>=o-i)return!1;if(n){let t=e.tr.step(l);t.setSelection(e3.create(t.doc,i)),n(t.scrollIntoView())}return!0}function tm(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let tg=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=ty(r)}let o=s&&s.nodeBefore;return!!o&&!!e5.isSelectable(o)&&(t&&t(e.tr.setSelection(e5.create(e.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ty(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function tb(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let tw=(e,t,n)=>{let r=tb(e,n);if(!r)return!1;let i=tk(r);if(!i)return!1;let s=i.nodeAfter;if(tE(e,i,t,1))return!0;if(0==r.parent.content.size&&(tm(s,"start")||e5.isSelectable(s))){let n=e$(e.doc,r.before(),r.after(),C.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(tm(s,"start")?eZ.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):e5.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!s.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0)},tv=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=tk(r)}let o=s&&s.nodeAfter;return!!o&&!!e5.isSelectable(o)&&(t&&t(e.tr.setSelection(e5.create(e.doc,s.pos)).scrollIntoView()),!0)};function tk(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let tx=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function tS(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let tC=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=tS(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(eZ.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},tM=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof e8||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=tS(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,s.createAndFill());o.setSelection(e3.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},tA=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(eL(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&eO(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function tE(e,t,n,r){let i,s,o,l=t.nodeBefore,a=t.nodeAfter,c,d,h=l.type.spec.isolating||a.type.spec.isolating;if(!h&&(i=t.nodeBefore,s=t.nodeAfter,o=t.index(),i&&s&&i.type.compatibleContent(s.type)&&(!i.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(o,o+1)&&
1!!(s.isTextblock||e_(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let u=!h&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(c=(d=l.contentMatchAt(l.childCount)).findWrapping(a.type))&&d.matchType(c[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=b.empty;for(let e=c.length-1;e>=0;e--)i=b.from(c[e].create(null,i));i=b.from(l.copy(i));let s=e.tr.step(new eA(t.pos-1,r,t.pos,r,new C(i,1,0),c.length,!0)),o=s.doc.resolve(r+2*c.length);o.nodeAfter&&o.nodeAfter.type==l.type&&e_(s.doc,o.pos)&&s.join(o.pos),n(s.scrollIntoView())}return!0}let p=a.type.spec.isolating||r>0&&h?null:eZ.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&eO(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(u&&tm(a,"start",!0)&&tm(l,"end")){let r=l,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let s=a,o=1;for(;!s.isTextblock;s=s.firstChild)o++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=b.empty;for(let e=i.length-1;e>=0;e--)r=b.from(i[e].copy(r));n(e.tr.step(new eA(t.pos-i.length,t.pos+a.nodeSize,t.pos+o,t.pos+a.nodeSize-o,new C(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function tT(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(e3.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}let tO=tT(-1),tN=tT(1);function tD(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(s,o,(r,s)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(s),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(s,o,e,t)}r(i.scrollIntoView())}return!0}}function tR(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let tI=tR(th,tp,tg),tL=tR(th,tw,tv),t_={Enter:tR(tx,tM,tA,(e,t)=>{if(e.selection instanceof e5&&e.selection.node.isBlock){let{$from:n}=e.selection;return!!n.parentOffset&&!!eL(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let n=e.tr;!e.selection.empty&&(e.selection instanceof e3||e.selection instanceof e8)&&n.deleteSelection();let{$from:r}=n.selection,i=n.steps.length,s=[],o,l,a=!1,c=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;a=r.end(e)==r.pos+(r.depth-e),c=r.start(e)==r.pos-(r.depth-e),l=tS(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));s.unshift(t||(a&&l?{type:l}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let d=r.pos,h=eL(n.doc,d,s.length,s);if(h||(s[0]=l?{type:l}:null,h=eL(n.doc,d,s.length,s)),!h)return!1;if(n.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let e=n.mapping.slice(i),t=e.map(r.before(o)),s=n.doc.resolve(t);l&&r.node(o-1).canReplaceWith(s.index(),s.index()+1,l)&&n.setNodeMarkup(e.map(r.before(o)),l)}return t&&t(n.scrollIntoView()),!0}),"Mod-Enter":tC,Backspace:tI,"Mod-Backspace":tI,"Shift-Backspace":tI,Delete:tL,"Mod-Delete":tL,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new e8(e.doc))),!0)},tP={"Ctrl-h":t_.Backspace,"Alt-Backspace":t_["Mod-Backspace"],"Ctrl-d":t_.Delete,"Ctrl-Alt-Backspace":t_["Mod-Delete"],"Alt-Delete":t_["Mod-Delete"],"Alt-d":t_["Mod-Delete"],"Ctrl-a":tO,"Ctrl-e":tN};for(let e in t_)tP[e]=t_[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let tj=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},tz=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},t$=null,tB=function(e,t,n){let r=t$||(t$=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},tV=function(){t$=null},tH=function(e,t,n,r){return n&&(tU(e,t,n,r,-1)||tU(e,t,n,r,1))},tF=/^(img|br|input|textarea|hr)$/i;function tU(e,t,n,r,i){for(var s;;){if(e==n&&t==r)return!0;if(t==(i<0?0:tW(e))){let n=e.parentNode;if(!n||1!=n.nodeType||tq(e)||tF.test(e.nodeName)||"false"==e.contentEditable)return!1;t=tj(e)+(i<0?0:1),e=n}
1else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(s=n.pmViewDesc)||!s.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?tW(e):0}}}function tW(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tq(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let tK=function(e){return e.focusNode&&tH(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tJ(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let tG="u">typeof navigator?navigator:null,tX="u">typeof document?document:null,tY=tG&&tG.userAgent||"",tQ=/Edge\/(\d+)/.exec(tY),tZ=/MSIE \d/.exec(tY),t0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tY),t1=!!(tZ||t0||tQ),t2=tZ?document.documentMode:t0?+t0[1]:tQ?+tQ[1]:0,t3=!t1&&/gecko\/(\d+)/i.test(tY);t3&&(/Firefox\/(\d+)/.exec(tY)||[0,0])[1];let t4=!t1&&/Chrome\/(\d+)/.exec(tY),t5=!!t4,t6=t4?+t4[1]:0,t8=!t1&&!!tG&&/Apple Computer/.test(tG.vendor),t9=t8&&(/Mobile\/\w+/.test(tY)||!!tG&&tG.maxTouchPoints>2),t7=t9||!!tG&&/Mac/.test(tG.platform),ne=!!tG&&/Win/.test(tG.platform),nt=/Android \d/.test(tY),nn=!!tX&&"webkitFontSmoothing"in tX.documentElement.style,nr=nn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ni(e,t){return"number"==typeof e?e:e[t]}function ns(e,t,n){if(!nd(t)&&0==t.left)return;let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(1!=o.nodeType){o=tz(o);continue}let e=o,n=e==s.body,l=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(s):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),a=0,c=0;if(t.top<l.top+ni(r,"top")?c=-(l.top-t.top+ni(i,"top")):t.bottom>l.bottom-ni(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+ni(i,"top")-l.top:t.bottom-l.bottom+ni(i,"bottom")),t.left<l.left+ni(r,"left")?a=-(l.left-t.left+ni(i,"left")):t.right>l.right-ni(r,"right")&&(a=t.right-l.right+ni(i,"right")),a||c)if(n)s.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let i=e.scrollLeft-n,s=e.scrollTop-r;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}let d=n?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(d))break;o="absolute"==d?o.offsetParent:tz(o)}}function no(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=tz(r));return t}function nl(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let na=null;function nc(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function nd(e){return e.top<e.bottom||e.left<e.right}function nh(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(nd(e))return e}return Array.prototype.find.call(n,nd)||e.getBoundingClientRect()}let nu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
vendor: 19,532 bytes, line 1
1function np(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),o=nn||t3;if(3==r.nodeType)if(o&&(nu.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=nh(tB(r,i,i),n);if(t3&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=nh(tB(r,i-1,i-1),-1);if(t.top==e.top){let n=nh(tB(r,i,i+1),-1);if(n.top!=e.top)return nf(n,n.left<t.left)}}return e}else{let e=i,t=i,s=n<0?1:-1;return n<0&&!i?(t++,s=-1):n>=0&&i==r.nodeValue.length?(e--,s=1):n<0?e--:t++,nf(nh(tB(r,e,t),s),s<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==tW(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return nm(e.getBoundingClientRect(),!1)}if(null==s&&i<tW(r)){let e=r.childNodes[i];if(1==e.nodeType)return nm(e.getBoundingClientRect(),!0)}return nm(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==tW(r))){let e=r.childNodes[i-1],t=3==e.nodeType?tB(e,tW(e)-!o):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return nf(nh(t,1),!1)}if(null==s&&i<tW(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?tB(e,0,+!o):1==e.nodeType?e:null:null;if(t)return nf(nh(t,-1),!0)}return nf(nh(3==r.nodeType?tB(r):r,-n),n>=0)}function nf(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function nm(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ng(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let ny=/[\u0590-\u08ac]/,nb=null,nw=null,nv=!1;class nk{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>tj(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!t||i.node))if(!n||!(s=i.nodeDOM)||(1==s.nodeType?s.contains(1==e.nodeType?e:e.parentNode):s==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],s=t+i.size;if(s>e||i instanceof nT){r=e-t;break}t=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof nx&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?tj(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?tj(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=n,o=0;;o++){let n=this.children[o],l=s+n.size;if(-1==r&&e<=l){let i=s+n.border;if(e>=i&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=s;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=tj(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||o==this.children.length-1)){t=l;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=tj(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let o=0,l=0;o<this.children.length;o++){let a=this.children[o],c=l+a.size;if(i>l&&s<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let o=this.domFromPos(e,e?-1:1),l=t==e?o:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((t3||t8)&&e==t){let{node:e,offset:t}=o;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(o=l={node:n.parentNode,offset:tj(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(t3&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&t8)&&tH(o.node,o.offset,c.anchorNode,c.anchorOffset)&&tH(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((a.extend||e==t)&&!(d&&t3)){a.collapse(o.node,o.offset);try{e!=t&&a.extend(l.node,l.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=o;o=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(o.node,o.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],s=n+i.size;if(n==s?e<=s&&t>=n:e<s&&t>n){let r=n+i.border,o=s-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==s?2:1,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class nx extends nk{constructor(e,t,n,r){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.hasAttribute("contenteditable")||(s.contentEditable="false"),s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class nS extends nk{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class nC extends nk{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=ec.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new nC(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=nC.create(this.parent,this.mark,!0,n),i=this.children,s=this.size;t<s&&(i=n$(i,t,s,n)),e>0&&(i=n$(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class nM extends nk{constructor(e,t,n,r,i,s,o){super(e,[],i,s),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(e,t,n,r,i,s){let o=i.nodeViews[t.type.name],l,a=o&&o(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:s,n,r),c=a&&a.dom,d=a&&a.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=ec.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return(c=nL(c,n,t),a)?l=new nO(e,t,n,r,c,d||null,h,a):t.isText?new nE(e,t,n,r,c,h):new nM(e,t,n,r,c,d||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>1==t.nodeType&&0>e.indexOf(t.parentNode)&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>b.empty}}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&n_(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,l=new nj(this,s&&s.node,e);(function(e,t,n,r){let i=t.locals(e),s=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(s,o),n),s+=o.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let d,h,u,p;for(;o<i.length&&i[o].to==s;){let e=i[o++];e.widget&&(d?(h||(h=[d])).push(e):d=e)}if(d)if(h){h.sort(nz);for(let e=0;e<h.length;e++)n(h[e],c,!!a)}else n(d,c,!!a);if(a)p=-1,u=a,a=null;else if(c<e.childCount)p=c,u=e.child(c++);else break;for(let e=0;e<l.length;e++)l[e].to<=s&&l.splice(e--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let f=s+u.nodeSize;if(u.isText){let e=f;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=u.cut(e-s),u=u.cut(0,e-s),f=e,p=-1)}else for(;o<i.length&&i[o].to<f;)o++;let m=u.isInline&&!u.isLeaf?l.filter(e=>!e.inline):l.slice();r(u,m,t.forChild(s,u),p),s=f}})(this.node,this.innerDeco,(t,i,s)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?x.none:this.node.child(i).marks,n,e,i),l.placeWidget(t,e,r)},(t,s,a,c)=>{let d;l.syncToMarks(t.marks,n,e,c),l.findNodeMatch(t,s,a,c)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,s,a,d,e)||l.updateNextNode(t,s,a,e,c,r)||l.addNode(t,s,a,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),function e(t,n,r){let i=t.firstChild,s=!1;for(let o=0;o<n.length;o++){let l=n[o],a=l.dom;if(a.parentNode==t){for(;a!=i;)i=nP(i),s=!0;i=i.nextSibling}else s=!0,t.insertBefore(a,i);if(l instanceof nC){let n=i?i.previousSibling:t.lastChild;e(l.contentDOM,l.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=nP(i),s=!0;s&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),t9&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof e3)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,s=function(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let o=e.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;a+=t.text}if(s>=n){if(s>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return s<0?null:{node:i,pos:s,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;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=void 0)}let s=new nS(this,i,t,r);e.input.compositionNodes.push(s),this.children=n$(this.children,n,n+r.length,e,s)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(n_(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=nI(this.dom,this.nodeDOM,nR(this.outerDeco,this.node,t),nR(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function nA(e,t,n,r,i){nL(r,t,e);let s=new nM(void 0,e,t,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class nE extends nM{constructor(e,t,n,r,i,s){super(e,t,n,r,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new nE(this.parent,r,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class nT extends nk{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class nO extends nM{constructor(e,t,n,r,i,s,o,l){super(e,t,n,r,i,s,o),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let nN=function(e){e&&(this.nodeName=e)};nN.prototype=Object.create(null);let nD=[new nN];function nR(e,t,n){if(0==e.length)return nD;let r=n?nD[0]:new nN,i=[r];for(let s=0;s<e.length;s++){let o=e[s].type.attrs;if(o)for(let e in o.nodeName&&i.push(r=new nN(o.nodeName)),o){let s=o[e];null!=s&&(n&&1==i.length&&i.push(r=new nN(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+s:"style"==e?r.style=(r.style?r.style+";":"")+s:"nodeName"!=e&&(r[e]=s))}}return i}function nI(e,t,n,r){if(n==nD&&r==nD)return t;let i=t;for(let t=0;t<r.length;t++){let s=r[t],o=n[t];if(t){let t;o&&o.nodeName==s.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==s.nodeName||((t=document.createElement(s.nodeName)).pmIsDeco=!0,t.appendChild(i),o=nD[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);
1if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,o||nD[0],s)}return i}function nL(e,t,n){return nI(e,e,nD,nR(t,n,1!=e.nodeType))}function n_(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function nP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nj{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,s=new Map,o=[];n:for(;i>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof nC)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[s])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof nC&&3!=t.dirty&&t.mark.type==e[s].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[s])&&(t.mark=e[s],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=nC.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,n))i=this.top.children.indexOf(s,this.index);else for(let r=this.index,s=Math.min(this.top.children.length,r+5);r<s;r++){let s=this.top.children[r];if(s.matchesNode(e,t,n)&&!this.preMatch.matched.has(s)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof nM){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&n_(t,l.outerDeco));if(!h&&l.update(e,t,n,r))return this.destroyBetween(this.index,o),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,n,r,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,s+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!n_(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=nM.create(this.top,t,n,r,i,s);if(o.contentDOM)for(let t of(o.children=e.children,e.children=[],o.children))t.parent=o;return e.destroy(),o}addNode(e,t,n,r,i){let s=nM.create(this.top,e,t,n,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new nx(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof nC;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof nE)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((t8||t5)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new nT(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}
1isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function nz(e,t){return e.type.side-t.type.side}function n$(e,t,n,r,i){let s=[];for(let o=0,l=0;o<e.length;o++){let a=e[o],c=l,d=l+=a.size;c>=n||d<=t?s.push(a):(c<t&&s.push(a.slice(0,t-c,r)),i&&(s.push(i),i=void 0),d>n&&s.push(a.slice(n-c,a.size,r)))}return s}function nB(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(tK(n)){for(a=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&e5.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==tW(e);r||i;){if(e==n)return!0;let t=tj(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==tW(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new e5(o==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let s=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[a,o]=i==e.state.selection.anchor?[i,t]:[t,i],l=r.resolve(o)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let n="pointer"==t||e.state.selection.head<l.pos&&!s?1:-1;c=nG(e,d,l,n)}return c}function nV(e){return e.editable?e.hasFocus():nY(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nH(e,t=!1){let n=e.state.selection;if(nK(e,n),!nV(e))return;let r=e.input.mouseDown;if(!t&&t5&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tH(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate())return void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,tj(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&t1&&t2<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var i;let r,s,o,l,{anchor:a,head:c}=n,d,h;nF&&!(n instanceof e3)&&(n.$from.parent.inlineContent||(d=nU(e,n.from)),n.empty||n.$from.parent.inlineContent||(h=nU(e,n.to))),e.docView.setSelection(a,c,e,t),nF&&(d&&nq(d),h&&nq(h)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((r=(i=e).dom.ownerDocument).removeEventListener("selectionchange",i.input.hideSelectionGuard),o=(s=i.domSelectionRange()).anchorNode,l=s.anchorOffset,r.addEventListener("selectionchange",i.input.hideSelectionGuard=()=>
1{(s.anchorNode!=o||s.anchorOffset!=l)&&(r.removeEventListener("selectionchange",i.input.hideSelectionGuard),setTimeout(()=>{(!nV(i)||i.state.selection.visible)&&i.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}let nF=t8||t5&&t6<63;function nU(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(t8&&i&&"false"==i.contentEditable)return nW(i);if((!i||"false"==i.contentEditable)&&(!s||"false"==s.contentEditable)){if(i)return nW(i);else if(s)return nW(s)}}function nW(e){return e.contentEditable="true",t8&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function nq(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function nK(e,t){if(t instanceof e5){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(nJ(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else nJ(e)}function nJ(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function nG(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||e3.between(t,n,r)}function nX(e){return(!e.editable||!!e.hasFocus())&&nY(e)}function nY(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nQ(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&eZ.findFrom(s,t)}function nZ(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function n0(e,t,n){let r=e.state.selection;if(r instanceof e3){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return nZ(e,new e3(r.$anchor,s))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nQ(e.state,t);return!!n&&n instanceof e5&&nZ(e,n)}else if(!(t7&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,s;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(s=e.docView.descAt(o))&&!s.contentDOM)&&(e5.isSelectable(i)?nZ(e,new e5(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!nn&&nZ(e,new e3(e.state.doc.resolve(t<0?o:o+i.nodeSize))))}}else{if(r instanceof e5&&r.node.isInline)return nZ(e,new e3(t>0?r.$to:r.$from));let n=nQ(e.state,t);return!!n&&nZ(e,n)}}function n1(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function n2(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function n3(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=!1;for(t3&&1==n.nodeType&&r<n1(n)&&n2(n.childNodes[r],-1)&&(o=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(n2(e,-1))i=n,s=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(n4(n))break;else{let t=n.previousSibling;for(;t&&n2(t,-1);)i=n.parentNode,s=tj(t),t=t.previousSibling;if(t)r=n1(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}o?n5(e,n,r):i&&n5(e,i,s)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,s=r.focusOffset;if(!i)return;let o=n1(i);for(;;)if(s<o){if(1!=i.nodeType)break;if(n2(i.childNodes[s],1))t=i,n=++s;else break}else if(n4(i))break;else{let r=i.nextSibling;for(;r&&n2(r,1);)t=r.parentNode,n=tj(r)+1,r=r.nextSibling;if(r)s=0,o=n1(i=r);else{if((i=i.parentNode)==e.dom)break;s=o=0}}
vendor: 2,095 bytes, line 1
1t&&n5(e,t,n)}(e)}function n4(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function n5(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!tq(e);)t=tj(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!tq(e);)t=tj(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(tK(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&nH(e)},50)}function n6(e,t){let n=e.state.doc.resolve(t);if(!(t5||ne)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function n8(e,t,n){let r=e.state.selection;if(r instanceof e3&&!r.empty||n.indexOf("s")>-1||t7&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nQ(e.state,t);if(n&&n instanceof e5)return nZ(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,o=r instanceof e8?eZ.near(n,t):eZ.findFrom(n,t);return!!o&&nZ(e,o)}return!1}function n9(e,t){if(!(e.state.selection instanceof e3))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}
1function n7(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function re(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let o=e.someProp("clipboardSerializer")||ec.fromSchema(e.state.schema),l=rl(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,d,h=0;for(;c&&1==c.nodeType&&(d=ro[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=l.createElement(d[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),h++}c=a.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function rt(e,t,n,r,i){let s,o,l=i.parent.type.spec.code;if(!n&&!t)return null;let a=!!t&&(r||l||!n);if(a){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return o=new C(b.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{o=t(o,e,!0)}),o;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)o=n;else{let n=i.marks(),{schema:r}=e.state,o=ec.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(o.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=rl(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),s;if((s=i&&ro[i[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;if(!ra){if(ra=t.defaultPolicy)try{return ra.createHTML(e)}catch(e){}ra=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return ra.createHTML(e)}(e),s)for(let e=0;e<s.length;e++)r=r.querySelector(s[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}(n),nn&&function(e){let t=e.querySelectorAll(t5?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||ee.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||rn.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)o=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch(e){break}i=b.from(t.create(r[e+1],i)),s++,o++}return new C(i,s,o)}(rs(o,+d[1],+d[2]),d[4]);else if((o=C.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(e=>{if(!s)return;let t=r.findWrapping(e.type),n;if(!t)return s=null;if(n=s.length&&i.length&&function e(t,n,r,i,s){if(s<t.length&&s<n.length&&t[s]==n[s]){let o=e(t,n,r,i.lastChild,s+1);if(o)return i.copy(i.content.replaceChild(i.childCount-1,o));if(i.contentMatchAt(i.childCount).matchType(s==t.length-1?r.type:t[s+1]))return i.copy(i.content.append(b.from(rr(r,t,s+1))))}}(t,i,e,s[s.length-1],0))s[s.length-1]=n;else{s.length&&(s[s.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(b.empty,!0);return t.copy(r.append(i))}(s[s.length-1],i.length));let n=rr(e,t);
1s.push(n),r=r.matchType(n.type),i=t}}),s)return b.from(s)}return e}(o.content,i),!0)).openStart||o.openEnd){let e=0,t=0;for(let t=o.content.firstChild;e<o.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=o.content.lastChild;t<o.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);o=rs(o,e,t)}return e.someProp("transformPasted",t=>{o=t(o,e,a)}),o}let rn=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function rr(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,b.from(e));return e}function ri(e,t,n,r,i,s){let o=t<0?e.firstChild:e.lastChild,l=o.content;return e.childCount>1&&(s=0),i<r-1&&(l=ri(l,t,n,r,i+1,s)),i>=n&&(l=t<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(l))}function rs(e,t,n){return t<e.openStart&&(e=new C(ri(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new C(ri(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let ro={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function rl(){return document.implementation.createHTMLDocument("title")}let ra=null,rc={},rd={},rh={touchstart:!0,touchmove:!0};class ru{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function rp(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function rf(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>rm(e,t))})}function rm(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function rg(e){return{left:e.clientX,top:e.clientY}}function ry(e,t,n,r,i){if(-1==r)return!1;let s=e.state.doc.resolve(r);for(let r=s.depth+1;r>0;r--)if(e.someProp(t,t=>r>s.depth?t(e,n,s.nodeAfter,s.before(r),i,!0):t(e,n,s.node(r),s.before(r),i,!1)))return!0;return!1}function rb(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function rw(e,t,n){let r=e.state.doc;if(-1==t)return r.inlineContent?e3.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),s=i.before(e);if(t.inlineContent)return e3.create(r,s+1,s+1+t.content.size);if(n&&e5.isSelectable(t))return e5.create(r,s)}return null}rd.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!rC(e))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!nt||!t5||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!t9||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||t7&&72==r&&"c"==i)return n9(e,-1)||n3(e,-1);if(46==r&&!t.shiftKey||t7&&68==r&&"c"==i)return n9(e,1)||n3(e,1);if(13==r||27==r)return!0;if(37==r||t7&&66==r&&"c"==i){let t=37==r?"ltr"==n6(e,e.state.selection.from)?-1:1:-1;return n0(e,t,i)||n3(e,t)}if(39==r||t7&&70==r&&"c"==i){let t=39==r?"ltr"==n6(e,e.state.selection.from)?1:-1:1;return n0(e,t,i)||n3(e,t)}else if(38==r||t7&&80==r&&"c"==i)return n8(e,-1,i)||n3(e,-1);else if(40==r||t7&&78==r&&"c"==i)return function(e){if(!t8||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;n7(e,n,"true"),setTimeout(()=>n7(e,n,"false"),20)}return!1}(e)||n8(e,1,i)||n3(e,1);else if(i==(t7?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():rp(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,tJ(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},rd.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},rd.keypress=(e,t)=>{if(rC(e)||!t.charCode||t.ctrlKey&&!t.altKey||t7&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof e3)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let rv=t7?"metaKey":"ctrlKey";rc.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let s=rT(e),o=Date.now(),l="singleClick";
1o-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[rv]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:l,button:t.button},e.input.mouseDown&&e.input.mouseDown.done();let a=e.posAtCoords(rg(t));a&&("singleClick"==l?e.input.mouseDown=new rx(e,a,t,!!s):("doubleClick"==l?function(e,t,n,r){return ry(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return ry(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=rw(e,t,!0),i=e.state.doc;return!!r&&(rb(e,r,"pointer"),r instanceof e3&&i.eq(e.state.doc)&&(e.input.mouseDown=new rS(e,r)),!0)}(e,n,r)})(e,a.pos,a.inside,t)?t.preventDefault():rp(e,"pointer"))};class rk{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){0==e.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class rx extends rk{constructor(e,t,n,r){let i,s;if(super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[rv],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const o=r?null:n.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof e5&&a.from<=s&&a.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&t3&&!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(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),rp(e,"pointer")}done(){super.done(),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.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||nH(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(rg(e))),this.updateAllowDefault(e),this.allowDefault||!t)rp(this.view,"pointer");else{var n,r,i,s;(n=this.view,r=t.pos,i=t.inside,s=this.selectNode,ry(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(s?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof e5&&(r=n.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(e5.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?s.before(n.$from.depth):s.before(e);break}}return null!=i&&(rb(e,e5.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&e5.isSelectable(r))&&(rb(e,new e5(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||t8&&this.mightDrag&&!this.mightDrag.node.isAtom||t5&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(rb(this.view,eZ.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):rp(this.view,"pointer")}}move(e){this.updateAllowDefault(e),rp(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class rS extends rk{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(0==e.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();e.preventDefault(),rp(this.view,"pointer");let t=this.view.posAtCoords(rg(e)),n=t&&rw(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[s,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];rb(this.view,e3.create(r,s,o),"pointer")}}function rC(e,t){return!!e.composing||!!(t8&&500>Math.abs(Date.now()-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}rc.touchstart=e=>{e.input.lastTouch=Date.now(),rT(e),rp(e,"pointer")},rc.touchmove=e=>{e.input.lastTouch=Date.now(),rp(e,"pointer")},rc.contextmenu=e=>rT(e);let rM=nt?5e3:-1;function rA(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>rT(e),t))}function rE(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function rT(e,t=!1){if(!nt||!(e.domObserver.flushingSoon>
1=0)){if(e.domObserver.forceFlush(),rE(e),t||e.docView&&e.docView.dirty){let n=nB(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}rd.compositionstart=rd.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof e3&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||t5&&ne&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),rT(e,!0),e.markCursor=null;else if(rT(e,!t.selection.empty),t3&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}rA(e,rM)},rd.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,rA(e,20))};let rO=t1&&t2<15||t9&&nr<604;function rN(e,t,n,r,i){let s=rt(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,s||C.empty)))return!0;if(!s)return!1;let o=0==s.openStart&&0==s.openEnd&&1==s.content.childCount?s.content.firstChild:null,l=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(s);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function rD(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rc.copy=rd.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=rO?null:t.clipboardData,{dom:s,text:o}=re(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",o)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,s),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},rd.paste=(e,t)=>{if(e.composing&&!nt)return;let n=rO?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&rN(e,rD(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?rN(e,r.value,null,i,t):rN(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class rR{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let rI=t7?"altKey":"ctrlKey";function rL(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[rI]}for(let e in rc.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(rg(t));if(s&&s.pos>=i.from&&s.pos<=(i instanceof e5?i.to-1:i.to));else if(r&&r.mightDrag)n=e5.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=e5.create(e.state.doc,r.posBefore))}let o=(n||e.state.selection).content(),{dom:l,text:a,slice:c}=re(e,o);t.dataTransfer.files.length&&t5&&!(t6>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(rO?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",rO||t.dataTransfer.setData("text/plain",a),e.dragging=new rR(c,rL(e,t),n)},rc.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},rd.dragover=rd.dragenter=(e,t)=>t.preventDefault(),rd.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(rg(t));if(!r)return;let i=e.state.doc.resolve(r.pos),s=n&&n.slice;s?e.someProp("transformPasted",t=>{s=t(s,e,!1)}):s=rt(e,rD(t.dataTransfer),rO?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&rL(e,t));if(e.someProp("handleDrop",n=>n(e,t,s||C.empty,o)))return t.preventDefault();if(!s)return;t.preventDefault();let l=s?ez(e.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let a=e.state.tr;if(o){let{node:e}=n;e?e.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,h=a.doc;
vendor: 6,576 bytes, line 1
1if(d?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(h))return;let u=a.doc.resolve(c);if(d&&e5.isSelectable(s.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new e5(u));else{let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(nG(e,u,a.doc.resolve(t)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},rc.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&nH(e)},20))},rc.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},rc.beforeinput=(e,t)=>{if(nt&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,tJ(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},rd)rc[e]=rd[e];function r_(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class rP{constructor(e,t){this.toDOM=e,this.spec=t||rV,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new r$(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof rP&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&r_(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class rj{constructor(e,t){this.attrs=e,this.spec=t||rV}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new r$(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof rj&&r_(this.attrs,e.attrs)&&r_(this.spec,e.spec)}static is(e){return e.type instanceof rj}destroy(){}}class rz{constructor(e,t){this.attrs=e,this.spec=t||rV}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new r$(i.pos-n,s.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof rz&&r_(this.attrs,e.attrs)&&r_(this.spec,e.spec)}destroy(){}}class r${constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new r$(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new r$(e,e,new rP(t,n))}static inline(e,t,n,r){return new r$(e,t,new rj(n,r))}static node(e,t,n,r){return new r$(e,t,new rz(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof rj}get widget(){return this.type instanceof rP}}let rB=[],rV={};class rH{constructor(e,t){this.local=e.length?e:rB,this.children=t.length?t:rB}static create(e,t){return t.length?rJ(t,e,0,rV):rF}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==rF||0==e.maps.length?this:this.mapInner(e,t,0,0,n||rV)}mapInner(e,t,n,r,i){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,n,r);l&&l.type.valid(t,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,n,r,i,s,o){let l=e.slice();for(let e=0,t=s;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,s)=>{let o=s-i-(n-e);for(let i=0;i<l.length;i+=3){let s=l[i+1];if(s<0||e>s+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&o&&(l[i]+=o,l[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+s),d=c-i;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(e[t+1]+s,-1)-i,{index:u,offset:p}=r.content.findIndex(d),f=r.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let r=l[t+2].mapInner(n,f,c+1,e[t]+s+1,o);r!=rF?(l[t]=d,l[t+1]=h,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=rJ(function(e,t,n,r,i,s,o){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(t,s){for(let e=0;e<t.local.length;e++){let l=t.local[e].map(r,i,s);l?n.push(l):o.onRemove&&o.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+s+1)}(e[l+2],t[l]+s+1);return n}(l,e,t,n,i,s,o),r,0,o);t=a.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<a.children.length;e+=3){let n=a.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,a.children[e],a.children[e+1],a.children[e+2])}}return new rH(t.sort(rG),l)}(this.children,s||[],e,t,n,r,i):s?new rH(s.sort(rG),rB):rF}add(e,t){return t.length?this==rF?rH.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,s)=>{let o=s+n,l;if(l=rq(t,e,o)){for(r||(r=this.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(e,l,o+1):r.splice(i,0,s,s+e.nodeSize,rJ(l,e,o+1,rV)),i+=3}});let s=rW(i?rK(t):t,-n);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||s.splice(t--,1);return new rH(s.length?this.local.concat(s).sort(rG):this.local,r||this.children)}remove(e){return 0==e.length||this==rF?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,s=n[r]+t,o=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>s&&n.to<o&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,s+1);l!=rF?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new rH(r,n):rF}forChild(e,t){let n,r;if(this==rF)return this;if(t.isLeaf)return rH.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,s=i+t.content.size;
vendor: 4,188 bytes, line 1
1for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<s&&t.to>i&&t.type instanceof rj){let e=Math.max(i,t.from)-i,n=Math.min(s,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new rH(r.sort(rG),rB);return n?new rU([e,n]):e}return n||rF}eq(e){if(this==e)return!0;if(!(e instanceof rH)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return rX(this.localsInner(e))}localsInner(e){if(this==rF)return rB;if(e.inlineContent||!this.local.some(rj.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof rj||t.push(this.local[e]);return t}forEachSet(e){e(this)}}rH.empty=new rH([],[]),rH.removeOverlap=rX;let rF=rH.empty;class rU{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,rV));return rU.from(n)}forChild(e,t){if(t.isLeaf)return rH.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=rF&&(i instanceof rU?n=n.concat(i.members):n.push(i))}return rU.from(n)}eq(e){if(!(e instanceof rU)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?rX(n?t:t.sort(rG)):rB}static from(e){switch(e.length){case 0:return rF;case 1:return e[0];default:return new rU(e.every(e=>e instanceof rH)?e:e.reduce((e,t)=>e.concat(t instanceof rH?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function rW(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new r$(i.from+t,i.to+t,i.type))}return n}function rq(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,s;t<e.length;t++)(s=e[t])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),e[t]=null);return i}function rK(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function rJ(e,t,n,r){let i=[],s=!1;t.forEach((t,o)=>{let l=rq(e,t,o+n);if(l){s=!0;let e=rJ(l,t,n+o+1,r);e!=rF&&i.push(o,o+t.nodeSize,e)}});let o=rW(s?rK(e):e,-n).sort(rG);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new rH(o,i):rF}function rG(e,t){return e.from-t.from||e.to-t.to}function rX(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let s=t[i];if(s.from==r.from){s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),rY(t,i+1,s.copy(r.to,s.to)));continue}s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),rY(t,i,r.copy(s.from,r.to)));break}}return t}function rY(e,t,n){for(;t<e.length&&rG(n,e[t])>0;)t++;e.splice(t,0,n)}function rQ(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=rF&&t.push(r)}),e.cursorWrapper&&t.push(rH.create(e.state.doc,[e.cursorWrapper.deco])),rU.from(t)}let rZ={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r0=t1&&t2<=11;class r1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class r2{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new r1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);t1&&t2<=11&&t.some(e=>
1"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():t8&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),r0&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rZ)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nX(this.view)){if(this.suppressingSelectionUpdates)return nH(this.view);if(t1&&t2<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tH(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=tz(n))t.add(n);for(let r=e.anchorNode;r;r=tz(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nX(t)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],a);t&&(s=s<0?t.from:Math.min(t.from,s),o=o<0?t.to:Math.max(t.to,o),t.typeOver&&(l=!0))}if(a.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||t5&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(e=>"childList"==e.type&&e.removedNodes.length))){for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(t3&&a.length){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;s<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&tK(r)&&(c=nB(t))&&c.eq(eZ.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nH(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,o),e=t,!r3.has(e)&&(r3.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=t3,r4||(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."),r4=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let s of t)if((null==(n=s.parentNode)?void 0:n.nodeName)=="TR"){let t=s.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(s,n.firstChild),r==s&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}(t,a)),this.handleDOMChange(s,o,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nH(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||
vendor: 2,698 bytes, line 1
1!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(t1&&t2<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:s}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!s||0>Array.prototype.indexOf.call(e.addedNodes,s))&&(i=s)}let s=r&&r.parentNode==e.target?tj(r)+1:0,o=n.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?tj(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let r3=new WeakMap,r4=!1;function r5(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return tH(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}let r6=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function r8(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nG(e,t.resolve(n.anchor),t.resolve(n.head))}function r9(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}class r7{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ru,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(is),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ir(this),it(this),this.nodeViews=ii(this),this.docView=nA(this.state.doc,ie(this),rQ(this),this.dom,this),this.domObserver=new r2(this,(e,t,n,r)=>(function(e,t,n,r,i){let s,o,l,a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=nB(e,t);
1if(n&&!e.state.selection.eq(n)){if(t5&&nt&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,tJ(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),a&&r.setMeta("composition",a),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let h=e.state.selection,u=function(e,t,n,r){let i,s,{node:o,fromOffset:l,toOffset:a,from:c,to:d}=e.docView.parseRange(t,n),h=e.domSelectionRange(),u=h.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(s=[{node:u,offset:h.anchorOffset}],tK(h)||s.push({node:h.focusNode,offset:h.focusOffset})),t5&&8===e.input.lastKeyCode)for(let e=a;e>l;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let p=e.state.doc,f=e.someProp("domParser")||ee.fromSchema(e.state.schema),m=p.resolve(c),g=null,y=f.parse(o,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:l,to:a,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:s,ruleFromNode:(i=r,e=>{let t=e.pmViewDesc;if(t)return t.parseRule(i);if("BR"==e.nodeName&&e.parentNode){if(t8&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||t8&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}),context:m});if(s&&null!=s[0].pos){let e=s[0].pos,t=s[1]&&s[1].pos;null==t&&(t=e),g={anchor:e+c,head:t+c}}return{doc:y,sel:g,from:c,to:d}}(e,t,n,i),p=e.state.doc,f=p.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,o="end"):(s=e.state.selection.from,o="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let s=e.findDiffStart(t,n),o=n+e.size,l=n+t.size;if(null==s)return null;let{a:a,b:c}=e.findDiffEnd(t,o,l);if("end"==i){let e=Math.max(0,s-Math.min(a,c));r-=a+e-s}if(a<s&&o<l){let e=r<=s&&r>=a?s-r:0;s-=e,c=s+(c-a),a=s}else if(c<s){let e=r<=s&&r>=c?s-r:0;s-=e,a=s+(a-c),c=s}return{start:s,endA:a,endB:c}}(f.content,u.doc.content,u.from,s,o);if(m&&e.input.domChangeCount++,(t9&&e.input.lastIOSEnter>Date.now()-225||nt)&&i.some(e=>1==e.nodeType&&!r6.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,tJ(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&h instanceof e3&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:h.from,endA:h.to,endB:h.to};else{if(u.sel){let t=r8(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta("composition",a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof e3&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),t1&&t2<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&"  "==u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),w=p.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&w.end()>=m.endA;if((t9&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,tJ(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||r9(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!r.parent.isTextblock){let e=s.nodeAfter;return null!=e&&n==t+e.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=e.resolve(r9(s,!0,!0));return!(!o.parent.isTextblock||o.pos>n||r9(o,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(o.parent.content)}(p,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>
1t(e,tJ(8,"Backspace")))){nt&&t5&&e.domObserver.suppressSelectionUpdates();return}t5&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),nt&&!v&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,tJ(13,"Enter"))})},20));let k=m.start,x=m.endA,S=t=>{let n=t||e.state.tr.replace(k,x,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let t=r8(e,n.doc,u.sel);t&&!(t5&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==k||t.head==n.mapping.map(x)-1)||t1&&t.empty&&t.head==k)&&n.setSelection(t)}return a&&n.setMeta("composition",a),n.scrollIntoView()};if(v)if(g.pos==y.pos){t1&&t2<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>nH(e),20));let t=S(e.state.tr.delete(k,x)),n=p.resolve(m.start).marksAcross(p.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,s=r,o,l,a;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);if(1==i.length&&0==s.length)l=i[0],o="add",a=e=>e.mark(l.addToSet(e.marks));else{if(0!=i.length||1!=s.length)return null;l=s[0],o="remove",a=e=>e.mark(l.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(a(t.child(e)));if(b.from(c).eq(e))return{mark:l,type:o}}(g.parent.content.cut(g.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,m.endA-w.start())))){let t=S(e.state.tr);"add"==l.type?t.addMark(k,x,l.mark):t.removeMark(k,x,l.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>S(e.state.tr.insertText(t,k,x));e.someProp("handleTextInput",r=>r(e,k,x,t,n))||e.dispatch(n())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in rc){let n=rc[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||rm(e,t)||!e.editable&&t.type in rd||n(e,t)},rh[t]?{passive:!0}:void 0)}t8&&e.dom.addEventListener("input",()=>null),rf(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rf(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(is),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let s=this.state,o=!1,l=!1;e.storedMarks&&this.composing&&(rE(this),l=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ii(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&rf(this),this.editable=ir(this),it(this);let c=rQ(this),d=ie(this),h=s.plugins==e.plugins||s.doc.eq(e.doc)?e.scrollToSelection>s.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,d,c);(u||!e.selection.eq(s.selection))&&(l=!0);let p="preserve"==h&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let s=(r.left+r.right)/2,o=i+1;o<Math.min(innerHeight,r.bottom);o+=5){let r=e.root.elementFromPoint(s,o);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:no(e.dom)}}(this);if(l){let t,n,l;this.domObserver.stop();
1let a=u&&(t1||t5)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&(r=s.selection,i=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(l)!=i.$anchor.start(l));if(u){let t=t5?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=tW(e=e.childNodes[t-1])}else{if(!e.parentNode||tq(e))return null;t=tj(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||tq(e))return null;t=tj(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=nA(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(a=!0)}let h=this.input.mouseDown;a||!(h&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),tH(t.node,t.offset,n.anchorNode,n.anchorOffset))&&h.delaySelUpdate())?nH(this,a):(nK(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),(null==(n=this.dragging)?void 0:n.node)&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;nl(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof e5){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&ns(this,t.getBoundingClientRect(),e)}else ns(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new rR(e.slice,e.move,r<0?void 0:e5.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let s=i[n].props[e];if(null!=s&&(r=t?t(s):s))return r}}hasFocus(){if(t1){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(na)return e.focus(na);let t=no(e);e.focus(null==na?{get preventScroll(){return na={preventScroll:!0},!0}}:void 0),na||(na=!1,nl(t,0))}(this.dom),nH(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,s=e.dom.ownerDocument,o,l=0,a=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);
1if(r)return{node:r.offsetNode,offset:Math.min(tW(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(tW(r.startContainer),r.startOffset)}}}(s,t.left,t.top);a&&({node:o,offset:l}=a);let c=(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!nc(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let s=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),o=s;;){let r=t.childNodes[o];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let s=t[i];if(nc(n,s))return e(r,n,s)}}if((o=(o+1)%i)==s)break}return t}(e.dom,t,n)))return null}if(t8)for(let e=c;o&&e;e=tz(e))e.draggable&&(o=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,o){let n;if(t3&&1==o.nodeType&&(l=Math.min(l,o.childNodes.length))<o.childNodes.length){let e=o.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&l++}nn&&l&&1==o.nodeType&&1==(n=o.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&l--,o==e.dom&&l==o.childNodes.length-1&&1==o.lastChild.nodeType&&t.top>o.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=o.nodeType||"BR"!=o.childNodes[l-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,s=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!s&&o.left>r.left||o.top>r.top?i=t.posBefore:(!s&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),s=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,o,l,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,s,o=2e8,l,a=0,c=n.top,d=n.top;for(let e=t.firstChild,h=0;e;e=e.nextSibling,h++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tB(e).getClientRects()}for(let u=0;u<t.length;u++){let p=t[u];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<o){s=e,o=t,l=t&&3==s.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(a=h+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!s&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(a=h+1)}}return(!s&&r&&(s=r,l=i,o=0),s&&3==s.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let n=nh(r,1);if(n.top!=n.bottom&&nc(t,n)){i={node:e,offset:s+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(s,l):!s||o&&1==s.nodeType?{node:t,offset:a}:e(s,l)}(t,n),s=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();s=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return np(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return nb==t&&nw==n?nv:(nb=t,nw=n,nv="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,ng(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=np(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tB(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=i==r.parent.content.size,o=e.domSelection();return o?ny.test(r.parent.textContent)&&o.modify?ng(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:l}=e.domSelectionRange(),a=o.caretBidiLevel;o.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==h;try{o.collapse(s,l),t&&(t!=s||i!=l)&&o.extend&&o.extend(t,i)}catch(e){}return null!=a&&(o.caretBidiLevel=a),u}):"left"==n||"backward"==n?!i:s:r.pos==r.start()||r.pos==r.end()}
1(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return rN(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return rN(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return re(this,e)}destroy(){if(this.docView){for(let e in this.input.mouseDown&&this.input.mouseDown.done(),this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rQ(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tV()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!rm(this,e)&&rc[e.type]&&(this.editable||!(e.type in rd))&&rc[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?t8&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return r5(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?r5(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ie(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[r$.node(0,e.state.doc.content.size,t)]}function it(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:r$.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function ir(e){return!e.someProp("editable",t=>!1===t(e.state))}function ii(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function is(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}r7.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var io={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},il={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ia="u">typeof navigator&&/Mac/.test(navigator.platform),ic="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),id=0;id<10;id++)io[48+id]=io[96+id]=String(id);for(var id=1;id<=24;id++)io[id+111]="F"+id;for(var id=65;id<=90;id++)io[id]=String.fromCharCode(id+32),il[id]=String.fromCharCode(id);for(var ih in io)il.hasOwnProperty(ih)||(il[ih]=io[ih]);let iu="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ip="u">typeof navigator&&/Win/.test(navigator.platform);
1function im(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ig(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let e=0;e<s.length-1;e++){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))r=!0;else if(/^mod$/i.test(o))iu?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+o)}return t&&(o="Alt-"+o),n&&(o="Ctrl-"+o),i&&(o="Meta-"+o),r&&(o="Shift-"+o),o}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(ia&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ic&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?il:io)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),s,o=t[im(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[im(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ip&&n.ctrlKey&&n.altKey)&&(s=io[n.keyCode])&&s!=i){let r=t[im(s,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}function iy(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var ib=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(s);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],l=!!e,a=e||i.tr,c=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(a),o.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return o.push(i),d}])),run:c};return d}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if("then"!==n)return"run"===n?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if("then"!==t)return"chain"===t?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:e,editor:r,view:s,state:iy({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}};let iw=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),null==(n=window)||null==(n=n.getSelection())||n.removeAllRanges()}}),!0),iv=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),ik=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,s=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),l=s.blockRange(o);if(!l)return;let a=eO(l);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},ix=e=>t=>e(t),iS=()=>({state:e,dispatch:t})=>tM(e,t),iC=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,s=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,s.content),r.setSelection(new e3(r.doc.resolve(Math.max(o-1,0)))),!0},iM=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function iA(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}let iE=e=>({tr:t,state:n,dispatch:r})=>{let i=iA(e,n.schema),s=t.selection.$anchor;for(let e=s.depth;e>0;e-=1)if(s.node(e).type===i){if(r){let n=s.before(e),r=s.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},iT=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0}
1,iO=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},iN=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r,s=n.mapping.slice(i),o=n.doc.resolve(s.map(t.$from.pos)),l=n.doc.resolve(s.map(t.$to.pos)),{from:a,to:c}={from:iO(o,r=e.schema,"left"),to:iO(l,r,"right")};n.deleteRange(a,c)}),n.selection.empty||n.setSelection(e3.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},iD=()=>({commands:e})=>e.keyboardShortcut("Enter"),iR=()=>({state:e,dispatch:t})=>tC(e,t);function iI(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function iL(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:iI(t[r])?t[r].test(e[r]):t[r]===e[r])}function i_(e,t,n={}){return e.find(e=>e.type===t&&iL(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function iP(e,t,n={}){return!!i_(e,t,n)}function ij(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!i_([...r.node.marks],t,n))return;let i=r.index,s=e.start()+r.offset,o=i+1,l=s+r.node.nodeSize;for(;i>0&&iP([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&iP([...e.parent.child(o).marks],t,n);)l+=e.parent.child(o).nodeSize,o+=1;return{from:s,to:l}}function iz(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}let i$=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=iz(e,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:d}=l;if(i){let e=ij(a,s,t);if(e&&e.from<=c&&e.to>=d){let t=e3.create(o,e.from,e.to);n.setSelection(t)}}return!0},iB=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function iV(e){return e instanceof e3}function iH(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function iF(e,t=null){if(!t)return null;let n=eZ.atStart(e),r=eZ.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,s=r.to;return"all"===t?e3.create(e,iH(0,i,s),iH(e.content.size,i,s)):e3.create(e,iH(t,i,s),iH(t,i,s))}function iU(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function iW(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let iq=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};let o=()=>{(iW()||iU())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!iW()&&!iU()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(s&&null===e&&!iV(n.state.selection))return o(),!0;let l=iF(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},iK=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),iJ=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),iG=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&iG(r)}return e};function iX(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return iG(new window.DOMParser().parseFromString(t,"text/html").body)}function iY(e){return"function"==typeof(null==e?void 0:e.nodesBetween)}
1function iQ(e,t,n){if(iY(e))return e;let r="object"==typeof e&&null!==e;n={slice:!0,parseOptions:{},...n};let i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return b.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),iQ("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",s=new Q({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?ee.fromSchema(s).parseSlice(iX(e),n.parseOptions):ee.fromSchema(s).parse(iX(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=ee.fromSchema(t);return n.slice?r.parseSlice(iX(e),n.parseOptions).content:r.parse(iX(e),n.parseOptions)}return iQ("",t,n)}function iZ(e){return!("type"in e)}function i0(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof eM||i instanceof eA))return;let s=e.mapping.maps[r],o=0;s.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(eZ.near(e.doc.resolve(o),n))}let i1=(e,t,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){let i,l;n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{iQ(t,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){a(e)}try{var o;i=iQ(t,s.schema,{parseOptions:c,errorOnInvalidContent:null!=(o=n.errorOnInvalidContent)?o:s.options.enableContentCheck})}catch(e){return a(e),!1}let{from:d,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,p=!0,f=iZ(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=!!u&&e.isText&&0===e.marks.length,p=!!p&&e.isBlock}),d===h&&p){let{parent:e}=r.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,h+=1)}if(u)l=Array.isArray(t)?t.map(e=>e.text||"").join(""):iY(t)?f.map(e=>{var t;return null!=(t=e.text)?t:""}).join(""):"object"==typeof t&&t&&t.text?t.text:t,r.insertText(l,d,h);else{l=b.from(f);let e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,f)}n.updateSelection&&i0(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:l})}return!0};function i2(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let i3=(e={})=>({tr:t,dispatch:n,editor:r})=>{let i,s,{pos:o,attrs:l,content:a,updateSelection:c=!0}=e,d=i2((i="number"==typeof o?t.doc.resolve(o):o||t.selection.$from).parent.contentMatchAt(i.index()));if(!d)return!1;let h=Object.keys(d.spec.attrs||{}),u=l?Object.fromEntries(Object.entries(l).filter(([e])=>h.includes(e))):{};if(a){let e=iQ(a,r.schema);s=d.createAndFill(u,e)}else s=d.createAndFill(u);return!!s&&(n&&(t.insert(i.pos,s),c&&i0(t,t.steps.length-1,-1)),!0)},i4=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof e5,i;if(r){if(n.node.isTextblock||!e_(e.doc,n.from))return!1;i=n.from}else if(null==(i=ej(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(e5.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),i5=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof e5){if(n.node.isTextblock||!e_(e.doc,n.to))return!1;r=n.to}else if(null==(r=ej(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),i6=()=>({state:e,dispatch:t})=>tp(e,t),i8=()=>({state:e,dispatch:t})=>tw(e,t),i9=()=>({state:e,dispatch:t,tr:n})=>{try{let r=ej(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},i7=()=>({state:e,dispatch:t,tr:n})=>{try{let r=ej(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},se=()=>({state:e,dispatch:t})=>((e,t)=>{let n=tu(e,void 0);if(!n)return!1;let r=ty(n);return!!r&&tf(e,r,t)})(e,t),st=()=>({state:e,dispatch:t})=>((e,t)=>{let n=tb(e,void 0);if(!n)return!1;let r=tk(n);return!!r&&tf(e,r,t)})(e,t);function sn(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}let sr=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let s=(function(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"===o&&(o=" ");for(let e=0;e<s.length-1;e+=1){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))r=!0;else if(/^mod$/i.test(o))iW()||sn()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${o}`)}return t&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),i&&(o=`Meta-${o}`),r&&(o=`Shift-${o}`),o})(e).split(/-(?!$)/),o=s.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"
1===o?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function si(e,t,n={}){let{from:r,to:i,empty:s}=e.selection,o=t?iA(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),s=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:s})});let a=i-r,c=l.filter(e=>!o||o.name===e.node.type.name).filter(e=>iL(e.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}let ss=(e,t={})=>({state:n,dispatch:r})=>!!si(n,iA(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),s=i&&eO(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)})(n,r),so=()=>({state:e,dispatch:t})=>tA(e,t),sl=e=>({state:t,dispatch:n})=>{var r;return(r=iA(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!s&&(!t||(n.node(s.depth-1).type==r?function(e,t,n,r){let i=e.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new eA(s-1,o,s,o,new C(b.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new _(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let l=eO(r);if(null==l)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return e_(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),t(i.scrollIntoView()),!0}(e,t,r,s):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,s=n.startIndex;t>s;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+ +!l,d+1,o.content.append(a?b.empty:b.from(i))))return!1;let h=s.pos,u=h+o.nodeSize;return r.step(new eA(h-!!l,u+ +!!a,h+1,u-1,new C((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),+!l,+!a),+!l)),t(r.scrollIntoView()),!0}(e,t,s)))})(t,n)},sa=()=>({state:e,dispatch:t})=>tx(e,t);function sc(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function sd(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}let sh=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null,l=sc("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(s=iA(e,r.schema)),"mark"===l&&(o=iz(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{s&&s===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,sd(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(s=>{o===s.type&&(a=!0,i&&n.addMark(r,r+e.nodeSize,o.create(sd(s.attrs,t))))})})}),a},su=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),sp=()=>({tr:e,dispatch:t})=>{if(t){let t=new e8(e.doc);e.setSelection(t)}return!0},sf=()=>({state:e,dispatch:t})=>tg(e,t),sm=()=>({state:e,dispatch:t})=>tv(e,t),sg=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,s=n.sharedDepth(r);return 0!=s&&(i=n.before(s),t&&t(e.tr.setSelection(e5.create(e.doc,i))),!0)})(e,t),sy=()=>({state:e,dispatch:t})=>tN(e,t),sb=()=>({state:e,dispatch:t})=>tO(e,t);function sw(e,t,n={},r={}){return iQ(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}let sv=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{let{doc:a}=s;if("full"!==r.preserveWhitespace){let l=sw(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});if(o){let e=iZ(l)?l.content:[l];s.replaceWith(0,a.content.size,e).setMeta("preventUpdate",!n)}return!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function sk(e,t){let n=iz(t,e.schema),{from:r,to:i,empty:s}=e.selection,o=[];s?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let l=o.find(e=>
1e.type.name===n.name);return l?{...l.attrs}:{}}function sx(e,t){let n=new eY(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function sS(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function sC(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function sM(e){return t=>sC(t.$from,e)}function sA(e,t,n){return void 0===e.config[t]&&e.parent?sA(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?sA(e.parent,t,n):null}):e.config[t]}function sE(e){return e.map(e=>{let t=sA(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...sE(t())]:e}).flat(10)}function sT(e,t){let n=ec.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function sO(e){return"function"==typeof e}function sN(e,t,...n){return sO(e)?t?e.bind(t)(...n):e(...n):e}function sD(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function sR(e){let t=[],{nodeExtensions:n,markExtensions:r}=sD(e),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),a=[...o,...l];return e.forEach(e=>{let n=sA(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?a:"nodes"===e.types?o:"marks"===e.types?l:[]).forEac
1h(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...s,...r}})})})})}),i.forEach(e=>{let n=sA(e,"addAttributes",{name:e.name,options:e.options,storage:e.storage});n&&Object.entries(n()).forEach(([n,r])=>{let i={...s,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sI(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,s=0,o=e.length;for(let l=0;l<o;l+=1){let o=e[l];if("'"===o&&!i){r=!r,n+=o;continue}if('"'===o&&!r){i=!i,n+=o;continue}if(!r&&!i){if("("===o){s+=1,n+=o;continue}if(")"===o&&s>0){s-=1,n+=o;continue}if(";"===o&&0===s){t.push(n),n="";continue}}n+=o}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let s=r.slice(0,i).trim(),o=r.slice(i+1).trim();s&&o&&t.push([s,o])}return t}function sL(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if("__proto__"===e)return void Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],s=r.filter(e=>!i.includes(e));n[e]=[...i,...s].join(" ")}else if("style"===e){let r=new Map([...sI(n[e]),...sI(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function s_(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>sL(e,t),{})}function sP(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function sj(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function sz(e){var t,n;let r={};return!(null==e||null==(t=e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==e||null==(n=e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function s$(e,t){var n;let r=sR(e),{nodeExtensions:i,markExtensions:s}=sD(e),o=null==(n=i.find(e=>sA(e,"topNode")))?void 0:n.name;return new Q({topNode:o,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},o=sj({...e.reduce((e,t)=>{let r=sA(t,"extendNodeSchema",s);return{...e,...r?r(n):{}}},{}),content:sN(sA(n,"content",s)),marks:sN(sA(n,"marks",s)),group:sN(sA(n,"group",s)),inline:sN(sA(n,"inline",s)),atom:sN(sA(n,"atom",s)),selectable:sN(sA(n,"selectable",s)),draggable:sN(sA(n,"draggable",s)),code:sN(sA(n,"code",s)),whitespace:sN(sA(n,"whitespace",s)),linebreakReplacement:sN(sA(n,"linebreakReplacement",s)),defining:sN(sA(n,"defining",s)),isolating:sN(sA(n,"isolating",s)),attrs:Object.fromEntries(i.map(sz))}),l=sN(sA(n,"parseHTML",s));l&&(o.parseDOM=l.map(e=>sP(e,i)));let a=sA(n,"renderHTML",s);a&&(o.toDOM=e=>a({node:e,HTMLAttributes:s_(e,i)}));let c=sA(n,"renderText",s);return c&&(o.toText=c),[n.name,o]})),marks:Object.fromEntries(s.map(n=>{let i=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},o=sj({...e.reduce((e,t)=>{let r=sA(t,"extendMarkSchema",s);return{...e,...r?r(n):{}}},{}),inclusive:sN(sA(n,"inclusive",s)),excludes:sN(sA(n,"excludes",s)),group:sN(sA(n,"group",s)),spanning:sN(sA(n,"spanning",s)),code:sN(sA(n,"code",s)),attrs:Object.fromEntries(i.map(sz))}),l=sN(sA(n,"parseHTML",s));l&&(o.parseDOM=l.map(e=>sP(e,i)));let a=sA(n,"renderHTML",s);return a&&(o.toDOM=e=>a({mark:e,HTMLAttributes:s_(e,i)})),[n.name,o]}))})}function sB(e){return e.sort((e,t)=>
1{let n=sA(e,"priority")||100,r=sA(t,"priority")||100;return n>r?-1:+(n<r)})}function sV(e){var t;let n=sB(sE(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function sH(e,t,n){let{from:r,to:i}=t,{blockSeparator:s="\n\n",textSerializers:o={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,c)=>{e.isBlock&&n>r&&(l+=s);let d=null==o?void 0:o[e.type.name];if(d)return a&&(l+=d({node:e,pos:n,parent:a,index:c,range:t})),!1;if(e.isText){var h;l+=null==e||null==(h=e.text)?void 0:h.slice(Math.max(r,n)-n,i-n)}}),l}function sF(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function sU(e,t){let n=sc("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=iA(t,e.schema),{from:r,to:i}=e.selection,s=[];e.doc.nodesBetween(r,i,e=>{s.push(e)});let o=s.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}(e,t):"mark"===n?sk(e,t):{}}function sW(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let s=[];if(e.ranges.length)e.forEach((e,t)=>{s.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;s.push({from:e,to:n})}s.forEach(({from:e,to:r})=>{let s=n.slice(t).map(e,-1),o=n.slice(t).map(r),l=n.invert().map(s,-1),a=n.invert().map(o);i.push({oldRange:{from:l,to:a},newRange:{from:s,to:o}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function sq(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=ij(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}let sK=(e,t,n,r=20)=>{let i=e.doc.resolve(n),s=r,o=null;for(;s>0&&null===o;){let e=i.node(s);(null==e?void 0:e.type.name)===t?o=e:s-=1}return[o,s]},sJ=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return 0===n?null:e.node(t).child(n-1)};function sG(e,t){return t.nodes[e]||t.marks[e]||null}function sX(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function sY(e,t,n={}){let{empty:r,ranges:i}=e.selection,s=t?iz(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!s||s.name===e.type.name).find(e=>iL(e.attrs,n,{strict:!1}));let o=0,l=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(s&&e.inlineContent&&!e.type.allowsMarkType(s))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);o+=a-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),0===o)return!1;let a=l.filter(e=>!s||s.name===e.mark.type.name).filter(e=>iL(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!s||e.mark.type!==s&&e.mark.type.excludes(s)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=o}let sQ=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=sM(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos},sZ=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos};function s0(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function s1(e,t){let{nodeExtensions:n}=sD(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=sN(sA(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function s2(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if("hardBreak"===e.type.name)return!0;if(e.isText){var r;return!/\S/.test(null!=(r=e.text)?r:"")}}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;
1if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(s2(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function s3(e){return e instanceof e5}var s4=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function s5(e,t){let n=t.mapping.mapResult(e.position);return{position:new s4(n.pos),mapResult:n}}function s6(e){return new s4(e)}let s8=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:s}=n,{empty:o,ranges:l}=s,a=iz(e,r.schema);if(i)if(o){let e=sk(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,s=e.$to.pos;r.doc.nodesBetween(i,s,(e,r)=>{let o=Math.max(r,i),l=Math.min(r+e.nodeSize,s);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(o,l,a.create({...e.attrs,...t}))}):n.addMark(o,l,a.create(t))})});return function(e,t,n){let{selection:r}=t,i=null;if(iV(r)&&(i=r.$cursor),i){var s;let t=null!=(s=e.storedMarks)?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:o}=r;return o.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),s=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&s}return!i}),i})}(r,n,a)},s9=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),s7=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let s,o=iA(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock)?i().command(({commands:e})=>!!tD(o,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>tD(o,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},oe=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=iH(e,0,n.content.size),i=e5.create(n,r);t.setSelection(i)}return!0},ot=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s,o,{selection:l}=r;return"number"==typeof t?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=l.from,o=l.to),i&&n.doc.nodesBetween(s,o,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},on=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,s=e3.atStart(n).from,o=e3.atEnd(n).to,l=iH(r,s,o),a=iH(i,s,o),c=e3.create(n,l,a);t.setSelection(c)}return!0},or=e=>({state:t,dispatch:n})=>{var r;return(r=iA(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(0==o)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=r)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,i=b.from(n?r.create():null),o=new C(b.from(r.create(null,b.from(l.type.create(null,i)))),n?3:1,0),c=s.start,d=s.end;t(e.tr.step(new eA(c-(n?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(t,n)};function oi(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}let oo=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:s,doc:o}=t,{$from:l,$to:a}=s,c=sX(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(s instanceof e5&&s.node.isBlock)return!!l.parentOffset&&!!eL(o,l.pos)&&(r&&(e&&oi(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,h=0===l.depth?void 0:i2(l.node(-1).contentMatchAt(l.indexAfter(-1))),u=d&&h?[{type:h,attrs:c}]:void 0,p=eL(t.doc,t.mapping.map(l.pos),1,u);if(!u&&!p&&eL(t.doc,t.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(p=!0,u=h?[{type:h,attrs:c}]:void 0),r){if(p&&(s instanceof e3&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,u),h&&!d&&!l.parentOffset&&l.parent.type!==h)){let e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(l.before()),h)}e&&oi(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},ol=(e,t={})=>({tr:n,state:r,dispatch:i,editor:s})=>{let o=iA(e,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;
1let d=l.node(-1);if(d.type!==o)return!1;let h=s.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){var u;let e=b.empty,r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=b.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,s={...sX(h,l.node().type.name,l.node().attrs),...t},a=(null==(u=o.contentMatch.defaultType)?void 0:u.createAndFill(s))||void 0;e=e.append(b.from(o.createAndFill(null,a)||void 0));let c=l.before(l.depth-(r-1));n.replace(c,l.after(-i),new C(e,4-r,0));let d=-1;n.doc.nodesBetween(c,n.doc.content.size,(e,t)=>{if(d>-1)return!1;e.isTextblock&&0===e.content.size&&(d=t+1)}),d>-1&&n.setSelection(e3.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}let p=a.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...sX(h,d.type.name,d.attrs),...t},m={...sX(h,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,a.pos);let g=p?[{type:o,attrs:f},{type:p,attrs:m}]:[{type:o,attrs:f}];if(!eL(n.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!i)return!0;let c=a.filter(e=>o.includes(e.type.name));n.ensureMarks(c)}return!0};function oa(e){return e&&"1"!==e?e:null}let oc=(e,t)=>{var n,r;let i=sM(e=>e.type===t)(e.selection);if(!i)return!0;let s=e.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===s)return!0;let o=e.doc.nodeAt(s);return!(i.node.type===(null==o?void 0:o.type)&&e_(e.doc,i.pos))||(n=i.node.attrs.type,r=null==o?void 0:o.attrs.type,oa(n)!==oa(r)||(e.join(i.pos),!0))},od=(e,t)=>{var n,r;let i=sM(e=>e.type===t)(e.selection);if(!i)return!0;let s=e.doc.resolve(i.start).after(i.depth);if(void 0===s)return!0;let o=e.doc.nodeAt(s);return!(i.node.type===(null==o?void 0:o.type)&&e_(e.doc,s))||(n=i.node.attrs.type,r=null==o?void 0:o.attrs.type,oa(n)!==oa(r)||(e.join(s),!0))},oh=(e,t,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:d})=>{let{extensions:h,splittableMarks:u}=i.extensionManager,p=iA(e,o.schema),f=iA(t,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:b}=m,w=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;let k=sM(e=>s1(e.type.name,h))(m),x=0===m.from&&m.to===o.doc.content.size,S=o.doc.content.content,C=1===S.length?S[0]:null,M=x&&C&&s1(C.type.name,h)?{node:C,pos:0,depth:0}:null,A=null!=k?k:M,E=!!k&&w.depth>
1=1&&w.depth-k.depth<=1,T=!!M;if((E||T)&&A){if(A.node.type===p)return x&&T?a().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return e3.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(s1(A.node.type.name,h)&&p.validContent(A.node.content))return a().command(()=>(s.setNodeMarkup(A.pos,p),!0)).command(()=>oc(s,p)).command(()=>od(s,p)).run()}return n&&v&&l?a().command(()=>{let e=d().wrapInList(p,r),t=v.filter(e=>u.includes(e.type.name));return s.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>oc(s,p)).command(()=>od(s,p)).run():a().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>oc(s,p)).command(()=>od(s,p)).run()},ou=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:s=!1}=n,o=iz(e,r.schema);return sY(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,t)},op=(e,t,n={})=>({state:r,commands:i})=>{let s,o=iA(e,r.schema),l=iA(t,r.schema),a=si(r,o,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(s=r.selection.$anchor.parent.attrs),a)?i.setNode(l,s):i.setNode(o,{...s,...n})},of=(e,t={})=>({state:n,commands:r})=>{let i=iA(e,n.schema);return si(n,i,t)?r.lift(i):r.wrapIn(i,t)},om=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,s=n[r];if(s.spec.isInputRules&&(i=s.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},og=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:s}=t,{empty:o,ranges:l}=s;if(o)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!a.includes(e.name));l.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},oy=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:s=!1}=t,{selection:o}=n,l=iz(e,r.schema),{$from:a,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){var h;let{from:e,to:t}=o,r=ij(a,l,null==(h=a.marks().find(e=>e.type===l))?void 0:h.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,l)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},ob=e=>({tr:t,state:n,dispatch:r})=>{let i,s,{selection:o}=n;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},ow=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null,l=sc("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(s=iA(e,r.schema)),"mark"===l&&(o=iz(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{let l,c,d,h,u=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(u,p,(e,t)=>{s&&s===e.type&&(a=!0,d=Math.max(t,u),h=Math.min(t+e.nodeSize,p),l=t,c=e)}):r.doc.nodesBetween(u,p,(e,r)=>{r<u&&s&&s===e.type&&(a=!0,d=Math.max(r,u),h=Math.min(r+e.nodeSize,p),l=r,c=e),r>=u&&r<=p&&(s&&s===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(s=>{if(o===s.type&&(a=!0,i)){let i=Math.max(r,u),l=Math.min(r+e.nodeSize,p);n.addMark(i,l,o.create({...s.attrs,...t}))}}))}),c&&(void 0!==l&&i&&n.setNodeMarkup(l,void 0,{...c.attrs,...t}),o&&c.marks.length&&c.marks.forEach(e=>{o===e.type&&i&&n.addMark(d,h,o.create({...e.attrs,...t}))}))}),a},ov=new td("__tiptap_decorations__"),ok=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(ov,{type:"force",name:e}),!0),ox=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&eN(o,e,t);return!!l&&(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0)}})(iA(e,n.schema),t)(n,r),oS=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,s=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){
1if(0==t.$from.index(t.depth-1))return!1;let e=o.resolve(t.start-2);s=new _(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new _(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let l=eN(s,n,r,t);return!!l&&(e&&function(e,t,n,r,i){let s=b.empty;for(let e=n.length-1;e>=0;e--)s=b.from(n[e].type.create(n[e].attrs,s));e.step(new eA(t.start-2*!!r,t.end,t.start,t.end,new C(s,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let l=n.length-o,a=t.start+n.length-2*!!r,c=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&eL(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(n).nodeSize}(e,t,l,i,n),!0)}(l,o,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(iA(e,n.schema),t)(n,r);var oC=(e=>{let t={};for(var n in e)f(t,n,{get:e[n],enumerable:!0});return f(t,Symbol.toStringTag,{value:"Module"}),t})({blur:()=>iw,clearContent:()=>iv,clearNodes:()=>ik,command:()=>ix,createParagraphNear:()=>iS,cut:()=>iC,deleteCurrentNode:()=>iM,deleteNode:()=>iE,deleteRange:()=>iT,deleteSelection:()=>iN,enter:()=>iD,exitCode:()=>iR,extendMarkRange:()=>i$,first:()=>iB,focus:()=>iq,forEach:()=>iK,insertContent:()=>iJ,insertContentAt:()=>i1,insertDefaultBlock:()=>i3,joinBackward:()=>i6,joinDown:()=>i5,joinForward:()=>i8,joinItemBackward:()=>i9,joinItemForward:()=>i7,joinTextblockBackward:()=>se,joinTextblockForward:()=>st,joinUp:()=>i4,keyboardShortcut:()=>sr,lift:()=>ss,liftEmptyBlock:()=>so,liftListItem:()=>sl,newlineInCode:()=>sa,resetAttributes:()=>sh,scrollIntoView:()=>su,selectAll:()=>sp,selectNodeBackward:()=>sf,selectNodeForward:()=>sm,selectParentNode:()=>sg,selectTextblockEnd:()=>sy,selectTextblockStart:()=>sb,setContent:()=>sv,setMark:()=>s8,setMeta:()=>s9,setNode:()=>s7,setNodeSelection:()=>oe,setTextDirection:()=>ot,setTextSelection:()=>on,sinkListItem:()=>
1or,splitBlock:()=>oo,splitListItem:()=>ol,toggleList:()=>oh,toggleMark:()=>ou,toggleNode:()=>op,toggleWrap:()=>of,undoInputRule:()=>om,unsetAllMarks:()=>og,unsetMark:()=>oy,unsetTextDirection:()=>ob,updateAttributes:()=>ow,updateDecorations:()=>ok,wrapIn:()=>ox,wrapInList:()=>oS});let oM=new WeakMap;var oA=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};let oE=void 0!==d.default&&!1;function oT(e,t){let n=[],r=new Set;for(let i of e)"widget"===i.kind&&"widget"===i.kind&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function oO({position:e,from:t,to:n,docSize:r}){return!(e<t)&&(e<n||e===n&&n===r)}function oN(e){return"attr"===e.jsonID}function oD(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=null==e?void 0:e.key;"string"==typeof t&&r.delete(t)}})}function oR(e,t){let n=Object.values(t).flatMap(e=>e.find());return rH.create(e,n)}function oI(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}let oL=new Set;var o_=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>
1{let t=ov.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>(function(e,t){var n;switch(null!=(n=t.update)?n:"document"){case"document":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}})(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var e,t;return null!=(e=null==(t=ov.getState(this.editor.state))?void 0:t.widgetKeys)?e:oL}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new tl({key:ov,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:s}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,s,n);r[e]=t,i[e]=o}let s={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:oI(i)};return this.warnDuplicateWidgetKeys(s),s},apply:(n,r,i,s)=>{let o=n.getMeta(ov),l=(null==o?void 0:o.type)==="force"&&!o.name,a=(null==o?void 0:o.type)==="force"?o.name:void 0,c={},d={},h=new Set;return(!function(e,t){var n,r;oM.set(e,(null!=(n=oM.get(e))?n:0)+1);try{return t()}finally{let t=(null!=(r=oM.get(e))?r:1)-1;t>0?oM.set(e,t):oM.delete(e)}}(e,()=>{for(let{name:u,spec:p}of t){var o;let t=l||a===u;if(o={editor:e,tr:n,oldState:i,newState:s},t||"manual"!==p.update&&(p.shouldUpdate?p.shouldUpdate(o):o.tr.docChanged))if("changedRanges"===p.update&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(u,p,r,n,s);c[u]=e.set,d[u]=e.widgetKeys,h.add(u)}else{let{set:e,widgetKeys:t}=this.buildFullSet(u,p,s);c[u]=e,d[u]=t,h.add(u)}else{let e=function(e,t,n){var r,i;let s=null!=(r=t.decorationSetsByExtension[e])?r:rH.empty,o=new Set(null!=(i=t.widgetKeysByExtension[e])?i:[]);return{set:oD(s,n.mapping,n.doc,o),widgetKeys:o}}(u,r,n);c[u]=e.set,d[u]=e.widgetKeys}}}),0!==h.size||n.docChanged)?{decorationSetsByExtension:c,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:h}),widgetKeys:oI(d)}:r}},props:{decorations(e){var t,n;return null!=(t=null==(n=ov.getState(e))?void 0:n.mergedDecorationSet)?t:rH.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let s=function(e,t){if(e.steps.some(e=>{let t;
1return t=!1,e.getMap().forEach(()=>{t=!0}),!(t||oN(e))&&("number"!=typeof e.from||"number"!=typeof e.to)}))return{type:"full"};let n=sW(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!oN(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=function(e,t){let n=null,r=0,i=0;for(let s=0;s<e.childCount&&!(i>t.to);s+=1){let o=i+e.child(s).nodeSize;o>=t.from&&(null===n&&(n=i),r=o),i=o}return null===n?null:{from:n,to:r}}(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:"ranges",ranges:i}}(r,i.doc);return"full"===s.type?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,s.ranges)}rebuildRanges(e,t,n,r,i,s){var o,l;let a=null!=(o=n.decorationSetsByExtension[e])?o:rH.empty,c=new Set(null!=(l=n.widgetKeysByExtension[e])?l:[]),d=oD(a,r.mapping,r.doc,c),h=i.doc.content.size;for(let{from:n,to:r}of s){let s=d.find(n,r).filter(e=>oO({position:e.from,from:n,to:r,docSize:h}));for(let e of s){let t=function(e){var t;let n=null==(t=e.spec)?void 0:t.key;return"string"==typeof n?n:void 0}(e);t&&c.delete(t)}d=d.remove(s);let{decorations:o,widgetKeys:l}=oT(function({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:s}){return e.filter(e=>!!oO({position:e.anchor,from:t,to:n,docSize:r})||e.anchor!==n&&(s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}({decorations:this.runCreate(e,"createInRange",()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:h,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);for(let e of(d=d.add(i.doc,o),l))c.add(e)}return{set:d,widgetKeys:c}}buildFullSet(e,t,n){let r=this.runCreate(e,"create",()=>t.create({editor:this.editor,state:n,view:this.mountedView}));
1return function(e,t,n){let{decorations:r,widgetKeys:i}=oT(t,n);return{set:rH.create(e,r),widgetKeys:i}}(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){}buildMergedSet(e,t){let n=Object.keys(t);return 1===n.length?t[n[0]]:oR(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return 1===e.length?r[e[0].name]:0===i.size?t.mergedDecorationSet.map(n.mapping,n.doc):oR(n.doc,r)}};function oP(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof e5){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}function oj(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function oz(e,t,n){let r=e.split("\n"),i=[],s="",o=0,l=t.baseIndentSize||2;for(;o<r.length;){let e,d=r[o],h=d.match(t.itemPattern);if(!h)if(i.length>0)break;else{if(""!==d.trim())return;o+=1,s=`${s}${d}
2`;continue}let u=t.extractItemData(h),{indentLevel:p,mainContent:f}=u;s=`${s}${d}
3`;let m=[f];for(o+=1;o<r.length;){var a,c;let e=r[o];if(""===e.trim()){let t=r.slice(o+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(c=r[o+1+t].match(/^(\s*)/))||null==(c=c[1])?void 0:c.length)||0)>p){m.push(e),s=`${s}${e}
4`,o+=1;continue}break}if(((null==(a=e.match(/^(\s*)/))||null==(a=a[1])?void 0:a.length)||0)>p)m.push(e),s=`${s}${e}
5`,o+=1;else break}let g=m.slice(1);if(g.length>0){let r=g.map(e=>e.slice(p+l)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let y=t.createToken(u,e);i.push(y)}if(0!==i.length)return{items:i,raw:s}}function o$(e){let t=0;for(let n of e)t="	"===n?t+4-t%4:t+1;return t}function oB(e,t,n,r,i){if(!e||!Array.isArray(e.content))return"";let s="function"==typeof n?n(r):n,[o,...l]=e.content,a=`${s}${t.renderChildren([o])}`;return l&&l.length>0&&l.forEach((e,n)=>{var r,o;let l=null!=(r=null==(o=t.renderChild)?void 0:o.call(t,e,n+1))?r:t.renderChildren([e]);if(null!=l){let n=e=>{if(!(null==i?void 0:i.alignNestedToPrefix))return t.indent(e);let n=t.indent(""),r=o$(s);return(o$(n)>=r?n:" ".repeat(r))+e},r=l.split("\n").map(e=>e?n(e):n("")).join("\n");a+="paragraph"===e.type?`
6
7${r}`:`
8${r}`}}),a}function oV(e,t,n={}){let{state:r}=t,{doc:i,tr:s}=r;i.descendants((t,r)=>{let i=s.mapping.map(r),o=s.mapping.map(r)+t.nodeSize,l=null;if(t.marks.forEach(t=>{if(t!==e)return!1;l=t}),!l)return;let a=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(a=!0)}),a){let t=e.type.create({...e.attrs,...n});s.removeMark(i,o,e.type),s.addMark(i,o,t)}}),s.docChanged&&t.view.dispatch(s)}var oH=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){oV(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!("selection"===e.type||this.contentDOM.contains(e.target)&&"childList"===e.type&&(iW()||iU())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}},oF=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function oU(e){var t;let{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,h=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,s)=>{var o,l;let a=(null==(o=(l=e.type.spec).toText)?void 0:o.call(l,{node:e,pos:t,parent:i,index:s}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(c)+s;
8return o.forEach(e=>{if(d)return;let t=((e,t)=>{if(iI(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;let o=t[0].length-s.length;if(o>0){let e=c.parentOffset-o;if(e<0||c.parent.textBetween(e,c.parentOffset)!==t[0].slice(0,o))return}let u=a.state.tr,p=iy({state:a.state,transaction:u}),f={from:r-(t[0].length-s.length),to:i},{commands:m,chain:g,can:y}=new ib({editor:n,state:p});null!==e.handler({state:p,range:f,match:t,commands:m,chain:g,can:y})&&u.steps.length&&(e.undoable&&u.setMeta(l,{transform:u,from:r,to:i,text:s}),a.dispatch(u),d=!0)}),d}var oW=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...sN(sA(this,"addOptions",{name:this.name}))}}get storage(){return{...sN(sA(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return oj(t)&&oj(n)&&Object.keys(n).forEach(i=>{oj(n[i])&&oj(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},oq=class e extends oW{constructor(...e){super(...e),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let s=i.find(e=>(null==e?void 0:e.type.name)===t.name);return s&&n.removeStoredMark(s),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},oK=class{constructor(e){this.find=e.find,this.handler=e.handler}};let oJ=null;var oG=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=sV(e),this.schema=s$(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=sA(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:sG(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=sB([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sG(t.name,this.schema)},r=[],i=sA(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&sA(t,"exitable",n)&&(s.ArrowRight=()=>oq.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let o=new tl({props:{handleKeyDown:ig(s)}});r.push(o);let l=sA(t,"addInputRules",n);if(s0(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new tl({state:{init:()=>null,apply(e,i,s){let o=e.getMeta(r);if(o)return o;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=sT(b.from(e),s.schema));let{from:i}=l,o=i+e.length;oU({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,s,o)=>oU({editor:t,from:i,to:s,text:o,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&oU({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:s}=e.state.selection;return!!s&&oU({editor:t,from:s.pos,to:s.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let a=sA(t,"addPasteRules",n);if(s0(t,e.options.enablePasteRules)&&a){let t=a();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}
8=e,i=null,s=!1,o=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let a=({state:e,from:r,to:i,rule:s,pasteEvt:o})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=e,{commands:a,chain:c,can:d}=new ib({editor:t,state:n}),h=[];return n.doc.nodesBetween(r,i,(e,t)=>{var u,p,f,m;if((null==(u=e.type)||null==(u=u.spec)?void 0:u.code)||!(e.isText||e.isTextblock||e.isInline))return;let g=null!=(p=null!=(f=null==(m=e.content)?void 0:m.size)?f:e.nodeSize)?p:0,y=Math.max(r,t),b=Math.min(i,t+g);y>=b||((e,t,n)=>{if(iI(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(y-t,b-t,void 0,""),s.find,o).forEach(e=>{if(void 0===e.index)return;let t=y+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=s.handler({state:n,range:i,match:e,commands:a,chain:c,can:d,pasteEvent:o,dropEvent:l});h.push(u)})}),h.every(e=>null!==e)}({editor:n,state:iy({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:s,pasteEvent:o,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new tl({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(oJ=n)},r=()=>{oJ&&(oJ=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(o=i===e.dom.parentElement,t=n,!o){let e=oJ;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],c="paste"===i.getMeta("uiEvent")&&!s,d="drop"===i.getMeta("uiEvent")&&!o,h=i.getMeta("applyPasteRules"),u=!!h;if(!c&&!d&&!u)return;if(u){var p,f;let t,{text:n}=h;"string"==typeof n||(n=sT(b.from(n),r.schema));let{from:i}=h,s=i+n.length;return a({rule:e,state:r,from:i,to:{b:s},pasteEvt:(p=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",p),t)})}let m=n.doc.content.findDiffStart(r.doc.content),g=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&g&&m!==g.b)return a({rule:e,state:r,from:m,to:g,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let c=sA(t,"addProseMirrorPlugins",n);if(c){let e=c();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;null==(e=this.decorationManager)||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=sA(e,"addDecorations",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:sG(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new o_({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return sR(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=sD(this.extensions);return Object.fromEntries(t.filter(e=>!!sA(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=sA(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:iA(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,s,o,l,a)=>{let c=s_(r,n);return i({node:r,view:s,getPos:o,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return sB([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sG(n.name,this.schema)},i=sA(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return sB([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sG(n.name,this.schema)},i=sA(n,"transformPastedHTML",r);return i?(t,n)=>{let s=e(t,n);return i.call(r,s)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=sD(this.extensions);return Object.fromEntries(t.filter(e=>!!sA(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=sA(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:iz(t.name,this.schema)});return r?[t.name,(i,s,o)=>{let l=s_(i,n);return r()({mark:i,view:s,inline:o,editor:e,extension:t,HTMLAttributes:l,updateAttributes:t=>{oV(i,e,t)}})}]:[]}))}destroy(){var e;null==(e=this.decorationManager)||e.destroy(),this.extensions.forEach(e
8=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sG(e.name,this.schema)};if("mark"===e.type){var n,r;(null==(n=sN(sA(e,"keepOnSplit",t)))||n)&&this.splittableMarks.push(e.name),null==(r=sN(sA(e,"clearable",t)))||r||this.nonClearableMarks.push(e.name)}let i=sA(e,"onBeforeCreate",t),s=sA(e,"onCreate",t),o=sA(e,"onUpdate",t),l=sA(e,"onSelectionUpdate",t),a=sA(e,"onTransaction",t),c=sA(e,"onFocus",t),d=sA(e,"onBlur",t),h=sA(e,"onDestroy",t);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};oG.resolve=sV,oG.sort=sB,oG.flatten=sE;var oX=class e extends oW{constructor(...e){super(...e),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};let oY=oX.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new tl({key:new td("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,s=sF(n),{blockSeparator:o}=this.options,l={...void 0!==o?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>sH(r,{from:e.pos,to:t.pos},l)).join(null!=o?o:"\n\n")}}})]}}),oQ=oX.create({name:"commands",addCommands:()=>({...oC})}),oZ=oX.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r;let i=()=>{var n,r,i;if(null!=(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)||null==(i=r.filterTransaction)?void 0:i.call(r,e))?n:e.getMeta("y-sync$"))return;let s=sx(e.before,[e,...t]);sW(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let o=s.mapping;s.steps.forEach((t,n)=>{if(t instanceof ex){var r,i;let l=o.slice(n).map(t.from,-1),a=o.slice(n).map(t.to),c=o.invert().map(l,-1),d=o.invert().map(a),h=l>0&&(null==(r=s.doc.nodeAt(l-1))?void 0:r.marks.some(e=>e.eq(t.mark))),u=null==(i=s.doc.nodeAt(a))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:l,to:a},partial:!!(u||h),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)?void 0:r.async)||n?setTimeout(i,0):i()}}),o0=oX.create({name:"drop",addProseMirrorPlugins(){return[new tl({key:new td("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),o1=oX.create({name:"editable",addProseMirrorPlugins(){return[new tl({key:new td("editable"),props:{editable:()=>this.editor.options.editable}})]}}),o2=new td("focusEvents"),o3=oX.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new tl({key:o2,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),o4=oX.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:s}=n,{pos:o,parent:l}=s,a=s.parent.isTextblock&&o>0?t.doc.resolve(o-1):s,c=a.parent.type.spec.isolating,d=s.pos-s.parentOffset,h=c&&1===a.parent.childCount?d===s.pos:eZ.atStart(r).from===o;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!h&&(!h||"paragraph"!==s.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return iW()||sn()?i:r},addProseMirrorPlugins(){return[new tl({key:new td("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:s,from:o,to:l}=t.selection,a=eZ.atStart(t.doc).from,c=eZ.atEnd(t.doc).to;
8if(s||o!==a||l!==c||!s2(n.doc))return;let d=n.tr,h=iy({state:n,transaction:d}),{commands:u}=new ib({editor:this.editor,state:h});if(u.clearNodes(),d.steps.length)return d}})]}}),o5=oX.create({name:"paste",addProseMirrorPlugins(){return[new tl({key:new td("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),o6=oX.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new tl({key:new td("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),o8=oX.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=sD(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new tl({key:new td("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),o9=!1;var o7=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+ +!s;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!o&&a.depth<=this.depth)return;let c=new e(a,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(s=>{n&&r.length>0||(s.node.type.name===e&&i.every(e=>t[e]===s.node.attrs[e])&&r.push(s),n&&r.length>0||(r=r.concat(s.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};let le=`.ProseMirror {
9  position: relative;
10}
11
12.ProseMirror {
13  word-wrap: break-word;
14  white-space: pre-wrap;
15  white-space: break-spaces;
16  -webkit-font-variant-ligatures: none;
17  font-variant-ligatures: none;
18  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
19}
20
21.ProseMirror [contenteditable="false"] {
22  white-space: normal;
23}
24
25.ProseMirror [contenteditable="false"] [contenteditable="true"] {
26  white-space: pre-wrap;
27}
28
29.ProseMirror pre {
30  white-space: pre-wrap;
31}
32
33img.ProseMirror-separator {
34  display: inline !important;
35  border: none !important;
36  margin: 0 !important;
37  width: 0 !important;
38  height: 0 !important;
39}
40
41.ProseMirror-gapcursor {
42  display: none;
43  pointer-events: none;
44  position: absolute;
45  margin: 0;
46}
47
48.ProseMirror-gapcursor:after {
49  content: "";
50  display: block;
51  position: absolute;
52  top: -2px;
53  width: 20px;
54  border-top: 1px solid black;
55  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
56}
57
58@keyframes ProseMirror-cursor-blink {
59  to {
60    visibility: hidden;
61  }
62}
63
64.ProseMirror-hideselection *::selection {
65  background: transparent;
66}
67
68.ProseMirror-hideselection *::-moz-selection {
69  background: transparent;
70}
71
72.ProseMirror-hideselection * {
73  caret-color: transparent;
74}
75
76.ProseMirror-focused .ProseMirror-gapcursor {
77  display: block;
78}`;var lt=class extends oA{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:s5,createMappablePosition:s6},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const e=iF(t,this.options.autofocus);this.editorState=to.create({doc:t,schema:this.schema,selection:e||void 0})}!function(e){let t;if(!o9){o9=!0;try{t=eM.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof b||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}}(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():ib.createFakeChain()}can(){return this.commandManager?this.commandManager.can():ib.createFallbackCan()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(le,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}
78),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return oE&&!this.hasWarnedStaleDecorationRead&&oM.has(this),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=sO(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[o1,oY.configure({blockSeparator:null==(e=this.options.coreExtensionOptions)||null==(e=e.clipboardTextSerializer)?void 0:e.blockSeparator}),oQ,o3,o4,o6.configure({value:null==(t=this.options.coreExtensionOptions)||null==(t=t.tabindex)?void 0:t.value}),o0,o5,oZ,o8.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new oG(n,this)}createCommandManager(){this.commandManager=new ib({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=sw(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;let e=sw(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=to.create({doc:e,schema:this.schema,selection:iF(e,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new r7(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),s=this.state;
78if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==o?void 0:o.getMeta("focus"),a=null==o?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||s.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return sU(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return si(e,null,n)||sY(e,null,n);let r=sc(t,e.schema);return"node"===r?si(e,t,n):"mark"===r&&sY(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sT(this.state.doc.content,this.schema)}getText(e){var t,n;let{blockSeparator:r="\n\n",textSerializers:i={}}=e||{};return t=this.state.doc,n={blockSeparator:r,textSerializers:{...sF(this.schema),...i}},sH(t,{from:0,to:t.content.size},n)}get isEmpty(){return s2(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(e=null==(t=this.editorView)?void 0:t.isDestroyed)||e}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new o7(t,this,!1,n)}get $doc(){return this.$pos(0)}},ln=class{static Inline(e,t,n={},r){return new lr(e,t,n,r)}static Node(e,t,n={},r){return new li(e,t,n,r)}static Widget(e,t,n){let{key:r,...i}=n;return new ls(e,t,r,i)}},lr=class extends ln{constructor(e,t,n={},r){super(),this.kind="inline",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return r$.inline(this.from,this.to,this.attrs,t)}},li=class extends ln{constructor(e,t,n={},r){super(),this.kind="node",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return r$.node(this.from,this.to,this.attrs,t)}},ls=class extends ln{constructor(e,t,n,r){super(),this.kind="widget",this.pos=e,this.render=t,this.key=n,this.spec=r}get anchor(){return this.pos}toPMDecoration(e){let t=e?{...this.spec,key:this.key,extensionName:e}:{...this.spec,key:this.key};return r$.widget(this.pos,this.render,t)}};function lo(e){return new oF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=sN(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:s}=t,o=r[r.length-1],l=r[0];if(o){let r=l.search(/\S/),a=n.from+l.indexOf(o),c=a+o.length;if(sq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>a).length)return null;c<n.to&&s.delete(c,n.to),a>n.from&&s.delete(n.from+r,a);let d=n.from+r+o.length;s.addMark(n.from+r,d,e.type.create(i||{})),s.removeStoredMark(e.type)}},undoable:e.undoable})}function ll(e){return new oF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=sN(e.getAttributes,void 0,r)||{},{tr:s}=t,o=n.from,l=n.to,a=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let t=r[0][r[0].length-1];s.insertText(t,o+r[0].length-1),s.replaceWith(e,l,a)}else if(r[0]){let t=e.type.isInline?o:o-1;s.insert(t,e.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:e.undoable})}function la(e){return new oF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),s=sN(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,s)},undoable:e.undoable})}function lc(e){return new oF({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let s=sN(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),a=l&&eN(l,e.type,s);if(!a)return null;if(o.wrap(l,a),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,s=r||n.$to.parentOffset&&n.$from.marks();if(s){let e=s.filter(e=>
78i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,s).run()}let c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&e_(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&o.join(n.from-1)},undoable:e.undoable})}var ld=class{constructor(e){var t,n,r,i,s,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==e||null==(r=e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(s=e.options)?void 0:s.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(o=e.options)?void 0:o.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),s=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),s&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.
78style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,s=e.includes("right"),o=e.includes("left"),l=e.includes("bottom"),a=e.includes("top");return(s?r=this.startWidth+t:o&&(r=this.startWidth-t),l?i=this.startHeight+n:a&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(s?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,s,o;if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return(null==(s=this.maxSize)?void 0:s.width)&&(n=Math.min(this.maxSize.width,n)),(null==(o=this.maxSize)?void 0:o.height)&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let l=e,a=t;return l<this.minSize.width&&(a=(l=this.minSize.width)/this.aspectRatio),a<this.minSize.height&&(l=(a=this.minSize.height)*this.aspectRatio),(null==(r=this.maxSize)?void 0:r.width)&&l>this.maxSize.width&&(a=(l=this.maxSize.width)/this.aspectRatio),(null==(i=this.maxSize)?void 0:i.height)&&a>this.maxSize.height&&(l=(a=this.maxSize.height)*this.aspectRatio),{width:l,height:a}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},lh=class e extends oW{constructor(...e){super(...e),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},lu=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,i,s,o,l;let{view:a}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let h=0,u=0;if(this.dom!==d){let t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),l=null!=(r=e.offsetX)?r:null==(i=e.nativeEvent)?void 0:i.offsetX,a=null!=(s=e.offsetY)?s:null==(o=e.nativeEvent)?void 0:o.offsetY;h=n.x-t.x+l,u=n.y-t.y+a}let p=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let f=null;try{(f=document.createElement("div")).style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(p),document.body.appendChild(f),null==(l=e.dataTransfer)||l.setDragImage(p,h,u)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}let m=this.getPos();if("number"!=typeof m)return;let g=e5.create(a.state.doc,m),y=a.state.tr.setSelection(g);a.dispatch(y)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,s="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!r)return!0;let{isEditable:o}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,c=e5.isSelectable(this.node),d="copy"===e.type,h="paste"===e.type,u="cut"===e.type,p="mousedown"===e.type;if(!a&&c&&r&&e.target===this.dom&&e.preventDefault(),a&&r&&!l&&e.target===this.dom)return e.preventDefault(),!1;if(a&&o&&!l&&p){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!l&&!i&&!s&&!d&&!h&&!u&&(!p||!c)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.contentDOM.contains(e.target)&&"childList"===e.type&&(iW()||iU())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes
78)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function lp(e){return new oK({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let s=sN(e.getAttributes,void 0,r,i);if(!1===s||null===s)return null;let{tr:o}=t,l=r[r.length-1],a=r[0],c=n.to;if(l){let i=a.search(/\S/),d=n.from+a.indexOf(l),h=d+l.length;if(sq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+i,d),c=n.from+i+l.length,o.addMark(n.from+i,c,e.type.create(s||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}e.s(["Editor",0,lt,"Extension",0,oX,"InputRule",0,oF,"MappablePosition",0,s4,"Mark",0,oq,"MarkView",0,oH,"Node",0,lh,"No
78deView",0,lu,"PasteRule",0,oK,"ResizableNodeView",0,ld,"callOrReturn",0,sN,"canInsertNode",0,oP,"combineTransactionSteps",0,sx,"createWidgetDecoration",0,function(e){let{editor:t,pos:n,key:r,props:i,cacheKey:s,context:o,create:l,materialize:a,side:c,relaxedSide:d,marks:h,stopEvent:u,ignoreSelection:p,destroy:f}=e,m=function(e,t){let n=e[t];if(!n){n={renderers:new Map,props:new Map,pendingProps:new Map,flushScheduled:!1},e[t]=n;let r=n;e.on("destroy",()=>{r.pendingProps.clear(),r.renderers.forEach(e=>e.destroy()),r.renderers.clear(),r.props.clear()})}return n}(t,s);if(m.renderers.has(r)){var g;let e=null!=(g=m.pendingProps.get(r))?g:m.props.get(r);(!e||!function(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n]))}(e,i))&&(m.pendingProps.set(r,i),m.flushScheduled||(m.flushScheduled=!0,queueMicrotask(()=>(function(e){for(let[t,n]of(e.flushScheduled=!1,e.pendingProps)){let r=e.renderers.get(t);r&&(r.updateProps(n),e.props.set(t,{...n}))}e.pendingProps.clear()})(m))))}return ln.Widget(n,(e,t)=>{let n={...i,...o(t)},s=m.renderers.get(r);return s?s.updateProps(n):(s=l(n),m.renderers.set(r,s),m.props.set(r,{...i})),a(s)},{key:r,side:c,relaxedSide:d,marks:h,stopEvent:u,ignoreSelection:p,destroy:e=>{var n,i,s;if(!(null!=(n=null==(i=t.extensionManager)||null==(i=i.decorationManager)?void 0:i.liveWidgetKeys())?n:oL).has(r))try{null==(s=m.renderers.get(r))||s.destroy(),m.renderers.delete(r),m.props.delete(r),m.pendingProps.delete(r)}finally{null==f||f(e)}}})},"findChildrenInRange",0,sS,"findParentNode",0,sM,"findParentNodeClosestToPos",0,sC,"generateJSON",0,function(e,t){let n=s$(sV(t),void 0),r=iX(e);return ee.fromSchema(n).parse(r).toJSON()},"getAttributes",0,sU,"getChangedRanges",0,sW,"getExtensionField",0,sA,"getMarksBetween",0,sq,"getNodeAtPosition",0,sK,"getNodeType",0,iA,"getPreviousBlockSibling",0,sJ,"getRenderedAttributes",0,s_,"getUpdatedPosition",0,s5,"isAtEndOfNode",0,sQ,"isAtStartOfNode",0,sZ,"isNodeActive",0,si,"isNodeEmpty",0,s2,"isNodeSelection",0,s3,"isTextSelection",0,iV,"markInputRule",0,lo,"markPasteRule",0,lp,"mergeAttributes",0,sL,"nodeInputRule",0,ll,"parseIndentedBlocks",0,oz,"renderNestedMarkdownContent",0,oB,"textblockTypeInputRule",0,la,"wrappingInputRule",0,lc],10552);let{getOwnPropertyNames:lf,getOwnPropertySymbols:lm}=Object,{hasOwnProperty:lg}=Object.prototype;function ly(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function lb(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,s=i.get(t),o=i.get(n);if(s&&o)return s===n&&o===t;i.set(t,n),i.set(n,t);let l=e(t,n,r);return i.delete(t),i.delete(n),l}}function lw(e){return lf(e).concat(lm(e))}let lv=Object.hasOwn||((e,t)=>lg.call(e,t));function lk(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let lx="u">typeof Float16Array,{getOwnPropertyDescriptor:lS,keys:lC}=Object;function lM(e,t){return e.byteLength===t.byteLength&&lj(new Uint8Array(e),new Uint8Array(t))}function lA(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function lE(e,t){return e.byteLength===t.byteLength&&lj(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function lT(e,t){return lk(e.getTime(),t.getTime())}function lO(e,t,n){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&n.equals(e.cause,t.cause,"cause","cause",e,t,n)}function lN(e,t){return e===t}function lD(e,t,n){let r,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),l=e.entries(),a=0;for(;(r=l.next())&&!r.done;){let s=t.entries(),l=!1,c=0;for(;(i=s.next())&&!i.done;){if(o[c]){c++;continue}let s=r.value,d=i.value;if(n.equals(s[0],d[0],a,c,e,t,n)&&n.equals(s[1],d[1],s[0],d[0],e,t,n)){l=o[c]=!0;break}c++}if(!l)return!1;a++}return!0}function lR(e,t,n){let r=lC(e),i=r.length;if(lC(t).length!==i)return!1;for(;i-- >0;)if(!lB(e,t,n,r[i]))return!1;return!0}function lI(e,t,n){let r,i,s,o=lw(e),l=o.length;if(lw(t).length!==l)return!1;for(;l-- >0;)if(!lB(e,t,n,r=o[l])||(i=lS(e,r),s=lS(t,r),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable)))return!1;return!0}function lL(e,t){return lk(e.valueOf(),t.valueOf())}function l_(e,t){return e.source===t.source&&e.flags===t.flags}function lP(e,t,n){let r,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),l=e.values();for(;(r=l.next())&&!r.done;){let s=t.values(),l=!1,a=0;for(;(i=s.next())&&!i.done;){if(!o[a]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){l=o[a]=!0;break}a++}if(!l)return!1}return!0}function lj(e,t){let n=e.length;if(t.length!==n||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||lx&&e instanceof Float16Array){for(;n-- >0;)if(e[n]!==t[n]&&(e[n]==e[n]||t[n]==t[n]))return!1;return!0}for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function lz(e,t){var n,r;let i,s;return e.href===t.href||e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&(n=e.searchParams,r=t.searchParams,i=n.toString(),i===(s=r.toString())||l$(i)===l$(s))}function l$(e){return e.split("&").sort().join("&")}function lB(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||lv(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let lV={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
78]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},lH=Object.prototype.toString,lF=lU();function lU(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:u,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?l(m,g,y):"function"===b&&s(m,g,y);let w=m.constructor;if(w!==g.constructor)return!1;if(w===Object)return a(m,g,y);if(Array.isArray(m))return t(m,g,y);if(w===Date)return r(m,g,y);if(w===RegExp)return d(m,g,y);if(w===Map)return o(m,g,y);if(w===Set)return h(m,g,y);let v=lH.call(m);if("[object Date]"===v)return r(m,g,y);if("[object RegExp]"===v)return d(m,g,y);if("[object Map]"===v)return o(m,g,y);if("[object Set]"===v)return h(m,g,y);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&a(m,g,y);if("[object URL]"===v)return p(m,g,y);if("[object Error]"===v)return i(m,g,y);if("[object Arguments]"===v)return a(m,g,y);if(lV[v])return u(m,g,y);if("[object ArrayBuffer]"===v)return e(m,g,y);if("[object DataView]"===v)return n(m,g,y);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return c(m,g,y);if(f){let e=f[v];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:lM,areArraysEqual:n?lI:lA,areDataViewsEqual:lE,areDatesEqual:lT,areErrorsEqual:n?ly(lO,lI):ly(lO,lR),areFunctionsEqual:lN,areMapsEqual:n?ly(lD,lI):lD,areNumbersEqual:lk,areObjectsEqual:n?lI:lR,arePrimitiveWrappersEqual:lL,areRegExpsEqual:l_,areSetsEqual:n?ly(lP,lI):lP,areTypedArraysEqual:n?ly(lj,lI):lj,areUrlsEqual:lz,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=lb(r.areArraysEqual),t=lb(r.areErrorsEqual),n=lb(r.areMapsEqual),i=lb(r.areObjectsEqual),s=lb(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areErrorsEqual:t,areMapsEqual:n,areObjectsEqual:i,areSetsEqual:s})}return r}(e)),o=n?n(s):function(e,t,n,r,i,o,l){return s(e,t,l)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(s,o){let{cache:l=e?new WeakMap:void 0,meta:a}=n();return t(s,o,{cache:l,equals:r,meta:a,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let s={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,s)}}({circular:t,comparator:s,createState:r,equals:o,strict:i})}lU({strict:!0}),lU({circular:!0}),lU({circular:!0,strict:!0}),lU({createInternalComparator:()=>lk}),lU({strict:!0,createInternalComparator:()=>lk}),lU({circular:!0,createInternalComparator:()=>lk}),lU({circular:!0,createInternalComparator:()=>lk,strict:!0});var lW=e.i(430224);let lq=({contentComponent:e})=>{let t=(0,p.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,l.jsx)(l.Fragment,{children:Object.values(t)})};var lK=class extends h.default.Component{constructor(e){super(e),this.editorContentRef=h.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n,r,i;if(t.contentComponent)return;let s=this.editorContentRef.current;s.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:s}),e=new Set,n={},r=!1,i=()=>{!r&&e.size&&(r=!0,queueMicrotask(()=>{r=!1,e.forEach(e=>e())}))},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(e,t){n={...n,[e]:u.default.createPortal(t.reactElement,t.element,e)},i()},removeRenderer(e){let t={...n};delete t[e],n=t,i()}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{var t;if(!(null==(t=e.view.dom)?void 0:t.parentNode))return;let n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{ref:((...e)=>t=>
78{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,l.jsx)(lq,{contentComponent:e.contentComponent})]})}};let lJ=(0,h.forwardRef)((e,t)=>{let n=h.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return h.default.createElement(lK,{key:n,innerRef:t,...e})}),lG=h.default.memo(lJ),lX="u">typeof window?h.useLayoutEffect:h.useEffect;var lY=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{((null==t?void 0:t.transaction)===void 0||t.transaction!==e)&&(e=null==t?void 0:t.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on("transaction",t),n.on("update",t),()=>{n.off("transaction",t),n.off("update",t)}}}};let lQ="u"<typeof window,lZ=lQ||!!("u">typeof window&&window.next);var l0=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return lQ?t=!1:lZ&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new lt({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onBeforeCreate)?void 0:t.call(n,...e)},onBlur:(...e)=>{var t,n;return null==(t=(n=this.options.current).onBlur)?void 0:t.call(n,...e)},onCreate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onCreate)?void 0:t.call(n,...e)},onDestroy:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDestroy)?void 0:t.call(n,...e)},onFocus:(...e)=>{var t,n;return null==(t=(n=this.options.current).onFocus)?void 0:t.call(n,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onSelectionUpdate)?void 0:t.call(n,...e)},onTransaction:(...e)=>{var t,n;return null==(t=(n=this.options.current).onTransaction)?void 0:t.call(n,...e)},onUpdate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onUpdate)?void 0:t.call(n,...e)},onContentError:(...e)=>{var t,n;return null==(t=(n=this.options.current).onContentError)?void 0:t.call(n,...e)},onDrop:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDrop)?void 0:t.call(n,...e)},onPaste:(...e)=>{var t,n;return null==(t=(n=this.options.current).onPaste)?void 0:t.call(n,...e)},onDelete:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDelete)?void 0:t.call(n,...e)},onMount:(...e)=>{var t,n;return null==(t=(n=this.options.current).onMount)?void 0:t.call(n,...e)},onUnmount:(...e)=>{var t,n;return null==(t=(n=this.options.current).onUnmount)?void 0:t.call(n,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
78if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};let l1=(0,h.createContext)({editor:null});l1.Consumer;let l2=(0,h.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),l3=h.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,h.useContext)(l2),r=e.as||"div";return(0,l.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function l4(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function l5(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var l6=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?(0,u.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=function(){try{if(h.version)return parseInt(h.version.split(".")[0],10)>=19}catch{}return!1}(),s=function(e){if(l4(e)||l5(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return l4(t)||l5(t)}return!1}(t),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,l.jsx)(t,{...o}),null==r||null==(e=r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==t||null==(e=t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};function l8(e){var t;if(!iV(e))return[];let{$from:n,$to:r}=e,i=[],s=Math.min(n.depth,r.depth);for(let e=1;e<=s&&(t=e,n.node(t)===r.node(t)&&n.before(t)===r.before(t));e+=1)i.push(n.before(e));return i}h.default.createContext({markViewContentRef:()=>{}});var l9=class{constructor(e){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=e}register(e){0===this.viewCount&&this.editor.on("transaction",this.handleTransaction),this.views.set(e.dom,e),this.viewCount+=1,this.scheduleSync()}unregister(e){this.views.delete(e.dom),this.viewCount-=1,this.insideViews.delete(e),0===this.viewCount&&this.editor.off("transaction",this.handleTransaction)}sync(){if(0===this.viewCount||this.editor.isDestroyed)return;let e=this.findInsideViews();this.updateViews(this.insideViews,e,!1),this.updateViews(e,this.insideViews,!0),this.insideViews=e}updateViews(e,t,n){for(let r of e)t.has(r)||r.setSelectionInside(n)}findInsideViews(){let e=new Set;for(let t of l8(this.editor.state.selection)){let n=this.editor.view.nodeDOM(t),r=n?this.views.get(n):void 0;r&&e.add(r)}return e}};let l7=new WeakMap;function ae(e){let t=l7.get(e);return t||(t=new l9(e),l7.set(e,t)),t}var at=class extends lu{constructor(e,t,n){if(super(e,t,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");e?e.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){if("storage"===r){var s;return null!=(s=e.storage[t.name])?s:{}}return Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,h.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{if(e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement){e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper");let t=function(e){var t;let n=e.getRootNode(),r="function"==typeof n.getSelection?n.getSelection():null==(t=e.ownerDocument)||null==(t=t.defaultView)?void 0:t.getSelection();if(!r||0===r.rangeCount)return null;let{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=r;return i&&o&&e.contains(i)&&e.contains(o)?()=>{try{r.setBaseAndExtent(i,s,o,l)}catch{}}:null}(this.contentDOMElement);e.appendChild(this.contentDOMElement),null==t||t()}}},n=this.component,r=(0,h.memo)(e=>(0,l.jsx)(l2.Provider,{value:t,children:(0,h.createElement)(n,e)}));r.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:s=""}=this.options;this.renderer=new l6(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.n
78ame} ${s}`.trim()}),ae(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let s={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),r(s),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(!0===this.options.selectedOnTextSelection&&this.isTextSelectionInside())}setSelectionInside(e){let t=this.nodeSelected||!0===this.options.selectedOnTextSelection&&e;this.renderer.updateProps({selectionInside:e,selected:t}),this.renderer.element.classList.toggle("ProseMirror-selectednode",t)}updateSelectedState(e){this.renderer.updateProps({selected:e}),this.renderer.element.classList.toggle("ProseMirror-selectednode",e)}isTextSelectionInside(){let e=this.getPos();return"number"==typeof e&&l8(this.editor.state.selection).includes(e)}destroy(){this.renderer.destroy(),ae(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=s_(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};Symbol("tiptapReactWidgetCache");let an=(0,h.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function ar({children:e,...t}){let n="editor"in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,h.useMemo)(()=>({editor:n}),[n]),i=(0,h.useMemo)(()=>({editor:n}),[n]);return(0,l.jsx)(l1.Provider,{value:i,children:(0,l.jsx)(an.Provider,{value:r,children:e})})}function ai({...e}){let{editor:t}=(0,h.useContext)(an);return(0,l.jsx)(lG,{editor:t,...e})}an.displayName="TiptapContext",ar.displayName="Tiptap",ai.displayName="Tiptap.Content",Object.assign(ar,{Content:ai});var as=e.i(582894),as=as,ao=e.i(192986),ao=ao,al=e.i(20623),al=al,aa=e.i(406940),aa=aa,ac=e.i(526943),ac=ac,ad=e.i(824678),ad=ad,ah=e.i(57489),ah=ah,au=e.i(636368),au=au,ap=e.i(393392),ap=ap,af=e.i(57522),af=af,am=e.i(778835),am=am,ag=e.i(655900),ay=e.i(664659),ab=e.i(612329);e.s(["Trash2",()=>ab.default],727612);var ab=ab,aw=e.i(107233),av=e.i(738125);e.s(["GripVertical",()=>av.default],750570);var av=av,ak=e.i(339402),ak=ak,ax=e.i(296497),ax=ax,aS=e.i(469582),aS=aS,aC=e.i(744989),aC=aC,aM=e.i(260345),aM=aM,aA=e.i(574320),aA=aA,aE=e.i(947875),aE=aE,aT=e.i(299023),aO=e.i(640761),aO=aO,aN=e.i(195083),aN=aN,aD=e.i(553789),aD=aD,aR=e.i(879664),aR=aR,aI=e.i(775854),aI=aI,aL=e.i(582458);e.s(["TriangleAlert",()=>aL.default],89128);var aL=aL,a_=e.i(497140),a_=a_,aP=e.i(977482);e.s(["Table2",()=>aP.default],330325);var aP=aP,aj=e.i(102040);e.s(["ChartColumn",()=>aj.default],279743);var aj=aj,az=e.i(367118),az=az,a$=e.i(783395),a$=a$,aB=e.i(827468),aB=aB,aV=e.i(853298),aV=aV,aH=e.i(384282),aH=aH,aF=e.i(251485),aF=aF,aU=e.i(335653),aU=aU,aW=e.i(972080),aq=e.i(576144);e.s(["Sparkles",()=>aq.default],283086);var aq=aq,aK=e.i(584526);e.s(["Shapes",()=>aK.default],453901);var aK=aK;e.i(785269);var aJ=e.i(322831);let aG=new WeakSet,aX=new WeakSet;function aY(e){return aG.add(e),e}function aQ(e){return Array.isArray(e)&&aG.has(e)}let aZ=(e,t)=>(function(e,t){if("slot"===e)return 0;if(e instanceof Function){let n=e(t);return!Array.isArray(n)||aQ(n)||aX.has(n)?n:aY(n)}let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(aQ(n))return aY([e,r,n]);if(0===n.length)return aY([e,r]);let t=function e(t){return t.flatMap(t=>null==t?[]:Array.isArray(t)&&aX.has(t)&&!aQ(t)?e(t):[t])}(n);return 0===t.length?aY([e,r]):aY([e,r,...t])}return null!=n?aY([e,r,n]):aY([e,r])})(e,t),a0=/^\s*>\s$/,a1=lh.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return aZ("blockquote",{...sL(this.options.HTMLAttributes,e),children:aZ("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,s;let o=(null!=(i=null==(s=t.renderChild)?void 0:s.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(o.join("\n"))}),n.join(`
79>
80`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}}
80,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>((e,t)=>{var n;let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:s}=i;if(0!==s.parentOffset)return!1;let o=s.depth-1;if(o<0)return!1;let l=s.node(o),a=s.index(o);if(0===a)return!1;if(l.type===t)return e.commands.lift(t.name);let c=l.child(a-1);if(c.type!==t||!(null==(n=c.lastChild)?void 0:n.isTextblock))return!1;let d=s.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=s.parent.content,r=new C(n,0,0);return e.replace(d,s.after(),r),e.setSelection(e3.create(e.doc,d+n.size)),e.scrollIntoView(),t(e),!0})})(this.editor,this.type)}},addInputRules(){return[lc({find:a0,type:this.type})]}}),a2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,a3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,a4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a5=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,a6=oq.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return aZ("strong",{...sL(this.options.HTMLAttributes,e),children:aZ("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[lo({find:a2,type:this.type}),lo({find:a4,type:this.type})]},addPasteRules(){return[lp({find:a3,type:this.type}
80),lp({find:a5,type:this.type})]}}),a8=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&"`"===e[t.index-1]?null:{index:t.index,text:t[0],replaceWith:t[1]}},a9=e=>{let t,n=/`([^`]+)`(?!`)/g,r=[];for(;null!==(t=n.exec(e));)t.index>0&&"`"===e[t.index-1]||r.push({index:t.index,text:t[0],replaceWith:t[1]});return r},a7=oq.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",sL(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[lo({find:a8,type:this.type})]},addPasteRules(){return[lp({find:a9,type:this.type})]}}),ce=/^```([a-z]+)?[\s\n]$/,ct=/^~~~([a-z]+)?[\s\n]$/,cn=lh.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",sL(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
81
82\`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;let l=" ".repeat(n);return o?e.commands.insertContent(l):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,s=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>l+e).join("\n");return e.replaceWith(t,n,r.schema.text(s)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type===this.type&&(o?e.commands.command(({tr:e})=>{var t;let{pos:i}=s,o=s.start(),l=s.end(),a=r.doc.textBetween(o,l,"\n","\n").split("\n"),c=0,d=0,h=i-o;for(let e=0;e<a.length;e+=1){if(d+a[e].length>=h){c=e;break}d+=a[e].length+1}let u=Math.min(((null==(t=a[c].match(/^ */))?void 0:t[0])||"").length,n);if(0===u)return!0;let p=o;for(let e=0;e<c;e+=1)p+=a[e].length+1;return e.delete(p,p+u),i-p<=u&&e.setSelection(e3.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:s}=i,o=r.doc.textBetween(t,s,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,s,r.schema.text(o)),!0}))},Enter:({editor:e})=>
82{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith("\n\n");return!!s&&!!o&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||0!==r.parentOffset)return!1;let s=r.before();return!(s>0)&&e.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return void 0!==o&&(r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(eZ.near(r.resolve(o))),!0)):e.commands.exitCode())}}},addInputRules(){return[la({find:ce,type:this.type,getAttributes:e=>({language:e[1]})}),la({find:ct,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new tl({key:new td("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>
82{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=null==i?void 0:i.mode;if(!n||!s)return!1;let{tr:o,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(e3.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),cr=lh.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),ci=lh.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",sL(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`  
83`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:o}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&s){let t=l.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cs=lh.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,sL(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>la({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
83)\\s$`),type:this.type,getAttributes:{level:e}}))}}),co=lh.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",sL(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!oP(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return s3(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(e3.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(e5.create(t.doc,n.pos)):t.setSelection(e3.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,s=null==i?void 0:i.create();s&&(t.insert(r,s),t.setSelection(e3.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ll({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
83ype})]}}),cl=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ca=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,cc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,cd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ch=oq.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",sL(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[lo({find:cl,type:this.type}
83),lo({find:cc,type:this.type})]},addPasteRules(){return[lp({find:ca,type:this.type}),lp({find:cd,type:this.type})]}}),cu="numeric",cp="ascii",cf="alpha",cm="asciinumeric",cg="alphanumeric",cy="domain",cb="emoji",cw="whitespace";function cv(e,t,n){for(let r in t[cu]&&(t[cm]=!0,t[cg]=!0),t[cp]&&(t[cm]=!0,t[cf]=!0),t[cm]&&(t[cg]=!0),t[cf]&&(t[cg]=!0),t[cg]&&(t[cy]=!0),t[cb]&&(t[cy]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function ck(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}ck.groups={},ck.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||ck.groups,t&&t.j?i=t:(i=new ck(t),n&&r&&cv(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,s=e.length;if(!s)return i;for(let t=0;t<s-1;t++)i=i.tt(e[t]);return i.tt(e[s-1],t,n,r)},tt(e,t,n,r){if(r=r||ck.groups,t&&t.j)return this.j[e]=t,t;let i,s=this.go(e);return s?(Object.assign((i=new ck).j,s.j),i.jr.push.apply(i.jr,s.jr),i.jd=s.jd,i.t=s.t):i=new ck,t&&(r&&(i.t&&"string"==typeof i.t?cv(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&cv(t,n,r)),i.t=t),this.j[e]=i,i}};let cx=(e,t,n,r,i)=>e.ta(t,n,r,i),cS=(e,t,n,r,i)=>e.tr(t,n,r,i),cC=(e,t,n,r,i)=>e.ts(t,n,r,i),cM=(e,t,n,r,i)=>e.tt(t,n,r,i),cA="WORD",cE="UWORD",cT="ASCIINUMERICAL",cO="ALPHANUMERICAL",cN="LOCALHOST",cD="UTLD",cR="SCHEME",cI="SLASH_SCHEME",cL="OPENBRACE",c_="CLOSEBRACE",cP="OPENBRACKET",cj="CLOSEBRACKET",cz="OPENPAREN",c$="CLOSEPAREN",cB="OPENANGLEBRACKET",cV="CLOSEANGLEBRACKET",cH="FULLWIDTHLEFTPAREN",cF="FULLWIDTHRIGHTPAREN",cU="LEFTCORNERBRACKET",cW="RIGHTCORNERBRACKET",cq="LEFTWHITECORNERBRACKET",cK="RIGHTWHITECORNERBRACKET",cJ="FULLWIDTHLESSTHAN",cG="FULLWIDTHGREATERTHAN",cX="AMPERSAND",cY="APOSTROPHE",cQ="ASTERISK",cZ="BACKSLASH",c0="BACKTICK",c1="CARET",c2="COLON",c3="COMMA",c4="DOLLAR",c5="EQUALS",c6="EXCLAMATION",c8="HYPHEN",c9="PERCENT",c7="PIPE",de="PLUS",dt="POUND",dn="QUERY",dr="QUOTE",di="FULLWIDTHMIDDLEDOT",ds="SEMI",dl="SLASH",da="TILDE",dc="UNDERSCORE",dd="EMOJI";var dh=Object.freeze({__proto__:null,ALPHANUMERICAL:cO,AMPERSAND:cX,APOSTROPHE:cY,ASCIINUMERICAL:cT,ASTERISK:cQ,AT:"AT",BACKSLASH:cZ,BACKTICK:c0,CARET:c1,CLOSEANGLEBRACKET:cV,CLOSEBRACE:c_,CLOSEBRACKET:cj,CLOSEPAREN:c$,COLON:c2,COMMA:c3,DOLLAR:c4,DOT:"DOT",EMOJI:dd,EQUALS:c5,EXCLAMATION:c6,FULLWIDTHGREATERTHAN:cG,FULLWIDTHLEFTPAREN:cH,FULLWIDTHLESSTHAN:cJ,FULLWIDTHMIDDLEDOT:di,FULLWIDTHRIGHTPAREN:cF,HYPHEN:c8,LEFTCORNERBRACKET:cU,LEFTWHITECORNERBRACKET:cq,LOCALHOST:cN,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:cB,OPENBRACE:cL,OPENBRACKET:cP,OPENPAREN:cz,PERCENT:c9,PIPE:c7,PLUS:de,POUND:dt,QUERY:dn,QUOTE:dr,RIGHTCORNERBRACKET:cW,RIGHTWHITECORNERBRACKET:cK,SCHEME:cR,SEMI:ds,SLASH:dl,SLASH_SCHEME:cI,SYM:"SYM",TILDE:da,TLD:"TLD",UNDERSCORE:dc,UTLD:cD,UWORD:cE,WORD:cA,WS:"WS"});let du=/[a-z]/,dp=/\p{L}/u,df=/\p{Emoji}/u,dm=/\d/,dg=/\s/,dy=null,db=null;function dw(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,s=e.charCodeAt(r),o=s<55296||s>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],s=0,o=0;for(;o<r;){let l=e,a=null,c=0,d=null,h=-1,u=-1;for(;o<r&&(a=l.go(n[o]));)(l=a).accepts()?(h=0,u=0,d=l):h>=0&&(h+=n[o].length,u++),c+=n[o].length,s+=n[o].length,o++;s-=h,o-=u,c-=h,i.push({t:d.t,v:t.slice(s-c,s),s:s-c,e:s})}return i}function dv(e,t,n,r,i){let s,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?s=e.j[o]:((s=new ck(r)).jr=i.slice(),e.j[o]=s),e=s}return(s=new ck(n)).jr=i.slice(),e.j[t[o-1]]=s,s}function dk(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let dx={defaultProtocol:"http",events:null,format:dC,formatHref:dC,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function dS(e,t=null){let n=Object.assign({},dx);e&&(n=Object.assign(n,e instanceof dS?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function dC(e){return e}function dM(e,t){this.t="token",this.v=e,this.tk=t}
83function dA(e,t){class n extends dM{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}dS.prototype={o:dx,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:dx[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},dM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=dx.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),s={},o=e.get("className",t,this),l=e.get("target",t,this),a=e.get("rel",t,this),c=e.getObj("attributes",t,this),d=e.getObj("events",t,this);return s.href=n,o&&(s.class=o),l&&(s.target=l),a&&(s.rel=a),c&&Object.assign(s,c),{tagName:r,attributes:s,content:i,eventListeners:d}}};let dE=dA("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),dT=dA("text"),dO=dA("nl"),dN=dA("url",{isLink:!0,toHref(e=dx.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==cN&&e[1].t===c2}}),dD=e=>new ck(e);function dR(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let dI="u">typeof console&&console&&console.warn||(()=>{}),dL={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function d_(e,t=!1){if(dL.initialized&&dI(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
841. Must only contain digits, lowercase ASCII letters or "-"
852. Cannot start or end with "-"
863. "-" cannot repeat`);dL.customSchemes.push([e,t])}function dP(e){return dL.initialized||function(){dL.scanner=function(e=[]){let t={};ck.groups=t;let n=new ck;null==dy&&(dy=dk("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
86ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==db&&(db=dk("ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
86ºÐ´2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3Õ°Õ¡Õµ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1ì»´2삼성2한국2")),cM(n,"'",cY),cM(n,"{",cL),cM(n,"}",c_),cM(n,"[",cP),cM(n,"]",cj),cM(n,"(",cz),cM(n,")",c$),cM(n,"<",cB),cM(n,">",cV),cM(n,"(",cH),cM(n,")",cF),cM(n,"「",cU),cM(n,"」",cW),cM(n,"『",cq),cM(n,"』",cK),cM(n,"<",cJ),cM(n,">",cG),cM(n,"&",cX),cM(n,"*",cQ),cM(n,"@","AT"),cM(n,"`",c0),cM(n,"^",c1),cM(n,":",c2),cM(n,",",c3),cM(n,"$",c4),cM(n,".","DOT"),cM(n,"=",c5),cM(n,"!",c6),cM(n,"-",c8),cM(n,"%",c9),cM(n,"|",c7),cM(n,"+",de),cM(n,"#",dt),cM(n,"?",dn),cM(n,'"',dr),cM(n,"/",dl),cM(n,";",ds),cM(n,"~",da),cM(n,"_",dc),cM(n,"\\",cZ),cM(n,"・",di);let r=cS(n,dm,"NUM",{[cu]:!0});cS(r,dm,r);let i=cS(r,du,cT,{[cm]:!0}),s=cS(r,dp,cO,{[cg]:!0}),o=cS(n,du,cA,{[cp]:!0});cS(o,dm,i),cS(o,du,o),cS(i,dm,i),cS(i,du,i);let l=cS(n,dp,cE,{[cf]:!0});cS(l,du),cS(l,dm,s),cS(l,dp,l),cS(s,dm,s),cS(s,du),cS(s,dp,s);let a=cM(n,"\n","NL",{[cw]:!0}),c=cM(n,"\r","WS",{[cw]:!0}),d=cS(n,dg,"WS",{[cw]:!0});cM(n,"",d),cM(c,"\n",a),cM(c,"",d),cS(c,dg,d),cM(d,"\r"),cM(d,"\n"),cS(d,dg,d),cM(d,"",d);let h=cS(n,df,dd,{[cb]:!0});cM(h,"#"),cS(h,df,h),cM(h,"️",h);let u=cM(h,"‍");cM(u,"#"),cS(u,df,h);let p=[[du,o],[dm,i]],f=[[du,null],[dp,l],[dm,s]];for(let e=0;e<dy.length;e++)dv(n,dy[e],"TLD",cA,p);for(let e=0;e<db.length;e++)dv(n,db[e],cD,cE,f);cv("TLD",{tld:!0,ascii:!0},t),cv(cD,{utld:!0,alpha:!0},t),dv(n,"file",cR,cA,p),dv(n,"mailto",cR,cA,p),dv(n,"http",cI,cA,p),dv(n,"https",cI,cA,p),dv(n,"ftp",cI,cA,p),dv(n,"ftps",cI,cA,p),cv(cR,{scheme:!0,ascii:!0},t),cv(cI,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[cy]=!0:du.test(r)?dm.test(r)?i[cm]=!0:i[cp]=!0:i[cu]=!0,cC(n,r,r,i)}return cC(n,"localhost",cN,{ascii:!0}),n.jd=new ck("SYM"),{start:n,tokens:Object.assign({groups:t},dh)}}(dL.customSchemes);for(let e=0;e<dL.tokenQueue.length;e++)dL.tokenQueue[e][1]({scanner:dL.scanner});dL.parser=function({groups:e}){let t=e.domain.concat([cX,cQ,"AT",cZ,c0,c1,c4,c5,c8,"NUM",c9,c7,de,dt,dl,"SYM",da,dc]),n=[cY,c2,c3,"DOT",c6,c9,dn,dr,ds,cB,cV,cL,c_,cj,cP,cz,c$,cH,cF,cU,cW,cq,cK,cJ,cG],r=[cX,cY,cQ,cZ,c0,c1,c4,c5,c8,cL,c_,c9,c7,de,dt,dn,dl,"SYM",da,dc],i=dD(),s=cM(i,da);cx(s,r,s),cx(s,e.domain,s);let o=dD(),l=dD(),a=dD();cx(i,e.domain,o),cx(i,e.scheme,l),cx(i,e.slashscheme,a),cx(o,r,s),cx(o,e.domain,o);let c=cM(o,"AT");cM(s,"AT",c),cM(l,"AT",c),cM(a,"AT",c);let d=cM(s,"DOT");cx(d,r,s),cx(d,e.domain,s);let h=dD();cx(c,e.domain,h),cx(h,e.domain,h);let u=cM(h,"DOT");cx(u,e.domain,h);let p=dD(dE);cx(u,e.tld,p),cx(u,e.utld,p),cM(c,cN,p);let f=cM(h,c8);cM(f,c8,f),cx(f,e.domain,h),cx(p,e.domain,h),cM(p,"DOT",u),cM(p,c8,f);let m=cM(o,c8),g=cM(o,"DOT");cM(m,c8,m),cx(m,e.domain,o),cx(g,r,s),cx(g,e.domain,o);let y=dD(dN);cx(g,e.tld,y),cx(g,e.utld,y),cx(y,e.domain,o),cx(y,r,s),cM(y,"DOT",g),cM(y,c8,m),cM(y,"AT",c);let b=cM(y,c2),w=dD(dN);cx(b,e.numeric,w);let v=dD(dN),k=dD();cx(v,t,v),cx(v,n,k),cx(k,t,v),cx(k,n,k),cM(y,dl,v),cM(w,dl,v);let x=cM(l,c2),S=cM(a,c2),C=cM(S,dl),M=cM(C,dl);cx(l,e.domain,o),cM(l,"DOT",g),cM(l,c8,m),cx(a,e.domain,o),cM(a,"DOT",g),cM(a,c8,m),cx(x,e.domain,v),cM(x,dl,v),cM(x,dn,v),cx(M,e.domain,v),cx(M,t,v),cM(M,dl,v);let A=[[cL,c_],[cP,cj],[cz,c$],[cB,cV],[cH,cF],[cU,cW],[cq,cK],[cJ,cG]];for(let e=0;e<A.length;e++){let[r,i]=A[e],s=cM(v,r);cM(k,r,s);let o=dD(dN);cx(s,t,o);let l=dD();cx(s,n,l),cM(s,i,v),cx(o,t,o),cx(o,n,l),cx(l,t,o),cx(l,n,l),cM(o,i,v),cM(l,i,v)}return cM(i,cN,y),cM(i,"NL",dO),{start:i,tokens:dh}}(dL.scanner.tokens);for(let e=0;e<dL.pluginQueue.length;e++)dL.pluginQueue[e][1]({scanner:dL.scanner,parser:dL.parser});dL.initialized=!0}(),function(e,t,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=e,a=null,c=null,d=0,h=null,u=-1;for(;i<r&&!(a=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,(l=c).accepts()?(u=0,h=l):u>=0&&u++,i++,d++;if(u<0)(i-=d)<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(dR(dT,t,o)),o=[]),i-=u,d-=u;let e=h.t,r=n.slice(i-d,i);s.push(dR(e,t,r))}}return o.length>0&&s.push(dR(dT,t,o)),s}(dL.parser.start,e,dw(dL.scanner.start,e))}function dj(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new dS(n),i=dP(e),s=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&s.push(n.toFormattedObject(r))}return s}dP.scan=dw;let dz="[\0-   ᠎ -\u2029  ]",d$=new RegExp(dz),dB=RegExp(`${dz}$`),dV=RegExp(dz,"g"),dH=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,dF=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function dU(e,t){let n=0;for(let r=t-1;r>=0&&"\\"===e[r];r-=1)n+=1;return n%2==1}function dW(e,t,n){var r,i;let[,s,o]=t;return!((t.index?e[t.index-1]:void 0)==="!"||dU(e,null!=(r=t.index)?r:0)||function(e,t){let n=0,r=0;for(;r<t;){if("`"!==e[r]||0===n&&dU(e,r)){r+=1;continue}let i=0;for(;r<t&&"`"===e[r];)i+=1,r+=1;0===n?n=i:i===n&&(n=0)}return n>0}(e,null!=(i=t.index)?i:0))&&!!s.trim()&&n(o)}function dq(e){var t,n;let[r,i,s,,o,l,a]=e,c=null!=(t=null!=o?o:l)?t:a;return{index:null!=(n=e.index)?n:0,text:r,replaceWith:i,data:{href:s,title:c||null,markdown:!0}}}function dK(e){var t,n,r;return{href:null==(t=e.data)?void 0:t.href,title:null!=(n=null==(r=e.data)?void 0:r.title)?n:null}}function dJ(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];
86return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(dV,"").match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}let dG=oq.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?d_(e):d_(e.scheme,e.optionalSlashes)})},onDestroy(){ck.groups={},dL.scanner=null,dL.parser=null,dL.tokenQueue=[],dL.pluginQueue=[],dL.customSchemes=[],dL.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!dJ(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){var e,t,n;return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:null!=(e=this.options.HTMLAttributes.target)?e:null},rel:{default:null!=(t=this.options.HTMLAttributes.rel)?t:null},class:{default:null!=(n=this.options.HTMLAttributes.class)?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",sL(this.options.HTMLAttributes,e),0]:["a",sL(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,s;let o=null!=(n=null==(r=e.attrs)?void 0:r.href)?n:"",l=null!=(i=null==(s=e.attrs)?void 0:s.title)?i:"",a=t.renderChildren(e);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){var e;let t;return this.options.markdownLinks?[new oF({find:(t=lo({find:t=>{let n=dH.exec(t);return n&&dW(t,n,e.isAllowedHref)?dq(n):null},type:(e={type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})}).type,getAttributes:dK})).find,handler:e=>{let n=t.handler(e);return null!==n&&e.state.tr.steps.length&&e.state.tr.setMeta("preventAutolink",!0),n}})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;dj(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!dJ(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};if(this.options.markdownLinks){var t;let n;return[new oK({find:(n=lp({find:e=>{var n,r;let i=[];for(let n of e.matchAll(dF))dW(e,n,t.isAllowedHref)&&i.push(dq(n));let s=(null!=(n=null==(r=t.findPlainUrls)?void 0:r.call(t,e))?n:[]).filter(e=>!i.some(t=>t.index<e.index+e.text.length&&e.index<t.index+t.text.length));return[...i,...s]}
86,type:(t={type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!dJ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e}).type,getAttributes:dK})).find,handler:e=>{var t;let r=n.handler(e);return null!==r&&e.state.tr.steps.length&&(null==(t=e.match.data)?void 0:t.markdown)&&e.state.tr.setMeta("preventAutolink",!0),r}})]}return[lp({find:e,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:s}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!dJ(e,i),protocols:i,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink},new tl({key:new td("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),s=t.some(e=>e.getMeta("preventAutolink"));if(!i||s)return;let{tr:o}=r;if(sW(sx(n.doc,[...t])).forEach(({newRange:t})=>{let n,i,s=sS(r.doc,t,e=>e.isTextblock);if(s.length>1)n=s[0],i=r.doc.textBetween(n.pos,n.pos+n.node.nodeSize,void 0," ");else if(s.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!dB.test(e))return;n=s[0],i=r.doc.textBetween(n.pos,t.to,void 0," ")}if(n&&i){let t=i.split(d$).filter(Boolean);if(t.length<=0)return!1;let s=t[t.length-1],l=n.pos+i.lastIndexOf(s);if(!s)return!1;let a=dP(s).map(t=>t.toObject(e.defaultProtocol));if(!(1===a.length?a[0].isLink:3===a.length&&!!a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;a.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{sq(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new tl({key:new td("handleClickLink"),props:{handleClick:(e,n,r)=>{if(0!==r.button||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(i=e.closest("a"))&&!n.contains(i)&&(i=null)}if(!i)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var o,l;let n=sU(e.state,t.type.name),r=null!=(o=i.href)?o:n.href,a=null!=(l=i.target)?l:n.target;r&&(window.open(r,a),s=!0)}return s}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new tl({key:new td("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(e=>{a+=e.textContent});let c=dj(a,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!!a&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}}),dX="textStyle",dY=/^\s*([-+*])\s$/,dQ=lh.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",sL(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(dX)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}
86,addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=lc({find:dY,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=lc({find:dY,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(dX),editor:this.editor})),[e]}}),dZ=(e,t)=>oX.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>{let n;return n=this.editor,((e,t,n,r)=>{let i=((e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let e=i.depth;e>0;e-=1)if(i.node(e).type.name===t){s=e;break}if(s<0)return null;let o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;let a=o.child(l+1);if(!n.includes(a.type.name))return null;let c=e.schema.nodes[t],d=!1;if(a.forEach(e=>{e.type===c&&e.childCount>1&&(d=!0)}),!d)return null;let h=e.doc.resolve(i.after()).nodeAfter;if(!h||!n.includes(h.type.name))return null;let u=[];return(h.forEach(e=>{u.push(e)}),0===u.length)?null:{listItemDepth:s,nestedList:h,nestedListPos:i.after(),insertPos:i.after(s),items:u}})(e,n,r);if(!i)return!1;let{selection:s}=e,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=i,d=e.tr;d.delete(l,l+o.nodeSize);let h=d.mapping.map(a);return d.insert(h,b.from(c)),d.setSelection(s.map(d.doc,d.mapping)),t&&t(d),!0})(n.state,n.view.dispatch,e,t)};return{Delete:n,"Mod-Delete":n}}}),d0=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],d1="abcdefghijklmnopqrstuvwxyz",d2=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function d3(e){let t=e,n="";for(let[e,r]of d0)for(;t>=e;)n+=r,t-=e;return n}function d4(e){return d3(e).toUpperCase()}function d5(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,s]of d0)if(t.startsWith(s,n)){r+=i,n+=s.length,e=!0;break}if(!e)return 0}return r}function d6(e){if(e<=26)return d1[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?d1[n]:d1[t]+d1[n]}function d8(e){if(!(!e||/^\d+$/.test(e))){if(function(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=d5(e);return!(t<=0)&&(e===e.toLowerCase()?d3(t):d4(t))===e}(e))return e===e.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(e))return"a";if(/^[A-Z]{1,2}$/.test(e))return"A"}}function d9(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=d8(e);if("i"===t||"I"===t)return d5(e);if("a"===t||"A"===t){let t,n=1===(t=e.toLowerCase()).length?t.charCodeAt(0)-97+1:2===t.length?(t.charCodeAt(0)-97+1)*26+(t.charCodeAt(1)-97)+1:0;return n>0?n:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}let d7=lh.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",sL(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n,r,i,s;if("list_item"!==e.type)return[];let o=null!=(n=t.parseBlockChildren)?n:t.parseChildren,l=[];if(e.tokens&&e.tokens.length>0){let n;if(n=null==(r=e.tokens)?void 0:r[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==n?void 0:n.type)==="list"&&n.ordered&&n.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(s=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(s)):t.parseInline([{type:"text",raw:s,text:s}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))l=o(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(l=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=o(e.tokens.slice(1));l.push(...t)}}else l=o(e.tokens)}}return 0===l.length&&(l=[{type:"paragraph",content:[]}]),{type:"listItem",content:l}},renderMarkdown:(e,t,n)=>oB(e,t,e=>{if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){var t,n;let r=(null==(t=e.meta)||null==(t=t.parentAttrs)?void 0:t.start)||1;return function(e,t,n=". "){let r=t+1;if(!e||"1"===e)return`${r}${n}`;switch(e){case"a":return`${d6(r)}${n}`;case"A":return`${d6(r).toUpperCase()}${n}`;case"i":return`${d3(r)}${n}`;case"I":return`${d4(r)}${n}`;default:return`${r}${n}`}}(null==(n=e.meta)||null==(n=n.parentAttrs)?void 0:n.type,r-1+(e.index||0),". ")}return"- "},n,{alignNestedToPrefix:(null==n?void 0:n.parentType)==="orderedList"}),addExtensions(){return[dZ(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),he=(e,t)=>{let{$from:n}=t.selection,r=iA(e,t.schema),i=n.depth,s=n.pos,o=null;for(;i>0&&null===o;)n.node(i).type===r?o=i:(i-=1,s-=1);return null===o?null:{$pos:t.doc.resolve(s),depth:o}},ht=(e,t)=>
86{let n=he(e,t);if(!n)return!1;let[,r]=sK(t,e,n.$pos.pos+4);return r},hn=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!si(e.state,t)&&((e,t)=>{let{$anchor:n}=e.selection,r=Math.max(0,n.pos-2),i=e.doc.resolve(r).node();return!!i&&!!t.includes(i.type.name)})(e.state,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let s=i.at(-1);if(!s)return!1;let o=e.state.doc.resolve(r.start()+s.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!si(e.state,t)||!sZ(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type===e.schema.nodes[t]&&0===r.index(i)&&e.chain().liftListItem(t).run()},hr=(e,t)=>{var n,r;let i,s,o,l;if(!si(e.state,t)||!sQ(e.state,t))return!1;let{selection:a}=e.state,{$from:c,$to:d}=a;return!(!a.empty&&c.sameParent(d))&&((i=ht(t,n=e.state),(s=he(t,n))&&i&&(i>s.depth||0))?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():(o=ht(t,r=e.state),(l=he(t,r))&&o&&(o<l.depth||0))?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},hi=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:s}=i;if(0!==s.parentOffset||!s.parent.isTextblock||si(r,t))return!1;let o=sJ(s);if(!o||!n.includes(o.type.name))return!1;let l=o.lastChild;if(!l||l.type.name!==t)return!1;let a=s.parent;if(!l.canReplace(l.childCount,l.childCount,b.from(a)))return!1;let c=s.before(),d=s.after(),h=c-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(c,d).insert(h,b.from(a)),e.setSelection(e3.create(e.doc,h+1)),e.scrollIntoView()),!0))},hs=oX.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&hr(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&hr(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&hn(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&hn(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(void 0!==e.state.schema.nodes[t]&&hi(e,t,n))return!0;return!1}}}}),ho=RegExp(`^(\\s*)(${d2})([.)])\\s+(.*)$`),hl=/^\s/,ha={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/},hc=RegExp(`^(${d2})([.)])\\s+(.+)$`),hd="textStyle",hh=/^(\d+)\.\s$/;function hu(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}let hp=lh.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute("type");if(t)return t;let n=e.getAttribute("style");if(n){let e=hu(n);if(e)return e}let r=e.querySelector("li");if(r){let e=r.getAttribute("style");if(e){let t=hu(e);if(t)return t}}return null}}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=sL(this.options.HTMLAttributes,r);return 1!==t&&(i.start=t),n&&"1"!==n&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.typeMarker,s=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>
860&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[],o={};return(1!==r&&(o.start=r),i&&(o.type=i),Object.keys(o).length>0)?{type:"orderedList",attrs:o,content:s}:{type:"orderedList",content:s}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(e,t,n)=>{var r,i;let s=e.split("\n"),[o,l]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],s=i.match(ho);if(!s)break;let[,o,l,a,c]=s,d=o.length,h=parseInt(l,10),u=isNaN(h)?d8(l):void 0,p=isNaN(h)?d9(l):h,f=[c],m=n+1,g=[i],y=!1;for(;m<e.length;){let t=e[m];if(t.match(ho))break;if(""===t.trim())g.push(t),f.push(""),y=!0,m+=1;else if(t.match(hl)){let e=t.length-t.trimStart().length,n=d+l.length+1;g.push(t),f.push(t.slice(Math.min(e,n))),m+=1}else{if(y||function(e){return Object.values(ha).some(t=>t.test(e))}(t))break;g.push(t),f.push(t),m+=1}}t.push({indent:d,number:p,type:u,content:f.join("\n").trim(),contentLines:f,raw:g.join("\n")}),r=m,n=m}return[t,r]}(s);if(0===o.length)return;let a=function e(t,n,r){let i=[],s=0;for(;s<t.length;){let o=t[s];if(o.indent===n){let{paragraphLines:l,blockLines:a}=function(e){let t=[],n=[],r=!1;return e.forEach(e=>{let i;if(r)return void n.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),ha.bulletItem.test(i)||ho.test(i.trimStart())||ha.heading.test(i)||ha.thematicBreak.test(i)&&!i.startsWith("-")||/^>\s?/.test(i)||ha.codeFence.test(i)||ha.blockMath.test(i))){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}(o.contentLines),c=l.join("\n").trim(),d=[];c&&d.push({type:"paragraph",raw:c,tokens:r.inlineTokens(c)});let h=a.join("\n").trim();if(h){let e=r.blockTokens(h);d.push(...e)}let u=s+1,p=[];for(;u<t.length&&t[u].indent>n;)p.push(t[u]),u+=1;if(p.length>0){let t=e(p,Math.min(...p.map(e=>e.indent)),r);d.push({type:"list",ordered:!0,start:p[0].number,typeMarker:p[0].type,items:t,raw:p.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:o.raw,tokens:d}),s=u}else s+=1}return i}(o,o[0].indent,n);if(0!==a.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,typeMarker:null==(i=o[0])?void 0:i.type,items:a,raw:s.slice(0,l).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(hd)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins:()=>[new tl({props:{handlePaste:(e,t)=>
86{var n,r;let i=null==(n=t.clipboardData)?void 0:n.getData("text/html");if(null==i?void 0:i.trim())return!1;let s=null==(r=t.clipboardData)?void 0:r.getData("text/plain");if(!s)return!1;let o=function(e){let t=e.split("\n").filter(e=>e.trim().length>0);if(0===t.length)return null;let n=[];for(let e of t){let t=e.trim().match(hc);if(!t)return null;n.push({marker:t[1],content:t[3]})}return!function(e){var t;if(0===e.length)return!1;let n=null!=(t=d8(e[0]))?t:"numeric",r=d9(e[0]);if(r<1)return!1;for(let t=0;t<e.length;t++){let i=function(e,t){if("numeric"===e)return String(t);switch(e){case"a":return d6(t);case"A":return d6(t).toUpperCase();case"i":return d3(t);case"I":return d4(t);default:return String(t)}}(n,r+t);if(e[t]!==i)return!1}return!0}(n.map(e=>e.marker))?null:{type:"orderedList",attrs:function(e){let{type:t,start:n}={type:d8(e),start:d9(e)},r={};return t&&(r.type=t),1!==n&&(r.start=n),r}(n[0].marker),content:n.map(e=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:e.content}]}]}))}}(s);if(!o)return!1;try{let t=e.state.schema.nodeFromJSON(o),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})],addInputRules(){let e=(e,t)=>(!t.attrs.type||"1"===t.attrs.type)&&t.childCount+t.attrs.start===+e[1],t=lc({find:hh,type:this.t
86ype,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=lc({find:hh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(hd)}),joinPredicate:e,editor:this.editor})),[t]}}),hf=/^\s*(\[([( |x])?\])\s$/,hm=lh.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>{var t;return null!=(t=e.querySelector("div"))?t:e}}]},renderHTML({node:e,HTMLAttributes:t}){return["li",sL(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;let r=`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `;return oB(e,t,r)},addExtensions(){return this.options.nested?[dZ(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");o.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";let c=e=>{var t,n,r;let i=(t=e.attrs.checked,(null==(n=this.options.a11y)||null==(r=n.checkboxLabel)?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||"empty task item"}`);l.setAttribute("aria-label",i),o.textContent=i};c(e),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",e=>e.preventDefault()),l.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(l.checked=!l.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:a,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,c(e);let t=s_(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),s=this.options.HTMLAttributes;return d.forEach(e=>{n.has(e)||(e in s?i.setAttribute(e,s[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in s?i.setAttribute(e,s[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=n,!0}}}},addInputRules(){return[lc({find:hf,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),hg=lh.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",sL(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>
86{let t=oz(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:"taskList",raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=oz(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});oX.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(dQ.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(d7.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(hs.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(hp.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(hm.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(hg.configure(this.options.taskList)),e}});let hy="&nbsp;",hb=lh.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",sL(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===hy||n[0].text===hy||" "===n[0].raw||" "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===hy||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return"";let r=Array.isArray(e.content)?e.content:[];if(0===r.length){var i,s;let e=Array.isArray(null==n||null==(i=n.previousNode)?void 0:i.content)?n.previousNode.content:[];return(null==n||null==(s=n.previousNode)?void 0:s.type)==="paragraph"&&0===e.length?hy:""}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}
86),hw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,hv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hk=oq.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",sL(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[lo({find:hw,type:this.type})]},addPasteRules(){return[lp({find:hv,type:this.type})]}}),hx=lh.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),hS=oq.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",sL(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});class hC{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(null!=this.cursorPos&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,s=this.editorView.dom,o=s.getBoundingClientRect(),l=o.width/s.offsetWidth,a=o.height/s.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),s=e?r.bottom:r.top;e&&t&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let o=this.width/2*a;i={left:r.left,right:r.right,top:s-o,bottom:s+o}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(!t||i)return null;let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=ez(this.editorView.state.doc,s,this.editorView.dragging.slice);null!=e&&(s=e)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);null!=t&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class hM extends eZ{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return hM.valid(n)?new hM(n):eZ.near(n)}content(){return C.empty}eq(e){return e instanceof hM&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new hM(e.resolve(t.pos))}getBookmark(){return new hA(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||hE(e.type))return!0;
86if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||hE(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&hM.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let s=e.node(n);if(t>0?e.indexAfter(n)<s.childCount:e.index(n)>0){i=s.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let o=e.doc.resolve(r);if(hM.valid(o))return o}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!e5.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=s,r+=t;let o=e.doc.resolve(r);if(hM.valid(o))return o}return null}}}hM.prototype.visible=!1,hM.findFrom=hM.findGapCursorFrom,eZ.jsonID("gapcursor",hM);class hA{constructor(e){this.pos=e}map(e){return new hA(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return hM.valid(t)?new hM(t):eZ.near(t)}}function hE(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let hT=ig({ArrowLeft:hO("horiz",-1),ArrowRight:hO("horiz",1),ArrowUp:hO("vert",-1),ArrowDown:hO("vert",1)});function hO(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let s=e.selection,o=t>0?s.$to:s.$from,l=s.empty;if(s instanceof e3){if(!i.endOfTextblock(n)||0==o.depth)return!1;l=!1,o=e.doc.resolve(t>0?o.after():o.before())}let a=hM.findGapCursorFrom(o,t,l);return!!a&&(r&&r(e.tr.setSelection(new hM(a))),!0)}}function hN(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!hM.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&e5.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new hM(r))),!0)}function hD(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof hM))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=b.empty;for(let e=r.length-1;e>=0;e--)i=b.from(r[e].createAndFill(null,i));let s=e.state.tr.replace(n.pos,n.pos,new C(i,0,0));return s.setSelection(e3.near(s.doc.resolve(n.pos+1))),e.dispatch(s),!1}function hR(e){if(!(e.selection instanceof hM))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",rH.create(e.doc,[r$.widget(e.selection.head,t,{key:"gapcursor"})])}var hI=function(){};hI.prototype.append=function(e){return e.length?(e=hI.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},hI.prototype.prepend=function(e){return e.length?hI.from(e).append(this):this},hI.prototype.appendInner=function(e){return new h_(this,e)},hI.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?hI.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},hI.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},hI.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},hI.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},hI.from=function(e){return e instanceof hI?e:e&&e.length?new hL(e):hI.empty};var hL=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(hI);hI.empty=new hL([]);var h_=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(hI);class hP{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,s;if(0==this.eventCount)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(r=(n=this.remapping(o,this.items.length)).maps.length);let l=e.tr,a=[],c=[];
86return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(o,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new hj(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new hj(i,void 0,void 0,a.length+c.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,s=new hP(this.items.slice(0,o).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:l,selection:i}}addTransform(e,t,n,r){var i,s;let o,l=[],a=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),s=new hj(e.mapping.maps[n],i,t),o;(o=d&&d.merge(s))&&(s=o,n?l.pop():c=c.slice(0,c.length-1)),l.push(s),t&&(a++,t=void 0),r||(d=s)}let h=a-n.depth;return h>h$&&(i=c,s=h,i.forEach((e,t)=>{if(e.selection&&0==s--)return o=t,!1}),c=i.slice(o),a-=h),new hP(c.append(l),a)}remapping(e,t){let n=new eg;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new hP(this.items.append(e.map(e=>new hj(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(e=>{e.selection&&o--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;s=Math.min(s,r);let a=i.maps[r];if(t.step){let s=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(l+1,r));c&&o++,n.push(new hj(a,s,c))}else n.push(new hj(a))},r);let a=[];for(let e=t;e<s;e++)a.push(new hj(i.maps[e]));let c=new hP(this.items.slice(0,r).append(a).append(n),o);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)r.push(s),s.selection&&i++;else if(s.step){let e=s.step.map(t.slice(n)),o=e&&e.getMap();if(n--,o&&t.appendMap(o,n),e){let l=s.selection&&s.selection.map(t.slice(n));l&&i++;let a=new hj(o.invert(),e,l),c,d=r.length-1;(c=r.length&&r[d].merge(a))?r[d]=c:r.push(a)}}else s.map&&n--},this.items.length,0),new hP(hI.from(r.reverse()),i)}}hP.empty=new hP(hI.empty,0);class hj{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new hj(t.getMap().invert(),t,this.selection)}}}class hz{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let h$=20;function hB(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function hV(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}let hH=!1,hF=null;function hU(e){let t=e.plugins;if(hF!=t){hH=!1,hF=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){hH=!0;break}}return hH}let hW=new td("history"),hq=new td("closeHistory");function hK(e,t){return(n,r)=>{let i=hW.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let s=function(e,t,n){let r=hU(t),i=hW.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),a=new hz(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(hW,{redo:n,historyState:a})}(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}let hJ=hK(!1,!0),hG=hK(!0,!0);hK(!1,!1),hK(!0,!1),oX.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new tl({key:new td("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,s=this.options.autoTrim;if(null==i||0===i||!1===s){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;
86if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let s=e.selection.$head.pos;return e.deleteRange(s-(i-n),s),!(this.storage.characters({node:e.doc})>n)}})]}});let hX=oX.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new tl({view:t=>new hC(t,e)})}(this.options)]}});oX.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new tl({key:new td("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!n||!r)return rH.create(e,[]);let o=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let l=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((l+=1,"deepest"===this.options.mode&&o-l>0||"shallowest"===this.options.mode&&l>1)?"deepest"===this.options.mode:void s.push(r$.node(t,t+e.nodeSize,{class:this.options.className})))),rH.create(e,s)}}})]}});let hY=oX.create({name:"gapCursor",addProseMirrorPlugins:()=>[new tl({props:{decorations:hR,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&hM.valid(n)?new hM(n):null,handleClick:hN,handleKeyDown:hT,handleDOMEvents:{beforeinput
86:hD}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=sN(sA(e,"allowGapCursor",n)))?t:null}}}),hQ="placeholder",hZ=new td("tiptap__placeholder");function h0(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=e,d=[a];return o&&d.push(c),r$.node(i,i+s.nodeSize,{class:d.join(" "),[r]:"function"==typeof n?n({editor:t,node:s,pos:i,hasAnchor:l}):n})}function h1(e,t){return"function"==typeof e?e(t):e}function h2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:s,to:o}){let{anchor:l}=i,a=[],c=e.isEmpty;return r.nodesBetween(s,o,(r,i)=>{let s=l>=i&&l<=i+r.nodeSize,o=!r.isLeaf&&s2(r);return r.type.isTextblock&&(s||!t.showOnlyCurrent)&&o&&a.push(h0({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:s,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:h1(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:s})},node:r,pos:i})),t.includeChildren}),a}function h3({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:s}=i,o=[],l=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(s),a=i.depth>0?i.node(1):i.nodeAfter,c=i.depth>0?i.before(1):s;if(a&&a.type.isTextblock&&s2(a)){let r=s>=c&&s<=c+a.nodeSize;o.push(h0({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:h1(t.emptyNodeClass,{editor:e,node:a,pos:c,hasAnchor:r})},node:a,pos:c}))}}else o.push(...h2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return rH.create(r,o)}function h4(e,t){let n=e.resolve(t);if(0===n.depth){var r;let e=null!=(r=n.nodeAfter)?r:n.nodeBefore;if(!e)return{from:t,to:t};let i=n.nodeAfter?t:t-e.nodeSize;return{from:i,to:i+e.nodeSize}}let i=n.before(1);return{from:i,to:i+n.node(1).nodeSize}}function h5(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function h6(e,t){return!e.selection.empty&&!s3(e.selection)&&t.isEditable}function h8({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}oX.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:hQ,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${hQ}`,r=t.showOnlyCurrent&&!t.includeChildren;return new tl({key:hZ,...r?{}:{state:function({editor:e,options:t,dataAttribute:n}){return{init(r,i){let s=h3({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection});return null!=s?s:rH.empty},apply:(r,i,s,o)=>r.docChanged||r.selectionSet?function({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let l=e;for(let e of t){let{from:t,to:a}=function(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}(e.from,e.to,s),c=l.find(t,a).filter(e=>e.from>=t&&e.to<=a);c.length&&(l=l.remove(c));let d=h2({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:t,to:a});d.length&&(l=l.add(s,d))}return l}({decorations:i.map(r.mapping,r.doc),ranges:function(e,t,n){let r=[];if(e.docChanged)for(let t of sW(e))r.push(...function(e,t){var n,r;let i,s=(n=t.from,r=t.to,i=[],e.forEach((e,t)=>{let s=t+e.nodeSize,o=s+1;t+1<r&&o>n&&i.push({from:t,to:s})}),i);return s.push(h5(e,h4(e,t.from))),t.to>t.from?s.push(h5(e,h4(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&s.push(h5(e,h4(e,Math.min(t.from+1,e.content.size)))),s}(n.doc,t.newRange));return e.selectionSet&&(r.push(h5(n.doc,h4(n.doc,e.mapping.map(t.selection.anchor)))),r.push(h5(n.doc,h4(n.doc,n.selection.anchor)))),function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}(r)}(r,s,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection}):i}}({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>h3({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>{var r;return t.showOnlyWhenEditable&&!e.isEditable?rH.empty:null!=(r=hZ.getState(n))?r:rH.empty}}})}({editor:this.editor,options:this.options})]}}),oX.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new tl({key:new td("selection"),props:{decorations:n=>
86!h6(n,e)||e.isFocused||e.view.dragging?null:rH.create(n.doc,[r$.inline(n.selection.from,n.selection.to,{class:t.className})]),handleDOMEvents:{blur(t){var n;return!!h6(t.state,e)&&(null==(n=window.getSelection())||n.removeAllRanges(),!1)},focus:t=>!!h6(t.state,e)&&(requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&t.focus()}),!1)}}})]}});let h9=oX.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new td(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new tl({key:t,appendTransaction:(e,r,i)=>{let{doc:s,tr:o,schema:l}=i,a=t.getState(i),c=s.content.size,d=l.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&a)return o.insert(c,d.create())},state:{init:(e,t)=>!h8({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!h8({node:e.doc.lastChild,types:r})}})]}}),h7=oX.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>hJ(e,t),redo:()=>({state:e,dispatch:t})=>hG(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new tl({key:hW,state:{init:()=>new hz(hP.empty,hP.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(hW),s;if(i)return i.historyState;n.getMeta(hq)&&(e=new hz(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(o&&o.getMeta(hW))if(o.getMeta(hW).redo)return new hz(e.done.addTransform(n,void 0,r,hU(t)),e.undone,hB(n.mapping.maps),e.prevTime,e.prevComposition);else return new hz(e.done,e.undone.addTransform(n,void 0,r,hU(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))if(s=n.getMeta("rebased"))return new hz(e.done.rebased(n,s),e.undone.rebased(n,s),hV(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new hz(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),hV(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),s=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=o?hV(e.prevRanges,n.mapping):hB(n.mapping.maps);return new hz(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,hU(t)),hP.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?hJ:"historyRedo"==n?hG:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ue=oX.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(a6.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(a1.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(dQ.configure(this.options.bulletList)),!1!==this.options.code&&i.push(a7.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(cn.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(cr.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(hX.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(hY.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(ci.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(cs.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(h7.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(co.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(ch.configure(this.options.italic)),!1!==this.options.listItem&&i.push(d7.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(hs.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(dG.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(hp.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(hb.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(hk.
86configure(this.options.strike)),!1!==this.options.text&&i.push(hx.configure(this.options.text)),!1!==this.options.underline&&i.push(hS.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(h9.configure(null==(r=this.options)?void 0:r.trailingNode)),i}}),ut=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,un=lh.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",sL(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,s,o;let l=null!=(t=null==(n=e.attrs)?void 0:n.src)?t:"",a=null!=(r=null==(i=e.attrs)?void 0:i.alt)?r:"",c=null!=(s=null==(o=e.attrs)?void 0:o.title)?s:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set(["src","width","height"]);return({node:s,getPos:o,HTMLAttributes:l,editor:a})=>{let c=document.createElement("img");c.draggable=!1;let d=sL(this.options.HTMLAttributes,l);Object.entries(d).forEach(([e,t])=>{if(null!=t)switch(e){case"src":case"width":case"height":break;default:c.setAttribute(e,t)}}),null!==d.src&&(c.src=d.src);let h={...l},u=e=>{if("string"==typeof e&&""!==e){c.getAttribute("src")!==e&&(c.src=e);return}c.hasAttribute("src")&&c.removeAttribute("src"),""!==c.src&&(c.src="")};u(l.src);let p=new ld({element:c,editor:a,node:s,getPos:o,onResize:(e,t)=>
86{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==s.type)return!1;let t=a.extensionManager.attributes.filter(t=>t.type===e.type.name),n=s_(e,t);return Object.keys(h).forEach(e=>{i.has(e)||e in n||c.removeAttribute(e)}),Object.entries(n).forEach(([e,t])=>{i.has(e)||(null!=t?c.setAttribute(e,t):c.removeAttribute(e))}),u(n.src),h=n,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),f=p.dom,m=()=>{f.style.visibility="",f.style.pointerEvents=""};return f.style.visibility="hidden",f.style.pointerEvents="none",c.complete&&c.naturalWidth>0?m():(c.onload=m,c.onerror=m),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ll({find:ut,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});if("u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var ur=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,s=r+1,o=i+1;for(let e=1;s<this.width&&this.map[t+e]==n;e++)s++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:s,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:s,bottom:o}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?0==s:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:s}=this.findCell(e),{left:o,right:l,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let s=r*this.width+i,o=this.map[s];!n[o]&&(n[o]=!0,i==e.left&&i&&this.map[s-1]==o||r==e.top&&r&&this.map[s-this.width]==o||t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let s=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?s-1:this.map[n]}i=s}}static get(e){return t(e)||n(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(s+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);s+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=s:t!=s&&(t=Math.max(t,s))}return t}(e),n=e.childCount,r=[],i=0,s=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let l=0,a=0;l<n;l++){let c=e.child(l);a++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;let d=c.child(e),{colspan:h,rowspan:u,colwidth:p}=d.attrs;for(let e=0;e<u;e++){if(e+l>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:a,n:u-e});break}let c=i+e*t;for(let e=0;e<h;e++){0==r[c+e]?r[c+e]=a:(s||(s=[])).push({type:"collision",row:l,pos:a,n:h-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=o[r];null==i||i!=n&&1==o[r+1]?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=h,a+=d.nodeSize}let d=(l+1)*t,h=0;for(;i<d;)0==r[i++]&&h++;h&&(s||(s=[])).push({type:"missing",row:l,n:h}),a++}(0===t||0===n)&&(s||(s=[])).push({type:"zero_sized"});let l=new ur(t,n,r,s),a=!1;for(let e=0;!a&&e<o.length;e+=2)null!=o[e]&&o[e+1]<n&&(a=!0);return a&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let s=e.map[i];if(r[s])continue;r[s]=!0;let o=n.nodeAt(s);if(!o)throw RangeError(`No cell with offset ${s} found`);let l=null,a=o.attrs;for(let n=0;n<a.colspan;n++){let r=t[(i+n)%e.width*2];null==r||a.colwidth&&a.colwidth[n]==r||((l||(l=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(a)))[n]=r)}l&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}(l,o,e),l}(e))}};function ui(e){let t=e.cached.tableNodeTypes;
86if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let us=new td("selectingCells");function uo(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function ul(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function ua(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=uo(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function uc(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function ud(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function uh(e,t,n){let r=e.node(-1),i=ur.get(r),s=e.start(-1),o=i.nextCell(e.pos-s,t,n);return null==o?null:e.node(0).resolve(s+o)}function uu(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function up(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var uf=class e extends eZ{constructor(e,t=e){const n=e.node(-1),r=ur.get(n),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),l=r.cellsInRect(s).filter(e=>e!=t.pos-i);l.unshift(t.pos-i);const a=l.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new e0(o.resolve(r),o.resolve(r+t.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(uc(r)&&uc(i)&&ud(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return e3.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=ur.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},s=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let s=n*t.width+r.left,l=r.left;l<r.right;l++,s++){let n=t.map[s];if(i[n])continue;i[n]=!0;let l=t.findCell(n),a=e.nodeAt(n);if(!a)throw RangeError(`No cell with offset ${n} found`);let c=r.left-l.left,d=l.right-r.right;if(c>0||d>0){let e=a.attrs;if(c>0&&(e=uu(e,0,c)),d>0&&(e=uu(e,e.colspan-d,d)),l.left<r.left){if(!(a=a.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else a=a.type.create(e,a.content)}if(l.top<r.top||l.bottom>r.bottom){let e={...a.attrs,rowspan:Math.min(l.bottom,r.bottom)-Math.max(l.top,r.top)};a=l.top<r.top?a.type.createAndFill(e):a.type.create(e,a.content)}o.push(a)}s.push(e.child(n).copy(b.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:s;return new C(b.from(o),1,1)}replace(e,t=C.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],l=e.mapping.slice(n);e.replace(l.map(s.pos),l.map(o.pos),i?C.empty:t)}let i=eZ.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new C(b.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=ur.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=ur.get(r),s=t.start(-1),o=i.findCell(t.pos-s),l=i.findCell(n.pos-s),a=t.node(0);return o.top<=l.top?(o.top>0&&(t=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ur.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=ur.get(r),s=t.start(-1),o=i.findCell(t.pos-s),l=i.findCell(n.pos-s),a=t.node(0);return o.left<=l.left?(o.left>0&&(t=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(t=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new um(this.$anchorCell.pos,this.$headCell.pos)}};uf.prototype.visible=!1,eZ.jsonID("cell",uf);var um=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&ud(t,n)?new uf(t,n):eZ.near(n,1)}};function ug(e){if(!(e.selection instanceof uf))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(r$.node(n,n+e.nodeSize,{class:"selectedCell"}))}),rH.create(e.doc,t)}let uy=new td("fix-tables");function ub(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,s,o=ur.get(t);if(!o.problems)return r;r||(r=e.tr);let l=[];for(let e=0;e<o.height;e++)l.push(0);for(let e=0;e<o.problems.length;e++){let i=o.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let s=e.attrs;for(let e=0;e<s.rowspan;e++)l[i.row+e]+=i.n;
86r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,uu(s,s.colspan-i.n,i.n))}else if("missing"==i.type)l[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<l.length;e++)l[e]&&(null==i&&(i=e),s=e);for(let a=0,c=n+1;a<o.height;a++){let n=t.child(a),o=c+n.nodeSize,d=l[a];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let l=[];for(let n=0;n<d;n++){let n=ui(e.schema)[t].createAndFill();n&&l.push(n)}let h=(0==a||i==a-1)&&s==a?c+1:o-1;r.insert(r.mapping.map(h),l)}c=o}return r.setMeta(uy,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let s=t.childCount,o=n.childCount;n:for(let l=0,a=0;l<o;l++){let o=n.child(l);for(let e=a,n=Math.min(s,l+3);e<n;e++)if(t.child(e)==o){a=e+1,r+=o.nodeSize;continue n}i(o,r),a<s&&t.child(a).sameMarkup(o)?e(t.child(a),o,r+1,i):o.nodesBetween(0,o.content.size,i,r+1),r+=o.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function uw(e){let t=e.selection,n=ua(e),r=n.node(-1),i=n.start(-1),s=ur.get(r);return{...t instanceof uf?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function uv(e,{map:t,tableStart:n,table:r},i){let s=i>0?-1:0;(function(e,t,n){let r=ui(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+s)&&(s=0==i||i==t.width?null:0);for(let o=0;o<t.height;o++){let l=o*t.width+i;if(i>0&&i<t.width&&t.map[l-1]==t.map[l]){let s=t.map[l],a=r.nodeAt(s);e.setNodeMarkup(e.mapping.map(n+s),null,up(a.attrs,i-t.colCount(s))),o+=a.attrs.rowspan-1}else{let a=null==s?ui(r.type.schema).cell:r.nodeAt(t.map[l+s]).type,c=t.positionAt(o,i,r);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function uk(e,{map:t,tableStart:n,table:r},i){let s=n;for(let e=0;e<i;e++)s+=r.child(e).nodeSize;let o=[],l=i>0?-1:0;(function(e,t,n){var r;let i=ui(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if((null==(r=t.nodeAt(e.map[s+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+l)&&(l=0==i||i==t.height?null:0);for(let s=0,c=t.width*i;s<t.width;s++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),s+=o.colspan-1}else{var a;let e=null==l?ui(r.type.schema).cell:null==(a=r.nodeAt(t.map[c+l*t.width]))?void 0:a.type,n=null==e?void 0:e.createAndFill();n&&o.push(n)}return e.insert(s,ui(r.type.schema).row.create(null,o)),e}function ux(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function uS(e,t){let n=e.selection;if(!(n instanceof uf)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=uw(e),{map:i}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,s=i,o=(r.bottom-1)*e+r.left,l=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[s]==n[s-1]||r.right<e&&n[l]==n[l+1])return!0;s+=e,l+=e}for(let s=r.left;s<r.right;s++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}(i,r))return!1;if(t){let n,s,o=e.tr,l={},a=b.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let c=i.map[e*i.width+t],d=r.table.nodeAt(c);if(!l[c]&&d)if(l[c]=!0,null==n)n=c,s=d;else{ux(d)||(a=a.append(d.content));let e=o.mapping.map(c+r.tableStart);o.delete(e,e+d.nodeSize)}}if(null==n||null==s)return!0;if(o.setNodeMarkup(n+r.tableStart,null,{...up(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){let e=n+1+s.content.size,t=ux(s)?n+1:e;o.replaceWith(t+r.tableStart,e+r.tableStart,a)}o.setSelection(new uf(o.doc.resolve(n+r.tableStart))),t(o)}return!0}function uC(e,t){var n;let r=ui(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,s=e.selection;if(s instanceof uf){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;r=s.$anchorCell.nodeAfter,i=s.$anchorCell.pos}else{var o;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;
86if("cell"===n||"header_cell"===n)return e.node(t)}return null}(s.$from)))return!1;i=null==(o=uo(s.$from))?void 0:o.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let o,l=r.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let d=uw(e),h=e.tr;for(let e=0;e<d.right-d.left;e++)a.push(c?{...l,colwidth:c&&c[e]?[c[e]]:null}:l);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=r.nodeSize);for(let i=d.left,s=0;i<d.right;i++,s++)(i!=d.left||e!=d.top)&&h.insert(o=h.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(a[s]))}h.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),s instanceof uf&&h.setSelection(new uf(h.doc.resolve(s.$anchorCell.pos),o?h.doc.resolve(o):void 0)),t(h)}return!0})(e,t)}function uM(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function uA(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!ul(t))return!1;if(n){let r=ui(t.schema),i=uw(t),s=t.tr,o=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)l[e].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[e],r.cell,l[e].attrs);if(0===s.steps.length)for(let e=0;e<o.length;e++)s.setNodeMarkup(i.tableStart+o[e],r.header_cell,l[e].attrs);n(s)}return!0};return function(t,n){if(!ul(t))return!1;if(n){let r=ui(t.schema),i=uw(t),s=t.tr,o=uM("row",i,r),l=uM("column",i,r),a=+("column"===e?!!o:"row"===e&&!!l),c="column"==e?{left:0,top:a,right:1,bottom:i.map.height}:"row"==e?{left:a,top:0,right:i.map.width,bottom:1}:i,d="column"==e?l?r.cell:r.header_cell:"row"==e?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=s.doc.nodeAt(t);n&&s.setNodeMarkup(t,d,n.attrs)}),n(s)}return!0}}uA("row",{useDeprecatedLogic:!0}),uA("column",{useDeprecatedLogic:!0});let uE=uA("cell",{useDeprecatedLogic:!0});function uT(e){return function(t,n){if(!ul(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(ua(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(e3.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function uO(e,t){let n=e.selection;if(!(n instanceof uf))return!1;if(t){let r=e.tr,i=ui(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new C(i,0,0))}),r.docChanged&&t(r)}return!0}function uN(e,t){let n=e.createAndFill();return new eY(n).replace(0,n.content.size,t).doc}function uD(e,t,n,r,i,s,o,l){if(0==o||o==t.height)return!1;let a=!1;for(let c=i;c<s;c++){let i=o*t.width+c,s=t.map[i];if(t.map[i-t.width]==s){a=!0;let i=n.nodeAt(s),{top:d,left:h}=t.findCell(s);e.setNodeMarkup(e.mapping.slice(l).map(s+r),null,{...i.attrs,rowspan:o-d}),e.insert(e.mapping.slice(l).map(t.positionAt(o,h,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-o})),c+=i.attrs.colspan-1}}return a}function uR(e,t,n,r,i,s,o,l){if(0==o||o==t.width)return!1;let a=!1;for(let c=i;c<s;c++){let i=c*t.width+o,s=t.map[i];if(t.map[i-1]==s){a=!0;let i=n.nodeAt(s),d=t.colCount(s),h=e.mapping.slice(l).map(s+r);e.setNodeMarkup(h,null,uu(i.attrs,o-d,i.attrs.colspan-(o-d))),e.insert(h+i.nodeSize,i.type.createAndFill(uu(i.attrs,0,o-d))),c+=i.attrs.rowspan-1}}return a}function uI(e,t,n,r,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw Error("No table found");let o=ur.get(s),{top:l,left:a}=r,c=a+i.width,d=l+i.height,h=e.tr,u=0;function p(){if(!(s=n?h.doc.nodeAt(n-1):h.doc))throw Error("No table found");o=ur.get(s),u=h.mapping.maps.length}(function(e,t,n,r,i,s){let o,l,a=ui(e.doc.type.schema);if(i>t.width)for(let s=0,c=0;s<t.height;s++){let d,h=n.child(s);c+=h.nodeSize;let u=[];d=null==h.lastChild||h.lastChild.type==a.cell?o||(o=a.cell.createAndFill()):l||(l=
86a.header_cell.createAndFill());for(let e=t.width;e<i;e++)u.push(d);e.insert(e.mapping.slice(0).map(c-1+r),u)}if(s>t.height){let c=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==a.header_cell;c.push(i?l||(l=a.header_cell.createAndFill()):o||(o=a.cell.createAndFill()))}let d=a.row.create(null,b.from(c)),h=[];for(let e=t.height;e<s;e++)h.push(d);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),h)}return!!(o||l)})(h,o,s,n,c,d)&&p(),uD(h,o,s,n,a,c,l,u)&&p(),uD(h,o,s,n,a,c,d,u)&&p(),uR(h,o,s,n,l,d,a,u)&&p(),uR(h,o,s,n,l,d,c,u)&&p();for(let e=l;e<d;e++){let t=o.positionAt(e,a,s),r=o.positionAt(e,c,s);h.replace(h.mapping.slice(u).map(t+n),h.mapping.slice(u).map(r+n),new C(i.rows[e-l],0,0))}p(),h.setSelection(new uf(h.doc.resolve(n+o.positionAt(l,a,s)),h.doc.resolve(n+o.positionAt(d-1,c-1,s)))),t(h)}let uL=ig({ArrowLeft:uP("horiz",-1),ArrowRight:uP("horiz",1),ArrowUp:uP("vert",-1),ArrowDown:uP("vert",1),"Shift-ArrowLeft":uj("horiz",-1),"Shift-ArrowRight":uj("horiz",1),"Shift-ArrowUp":uj("vert",-1),"Shift-ArrowDown":uj("vert",1),Backspace:uO,"Mod-Backspace":uO,Delete:uO,"Mod-Delete":uO});function u_(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function uP(e,t){return(n,r,i)=>{if(!i)return!1;let s=n.selection;if(s instanceof uf)return u_(n,r,eZ.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;let o=uV(i,e,t);if(null==o)return!1;if("horiz"==e)return u_(n,r,eZ.near(n.doc.resolve(s.head+t),t));{let i,s=n.doc.resolve(o),l=uh(s,e,t);return i=l?eZ.near(l,1):t<0?eZ.near(n.doc.resolve(s.before(-1)),-1):eZ.near(n.doc.resolve(s.after(-1)),1),u_(n,r,i)}}}function uj(e,t){return(n,r,i)=>{let s;if(!i)return!1;let o=n.selection;if(o instanceof uf)s=o;else{let r=uV(i,e,t);if(null==r)return!1;s=new uf(n.doc.resolve(r))}let l=uh(s.$headCell,e,t);return!!l&&u_(n,r,new uf(s.$anchorCell,l))}}function uz(e,t){let n=uo(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new uf(n))),!0)}function u$(e,t,n){if(!ul(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if("row"==s)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,s=e?0:Math.max(0,n-1),a=e<t.childCount-1?0:Math.max(0,r-1);(s||a)&&(i=uN(ui(o).row,new C(i,s,a)).content),l.push(i)}else{if("cell"!=s&&"header_cell"!=s)return null;l.push(n||r?uN(ui(o).row,new C(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:s}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+s}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(b.empty),n[i]<r){let s=ui(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(s);t[i]=t[i].append(b.from(o))}return{height:t.length,width:r,rows:t}}(o,l)}(n),i=e.state.selection;if(i instanceof uf){r||(r={width:1,height:1,rows:[b.from(uN(ui(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),o=ur.get(t).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let s=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let l=s.child(i%s.childCount);n+l.attrs.colspan>r&&(l=l.type.createChecked(uu(l.attrs,l.attrs.colspan,n+l.attrs.colspan-r),l.content)),o.push(l),n+=l.attrs.colspan;for(let n=1;n<l.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+l.attrs.colspan}i.push(b.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,s=0;r<i;r++,s++){let o=[],l=n[s%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(b.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}(r,o.right-o.left,o.bottom-o.top),uI(e.state,e.dispatch,s,o,r),!0}if(!r)return!1;{let t=ua(e.state),n=t.start(-1);return uI(e.state,e.dispatch,n,ur.get(t.node(-1)).findCell(t.pos-n),r),!0}}function uB(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=uH(e,t.target);if(t.shiftKey&&e.state.selection instanceof uf)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=uo(e.state.selection.$anchor))&&(null==(n=uF(e,t))?void 0:n.pos)!=r.pos)s(r,t),t.preventDefault();else if(!i)return;function s(t,n){let r=uF(e,n),i=null==us.getState(e.state);if(!r||!ud(t,r))if(!i)return;else r=t;let s=new uf(t,r);
86if(i||!e.state.selection.eq(s)){let n=e.state.tr.setSelection(s);i&&n.setMeta(us,t.pos),e.dispatch(n)}}function o(){e.root.removeEventListener("mouseup",o),e.root.removeEventListener("dragstart",o),e.root.removeEventListener("mousemove",l),null!=us.getState(e.state)&&e.dispatch(e.state.tr.setMeta(us,-1))}function l(n){let r,l=us.getState(e.state);if(null!=l)r=e.state.doc.resolve(l);else if(uH(e,n.target)!=i&&!(r=uF(e,t)))return o();r&&s(r,n)}e.root.addEventListener("mouseup",o),e.root.addEventListener("dragstart",o),e.root.addEventListener("mousemove",l)}function uV(e,t,n){if(!(e.state.selection instanceof e3))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))break;if("cell"==s.type.spec.tableRole||"header_cell"==s.type.spec.tableRole){let s=r.before(i),o="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(o)?s:null}}return null}function uH(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function uF(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&uo(e.state.doc.resolve(r))||uo(e.state.doc.resolve(i))}var uU=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),uW(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,uW(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function uW(e,t,n,r,i,s){let o=0,l=!0,a=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:h}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=i==n?s:h&&h[e],d=c?c+"px":"";if(o+=c||r,c||(l=!1),a)a.style.width!=d&&(a.style.width=d),a=a.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;a;){var d;let e=a.nextSibling;null==(d=a.parentNode)||d.removeChild(a),a=e}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}let uq=new td("tableColumnResizing");var uK=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(uq);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return uc(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function uJ(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:s}=i,o=uo(e.state.doc.resolve(s));if(!o)return -1;if("right"==n)return o.pos;let l=ur.get(o.node(-1)),a=o.start(-1),c=l.map.indexOf(o.pos-a);return c%l.width==0?-1:a+l.map[c-1]}function uG(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function uX(e,t){e.dispatch(e.state.tr.setMeta(uq,{setHandle:t}))}function uY(e,t,n,r){let i=e.state.doc.resolve(t),s=i.node(-1),o=i.start(-1),l=ur.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,a=e.domAtPos(i.start(-1)).node;for(;a&&"TABLE"!=a.nodeName;)a=a.parentNode;a&&uW(s,a.firstChild,a,r,l,n)}function uQ(e){return"left"===e||"right"===e||"center"===e?e:null}function uZ(){return{default:null,parseHTML:e=>{let t,n;return t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase(),uQ(t||n)},renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function u0(e){let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):function(e){var t;let n=e.parentElement,r=e.closest("table");if(!n||!r)return null;let i=Array.from(n.children).indexOf(e),s=null==(t=r.querySelectorAll("colgroup > col")[i])?void 0:t.getAttribute("width");return s?[parseInt(s,10)]:null}(e)}let u1=/[ \t\r\n\f]+/g;function u2(e){var t;return!(e.children.length>0)&&""===(null!=(t=e.textContent)?t:"").replace(u1,"")}function u3(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}let u4=lh.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:u0},align:uZ()}),tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:e=>!!u2(e)&&{},getContent:(e,t)=>
86u3(t.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",sL(this.options.HTMLAttributes,e),0]}}),u5=lh.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:u0},align:uZ()}),tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:e=>!!u2(e)&&{},getContent:(e,t)=>u3(t.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",sL(this.options.HTMLAttributes,e),0]}}),u6=lh.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",sL(this.options.HTMLAttributes,e),0]}});function u8(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function u9(e,t,n,r,i,s){let o=0,l=!0,a=t.firstChild,c=e.firstChild;if(null!==c)for(let e=0,n=0;e<c.childCount;e+=1){let{colspan:d,colwidth:h}=c.child(e).attrs;for(let e=0;e<d;e+=1,n+=1){let c=i===n?s:h&&h[e],d=c?`${c}px`:"";if(o+=c||r,c||(l=!1),a){if(a.style.width!==d){let[e,t]=u8(r,c);a.style.setProperty(e,t)}a=a.nextSibling}else{let e=document.createElement("col"),[n,i]=u8(r,c);e.style.setProperty(n,i),t.appendChild(e)}}}for(;a;){var d;let e=a.nextSibling;null==(d=a.parentNode)||d.removeChild(a),a=e}let h=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!h?(n.style.width=`${o}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${o}px`)}var u7=class{constructor(e,t,n,r={}){for(const[n,i]of(this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),Object.entries(r)))null!=i&&("style"===n?this.table.style.cssText=String(i):this.table.setAttribute(n,String(i)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),u9(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type===this.node.type&&(this.node=e,u9(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!n&&!r&&("attributes"===e.type||"childList"===e.type||"characterData"===e.type)}};function pe(e,t){return t?e.createChecked(null,t):e.createAndFill()}let pt=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof uf))return!1;let n=0,r=sC(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function pn(e,t){let n=e.mapping.map(t),r=sC(e.selection.$from,e=>"table"===e.type.name);if((null==r?void 0:r.pos)===n)return;let i=e.doc.nodeAt(n);if(!i)return;let s=n+i.nodeSize-1;e.setSelection(e3.near(e.doc.resolve(s),-1))}let pr=lh.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:u7,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=function(e,t){let n=0,r=!0,i=[],s=e.firstChild;if(!s)return{};for(let e=0,o=0;e<s.childCount;e+=1){let{colspan:l,colwidth:a}=s.child(e).attrs;for(let e=0;e<l;e+=1,o+=1){let s=void 0===o?void 0:a&&a[e];n+=s||t,s||(r=!1);let[l,c]=u8(t,s);i.push(["col",{style:`${l}: ${c}`}])}}return{colgroup:["colgroup",{},...i],tableWidth:r?`${n}px`:"",tableMinWidth:r?"":`${n}px`}}(e,this.options.cellMinWidth),s=t.style,o=["table",sL(this.options.HTMLAttributes,t,{style:s||(r?`width: ${r}`:`min-width: ${i}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{var s;let o=uQ(null!=(s=r[n])?s:e.align);i.push(t.createNode("tableHeader",o?{align:o}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}
86]))}),n.push(t.createNode("tableRow",{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{var s;let o=uQ(null!=(s=r[n])?s:e.align);i.push(t.createNode("tableCell",o?{align:o}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>(function(e,t,n={}){var r;let i=null!=(r=n.cellLineSeparator)?r:"\x1f";if(!e||!e.content||0===e.content.length)return"";let s=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{var r;let s=((e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(i):e.content?t.renderChildren(e.content):"").split(i).join("\n").replace(/[ \t]*\r?\n[ \t]*/g,"<br>")||"").replace(/\s+/g," ").trim(),o="tableHeader"===e.type,l=uQ(null==(r=e.attrs)?void 0:r.align);n.push({text:s,isHeader:o,align:l})}),s.push(n)});let o=s.reduce((e,t)=>Math.max(e,t.length),0);if(0===o)return"";let l=Array.from({length:o}).fill(0);s.forEach(e=>{for(let n=0;n<o;n+=1){var t;let r=((null==(t=e[n])?void 0:t.text)||"").length;r>l[n]&&(l[n]=r),l[n]<3&&(l[n]=3)}});let a=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),c=s[0],d=c.some(e=>e.isHeader),h=Array.from({length:o}).fill(null);s.forEach(e=>{for(let n=0;n<o;n+=1){var t;!h[n]&&(null==(t=e[n])?void 0:t.align)&&(h[n]=e[n].align)}});let u="\n",p=Array.from({length:o}).map((e,t)=>d&&c[t]&&c[t].text||"");return u+=`| ${p.map((e,t)=>a(e,l[t])).join(" | ")} |
87| ${l.map((e,t)=>{let n=Math.max(3,e),r=h[t];return"left"===r?`:${"-".repeat(n)}`:"right"===r?`${"-".repeat(n)}:`:"center"===r?`:${"-".repeat(n)}:`:"-".repeat(n)}).join(" | ")} |
88`,(d?s.slice(1):s).forEach(e=>{u+=`| ${Array.from({length:o}).fill(0).map((t,n)=>a(e[n]&&e[n].text||"",l[n])).join(" | ")} |
89`}),u})(e,t),markdownTokenizer:{name:"table",level:"block",start:e=>{let t=e.split("\n");if(t.length<2)return -1;let n=t[1];return/^[ \t|:]*-[ \t|:-]*$/.test(n)&&n.includes("|")&&t[0].includes("|")?0:-1},tokenize(e,t,n){let r=e.indexOf("\n\n"),i=r>=0?e.slice(0,r):e,s=i.split("\n");if(s.length<2)return;let o=s[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes("|"))return;let l=i.split("\n").map(e=>e.includes("|")&&e.includes("`")?function(e){let t="",n=0;for(;n<e.length;){if("\\"===e[n]&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if("`"!==e[n]){t+=e[n++];continue}let r=0;for(;n+r<e.length&&"`"===e[n+r];)r+=1;let i=n+r,s=!1;for(;i<e.length;){if("`"!==e[i]){i+=1;continue}let o=0;for(;i+o<e.length&&"`"===e[i+o];)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>"|"===e?"\\|":e)+e.slice(i,i+r),n=i+r,s=!0;break}i+=o}s||(t+=e.slice(n,n+r),n+=r)}return t}(e):e).join("\n");if(l===i)return;let a=n.blockTokens(l)[0];if((null==a?void 0:a.type)!=="table"||!a.raw)return;let c=a.raw.split("\n").length,d=e.split("\n").slice(0,c).join("\n");return{...a,raw:d}}},addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{let o=function(e,t,n,r){let i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),s=[],o=[];for(let e=0;e<n;e+=1){let e=pe(i.cell,void 0);if(e&&o.push(e),r){let e=pe(i.header_cell,void 0);e&&s.push(e)}}let l=[];for(let e=0;e<t;e+=1)l.push(i.row.createChecked(null,r&&0===e?s:o));return i.table.createChecked(null,l)}(s.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(e3.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!ul(e))return!1;if(t){let n=uw(e);t(uv(e.tr,n,n.left))}return!0})(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!ul(e))return!1;if(t){let n=uw(e);t(uv(e.tr,n,n.right))}return!0})(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=sC(e.selection.$from,e=>"table"===e.type.name);return function(e,t){if(!ul(e))return!1;if(t){let n=uw(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let s=e.mapping.maps.length;for(let o=0;o<t.height;){let l=o*t.width+i,a=t.map[l],c=n.nodeAt(a),d=c.attrs;if(i>0&&t.map[l-1]==a||i<t.width-1&&t.map[l+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(r+a),null,uu(d,i-t.colCount(a)));else{let t=e.mapping.slice(s).map(r+a);e.delete(t,t+c.nodeSize)}o+=d.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ur.get(e)}t(r)}return!0}(e,t&&(e=>{n&&pn(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!ul(e))return!1;if(t){let n=uw(e);t(uk(e.tr,n,n.top))}return!0})(e,t),addRowAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!ul(e))return!1;if(t){let n=uw(e);t(uk(e.tr,n,n.bottom))}return!0})(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=sC(e.selection.$from,e=>"table"===e.type.name);return function(e,t){if(!ul(e))return!1;if(t){let n=uw(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let s=0;for(let e=0;e<i;e++)s+=n.child(e).nodeSize;let o=s+n.child(i).nodeSize,l=e.mapping.maps.length;e.delete(s+r,o+r);let a=new Set;for(let s=0,o=i*t.width;s<t.width;s++,o++){let c=t.map[o];if(!a.has(c)){if(a.add(c),i>0&&c==t.map[o-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(l).map(c+r),null,{...t,rowspan:t.rowspan-1}),s+=t.colspan-1}else if(i<t.height&&c==t.map[o+t.width]){let o=n.nodeAt(c),a=o.attrs,d=o.type.create({...a,rowspan:o.attrs.rowspan-1},o.content),h=t.positionAt(i+1,s,n);e.insert(e.mapping.slice(l).map(r+h),d),s+=a.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ur.get(n.table)}t(r)}return!0}(e,t&&(e=>{n&&pn(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>(function(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1})(e,t),mergeCells:()=>({state:e,dispatch:t})=>uS(e,t),splitCell:()=>({state:e,dispatch:t})=>uC(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>uA("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>uA("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>uE(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!uS(e,t)||uC(e,t),setCellAttribute:(e,t)=>
89({state:n,dispatch:r})=>(function(n,r){if(!ul(n))return!1;let i=ua(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let s=n.tr;n.selection instanceof uf?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&s.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(s)}return!0})(n,r),goToNextCell:()=>({state:e,dispatch:t})=>uT(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>uT(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&ub(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=uf.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:pt,"Mod-Backspace":pt,Delete:pt,"Mod-Delete":pt}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=uU,lastColumnResizable:i=!0}={}){let s=new tl({key:uq,state:{init(e,t){var i;let o=null==(i=s.spec)||null==(i=i.props)?void 0:i.nodeViews,l=ui(t.schema).table.name;return r&&o&&(o[l]=(e,t)=>new r(e,n,t)),new uK(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=uq.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=uq.getState(e.state);if(i&&!i.dragging){let s=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),o=-1;if(s){let{left:r,right:i}=s.getBoundingClientRect();t.clientX-r<=n?o=uJ(e,t,"left",n):i-t.clientX<=n&&(o=uJ(e,t,"right",n))}if(o!=i.activeHandle){if(!r&&-1!==o){let t=e.state.doc.resolve(o),n=t.node(-1),r=ur.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}uX(e,o)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=uq.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&uX(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let s=null!=(i=e.dom.ownerDocument.defaultView)?i:window,o=uq.getState(e.state);if(!o||-1==o.activeHandle||o.dragging)return;let l=e.state.doc.nodeAt(o.activeHandle),a=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let s=e.domAtPos(t),o=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],l--);return o/l}(e,o.activeHandle,l.attrs);function c(t){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",d);let r=uq.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),s=ur.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let e=0;e<s.height;e++){let t=e*s.width+l;if(e&&s.map[t]==s.map[t-s.width])continue;let r=s.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:l-s.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;let h=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);h[d]=n,a.setNodeMarkup(o+r,null,{...c,colwidth:h})}a.docChanged&&e.dispatch(a)}(e,r.activeHandle,uG(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(uq,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=uq.getState(e.state);if(i&&i.dragging){let s=uG(i.dragging,t,n);uY(e,i.activeHandle,s,r)}}e.dispatch(e.state.tr.setMeta(uq,{setDragging:{startX:t.clientX,startWidth:a}})),uY(e,o.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=uq.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return rH.empty;let s=ur.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<s.height;t++){let r=l+t*s.width;if((l==s.width-1||s.map[r]!=s.map[r+1])&&(0==t||s.map[r]!=s.map[r-s.width])){var a;let t=s.map[r],l=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(a=uq.getState(e))?void 0:a.dragging)&&n.push(r$.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(r$.widget(l,c))}}return rH.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return s}({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],function({allowTableNodeSelection:e=!1}={}){return new tl({key:us,state:{init:()=>null,apply(e,t){let n=e.getMeta(us);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:ug,handleDOMEvents:{mousedown:uB},createSelectionBetween:e=>null!=us.getState(e.state)?e.state.selection:null,handleTripleClick:uz,handleKeyDown:uL,handlePaste:u$},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,s=(t||e).selection,o=(t||e).doc;if(s instanceof e5&&(i=s.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=uf.create(o,s.from);else if("row"==i){let e=o.resolve(s.from+1);r=uf.rowSelection(e,e)}else if(!n){let e=ur.get(s.node),t=s.from+1,n=t+e.map[e.width*e.height-1];r=uf.create(o,t+1,n)}}else s instanceof e3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(s)?r=e3.create(o,s.from):s instanceof e3&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(s)&&(r=e3.create(o,s.$from.start(),s.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,ub(r,n),e)})}({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=sL(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:sN(sA(e,"tableRole",t))}}}),pi=oX.create({name:"tableKit",addExtensions(){let e=[];return!1!==this.options.table&&e.push(pr.configure(this.options.table)),!1!==this.options.tableCell&&e.push(u4.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(u5.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(u6.configure(this.options.tableRow)),e}}),ps=oX.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}}
89,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")}}});var po=e.i(500932),pl=e.i(430796);function pa(e){let t,n,r=(0,po.c)(10),{node:i,selected:s}=e,o="";try{let e,t;r[0]!==i?(e=(0,a.renderNode)(i.toJSON()),r[0]=i,r[1]=e):e=r[1];let n=`<html><head><style>body{margin:0;background:white}body>div{height:320px!important}</style></head><body>${e}</body></html>`;r[2]!==n?(t=(0,pl.prepareArtifactHtml)(n),r[2]=n,r[3]=t):t=r[3],o=t}catch{}let c=`studio-chart-node ${s?"selected":""}`,d=String(i.attrs.chart?.title||"Chart");return r[4]!==o||r[5]!==d?(t=(0,l.jsx)("iframe",{title:d,srcDoc:o,sandbox:"allow-scripts",tabIndex:-1}),r[4]=o,r[5]=d,r[6]=t):t=r[6],r[7]!==c||r[8]!==t?(n=(0,l.jsx)(l3,{className:c,"data-chart-node":!0,contentEditable:!1,children:t}),r[7]=c,r[8]=t,r[9]=n):n=r[9],n}let pc=e=>/^#[\da-f]{6}$/i.test(String(e||""))?String(e):null,pd=e=>pc(e)||(/^rgb\(\d+, \d+, \d+\)$/.test(e)?"#"+e.match(/\d+/g).map(e=>Number(e).toString(16).padStart(2,"0")).join(""):null),ph=oq.create({name:"textStyle",addAttributes:()=>({fontFamily:{default:null},fontSize:{default:null},color:{default:null},background:{default:null}}),parseHTML:()=>[{tag:"span[style]",getAttrs:e=>({fontFamily:a.STUDIO_FONTS.includes(e.style.fontFamily.replaceAll('"',""))?e.style.fontFamily.replaceAll('"',""):null,fontSize:/^\d+px$/.test(e.style.fontSize)?Math.max(8,Math.min(96,parseInt(e.style.fontSize))):null,color:pd(e.style.color),background:pd(e.style.backgroundColor)})}],renderHTML:({mark:e})=>["span",{style:[a.STUDIO_FONTS.includes(e.attrs.fontFamily)?`font-family:${e.attrs.fontFamily}`:"",e.attrs.fontSize?`font-size:${Math.max(8,Math.min(96,Number(e.attrs.fontSize)||15))}px`:"",pc(e.attrs.color)?`color:${e.attrs.color}`:"",pc(e.attrs.background)?`background-color:${e.attrs.background}`:""].filter(Boolean).join(";")},0]}),pu=lh.create({name:"chart",group:"block",atom:!0,draggable:!0,addNodeView:()=>e=>e.editor.contentComponent?new at(pa,e,void 0):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0},addAttributes:()=>({id:{default:null},chart:{default:null}}),parseHTML:()=>[{tag:"[data-chart]",getAttrs:e=>{try{return{chart:JSON.parse(e.getAttribute("data-studio-chart")||e.getAttribute("data-chart")||"{}")}}catch{return!1}}}],renderHTML:({node:e,HTMLAttributes:t})=>["div",sL(t,{"data-chart":JSON.stringify(e.attrs.chart),class:"studio-chart-placeholder",role:"img","aria-label":e.attrs.chart?.title||"Chart"}),e.attrs.chart?.title||"Chart"]}),pp=un.extend({addAttributes(){return{...this.parent?.(),id:{default:null},prompt:{default:null},aspect:{default:null}}},renderHTML({node:e,HTMLAttributes:t}){if(!e.attrs.src&&e.attrs.prompt)return["figure",{class:"studio-image-pending","data-prompt":e.attrs.prompt,"data-aspect":e.attrs.aspect||"16:9",style:`aspect-ratio:${a.IMAGE_ASPECTS[e.attrs.aspect]||"16/9"}`,role:"img","aria-label":e.attrs.alt||""},["figcaption",{},e.attrs.alt||e.attrs.prompt]];let n=a.IMAGE_ASPECTS[e.attrs.aspect];return["figure",{},["img",sL(this.options.HTMLAttributes,t,n?{style:`aspect-ratio:${n};width:100%;object-fit:cover`}:{})]]}}),pf=a.INNER_BLOCKS.join("|"),pm=lh.create({name:"banner",group:"block",content:"(heading|paragraph)+",defining:!0,draggable:!0,addAttributes:()=>({variant:{default:"section"},fill:{default:null},image:{default:null}}),parseHTML:()=>[{tag:"header.studio-banner",getAttrs:e=>({variant:a.BANNER_VARIANTS.includes(e.dataset.variant||"")?e.dataset.variant:"section",fill:pc(e.style.getPropertyValue("--banner-fill")),image:e.style.backgroundImage.match(/url\("?([^")]+)"?\)/)?.[1]||null})}],renderHTML:({node:e})=>["header",{class:"studio-banner","data-variant":e.attrs.variant,style:[e.attrs.fill?`--banner-fill:${e.attrs.fill}`:"",e.attrs.image?`background-image:linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.55)),url("${e.attrs.image}
89")`:""].filter(Boolean).join(";")||void 0},0]}),pg=lh.create({name:"callout",group:"block",content:`(${pf})+`,defining:!0,draggable:!0,addAttributes:()=>({tone:{default:"note"},icon:{default:null}}),parseHTML:()=>[{tag:"aside.studio-callout",contentElement:".studio-callout-body",getAttrs:e=>({tone:a.CALLOUT_TONES.includes(e.dataset.tone||"")?e.dataset.tone:"note",icon:e.querySelector(".studio-callout-icon")?.textContent||null})}],renderHTML:({node:e})=>["aside",{class:"studio-callout","data-tone":e.attrs.tone},["span",{class:"studio-callout-icon","aria-hidden":"true",contenteditable:"false"},e.attrs.icon||""],["div",{class:"studio-callout-body"},0]]}),py=lh.create({name:"column",content:`(${pf})+`,isolating:!0,parseHTML:()=>[{tag:"div.studio-column"}],renderHTML:()=>["div",{class:"studio-column"},0]}),pb=lh.create({name:"columns",group:"block",content:"column{2,3}",defining:!0,draggable:!0,parseHTML:()=>[{tag:"div.studio-columns"}],renderHTML:({node:e})=>["div",{class:"studio-columns","data-count":String(e.childCount)},0]}),pw=lh.create({name:"stats",group:"block",atom:!0,draggable:!0,addAttributes:()=>({id:{default:null},items:{default:[]}}),parseHTML:()=>[{tag:"table.studio-stats",getAttrs:e=>({items:Array.from(e.querySelectorAll("td")).slice(0,6).map(e=>({value:e.querySelector("strong")?.textContent||"",label:e.querySelector("span")?.textContent||"",delta:e.querySelector("em")?.textContent||void 0}))})}],renderHTML:({node:e})=>["table",{class:"studio-stats"},["tbody",{},["tr",{},...e.attrs.items.map(e=>["td",{},["strong",{},String(e.value??"")],["span",{},String(e.label??"")],...null!=e.delta?[["em",{},String(e.delta)]]:[]])]]]}),pv=[ue.configure({link:{openOnClick:!1,autolink:!0}}),pp.configure({allowBase64:!0}),pi,ps.configure({types:["heading","paragraph"]}),pu,ph,pm,pg,pb,py,pw,hg.configure({HTMLAttributes:{class:"studio-tasks"}}),hm.configure({nested:!1})];function pk(e){let t=[];return e.state.doc.forEach((e,n)=>t.push({pos:n,size:e.nodeSize,type:e.type.name,label:e.textContent||String(e.attrs.alt||e.attrs.chart?.title||e.attrs.items?.[0]?.value||e.type.name)})),t}function px(e,t,n){let r=pk(e);if(t===n||!r[t]||n<0||n>=r.length)return!1;let i=r[t],s=e.state.doc.nodeAt(i.pos);if(!s)return!1;let o=n>t?r[n].pos+r[n].size:r[n].pos,l=e.state.tr.delete(i.pos,i.pos+i.size),a=l.mapping.map(o);return l.insert(a,s).setSelection(e5.create(l.doc,a)).scrollIntoView(),e.view.dispatch(l),!0}function pS(e,t){let n=e.state.doc.nodeAt(t);if(!n)return;let r=n.isTextblock?e3.near(e.state.doc.resolve(t+1)):e5.create(e.state.doc,t);e.view.dispatch(e.state.tr.setSelection(r).scrollIntoView()),e.view.focus()}e.s(["documentExtensions",0,pv],523278);var pC=e.i(209165),pM=e.i(943094);function pA({src:e,images:t,onApply:n}){let{t:r}=(0,aJ.useTranslation)(),[i,s]=(0,c.useState)({brightness:100,contrast:100,saturation:100,blur:0}),[o,a]=(0,c.useState)("original"),[d,h]=(0,c.useState)(!1),[u,p]=(0,c.useState)(!1),[f,m]=(0,c.useState)(!1),[g,y]=(0,c.useState)(!1),[b,w]=(0,c.useState)(""),[v,k]=(0,c.useState)(""),[x,S]=(0,c.useState)(""),C=`brightness(${i.brightness}%) contrast(${i.contrast}%) saturate(${i.saturation}%) blur(${i.blur}px)`,M=async()=>{m(!0),y(!1);try{let i=await (0,pM.inlineOwnImages)([e]),s=new Image;s.crossOrigin="anonymous",s.src=i[e]||e,await s.decode();let l="original"===o?s.naturalWidth/s.naturalHeight:Number(o),a=Math.min(s.naturalWidth,s.naturalHeight*l),c=a/l,h=document.createElement("canvas"),p=Math.min(1,4096/Math.max(a,c));h.width=Math.max(1,Math.round(a*p)),h.height=Math.max(1,Math.round(c*p));let f=h.getContext("2d");f.filter=C,f.translate(d?h.width:0,u?h.height:0),f.scale(d?-1:1,u?-1:1),f.drawImage(s,(s.naturalWidth-a)/2,(s.naturalHeight-c)/2,a,c,0,0,h.width,h.height);let m=await new Promise((e,t)=>h.toBlob(n=>n?e(n):t(Error(r("studio.imageEncodingFailed"))),"image/png"));if(m.size>12e6)throw Error(r("studio.imageTooLarge"));n(await t.upload(new File([m],"edited-image.png",{type:"image/png"})))}catch{y(!0)}finally{m(!1)}};return(0,l.jsxs)("details",{className:"studio-property-section",children:[(0,l.jsx)("summary",{children:r("studio.imageAdjustments")}),(0,l.jsxs)("fieldset",{disabled:f||t.busy,children:[(0,l.jsx)("div",{className:"studio-image-adjust-preview",style:{aspectRatio:"original"===o?"16/9":o},children:(0,l.jsx)("img",{src:e,alt:r("studio.imagePreview"),style:{filter:C,transform:`scale(${d?-1:1},${u?-1:1})`,objectFit:"original"===o?"contain":"cover"}})}),(0,l.jsxs)("label",{children:[r("studio.crop"),(0,l.jsxs)("select",{"aria-label":r("studio.crop"),value:o,onChange:e=>a(e.target.value),children:[(0,l.jsx)("option",{value:"original",children:r("studio.original")}),[["1:1",1],["16:9",16/9],["4:3",4/3],["3:4",3/4],["9:16",9/16]].map(([e,t])=>(0,l.jsx)("option",{value:t,children:e},e))]})]}),Object.keys(i).map(e=>(0,l.jsxs)("label",{children:[r(`studio.${e}`)," ",(0,l.jsx)("output",{children:i[e]}),(0,l.jsx)("input",{"aria-label":r(`studio.${e}`),type:"range",min:0,max:"blur"===e?12:200,value:i[e],onChange:t=>s({...i,[e]:Number(t.target.value)})})]},e)),(0,l.jsxs)("div",{className:"studio-tools",children:[(0,l.jsx)("button",{"aria-pressed":d,onClick:()=>h(!d),children:r("studio.flipHorizontal")}),(0,l.jsx)("button",{"aria-pressed":u,onClick:()=>p(!u),children:r("studio.flipVertical")})]}),(0,l.jsx)("p",{className:"studio-help",children:r("studio.imageAdjustmentsHint")}),(0,l.jsx)("button",{onClick:()=>void M(),children:r(f?"studio.saving":"studio.applyImageAdjustments")}),(0,l.jsxs)("details",{className:"studio-property-section",children:[(0,l.jsx)("summary",{children:r("studio.aiImageEdit")}),(0,l.jsx)("p",{className:"studio-help",children:r("studio.aiImageEditHint")}
89),(0,l.jsxs)("label",{children:[r("studio.imagePrompt"),(0,l.jsx)("textarea",{maxLength:600,value:b,onChange:e=>w(e.target.value)})]}),(0,l.jsx)("div",{className:"studio-tools",children:["removeObject","changeBackground","enhanceImage"].map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>w(r(`studio.${e}Prompt`)),children:r(`studio.${e}`)},e))}),(0,l.jsx)("button",{disabled:!b.trim(),onClick:async()=>{m(!0),S(""),k("");try{let t=await (0,pM.inlineOwnImages)([e]),n=await fetch(t[e]||e);if(!n.ok)throw Error(r("studio.imageFailed"));let i=await n.blob();if(i.size>12e6)throw Error(r("studio.imageFailed"));let s=new FormData;s.append("file",i,"source-image"),s.append("prompt",b);let o=await (await (0,pC.apiFetch)("/api/v1/studio/image-edit",{method:"POST",body:s})).json();k(o.url)}catch(e){S(e instanceof Error?e.message:r("studio.imageFailed"))}finally{m(!1)}},children:r(f?"studio.generating":"studio.generatePreview")}),v&&(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsx)("img",{src:v,alt:r("studio.imagePreview"),style:{width:"100%"}}),(0,l.jsx)("p",{children:r("studio.reviewImageEdit")}),(0,l.jsx)("button",{onClick:()=>{n(v),k("")},children:r("studio.applyImageAdjustments")}),(0,l.jsx)("button",{onClick:()=>k(""),children:r("studio.cancel")})]}),x&&(0,l.jsx)("p",{role:"alert",children:x})]})]}),g&&(0,l.jsx)("p",{role:"alert",children:r("studio.imageFailed")})]})}e.s(["ImageEffects",0,pA],248120);let pE={type:"bar",title:"Chart",x:["A","B","C"],series:[{name:"Series 1",data:[3,5,4]}]},pT=Object.keys(a.IMAGE_ASPECTS),pO=e=>!e.src&&!!String(e.prompt||"").trim(),pN=e=>!!(e&&/^image\/(png|jpeg|webp|gif)$/.test(e.type)&&e.size<=12e6);function pD(e){let t,n,r,i,s,o,a,d,h,u,p,f,m,g,y,b,w,v,k,x,S,C,M,A,E,T,O,N,D,R,I,L,_,P,j,z=(0,po.c)(104),{props:$,onPatch:B,images:V,assets:H,t:F}=e,[U,W]=(0,c.useState)(!1);z[0]!==B?(t=async e=>{W(!1);try{B({src:await e()})}catch{W(!0)}},z[0]=B,z[1]=t):t=z[1];let q=t;z[2]!==$||z[3]!==F?(n=pO($)&&(0,l.jsx)("p",{className:"studio-notice",children:F("studio.pendingImage")}),z[2]=$,z[3]=F,z[4]=n):n=z[4],z[5]!==F?(r=F("studio.imagePrompt"),z[5]=F,z[6]=r):r=z[6],z[7]!==F?(i=F("studio.imagePrompt"),z[7]=F,z[8]=i):i=z[8];let K=String($.prompt||"");z[9]!==B?(s=e=>B({prompt:e.target.value}),z[9]=B,z[10]=s):s=z[10],z[11]!==i||z[12]!==K||z[13]!==s?(o=(0,l.jsx)("textarea",{"aria-label":i,value:K,onChange:s,maxLength:600}),z[11]=i,z[12]=K,z[13]=s,z[14]=o):o=z[14],z[15]!==r||z[16]!==o?(a=(0,l.jsxs)("label",{children:[r,o]}),z[15]=r,z[16]=o,z[17]=a):a=z[17],z[18]!==F?(d=F("studio.aspect"),z[18]=F,z[19]=d):d=z[19],z[20]!==F?(h=F("studio.aspect"),z[20]=F,z[21]=h):h=z[21];let J=String($.aspect||"16:9");z[22]!==B?(u=e=>B({aspect:e.target.value}),z[22]=B,z[23]=u):u=z[23],z[24]===Symbol.for("react.memo_cache_sentinel")?(p=pT.map(pR),z[24]=p):p=z[24],z[25]!==h||z[26]!==J||z[27]!==u?(f=(0,l.jsx)("select",{"aria-label":h,value:J,onChange:u,children:p}),z[25]=h,z[26]=J,z[27]=u,z[28]=f):f=z[28],z[29]!==f||z[30]!==d?(m=(0,l.jsxs)("label",{className:"studio-field",children:[d,f]}),z[29]=f,z[30]=d,z[31]=m):m=z[31],z[32]!==V.busy||z[33]!==$.prompt?(g=V.busy||!String($.prompt||"").trim(),z[32]=V.busy,z[33]=$.prompt,z[34]=g):g=z[34],z[35]!==V||z[36]!==$.aspect||z[37]!==$.prompt||z[38]!==q?(y=()=>void q(()=>V.generate(String($.prompt),String($.aspect||"16:9"))),z[35]=V,z[36]=$.aspect,z[37]=$.prompt,z[38]=q,z[39]=y):y=z[39];let G=V.busy?"studio.generating":$.src?"studio.regenerate":"studio.generateImage";z[40]!==F||z[41]!==G?(b=F(G),z[40]=F,z[41]=G,z[42]=b):b=z[42],z[43]!==g||z[44]!==y||z[45]!==b?(w=(0,l.jsx)("button",{disabled:g,onClick:y,children:b}),z[43]=g,z[44]=y,z[45]=b,z[46]=w):w=z[46],z[47]!==F?(v=F("studio.uploadImage"),z[47]=F,z[48]=v):v=z[48],z[49]!==V||z[50]!==q?(k=(0,l.jsx)("input",{className:"rlBare",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:e=>{let t=e.target.files?.[0];e.target.value="",pN(t)?q(()=>V.upload(t)):W(!0)}}),z[49]=V,z[50]=q,z[51]=k):k=z[51],z[52]!==v||z[53]!==k?(x=(0,l.jsxs)("label",{className:"studio-import",children:[v,k]}),z[52]=v,z[53]=k,z[54]=x):x=z[54],z[55]!==m||z[56]!==w||z[57]!==x?(S=(0,l.jsxs)("div",{className:"studio-tools",children:[m,w,x]}),z[55]=m,z[56]=w,z[57]=x,z[58]=S):S=z[58],z[59]!==F?(C=F("studio.altText"),z[59]=F,z[60]=C):C=z[60],z[61]!==F?(M=F("studio.altText"),z[61]=F,z[62]=M):M=z[62];let X=String($.alt||"");z[63]!==B?(A=e=>B({alt:e.target.value}),z[63]=B,z[64]=A):A=z[64],z[65]!==M||z[66]!==X||z[67]!==A?(E=(0,l.jsx)("input",{"aria-label":M,value:X,onChange:A}),z[65]=M,z[66]=X,z[67]=A,z[68]=E):E=z[68],z[69]!==C||z[70]!==E?(T=(0,l.jsxs)("label",{children:[C,E]}),z[69]=C,z[70]=E,z[71]=T):T=z[71],z[72]!==F?(O=F("studio.imageUrl"),z[72]=F,z[73]=O):O=z[73],z[74]!==F?(N=F("studio.imageUrl"),z[74]=F,z[75]=N):N=z[75];let Y=String($.src||"");return z[76]!==B?(D=e=>B({src:e.target.value}),z[76]=B,z[77]=D):D=z[77],z[78]!==N||z[79]!==Y||z[80]!==D?(R=(0,l.jsx)("input",{"aria-label":N,value:Y,onChange:D}),z[78]=N,z[79]=Y,z[80]=D,z[81]=R):R=z[81],z[82]!==O||z[83]!==R?(I=(0,l.jsxs)("label",{children:[O,R]}),z[82]=O,z[83]=R,z[84]=I):I=z[84],z[85]!==V||z[86]!==B||z[87]!==$.src?(L=!!$.src&&(0,l.jsx)(pA,{src:String($.src),images:V,onApply:e=>B({src:e})},String($.src)),z[85]=V,z[86]=B,z[87]=$.src,z[88]=L):L=z[88],z[89]!==H||z[90]!==B?(_=H.length>0&&(0,l.jsx)("div",{className:"studio-asset-row",children:H.map(e=>(0,l.jsx)("button",{type:"button",title:e.title,onClick:()=>B({src:e.url}),children:(0,l.jsx)("img",{src:e.url,alt:e.title})},e.url))}),z[89]=H,z[90]=B,z[91]=_):_=z[91],z[92]!==U||z[93]!==F?(P=U&&(0,l.jsx)("p",{role:"alert",className:"studio-notice",children:F("studio.imageFailed")}),z[92]=U,z[93]=F,z[94]=P):P=z[94],z[95]!==n||z[96]!==S||z[97]!==T||z[98]!==I||z[99]!==L||z[100]!==_||z[101]!==P||z[102]!==a?(j=(0,l.jsxs)("div",{className:"studio-image-panel",children:[n,a,S,T,I,L,_,P]}),z[95]=n,z[96]=S,z[97]=T,z[98]=I,z[99]=L,z[100]=_,z[101]=P,z[102]=a,z[103]=j):j=z[103],j}function pR(e){return(0,l.jsx)("option",{value:e,children:e},e)}function pI(e){let t,n,r,i,s,o,d,h,u,p,f,m,g,y,b,w,v,k,x,S,C,M,A,E,T,O,N,D,R,I,L,_,P,j=(0,po.c)(93),{value:z,onChange:$}=e,{t:B}=(0,aJ.useTranslation)();j[0]!==z?(t=()=>{try{return(0,a.validateChart)(JSON.parse(z))}catch{return null}}
89,j[0]=z,j[1]=t):t=j[1];let[V,H]=(0,c.useState)(t),[F,U]=(0,c.useState)(!1),[W,q]=(0,c.useState)(0);if(j[2]!==z?(n=()=>{try{H((0,a.validateChart)(JSON.parse(z))),q(0)}catch{H(null)}},r=[z],j[2]=z,j[3]=n,j[4]=r):(n=j[3],r=j[4]),(0,c.useEffect)(n,r),!V){let e,t;return j[5]!==B?(e=B("studio.advancedChart"),j[5]=B,j[6]=e):e=j[6],j[7]!==e?(t=(0,l.jsx)("p",{className:"studio-notice",children:e}),j[7]=e,j[8]=t):t=j[8],t}j[9]!==B?(i=B("studio.chartTitle"),j[9]=B,j[10]=i):i=j[10],j[11]!==V?(s=e=>H({...V,title:e.target.value}),j[11]=V,j[12]=s):s=j[12],j[13]!==V.title||j[14]!==s?(o=(0,l.jsx)("input",{value:V.title,onChange:s}),j[13]=V.title,j[14]=s,j[15]=o):o=j[15],j[16]!==i||j[17]!==o?(d=(0,l.jsxs)("label",{className:"studio-field",children:[i,o]}),j[16]=i,j[17]=o,j[18]=d):d=j[18],j[19]!==B?(h=B("studio.chartType"),j[19]=B,j[20]=h):h=j[20];let K=V.type;return j[21]!==V?(u=e=>H({...V,type:e.target.value}),j[21]=V,j[22]=u):u=j[22],j[23]===Symbol.for("react.memo_cache_sentinel")?(p=["bar","line","area","stacked-bar","pie","donut","scatter"],j[23]=p):p=j[23],j[24]!==B?(f=p.map(e=>(0,l.jsx)("option",{value:e,children:B(`studio.chartTypes.${e}`)},e)),j[24]=B,j[25]=f):f=j[25],j[26]!==V.type||j[27]!==u||j[28]!==f?(m=(0,l.jsx)("select",{value:K,onChange:u,children:f}),j[26]=V.type,j[27]=u,j[28]=f,j[29]=m):m=j[29],j[30]!==m||j[31]!==h?(g=(0,l.jsxs)("label",{className:"studio-field",children:[h,m]}),j[30]=m,j[31]=h,j[32]=g):g=j[32],j[33]!==B?(y=B("studio.category"),j[33]=B,j[34]=y):y=j[34],j[35]!==y?(b=(0,l.jsx)("th",{children:y}),j[35]=y,j[36]=b):b=j[36],j[37]!==V||j[38]!==B?(w=V.series.map((e,t)=>(0,l.jsx)("th",{children:(0,l.jsx)("input",{"aria-label":B("studio.seriesName",{number:t+1}),value:e.name,onChange:e=>H({...V,series:V.series.map((n,r)=>r===t?{...n,name:e.target.value}:n)})})},t)),j[37]=V,j[38]=B,j[39]=w):w=j[39],j[40]!==b||j[41]!==w?(v=(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[b,w]})}),j[40]=b,j[41]=w,j[42]=v):v=j[42],j[43]!==V||j[44]!==W||j[45]!==B?(k=V.x.slice(20*W,20*W+20).map((e,t)=>{let n=20*W+t;return(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:(0,l.jsx)("input",{"aria-label":B("studio.categoryNumber",{number:n+1}),value:e,onChange:e=>H({...V,x:V.x.map((t,r)=>r===n?e.target.value:t)})})}),V.series.map((e,t)=>(0,l.jsx)("td",{children:(0,l.jsx)("input",{"aria-label":B("studio.cell",{row:n+1,column:t+1}),type:"number",value:Number.isFinite(e.data[n])?e.data[n]:"",onChange:e=>H({...V,series:V.series.map((r,i)=>i===t?{...r,data:r.data.map((t,r)=>r===n?""===e.target.value?NaN:Number(e.target.value):t)}:r)})})},t))]},n)}),j[43]=V,j[44]=W,j[45]=B,j[46]=k):k=j[46],j[47]!==k?(x=(0,l.jsx)("tbody",{children:k}),j[47]=k,j[48]=x):x=j[48],j[49]!==v||j[50]!==x?(S=(0,l.jsx)("div",{className:"studio-table-editor",children:(0,l.jsxs)("table",{children:[v,x]})}),j[49]=v,j[50]=x,j[51]=S):S=j[51],j[52]!==V?(C=()=>H({...V,x:[...V.x,`${V.x.length+1}`],series:V.series.map(p_)}),j[52]=V,j[53]=C):C=j[53],j[54]!==B?(M=B("studio.addRow"),j[54]=B,j[55]=M):M=j[55],j[56]!==C||j[57]!==M?(A=(0,l.jsx)("button",{onClick:C,children:M}),j[56]=C,j[57]=M,j[58]=A):A=j[58],j[59]!==V||j[60]!==B?(E=()=>H({...V,series:[...V.series,{name:`${B("studio.seriesName",{number:V.series.length+1})}`,data:V.x.map(pL)}]}),j[59]=V,j[60]=B,j[61]=E):E=j[61],j[62]!==B?(T=B("studio.addSeries"),j[62]=B,j[63]=T):T=j[63],j[64]!==E||j[65]!==T?(O=(0,l.jsx)("button",{onClick:E,children:T}),j[64]=E,j[65]=T,j[66]=O):O=j[66],j[67]!==V.x.length||j[68]!==W||j[69]!==B?(N=V.x.length>20&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{disabled:0===W,onClick:()=>q(W-1),children:B("studio.previous")}),(0,l.jsxs)("span",{children:[W+1," / ",Math.ceil(V.x.length/20)]}),(0,l.jsx)("button",{disabled:(W+1)*20>=V.x.length,onClick:()=>q(W+1),children:B("studio.next")})]}),j[67]=V.x.length,j[68]=W,j[69]=B,j[70]=N):N=j[70],j[71]!==A||j[72]!==O||j[73]!==N?(D=(0,l.jsxs)("div",{className:"studio-tools",children:[A,O,N]}),j[71]=A,j[72]=O,j[73]=N,j[74]=D):D=j[74],j[75]!==V||j[76]!==$?(R=()=>{try{(0,a.validateChart)(V),$(JSON.stringify(V)),U(!1)}catch{U(!0)}},j[75]=V,j[76]=$,j[77]=R):R=j[77],j[78]!==B?(I=B("studio.applyData"),j[78]=B,j[79]=I):I=j[79],j[80]!==R||j[81]!==I?(L=(0,l.jsx)("button",{onClick:R,children:I}),j[80]=R,j[81]=I,j[82]=L):L=j[82],j[83]!==F||j[84]!==B?(_=F&&(0,l.jsx)("p",{role:"alert",children:B("studio.invalidChart")}),j[83]=F,j[84]=B,j[85]=_):_=j[85],j[86]!==g||j[87]!==S||j[88]!==D||j[89]!==L||j[90]!==_||j[91]!==d?(P=(0,l.jsxs)("div",{className:"studio-chart-editor",children:[d,g,S,D,L,_]}),j[86]=g,j[87]=S,j[88]=D,j[89]=L,j[90]=_,j[91]=d,j[92]=P):P=j[92],P}function pL(){return 0}function p_(e){return{...e,data:[...e.data,0]}}function pP(e){let t,n,r,i,s,o,a=(0,po.c)(21),{items:c,onChange:d}=e,{t:h}=(0,aJ.useTranslation)();a[0]!==c||a[1]!==d?(t=(e,t)=>
89d(c.map((n,r)=>r===e?{...n,...t}:n)),a[0]=c,a[1]=d,a[2]=t):t=a[2];let u=t;a[3]!==c||a[4]!==d||a[5]!==h||a[6]!==u?(n=c.map((e,t)=>(0,l.jsxs)("div",{className:"studio-stat-row",children:[(0,l.jsx)("input",{"aria-label":`${h("studio.statValue")} ${t+1}`,value:e.value,maxLength:80,placeholder:h("studio.statValue"),onChange:e=>u(t,{value:e.target.value})}),(0,l.jsx)("input",{"aria-label":`${h("studio.statLabel")} ${t+1}`,value:e.label,maxLength:80,placeholder:h("studio.statLabel"),onChange:e=>u(t,{label:e.target.value})}),(0,l.jsx)("input",{"aria-label":`${h("studio.statDelta")} ${t+1}`,value:e.delta||"",maxLength:80,placeholder:h("studio.statDelta"),onChange:e=>u(t,{delta:e.target.value||void 0})}),(0,l.jsx)("button",{"aria-label":`${h("studio.removeStat")} ${t+1}`,disabled:c.length<=1,onClick:()=>d(c.filter((e,n)=>n!==t)),children:"×"})]},t)),a[3]=c,a[4]=d,a[5]=h,a[6]=u,a[7]=n):n=a[7];let p=c.length>=6;return a[8]!==c||a[9]!==d||a[10]!==h?(r=()=>d([...c,{value:"0",label:h("studio.statLabel")}]),a[8]=c,a[9]=d,a[10]=h,a[11]=r):r=a[11],a[12]!==h?(i=h("studio.addStat"),a[12]=h,a[13]=i):i=a[13],a[14]!==p||a[15]!==r||a[16]!==i?(s=(0,l.jsx)("button",{disabled:p,onClick:r,children:i}),a[14]=p,a[15]=r,a[16]=i,a[17]=s):s=a[17],a[18]!==n||a[19]!==s?(o=(0,l.jsxs)("div",{className:"studio-stats-editor",children:[n,s]}),a[18]=n,a[19]=s,a[20]=o):o=a[20],o}e.s(["ChartEditor",0,pI,"DEFAULT_CHART",0,pE,"ImagePanel",0,pD,"StatsEditor",0,pP,"isImageFile",0,pN,"isPending",0,pO],510096);var pj=e.i(667719);let pz=()=>new Map,p$=e=>{let t=pz();return e.forEach((e,n)=>{t.set(n,e)}),t},pB=(e,t,n)=>{let r=e.get(t);return void 0===r&&e.set(t,r=n()),r},pV=()=>new Set,pH=e=>e[e.length-1],pF=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},pU=Array.from,pW=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},pq=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},pK=Array.isArray;class pJ{constructor(){this._observers=pz()}on(e,t){return pB(this._observers,e,pV).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);void 0!==n&&(n.delete(t),0===n.size&&this._observers.delete(e))}emit(e,t){return pU((this._observers.get(e)||pz()).values()).forEach(e=>e(...t))}destroy(){this._observers=pz()}}e.s(["Observable",0,class{constructor(){this._observers=pz()}on(e,t){pB(this._observers,e,pV).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);void 0!==n&&(n.delete(t),0===n.size&&this._observers.delete(e))}emit(e,t){return pU((this._observers.get(e)||pz()).values()).forEach(e=>e(...t))}destroy(){this._observers=pz()}},"ObservableV2",0,pJ],850050);let pG=Math.floor,pX=Math.ceil,pY=Math.abs,pQ=Math.round,pZ=Math.log10,p0=(e,t)=>e<t?e:t,p1=(e,t)=>e>t?e:t,p2=e=>0!==e?e<0:1/e<0;e.s(["abs",0,pY,"ceil",0,pX,"exp10",0,e=>Math.pow(10,e),"floor",0,pG,"isNegativeZero",0,p2,"log10",0,pZ,"max",0,p1,"min",0,p0,"round",0,pQ],399993);let p3=Number.MAX_SAFE_INTEGER,p4=Number.MIN_SAFE_INTEGER,p5=Number.isInteger||(e=>"number"==typeof e&&isFinite(e)&&pG(e)===e),p6=String.fromCharCode;p6(65535);let p8=/^\s*/g,p9=/([A-Z])/g,p7=(e,t)=>e.replace(p9,e=>`${t}${e.toLowerCase()}`).replace(p8,""),fe="u">typeof TextEncoder?new TextEncoder:null,ft=fe?e=>fe.encode(e):e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},fn="u"<typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});fn&&1===fn.decode(new Uint8Array).length&&(fn=null);let fr=(e,t)=>((e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n})(t,()=>e).join("");class fi{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}let fs=()=>new fi,fo=e=>{let t=fs();return e(t),fa(t)},fl=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},fa=e=>{let t=new Uint8Array(fl(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},fc=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*n),e.cpos=0),e.cbuf[e.cpos++]=t},fd=(e,t)=>{for(;t>127;)fc(e,128|127&t),t=pG(t/128);fc(e,127&t)},fh=(e,t)=>{let n=p2(t);for(n&&(t=-t),fc(e,128*(t>63)|64*!!n|63&t),t=pG(t/64);t>0;)fc(e,128*(t>127)|127&t),t=pG(t/128)},fu=new Uint8Array(3e4),fp=fu.length/3,ff=fe&&fe.encodeInto?(e,t)=>{if(t.length<fp){let n=fe.encodeInto(t,fu).written||0;fd(e,n);for(let t=0;t<n;t++)fc(e,fu[t])}else fg(e,ft(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;fd(e,r);for(let t=0;t<r;t++)fc(e,n.codePointAt(t))},fm=(e,t)=>
89{let n=e.cbuf.length,r=e.cpos,i=p0(n-r,t.length),s=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,s>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(p1(2*n,s)),e.cbuf.set(t.subarray(i)),e.cpos=s)},fg=(e,t)=>{fd(e,t.byteLength),fm(e,t)},fy=(e,t)=>{let n;(n=e.cbuf.length)-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(2*p1(n,t)),e.cpos=0);let r=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,r},fb=new DataView(new ArrayBuffer(4)),fw=(e,t)=>{switch(typeof t){case"string":fc(e,119),ff(e,t);break;case"number":if(p5(t)&&0x7fffffff>=pY(t))fc(e,125),fh(e,t);else if(fb.setFloat32(0,t),fb.getFloat32(0)===t)fc(e,124),fy(e,4).setFloat32(0,t,!1);else fc(e,123),fy(e,8).setFloat64(0,t,!1);break;case"bigint":fc(e,122),fy(e,8).setBigInt64(0,t,!1);break;case"object":if(null===t)fc(e,126);else if(pK(t)){fc(e,117),fd(e,t.length);for(let n=0;n<t.length;n++)fw(e,t[n])}else if(t instanceof Uint8Array)fc(e,116),fg(e,t);else{fc(e,118);let n=Object.keys(t);fd(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];ff(e,i),fw(e,t[i])}}break;case"boolean":fc(e,t?120:121);break;default:fc(e,127)}};class fv extends fi{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&fd(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}let fk=e=>{e.count>0&&(fh(e.encoder,1===e.count?e.s:-e.s),e.count>1&&fd(e.encoder,e.count-2))};class fx{constructor(){this.encoder=new fi,this.s=0,this.count=0}write(e){this.s===e?this.count++:(fk(this),this.count=1,this.s=e)}toUint8Array(){return fk(this),fa(this.encoder)}}let fS=e=>{if(e.count>0){let t=2*e.diff+ +(1!==e.count);fh(e.encoder,t),e.count>1&&fd(e.encoder,e.count-2)}};class fC{constructor(){this.encoder=new fi,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(fS(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return fS(this),fa(this.encoder)}}class fM{constructor(){this.sarr=[],this.s="",this.lensE=new fx}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){let e=new fi;return this.sarr.push(this.s),this.s="",ff(e,this.sarr.join("")),fm(e,this.lensE.toUint8Array()),fa(e)}}e.s(["IntDiffOptRleEncoder",0,fC,"RleEncoder",0,fv,"StringEncoder",0,fM,"UintOptRleEncoder",0,fx,"createEncoder",0,fs,"encode",0,fo,"length",0,fl,"toUint8Array",0,fa,"write",0,fc,"writeAny",0,fw,"writeBinaryEncoder",0,(e,t)=>fm(e,fa(t)),"writeUint8",0,fc,"writeUint8Array",0,fm,"writeVarInt",0,fh,"writeVarString",0,ff,"writeVarUint",0,fd,"writeVarUint8Array",0,fg],968575);let fA=e=>Error(e),fE=()=>{throw fA("Method unimplemented")},fT=()=>{throw fA("Unexpected case")};e.s(["create",0,fA,"methodUnimplemented",0,fE,"unexpectedCase",0,fT],765381);let fO=fA("Unexpected end of array"),fN=fA("Integer out of Range");class fD{constructor(e){this.arr=e,this.pos=0}}let fR=e=>new fD(e),fI=e=>e.pos!==e.arr.length,fL=e=>{var t;let n;return t=fP(e),n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t),e.pos+=t,n},f_=e=>e.arr[e.pos++],fP=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(127&r)*n,n*=128,r<128)return t;if(t>p3)throw fN}throw fO},fj=e=>{let t=e.arr[e.pos++],n=63&t,r=64,i=(64&t)>0?-1:1;if((128&t)==0)return i*n;let s=e.arr.length;for(;e.pos<s;){if(n+=(127&(t=e.arr[e.pos++]))*r,r*=128,t<128)return i*n;if(n>p3)throw fN}throw fO},fz=fn?e=>fn.decode(fL(e)):e=>{let t=fP(e);if(0===t)return"";{let n=String.fromCodePoint(f_(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(f_(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},f$=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},fB=[e=>void 0,e=>null,fj,e=>f$(e,4).getFloat32(0,!1),e=>f$(e,8).getFloat64(0,!1),e=>f$(e,8).getBigInt64(0,!1),e=>!1,e=>!0,fz,e=>{let t=fP(e),n={};for(let r=0;r<t;r++)n[fz(e)]=fV(e);return n},e=>{let t=fP(e),n=[];for(let r=0;r<t;r++)n.push(fV(e));return n},fL],fV=e=>fB[127-f_(e)](e);class fH extends fD{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return 0===this.count&&(this.s=this.reader(this),fI(this)?this.count=fP(this)+1:this.count=-1),this.count--,this.s}}class fF extends fD{constructor(e){super(e),this.s=0,this.count=0}read(){if(0===this.count){this.s=fj(this);let e=p2(this.s);this.count=1,e&&(this.s=-this.s,this.count=fP(this)+2)}return this.count--,this.s}}class fU extends fD{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){let e=fj(this);this.diff=pG(e/2),this.count=1,1&e&&(this.count=fP(this)+2)}return this.s+=this.diff,this.count--,this.s}}class fW{constructor(e){this.decoder=new fF(e),this.str=fz(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}e.s(["IntDiffOptRleDecoder",0,fU,"RleDecoder",0,fH,"StringDecoder",0,fW,"UintOptRleDecoder",0,fF,"createDecoder",0,fR,"hasContent",0,fI,"peekVarString",0,e=>{let t=e.pos,n=fz(e);
89return e.pos=t,n},"readAny",0,fV,"readUint8",0,f_,"readVarInt",0,fj,"readVarString",0,fz,"readVarUint",0,fP,"readVarUint8Array",0,fL],297907),crypto.subtle;let fq=crypto.getRandomValues.bind(crypto),fK=Math.random,fJ=()=>fq(new Uint32Array(1))[0],fG=Date.now;e.s(["getUnixTime",0,fG],849074);let fX=e=>new Promise(e),fY=Promise.all.bind(Promise);e.s(["all",0,fY,"create",0,fX],560050);var fQ=e.i(725922);let fZ=e=>void 0===e?null:e,f0=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{"u">typeof localStorage&&localStorage&&(f0=localStorage)}catch(e){}let f1=f0,f2=Symbol("Equality"),f3=(e,t)=>e===t||!!e?.[f2]?.(t),f4=Object.assign,f5=Object.keys,f6=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},f8=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f9=Object.freeze,f7=e=>{for(let t in e){let n=e[t];("object"==typeof n||"function"==typeof n)&&f7(e[t])}return f9(e)},me=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&me(e,t,n+1)}},mt=e=>e,mn=(e,t)=>{if(e===t)return!0;if(null==e||null==t||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(null!=e[f2])return e[f2](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!mn(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(f5(e).length!==f5(t).length)return!1;for(let n in e)if(!f8(e,n)||!mn(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!mn(e[n],t[n]))return!1;break;default:return!1}return!0},mr=(e,t)=>t.includes(e);e.s(["callAll",0,me,"equalityDeep",0,mn,"equalityStrict",0,(e,t)=>e===t,"id",0,mt,"isOneOf",0,mr,"nop",0,()=>{}],709646);let mi=void 0!==d.default&&d.default.release&&/node|io\.js/.test(d.default.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==d.default?d.default:0),ms="u">typeof window&&"u">typeof document&&!mi;"u">typeof navigator&&/Mac/.test(navigator.platform);let mo=[],ml=e=>(()=>{if(void 0===r)if(mi){r=pz();let e=d.default.argv,t=null;for(let n=0;n<e.length;n++){let i=e[n];"-"===i[0]?(null!==t&&r.set(t,""),t=i):null!==t?(r.set(t,i),t=null):mo.push(i)}null!==t&&r.set(t,"")}else"object"==typeof location?(r=pz(),(location.search||"?").slice(1).split("&").forEach(e=>{if(0!==e.length){let[t,n]=e.split("=");r.set(`--${p7(t,"-")}`,n),r.set(`-${p7(t,"-")}`,n)}})):r=pz();return r})().has(e),ma=e=>mi?fZ(d.default.env[e.toUpperCase().replaceAll("-","_")]):fZ(f1.getItem(e)),mc=e=>ml("--"+e)||null!==ma(e),md=mc("production"),mh=mi&&mr(d.default.env.FORCE_COLOR,["true","1","2"])||!ml("--no-colors")&&!mc("no-color")&&(!mi||d.default.stdout.isTTY)&&(!mi||ml("--color")||null!==ma("COLORTERM")||(ma("TERM")||"").includes("color")),mu=ms?e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=p6(e[n]);return btoa(t)}:e=>fQ.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");class mp{constructor(e,t){this.left=e,this.right=t}}let mf=(e,t)=>new mp(e,t),mm=e=>e.next()>=.5,mg=(e,t,n)=>pG(e.next()*(n+1-t)+t),my=(e,t,n)=>pG(e.next()*(n+1-t)+t),mb=e=>p6(my(e,97,122)),mw=(e,t)=>t[my(e,0,t.length-1)],mv=Symbol("0schema");class mk{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(fr(" ",(this._rerrs.length-t)*2)+`${null!=n.path?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join("\n")}}let mx=(e,t)=>e===t||null!=e&&null!=t&&e.constructor===t.constructor&&(e[f2]?f3(e,t):pK(e)?pW(e,e=>pq(t,t=>mx(e,t))):"object"==typeof e&&f6(e,(e,n)=>mx(e,t[n])));class mS{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),mx(t,n)}equals(e){return this.constructor===e.constructor&&mn(this.shape,e.shape)}[mv](){return!0}[f2](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){fE()}get nullable(){return mZ(this,gi)}get optional(){return new mL(this)}cast(e){return ga(e,this),e}expect(e){return ga(e,this),e}}class mC extends mS{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e?.constructor===this.shape&&(null==this._c||this._c(e));
89return n||t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}}let mM=(e,t=null)=>new mC(e,t);mM(mC);class mA extends mS{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return n||t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}}let mE=e=>new mA(e);mM(mA);class mT extends mS{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return n||t?.extend(null,this.shape.join(" | "),e.toString()),n}}let mO=(...e)=>new mT(e),mN=mM(mT),mD=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),mR=e=>m7.check(e)?[mD(e)]:mN.check(e)?e.shape.map(e=>e+""):m9.check(e)?["[+-]?\\d+.?\\d*"]:ge.check(e)?[".*"]:m0.check(e)?e.shape.map(mR).flat(1):void fT();mM(class extends mS{constructor(e){super(),this.shape=e,this._r=RegExp("^"+e.map(mR).map(e=>`(${e.join("|")})`).join("")+"$")}check(e,t){let n=null!=this._r.exec(e);return n||t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),n}});let mI=Symbol("optional");class mL extends mS{constructor(e){super(),this.shape=e}check(e,t){let n=void 0===e||this.shape.check(e);return n||t?.extend(null,"undefined (optional)","()"),n}get[mI](){return!0}}let m_=mM(mL);class mP extends mS{check(e,t){return t?.extend(null,"never",typeof e),!1}}new mP,mM(mP);class mj extends mS{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new mj(this.shape,!0)}check(e,t){return null==e?(t?.extend(null,"object","null"),!1):f6(this.shape,(n,r)=>{let i=this._isPartial&&!f8(e,r)||n.check(e[r],t);return i||t?.extend(r.toString(),n.toString(),typeof e[r],"Object property does not match"),i})}}let mz=mM(mj),m$=mE(e=>null!=e&&(e.constructor===Object||null==e.constructor));class mB extends mS{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return null!=e&&f6(e,(n,r)=>{let i=this.shape.keys.check(r,t);return i||t?.extend(r+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(n,t)})}}let mV=(e,t)=>new mB(e,t),mH=mM(mB);class mF extends mS{constructor(e){super(),this.shape=e}check(e,t){return null!=e&&f6(this.shape,(n,r)=>{let i=n.check(e[r],t);return i||t?.extend(r.toString(),"Tuple",typeof n),i})}}mM(mF);class mU extends mS{constructor(e){super(),this.shape=1===e.length?e[0]:new mQ(e)}check(e,t){let n=pK(e)&&pW(e,e=>this.shape.check(e));return n||t?.extend(null,"Array",""),n}}let mW=(...e)=>new mU(e),mq=mM(mU),mK=mE(e=>pK(e));class mJ extends mS{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(null==this._c||this._c(e));return n||t?.extend(null,this.shape.name,e?.constructor.name),n}}mM(mJ);let mG=((e,t=null)=>new mJ(e,t))(mS),mX=mM(class extends mS{constructor(e){super(),this.len=e.length-1,this.args=((...e)=>new mF(e))(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return n||t?.extend(null,"function",typeof e),n}}),mY=mE(e=>"function"==typeof e);mM(class extends mS{constructor(e){super(),this.shape=e}check(e,t){let n=pW(this.shape,n=>n.check(e,t));return n||t?.extend(null,"Intersectinon",typeof e),n}},e=>e.shape.length>0);class mQ extends mS{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=pq(this.shape,n=>n.check(e,t));return t?.extend(null,"Union",typeof e),n}}let mZ=(...e)=>e.findIndex(e=>m0.check(e))>=0?mZ(...e.map(e=>gl(e)).map(e=>m0.check(e)?e.shape:[e]).flat(1)):1===e.length?e[0]:new mQ(e),m0=mM(mQ),m1=()=>!0,m2=mE(m1),m3=mM(mA,e=>e.shape===m1),m4=mE(e=>"bigint"==typeof e),m5=mE(e=>e===m4),m6=mE(e=>"symbol"==typeof e);mE(e=>e===m6);let m8=mE(e=>"number"==typeof e),m9=mE(e=>e===m8),m7=mE(e=>"string"==typeof e),ge=mE(e=>e===m7),gt=mE(e=>"boolean"==typeof e),gn=mE(e=>e===gt),gr=mO(void 0);mM(mT,e=>1===e.shape.length&&void 0===e.shape[0]),mO(void 0);let gi=mO(null),gs=mM(mT,e=>1===e.shape.length&&null===e.shape[0]);mM(Uint8Array),mM(mC,e=>e.shape===Uint8Array);let go=mZ(m8,m7,gi,gr,m4,gt,m6);i=mW(m2),s=mV(m7,m2),o=mZ(m8,m7,gi,gt,i,s),i.shape=o,s.shape.values=o;let gl=e=>{if(mG.check(e))return e;if(m$.check(e)){let t={};for(let n in e)t[n]=gl(e[n]);return new mj(t)}if(mK.check(e))return mZ(...e.map(gl));if(go.check(e))return mO(e);if(mY.check(e))return mM(e);fT()},ga=md?()=>{}:(e,t)=>{let n=new mk;if(!t.check(e,n))throw fA(`Expected value to be of type ${t.constructor.name}.
90${n.toString()}`)},gc=new class e{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:gl(e),h:t}),this}else(e){return this.if(m2,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw fA("Unhandled pattern")}}}(m2).if(m9,(e,t)=>mg(t,p4,p3)).if(ge,(e,t)=>((e,t=0,n=20)=>{let r=my(e,t,n),i="";for(let t=0;t<r;t++)i+=mb(e);return i})(t)).if(gn,(e,t)=>mm(t)).if(m5,(e,t)=>BigInt(mg(t,p4,p3))).if(m0,(e,t)=>gd(t,mw(t,e.shape))).if(mz,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(m_.check(i)){if(mm(t))continue;i=i.shape}n[r]=gc(i,t)}return n}).if(mq,(e,t)=>{let n=[],r=my(t,0,42);for(let i=0;i<r;i++)n.push(gd(t,e.shape));return n}).if(mN,(e,t)=>mw(t,e.shape)).if(gs,(e,t)=>null).if(mX,(e,t)=>{let n=gd(t,e.res);return()=>n}).if(m3,(e,t)=>gd(t,mw(t,[m8,m7,gi,gr,m4,gt,mW(m8),mV(mZ("a","b","c"),m8)]))).if(mH,(e,t)=>{let n={},r=mg(t,0,3);for(let i=0;i<r;i++){let r=gd(t,e.shape.keys),i=gd(t,e.shape.values);n[r]=i}return n}).done(),gd=(e,t)=>gc(gl(t),e),gh="u">typeof document?document:{};mE(e=>e.nodeType===gg),"u">typeof DOMParser&&new DOMParser,mE(e=>e.nodeType===gp),mE(e=>e.nodeType===gf);let gu=e=>((e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n})(e,(e,t)=>`${t}:${e};`).join(""),gp=gh.ELEMENT_NODE,gf=gh.TEXT_NODE;gh.CDATA_SECTION_NODE,gh.COMMENT_NODE;let gm=gh.DOCUMENT_NODE;gh.DOCUMENT_TYPE_NODE;let gg=gh.DOCUMENT_FRAGMENT_NODE;mE(e=>e.nodeType===gm);let gy=e=>class{constructor(e){this._=e}destroy(){e(this._)}},gb=gy(clearTimeout),gw=(e,t)=>new gb(setTimeout(t,e));gy(clearInterval),gy(e=>"u">typeof requestAnimationFrame&&cancelAnimationFrame(e)),gy(e=>"u">typeof cancelIdleCallback&&cancelIdleCallback(e));
90let gv=Symbol,gk=gv(),gx=gv(),gS=gv(),gC=gv(),gM=gv(),gA=gv(),gE=gv(),gT=gv(),gO=gv();fG();let gN={[gk]:mf("font-weight","bold"),[gx]:mf("font-weight","normal"),[gS]:mf("color","blue"),[gM]:mf("color","green"),[gC]:mf("color","grey"),[gA]:mf("color","red"),[gE]:mf("color","purple"),[gT]:mf("color","orange"),[gO]:mf("color","black")},gD=mh?e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=pz(),i=[],s=0;for(;s<e.length;s++){let i=e[s],o=gN[i];if(void 0!==o)r.set(o.left,o.right);else{if(void 0===i)break;if(i.constructor===String||i.constructor===Number){let e=gu(r);s>0||e.length>0?(t.push("%c"+i),n.push(e)):t.push(i)}else break}}for(s>0&&(i=n).unshift(t.join(""));s<e.length;s++){let t=e[s];t instanceof Symbol||i.push(t)}return i}:e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(void 0===n)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n},gR=(...e)=>{console.warn(...gD(e)),e.unshift(gT),gI.forEach(t=>t.print(e))},gI=pV(),gL=e=>({[Symbol.iterator](){return this},next:e}),g_=(e,t)=>gL(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});class gP{constructor(e,t){this.clock=e,this.len=t}}class gj{constructor(){this.clients=new Map}}let gz=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(null!=i){let r=i[i.length-1],s=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<s;o=t[++r])yA(e,i,o.clock,o.len,n)}}),g$=(e,t)=>{let n=e.clients.get(t.client);return void 0!==n&&null!==((e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=pG((n+r)/2),s=e[i],o=s.clock;if(o<=t){if(t<o+s.len)return i;n=i+1}else r=i-1}return null})(n,t.clock)},gB=e=>{e.clients.forEach(e=>{let t,n;for(e.sort((e,t)=>e.clock-t.clock),t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new gP(r.clock,p1(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},gV=e=>{let t=new gj;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let s=r.slice();for(let t=n+1;t<e.length;t++)pF(s,e[t].clients.get(i)||[]);t.clients.set(i,s)}});return gB(t),t},gH=(e,t,n,r)=>{pB(e.clients,t,()=>[]).push(new gP(n,r))},gF=()=>new gj,gU=e=>{let t=gF();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,s=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])s+=n.length;r.push(new gP(i,s))}}r.length>0&&t.clients.set(n,r)}),t},gW=(e,t)=>{fd(e.restEncoder,t.clients.size),pU(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),fd(e.restEncoder,t);let r=n.length;fd(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},gq=e=>{let t=new gj,n=fP(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=fP(e.restDecoder),r=fP(e.restDecoder);if(r>0){let i=pB(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new gP(e.readDsClock(),e.readDsLen()))}}return t},gK=(e,t,n)=>{let r=new gj,i=fP(e.restDecoder);for(let s=0;s<i;s++){e.resetDsCurVal();let i=fP(e.restDecoder),s=fP(e.restDecoder),o=n.clients.get(i)||[],l=yw(n,i);for(let n=0;n<s;n++){let n=e.readDsClock(),s=n+e.readDsLen();if(n<l){l<s&&gH(r,i,l,s-l);let e=yk(o,n),a=o[e];for(!a.deleted&&a.id.clock<n&&(o.splice(e+1,0,b2(t,a,n-a.id.clock)),e++);e<o.length;)if((a=o[e++]).id.clock<s)a.deleted||(s<a.id.clock+a.length&&o.splice(e,0,b2(t,a,s-a.id.clock)),a.delete(t));else break}else gH(r,i,n,s-n)}}if(r.clients.size>0){let e=new g2;return fd(e.restEncoder,0),gW(e,r),e.toUint8Array()}return null};class gJ extends pJ{constructor({guid:e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^fJ()&15>>e/4).toString(16)),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=fJ(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new yy,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=fX(e=>{this.on("load",()=>{this.isLoaded=!0,e(this)})});const l=()=>fX(e=>{let t=n=>{(void 0===n||!0===n)&&(this.off("sync",t),e())};this.on("sync",t)});this.on("sync",e=>{!1===e&&this.isSynced&&(this.whenSynced=l()),this.isSynced=void 0===e||!0===e,this.isSynced&&!this.isLoaded&&this.emit
90("load",[this])}),this.whenSynced=l()}load(){let e=this._item;null===e||this.shouldLoad||yR(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(pU(this.subdocs).map(e=>e.guid))}transact(e,t=null){return yR(this,e,t)}get(e,t=y1){let n=pB(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==y1&&r!==t)if(r===y1){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;null!==e;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;null!==e;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=""){return this.get(e,ba)}getText(e=""){return this.get(e,bA)}getMap(e=""){return this.get(e,bd)}getXmlElement(e=""){return this.get(e,bO)}getXmlFragment(e=""){return this.get(e,bT)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,pU(this.subdocs).forEach(e=>e.destroy());let e=this._item;if(null!==e){this._item=null;let t=e.content;t.doc=new gJ({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,yR(e.parent.doc,n=>{let r=t.doc;e.deleted||n.subdocsAdded.add(r),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class gG{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return fP(this.restDecoder)}readDsLen(){return fP(this.restDecoder)}}class gX extends gG{readLeftID(){return yr(fP(this.restDecoder),fP(this.restDecoder))}readRightID(){return yr(fP(this.restDecoder),fP(this.restDecoder))}readClient(){return fP(this.restDecoder)}readInfo(){return f_(this.restDecoder)}readString(){return fz(this.restDecoder)}readParentInfo(){return 1===fP(this.restDecoder)}readTypeRef(){return fP(this.restDecoder)}readLen(){return fP(this.restDecoder)}readAny(){return fV(this.restDecoder)}readBuf(){var e=fL(this.restDecoder);let t=new Uint8Array(e.byteLength);return t.set(e),t}readJSON(){return JSON.parse(fz(this.restDecoder))}readKey(){return fz(this.restDecoder)}}class gY{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=fP(this.restDecoder),this.dsCurrVal}readDsLen(){let e=fP(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class gQ extends gY{constructor(e){super(e),this.keys=[],fP(e),this.keyClockDecoder=new fU(fL(e)),this.clientDecoder=new fF(fL(e)),this.leftClockDecoder=new fU(fL(e)),this.rightClockDecoder=new fU(fL(e)),this.infoDecoder=new fH(fL(e),f_),this.stringDecoder=new fW(fL(e)),this.parentInfoDecoder=new fH(fL(e),f_),this.typeRefDecoder=new fF(fL(e)),this.lenDecoder=new fF(fL(e))}readLeftID(){return new yt(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new yt(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return fV(this.restDecoder)}readBuf(){return fL(this.restDecoder)}readJSON(){return fV(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}}class gZ{constructor(){this.restEncoder=fs()}toUint8Array(){return fa(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){fd(this.restEncoder,e)}writeDsLen(e){fd(this.restEncoder,e)}}class g0 extends gZ{writeLeftID(e){fd(this.restEncoder,e.client),fd(this.restEncoder,e.clock)}writeRightID(e){fd(this.restEncoder,e.client),fd(this.restEncoder,e.clock)}writeClient(e){fd(this.restEncoder,e)}writeInfo(e){fc(this.restEncoder,e)}writeString(e){ff(this.restEncoder,e)}writeParentInfo(e){fd(this.restEncoder,+!!e)}writeTypeRef(e){fd(this.restEncoder,e)}writeLen(e){fd(this.restEncoder,e)}writeAny(e){fw(this.restEncoder,e)}writeBuf(e){fg(this.restEncoder,e)}writeJSON(e){ff(this.restEncoder,JSON.stringify(e))}writeKey(e){ff(this.restEncoder,e)}}class g1{constructor(){this.restEncoder=fs(),this.dsCurrVal=0}toUint8Array(){return fa(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,fd(this.restEncoder,t)}writeDsLen(e){0===e&&fT(),fd(this.restEncoder,e-1),this.dsCurrVal+=e}}class g2 extends g1{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new fC,this.clientEncoder=new fx,this.leftClockEncoder=new fC,this.rightClockEncoder=new fC,this.infoEncoder=new fv(fc),this.stringEncoder=new fM,this.parentInfoEncoder=new fv(fc),this.typeRefEncoder=new fx,this.lenEncoder=new fx}toUint8Array(){let e=fs();return fd(e,0),fg(e,this.keyClockEncoder.toUint8Array()),fg(e,this.clientEncoder.toUint8Array()),fg(e,this.leftClockEncoder.toUint8Array()),fg(e,this.rightClockEncoder.toUint8Array()),fg(e,fa(this.infoEncoder)),fg(e,this.stringEncoder.toUint8Array()),fg(e,fa(this.parentInfoEncoder)),fg(e,this.typeRefEncoder.toUint8Array()),fg(e,this.lenEncoder.toUint8Array()),fm(e,fa(this.restEncoder)),fa(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){fw(this.restEncoder,e)}writeBuf(e){fg(this.restEncoder,e)}writeJSON(e){fw(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);void 0===t?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}
90let g3=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{yw(t,n)>e&&r.set(n,e)}),yb(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),fd(e.restEncoder,r.size),pU(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{((e,t,n,r)=>{r=p1(r,t[0].id.clock);let i=yk(t,r);fd(e.restEncoder,t.length-i),e.writeClient(n),fd(e.restEncoder,r);let s=t[i];s.write(e,r-s.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)})(e,t.clients.get(n),n,r)})},g4=(e,t,n,r=gQ)=>{let i=fR(t);((e,t,n,r=new gQ(e))=>yR(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,s=((e,t,n)=>{let r=[],i=pU(n.keys()).sort((e,t)=>e-t);if(0===i.length)return null;let s=()=>{if(0===i.length)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;){if(i.pop(),!(i.length>0))return null;e=n.get(i[i.length-1])}return e},o=s();if(null===o)return null;let l=new yy,a=new Map,c=(e,t)=>{let n=a.get(e);(null==n||n>t)&&a.set(e,t)},d=o.refs[o.i++],h=new Map,u=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,l.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):l.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(d.constructor!==b9){let i=pB(h,d.id.client,()=>yw(t,d.id.client))-d.id.clock;if(i<0)r.push(d),c(d.id.client,d.id.clock-1),u();else{let s=d.getMissing(e,t);if(null!==s){r.push(d);let e=n.get(s)||{refs:[],i:0};if(e.refs.length===e.i)c(s,yw(t,s)),u();else{d=e.refs[e.i++];continue}}else(0===i||i<d.length)&&(d.integrate(e,i),h.set(d.id.client,d.id.clock+d.length))}}if(r.length>0)d=r.pop();else if(null!==o&&o.i<o.refs.length)d=o.refs[o.i++];else{if(null===(o=s()))break;d=o.refs[o.i++]}}if(l.clients.size>0){let e=new g2;return g3(e,l,new Map),fd(e.restEncoder,0),{missing:a,update:e.toUint8Array()}}return null})(e,i,((e,t)=>{let n=pz(),r=fP(e.restDecoder);for(let i=0;i<r;i++){let r=fP(e.restDecoder),i=Array(r),s=e.readClient(),o=fP(e.restDecoder);n.set(s,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new bL(yr(s,o),t),o+=t;break}case 10:{let t=fP(e.restDecoder);i[n]=new b9(yr(s,o),t),o+=t;break}default:{let l=(192&r)==0,a=new b5(yr(s,o),null,(128&r)==128?e.readLeftID():null,null,(64&r)==64?e.readRightID():null,l?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,l&&(32&r)==32?e.readString():null,b6(e,r));i[n]=a,o+=a.length}}}}return n})(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<yw(i,e)){t=!0;break}if(s){for(let[e,t]of s.missing){let n=o.missing.get(e);(null==n||n>t)&&o.missing.set(e,t)}o.update=yV([o.update,s.update])}}else i.pendingStructs=s;let l=gK(r,e,i);if(i.pendingDs){let t=new gQ(fR(i.pendingDs));fP(t.restDecoder);let n=gK(t,e,i);l&&n?i.pendingDs=yV([l,n]):i.pendingDs=l||n}else i.pendingDs=l;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,g4(e.doc,t)}},n,!1))(i,e,n,new r(i))},g5=e=>(e=>{let t=new Map,n=fP(e.restDecoder);for(let r=0;r<n;r++){let n=fP(e.restDecoder),r=fP(e.restDecoder);t.set(n,r)}return t})(new gG(fR(e))),g6=(e,t)=>(fd(e.restEncoder,t.size),pU(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{fd(e.restEncoder,t),fd(e.restEncoder,n)}),e);class g8{constructor(){this.l=[]}}let g9=()=>new g8,g7=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},ye=(e,t,n)=>me(e.l,[t,n]);class yt{constructor(e,t){this.client=e,this.clock=t}}let yn=(e,t)=>e===t||null!==e&&null!==t&&e.client===t.client&&e.clock===t.clock,yr=(e,t)=>new yt(e,t),yi=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw fT()},ys=(e,t)=>{for(;null!==t;){if(t.parent===e)return!0;t=t.parent._item}return!1};class yo{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}}let yl=e=>new yo(null==e.type?null:yr(e.type.client,e.type.clock),e.tname??null,null==e.item?null:yr(e.item.client,e.item.clock),null==e.assoc?0:e.assoc);class ya{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}}let yc=(e,t,n)=>{let r=null,i=null;return null===e._item?i=yi(e):r=yr(e._item.id.client,e._item.id.clock),new yo(r,i,t,n)},yd=(e,t,n=0)=>{let r=e._start;if(n<0){if(0===t)return yc(e,null,n);t--}for(;null!==r;){if(!r.deleted&&r.countable){if(r.length>t)return yc(e,yr(r.id.client,r.id.clock+t),n);t-=r.length}if(null===r.right&&n<0)return yc(e,r.lastId,n);r=r.right}return yc(e,null,n)},yh=(e,t,n=!0)=>{let r=t.store,i=e.item,s=e.type,o=e.tname,l=e.assoc,a=null,c=0;if(null!==i){let e,t;if(yw(r,i.client)<=i.clock)return null;
90let s=n?b0(r,i):(e=yx(r,i),t=i.clock-e.id.clock,{item:e,diff:t}),o=s.item;if(!(o instanceof b5))return null;if(null===(a=o.parent)._item||!a._item.deleted){c=o.deleted||!o.countable?0:s.diff+(l>=0?0:1);let e=o.left;for(;null!==e;)!e.deleted&&e.countable&&(c+=e.length),e=e.left}}else{if(null!==o)a=t.get(o);else if(null!==s){if(yw(r,s.client)<=s.clock)return null;let{item:e}=n?b0(r,s):{item:yx(r,s)};if(!(e instanceof b5)||!(e.content instanceof bZ))return null;a=e.content.type}else throw fT();c=l>=0?a._length:0}return((e,t,n=0)=>new ya(e,t,n))(a,c,e.assoc)};class yu{constructor(e,t){this.ds=e,this.sv=t}}let yp=(e,t)=>new yu(e,t);yp(gF(),new Map);let yf=e=>yp(gU(e.store),yb(e.store)),ym=(e,t)=>void 0===t?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!g$(t.ds,e.id),yg=(e,t)=>{let n=pB(e.meta,yg,pV),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<yw(r,n)&&yC(e,yr(n,t))}),gz(e,t.ds,e=>{}),n.add(t))};class yy{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}let yb=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},yw=(e,t)=>{let n=e.clients.get(t);if(void 0===n)return 0;let r=n[n.length-1];return r.id.clock+r.length},yv=(e,t)=>{let n=e.clients.get(t.id.client);if(void 0===n)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw fT()}n.push(t)},yk=(e,t)=>{let n=0,r=e.length-1,i=e[r],s=i.id.clock;if(s===t)return r;let o=pG(t/(s+i.length-1)*r);for(;n<=r;){if((s=(i=e[o]).id.clock)<=t){if(t<s+i.length)return o;n=o+1}else r=o-1;o=pG((n+r)/2)}throw fT()},yx=(e,t)=>{let n=e.clients.get(t.client);return n[yk(n,t.clock)]},yS=(e,t,n)=>{let r=yk(t,n),i=t[r];return i.id.clock<n&&i instanceof b5?(t.splice(r+1,0,b2(e,i,n-i.id.clock)),r+1):r},yC=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[yS(e,n,t.clock)]},yM=(e,t,n)=>{let r=t.clients.get(n.client),i=yk(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==bL&&r.splice(i+1,0,b2(e,s,n.clock-s.id.clock+1)),s},yA=(e,t,n,r,i)=>{let s;if(0===r)return;let o=n+r,l=yS(e,t,n);do o<(s=t[l++]).id.clock+s.length&&yS(e,t,o),i(s);while(l<t.length&&t[l].id.clock<o)};class yE{constructor(e,t,n){this.doc=e,this.deleteSet=new gj,this.beforeState=yb(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}let yT=(e,t)=>(0!==t.deleteSet.clients.size||!!((e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1})(t.afterState,(e,n)=>t.beforeState.get(n)!==e))&&(gB(t.deleteSet),g3(e,t.doc.store,t.beforeState),gW(e,t.deleteSet),!0),yO=(e,t,n)=>{let r=t._item;(null===r||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&pB(e.changed,t,pV).add(n)},yN=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof b5&&null!==n.parentSub&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let s=t-i;return s&&e.splice(t+1-s,s),s},yD=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{gB(s),n.afterState=yb(n.doc.store),r.emit("beforeObserverCalls",[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{null!==r._item&&r._item.deleted||r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(null===r._item||!r._item.deleted)&&((t=t.filter(e=>null===e.target._item||!e.target._item.deleted)).forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{ye(r._dEH,t,n)}))}),e.push(()=>r.emit("afterTransaction",[n,r])),e.push(()=>{n._needFormattingCleanup&&bS(n)})}),me(e,[])}finally{r.gc&&((e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let s=i[r],o=s.clock+s.len;for(let r=yk(e,s.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(s.clock+s.len<=i.id.clock)break;i instanceof b5&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}}
90)(s,i,r.gcFilter),s.clients.forEach((e,t)=>{let n=i.clients.get(t);for(let t=e.length-1;t>=0;t--){let r=e[t],i=p0(n.length-1,1+yk(n,r.clock+r.len-1));for(let e=i,t=n[e];e>0&&t.id.clock>=r.clock;t=n[e])e-=1+yN(n,e)}}),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=p1(yk(e,r),1);for(let t=e.length-1;t>=n;)t-=1+yN(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),s=yk(r,n);!(s+1<r.length&&yN(r,s+1)>1)&&s>0&&yN(r,s)}if(n.local||n.afterState.get(r.clientID)===n.beforeState.get(r.clientID)||(((...e)=>{console.log(...gD(e)),gI.forEach(t=>t.print(e))})(gT,gk,"[yjs] ",gx,gA,"Changed the client-id because another client seems to be using it."),r.clientID=fJ()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){let e=new g0;yT(e,n)&&r.emit("update",[e.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){let e=new g2;yT(e,n)&&r.emit("updateV2",[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=n;(l.size>0||c.size>0||a.size>0)&&(l.forEach(e=>{e.clientID=r.clientID,null==e.collectionid&&(e.collectionid=r.collectionid),r.subdocs.add(e)}),c.forEach(e=>r.subdocs.delete(e)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,n]),c.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):yD(e,t+1)}}},yR=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,s=!1,o=null;null===e._transaction&&(s=!0,e._transaction=new yE(e,n,r),i.push(e._transaction),1===i.length&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(s){let t=e._transaction===i[0];e._transaction=null,t&&yD(i,0)}}return o};class yI{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}let yL=(e,t,n)=>{gz(e,n.deletions,n=>{n instanceof b5&&t.scope.some(t=>t===e.doc||ys(t,n))&&b1(n,!1)})},y_=(e,t,n)=>{let r=null,i=e.doc,s=e.scope;yR(i,n=>{for(;t.length>0&&null===e.currStackItem;){let r=i.store,o=t.pop(),l=new Set,a=[],c=!1;gz(n,o.insertions,e=>{if(e instanceof b5){if(null!==e.redone){let{item:t,diff:i}=b0(r,e.id);i>0&&(t=yC(n,yr(t.id.client,t.id.clock+i))),e=t}!e.deleted&&s.some(t=>t===n.doc||ys(t,e))&&a.push(e)}}),gz(n,o.deletions,e=>{e instanceof b5&&s.some(t=>t===n.doc||ys(t,e))&&!g$(o.insertions,e.id)&&l.add(e)}),l.forEach(t=>{c=null!==b4(n,t,l,o.insertions,e.ignoreRemoteMapChanges,e)||c});for(let t=a.length-1;t>=0;t--){let r=a[t];e.deleteFilter(r)&&(r.delete(n),c=!0)}e.currStackItem=c?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(null!=o){let t=r.changedParentTypes;e.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o};class yP extends pJ{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:o=pK(e)?e[0].doc:e instanceof gJ?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new gj;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,s=t-r;s>0&&gH(i,n,r,s)});let s=fG(),o=!1;if(this.lastChange>0&&s-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=gV([t.deletions,e.deleteSet]),t.insertions=gV([t.insertions,i])}else r.push(new yI(e.deleteSet,i)),o=!0;t||n||(this.lastChange=s),gz(e,e.deleteSet,t=>{t instanceof b5&&this.scope.some(n=>n===e.doc||ys(n,t))&&b1(t,!0)});let l=[{stackItem:r[r.length-1],origin:e.origin,type:t?"redo":"undo",changedParentTypes:e.changedParentTypes},this];
90o?this.emit("stack-item-added",l):this.emit("stack-item-updated",l)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(e){let t=new Set(this.scope);(e=pK(e)?e:[e]).forEach(e=>{t.has(e)||(t.add(e),(e instanceof y1?e.doc!==this.doc:e!==this.doc)&&gR("[yjs#509] Not same Y.Doc"),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>yL(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>yL(n,this,e)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){let e;this.undoing=!0;try{e=y_(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){let e;this.redoing=!0;try{e=y_(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),this.doc.off("destroy",this.destroy),super.destroy()}}class yj{constructor(e,t){this.gen=function*(e){let t=fP(e.restDecoder);for(let n=0;n<t;n++){let t=fP(e.restDecoder),n=e.readClient(),r=fP(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(10===t){let t=fP(e.restDecoder);yield new b9(yr(n,r),t),r+=t}else if((31&t)!=0){let i=(192&t)==0,s=new b5(yr(n,r),null,(128&t)==128?e.readLeftID():null,null,(64&t)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(32&t)==32?e.readString():null,b6(e,t));yield s,r+=s.length}else{let t=e.readLen();yield new bL(yr(n,r),t),r+=t}}}}(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&null!==this.curr&&this.curr.constructor===b9)return this.curr}}class yz{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}let y$=e=>yV(e,gX,g0),yB=(e,t)=>{if(e.constructor===bL){let{client:n,clock:r}=e.id;return new bL(yr(n,r+t),e.length-t)}if(e.constructor===b9){let{client:n,clock:r}=e.id;return new b9(yr(n,r+t),e.length-t)}{let{client:n,clock:r}=e.id;return new b5(yr(n,r+t),null,yr(n,r+t-1),null,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t))}},yV=(e,t=gQ,n=g2)=>{if(1===e.length)return e[0];let r=e.map(e=>new t(fR(e))),i=r.map(e=>new yj(e,!0)),s=null,o=new n,l=new yz(o);for(;(i=i.filter(e=>null!==e.curr)).sort((e,t)=>{if(e.curr.id.client!==t.curr.id.client)return t.curr.id.client-e.curr.id.client;{let n=e.curr.id.clock-t.curr.id.clock;return 0===n?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===b9?1:-1:n}}),0!==i.length;){let e=i[0],t=e.curr.id.client;if(null!==s){let n=e.curr,r=!1;for(;null!==n&&n.id.clock+n.length<=s.struct.id.clock+s.struct.length&&n.id.client>=s.struct.id.client;)n=e.next(),r=!0;if(null===n||n.id.client!==t||r&&n.id.clock>s.struct.id.clock+s.struct.length)continue;if(t!==s.struct.id.client)yF(l,s.struct,s.offset),s={struct:n,offset:0},e.next();else if(s.struct.id.clock+s.struct.length<n.id.clock)if(s.struct.constructor===b9)s.struct.length=n.id.clock+n.length-s.struct.id.clock;else{yF(l,s.struct,s.offset);let e=n.id.clock-s.struct.id.clock-s.struct.length;s={struct:new b9(yr(t,s.struct.id.clock+s.struct.length),e),offset:0}}else{let t=s.struct.id.clock+s.struct.length-n.id.clock;t>0&&(s.struct.constructor===b9?s.struct.length-=t:n=yB(n,t)),s.struct.mergeWith(n)||(yF(l,s.struct,s.offset),s={struct:n,offset:0},e.next())}}else s={struct:e.curr,offset:0},e.next();for(let n=e.curr;null!==n&&n.id.client===t&&n.id.clock===s.struct.id.clock+s.struct.length&&n.constructor!==b9;n=e.next())yF(l,s.struct,s.offset),s={struct:n,offset:0}}return null!==s&&(yF(l,s.struct,s.offset),s=null),yU(l),gW(o,gV(r.map(e=>gq(e)))),o.toUint8Array()},yH=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:fa(e.encoder.restEncoder)}),e.encoder.restEncoder=fs(),e.written=0)},yF=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&yH(e),0===e.written&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),fd(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++}
90,yU=e=>{yH(e);let t=e.encoder.restEncoder;fd(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];fd(t,r.written),fm(t,r.restEncoder)}},yW="You must not compute changes after the event-handler fired.";class yq{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=yK(this.currentTarget,this.target))}deletes(e){return g$(this.transaction.deleteSet,e.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw fA(yW);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(null!==n){let r,i,s=t._map.get(n);if(this.adds(s)){let e=s.left;for(;null!==e&&this.adds(e);)e=e.left;if(this.deletes(s))if(!(null!==e&&this.deletes(e)))return;else r="delete",i=pH(e.content.getContent());else null!==e&&this.deletes(e)?(r="update",i=pH(e.content.getContent())):(r="add",i=void 0)}else{if(!this.deletes(s))return;r="delete",i=pH(s.content.getContent())}e.set(n,{action:r,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(null===e){if(0===this.transaction.doc._transactionCleanups.length)throw fA(yW);let t=this.target,n=pV(),r=pV(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,s=()=>{e&&i.push(e)};for(let i=t._start;null!==i;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((null===e||void 0===e.delete)&&(s(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((null===e||void 0===e.insert)&&(s(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((null===e||void 0===e.retain)&&(s(),e={retain:0}),e.retain+=i.length);null!==e&&void 0===e.retain&&s()}this._changes=e}return e}}let yK=(e,t)=>{let n=[];for(;null!==t._item&&t!==e;){if(null!==t._item.parentSub)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&null!==r;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},yJ=()=>{gR("Invalid access: Add Yjs type to a document before reading data.")},yG=0;class yX{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=yG++}}let yY=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=yG++},yQ=(e,t)=>{if(null===e._start||0===t||null===e._searchMarker)return null;let n=0===e._searchMarker.length?null:e._searchMarker.reduce((e,n)=>pY(t-e.index)<pY(t-n.index)?e:n),r=e._start,i=0;for(null!==n&&(r=n.p,i=n.index,n.timestamp=yG++);null!==r.right&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;null!==r.left&&i>t;)!(r=r.left).deleted&&r.countable&&(i-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)!(r=r.left).deleted&&r.countable&&(i-=r.length);if(null!==n&&pY(n.index-i)<r.parent.length/80)return yY(n,r,i),n;var s=e._searchMarker,o=r,l=i;if(s.length>=80){let e=s.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return yY(e,o,l),e}{let e=new yX(o,l);return s.push(e),e}},yZ=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)(t=t.left)&&!t.deleted&&t.countable&&(i.index-=t.length);if(null===t||!0===t.marker){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=p1(t,i.index+n))}},y0=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;pB(i,e,()=>[]).push(n),null!==e._item;)e=e._item.parent;ye(r._eH,n,t)};class y1{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=g9(),this._dEH=g9(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw fE()}clone(){throw fE()}_write(e){}get _first(){let e=this._start;for(;null!==e&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){let t;t=this._eH,t.l.push(e)}observeDeep(e){let t;t=this._dEH,t.l.push(e)}unobserve(e){g7(this._eH,e)}unobserveDeep(e){g7(this._dEH,e)}toJSON(){}}
90let y2=(e,t,n)=>{e.doc??yJ(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],s=e._start;for(;null!==s&&r>0;){if(s.countable&&!s.deleted){let e=s.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}s=s.right}return i},y3=e=>{e.doc??yJ();let t=[],n=e._start;for(;null!==n;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},y4=(e,t)=>{let n=[],r=e._start;for(;null!==r;){if(r.countable&&ym(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},y5=(e,t)=>{let n=0,r=e._start;for(e.doc??yJ();null!==r;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},y6=(e,t)=>{let n=[];return y5(e,(r,i)=>{n.push(t(r,i,e))}),n},y8=(e,t)=>{e.doc??yJ();let n=yQ(e,t),r=e._start;for(null!==n&&(r=n.p,t-=n.index);null!==r;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},y9=(e,t,n,r)=>{let i=n,s=e.doc,o=s.clientID,l=s.store,a=null===n?t._start:n.right,c=[],d=()=>{c.length>0&&((i=new b5(yr(o,yw(l,o)),i,i&&i.lastId,a,a&&a.id,t,null,new bF(c))).integrate(e,0),c=[])};r.forEach(n=>{if(null===n)c.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(n);break;default:switch(d(),n.constructor){case Uint8Array:case ArrayBuffer:(i=new b5(yr(o,yw(l,o)),i,i&&i.lastId,a,a&&a.id,t,null,new b_(new Uint8Array(n)))).integrate(e,0);break;case gJ:(i=new b5(yr(o,yw(l,o)),i,i&&i.lastId,a,a&&a.id,t,null,new bz(n))).integrate(e,0);break;default:if(n instanceof y1)(i=new b5(yr(o,yw(l,o)),i,i&&i.lastId,a,a&&a.id,t,null,new bZ(n))).integrate(e,0);else throw Error("Unexpected content type in insert operation")}}}),d()},y7=(e,t,n,r)=>{if(n>t._length)throw fA("Length exceeded!");if(0===n)return t._searchMarker&&yZ(t._searchMarker,n,r.length),y9(e,t,null,r);let i=n,s=yQ(t,n),o=t._start;for(null!==s&&(o=s.p,0==(n-=s.index)&&(n+=(o=o.prev)&&o.countable&&!o.deleted?o.length:0));null!==o;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&yC(e,yr(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&yZ(t._searchMarker,i,r.length),y9(e,t,o,r)},be=(e,t,n,r)=>{if(0===r)return;let i=n,s=r,o=yQ(t,n),l=t._start;for(null!==o&&(l=o.p,n-=o.index);null!==l&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&yC(e,yr(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&null!==l;)l.deleted||(r<l.length&&yC(e,yr(l.id.client,l.id.clock+r)),l.delete(e),r-=l.length),l=l.right;if(r>0)throw fA("Length exceeded!");t._searchMarker&&yZ(t._searchMarker,i,-s+r)},bt=(e,t,n)=>{let r=t._map.get(n);void 0!==r&&r.delete(e)},bn=(e,t,n,r)=>{let i,s=t._map.get(n)||null,o=e.doc,l=o.clientID;if(null==r)i=new bF([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:i=new bF([r]);break;case Uint8Array:i=new b_(r);break;case gJ:i=new bz(r);break;default:if(r instanceof y1)i=new bZ(r);else throw Error("Unexpected content type")}new b5(yr(l,yw(o.store,l)),s,s&&s.lastId,null,null,t,n,i).integrate(e,0)},br=(e,t)=>{e.doc??yJ();let n=e._map.get(t);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},bi=e=>{let t={};return e.doc??yJ(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},bs=(e,t)=>{e.doc??yJ();let n=e._map.get(t);return void 0!==n&&!n.deleted},bo=e=>{let t,n;return e.doc??yJ(),t=e._map.entries(),n=e=>!e[1].deleted,gL(()=>{let e;do e=t.next();while(!e.done&&!n(e.value))return e})};class bl extends yq{}class ba extends y1{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){let t=new ba;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ba}clone(){let e=new ba;return e.insert(0,this.toArray().map(e=>e instanceof y1?e.clone():e)),e}get length(){return this.doc??yJ(),this._length}_callObserver(e,t){super._callObserver(e,t),y0(this,e,new bl(this,e))}insert(e,t){null!==this.doc?yR(this.doc,n=>{y7(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){null!==this.doc?yR(this.doc,t=>
90{((e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return y9(e,t,r,n)})(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){null!==this.doc?yR(this.doc,n=>{be(n,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return y8(this,e)}toArray(){return y3(this)}slice(e=0,t=this.length){return y2(this,e,t)}toJSON(){return this.map(e=>e instanceof y1?e.toJSON():e)}map(e){return y6(this,e)}forEach(e){y5(this,e)}[Symbol.iterator](){let e,t,n;return e=this._start,t=null,n=0,{[Symbol.iterator](){return this},next:()=>{if(null===t){for(;null!==e&&e.deleted;)e=e.right;if(null===e)return{done:!0,value:void 0};t=e.content.getContent(),n=0,e=e.right}let r=t[n++];return t.length<=n&&(t=null),{done:!1,value:r}}}}_write(e){e.writeTypeRef(bq)}}class bc extends yq{constructor(e,t,n){super(e,t),this.keysChanged=n}}class bd extends y1{constructor(e){super(),this._prelimContent=null,void 0===e?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new bd}clone(){let e=new bd;return this.forEach((t,n)=>{e.set(n,t instanceof y1?t.clone():t)}),e}_callObserver(e,t){y0(this,e,new bc(this,e,t))}toJSON(){this.doc??yJ();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof y1?r.toJSON():r}}),e}get size(){return[...bo(this)].length}keys(){return g_(bo(this),e=>e[0])}values(){return g_(bo(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return g_(bo(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??yJ(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){null!==this.doc?yR(this.doc,t=>{bt(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return null!==this.doc?yR(this.doc,n=>{bn(n,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return br(this,e)}has(e){return bs(this,e)}clear(){null!==this.doc?yR(this.doc,e=>{this.forEach(function(t,n,r){bt(e,r,n)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(bK)}}let bh=(e,t)=>{let n,r;return e===t||"object"==typeof e&&"object"==typeof t&&e&&t&&((n=e)===(r=t)||f5(n).length===f5(r).length&&f6(n,(e,t)=>(void 0!==e||f8(r,t))&&f3(r[t],e)))};class bu{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){null===this.right&&fT(),this.right.content.constructor===bB?this.right.deleted||bg(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}let bp=(e,t,n)=>{for(;null!==t.right&&n>0;)t.right.content.constructor===bB?t.right.deleted||bg(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&yC(e,yr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},bf=(e,t,n,r)=>{let i=new Map,s=r?yQ(t,n):null;return s?bp(e,new bu(s.p.left,s.p,s.index,i),n-s.index):bp(e,new bu(null,t._start,0,i),n)},bm=(e,t,n,r)=>{for(;null!==n.right&&(!0===n.right.deleted||n.right.content.constructor===bB&&bh(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,s=i.clientID;r.forEach((r,o)=>{let l=n.left,a=n.right,c=new b5(yr(s,yw(i.store,s)),l,l&&l.lastId,a,a&&a.id,t,null,new bB(o,r));c.integrate(e,0),n.right=c,n.forward()})},bg=(e,t)=>{let{key:n,value:r}=t;null===r?e.delete(n):e.set(n,r)},by=(e,t)=>{for(;null!==e.right&&(e.right.deleted||e.right.content.constructor===bB&&bh(t[e.right.content.key]??null,e.right.content.value));){;e.forward()}},bb=(e,t,n,r)=>{let i=e.doc,s=i.clientID,o=new Map;for(let l in r){let a=r[l],c=n.currentAttributes.get(l)??null;if(!bh(c,a)){o.set(l,c);let{left:r,right:d}=n;n.right=new b5(yr(s,yw(i.store,s)),r,r&&r.lastId,d,d&&d.id,t,null,new bB(l,a)),n.right.integrate(e,0),n.forward()}}return o},bw=(e,t,n,r,i)=>
90{n.currentAttributes.forEach((e,t)=>{void 0===i[t]&&(i[t]=null)});let s=e.doc,o=s.clientID;by(n,i);let l=bb(e,t,n,i),a=r.constructor===String?new bU(r):r instanceof y1?new bZ(r):new b$(r),{left:c,right:d,index:h}=n;t._searchMarker&&yZ(t._searchMarker,n.index,a.getLength()),(d=new b5(yr(o,yw(s.store,o)),c,c&&c.lastId,d,d&&d.id,t,null,a)).integrate(e,0),n.right=d,n.index=h,n.forward(),bm(e,t,n,l)},bv=(e,t,n,r,i)=>{let s=e.doc,o=s.clientID;by(n,i);let l=bb(e,t,n,i);for(;null!==n.right&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===bB));){if(!n.right.deleted)if(n.right.content.constructor===bB){let{key:t,value:s}=n.right.content,o=i[t];if(void 0!==o){if(bh(o,s))l.delete(t);else{if(0===r)break;l.set(t,s)}n.right.delete(e)}else n.currentAttributes.set(t,s)}else r<n.right.length&&yC(e,yr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;n.forward()}if(r>0){let i="";for(;r>0;r--)i+="\n";n.right=new b5(yr(o,yw(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new bU(i)),n.right.integrate(e,0),n.forward()}bm(e,t,n,l)},bk=(e,t,n,r,i)=>{let s=t,o=pz();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===bB){let e=s.content;o.set(e.key,e)}s=s.right}let l=0,a=!1;for(;t!==s;){if(n===t&&(a=!0),!t.deleted){let n=t.content;if(n.constructor===bB){let{key:s,value:c}=n,d=r.get(s)??null;(o.get(s)!==n||d===c)&&(t.delete(e),l++,a||(i.get(s)??null)!==c||d===c||(null===d?i.delete(s):i.set(s,d))),a||t.deleted||bg(i,n)}}t=t.right}return l},bx=e=>{let t=0;return yR(e.doc,n=>{let r=e._start,i=e._start,s=pz(),o=p$(s);for(;i;)!1===i.deleted&&(i.content.constructor===bB?bg(o,i.content):(t+=bk(n,r,i,s,o),s=p$(o),r=i)),i=i.right}),t},bS=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let s=e.beforeState.get(r)||0;i!==s&&yA(e,n.store.clients.get(r),s,i,e=>{e.deleted||e.content.constructor!==bB||e.constructor===bL||t.add(e.parent)})}yR(n,n=>{for(let r of(gz(e,e.deleteSet,e=>{if(e instanceof bL||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;if(e.content.constructor===bB)t.add(r);else{for(var i=e;i&&i.right&&(i.right.deleted||!i.right.countable);)i=i.right;let t=new Set;for(;i&&(i.deleted||!i.countable);){if(!i.deleted&&i.content.constructor===bB){let e=i.content.key;t.has(e)?i.delete(n):t.add(e)}i=i.left}}}),t))bx(r)})},bC=(e,t,n)=>{let r=n,i=p$(t.currentAttributes),s=t.right;for(;n>0&&null!==t.right;){if(!1===t.right.deleted)switch(t.right.content.constructor){case bZ:case b$:case bU:n<t.right.length&&yC(e,yr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e)}t.forward()}s&&bk(e,s,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&yZ(o._searchMarker,t.index,-r+n),t};class bM extends yq{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{null===e?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(null===this._changes){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(null===this._delta){let e=this.target.doc,t=[];yR(e,e=>{let n=new Map,r=new Map,i=this.target._start,s=null,o={},l="",a=0,c=0,d=()=>{if(null!==s){let e=null;switch(s){case"delete":c>0&&(e={delete:c}),c=0;break;case"insert":("object"==typeof l||l.length>0)&&(e={insert:l},n.size>0&&(e.attributes={},n.forEach((t,n)=>{null!==t&&(e.attributes[n]=t)}))),l="";break;case"retain":a>0&&(e={retain:a},(e=>{for(let t in e)return!1;return!0})(o)||(e.attributes=f4({},o))),a=0}e&&t.push(e),s=null}};for(;null!==i;){switch(i.content.constructor){case bZ:case b$:this.adds(i)?this.deletes(i)||(d(),s="insert",l=i.content.getContent()[0],d()):this.deletes(i)?("delete"!==s&&(d(),s="delete"),c+=1):i.deleted||("retain"!==s&&(d(),s="retain"),a+=1);break;case bU:this.adds(i)?this.deletes(i)||("insert"!==s&&(d(),s="insert"),l+=i.content.str):this.deletes(i)?("delete"!==s&&(d(),s="delete"),c+=i.length):i.deleted||("retain"!==s&&(d(),s="retain"),a+=i.length);break;case bB:{let{key:t,value:l}=i.content;if(this.adds(i))this.deletes(i)||(bh(n.get(t)??null,l)?null!==l&&i.delete(e):("retain"===s&&d(),bh(l,r.get(t)??null)?delete o[t]:o[t]=l));else if(this.deletes(i)){r.set(t,l);let e=n.get(t)??null;bh(e,l)||("retain"===s&&d(),o[t]=e)}else if(!i.deleted){r.set(t,l);let n=o[t];void 0!==n&&(bh(n,l)?null!==n&&i.delete(e):("retain"===s&&d(),null===l?delete o[t]:o[t]=l))}i.deleted||("insert"===s&&d(),bg(n,i.content))}}i=i.right}for(d();t.length>0;){let e=t[t.length-1];if(void 0!==e.retain&&void 0===e.attributes)t.pop();else break}}),this._delta=t}return this._delta}}class bA extends y1{constructor(e){super(),this._pending=void 0!==e?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??yJ(),this._length}_integrate(e,t){super._integrate(e,t);
90try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new bA}clone(){let e=new bA;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);let n=new bM(this,e,t);y0(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??yJ();let e="",t=this._start;for(;null!==t;)!t.deleted&&t.countable&&t.content.constructor===bU&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){null!==this.doc?yR(this.doc,n=>{let r=new bu(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let s=e[i];if(void 0!==s.insert){let o=t||"string"!=typeof s.insert||i!==e.length-1||null!==r.right||"\n"!==s.insert.slice(-1)?s.insert:s.insert.slice(0,-1);("string"!=typeof o||o.length>0)&&bw(n,this,r,o,s.attributes||{})}else void 0!==s.retain?bv(n,this,r,s.retain,s.attributes||{}):void 0!==s.delete&&bC(n,r,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,n){this.doc??yJ();let r=[],i=new Map,s=this.doc,o="",l=this._start;function a(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=""}}let c=()=>{for(;null!==l;){if(ym(l,e)||void 0!==t&&ym(l,t))switch(l.content.constructor){case bU:{let r=i.get("ychange");void 0===e||ym(l,e)?void 0===t||ym(l,t)?void 0!==r&&(a(),i.delete("ychange")):(void 0===r||r.user!==l.id.client||"added"!==r.type)&&(a(),i.set("ychange",n?n("added",l.id):{type:"added"})):(void 0===r||r.user!==l.id.client||"removed"!==r.type)&&(a(),i.set("ychange",n?n("removed",l.id):{type:"removed"})),o+=l.content.str;break}case bZ:case b$:{a();let e={insert:l.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case bB:ym(l,e)&&(a(),bg(i,l.content))}l=l.right}a()};return e||t?yR(s,n=>{e&&yg(n,e),t&&yg(n,t),c()},"cleanup"):c(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;null!==r?yR(r,r=>{let i=bf(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),bw(r,this,i,t,n)}):this._pending.push(()=>this.insert(e,t,n))}insertEmbed(e,t,n){let r=this.doc;null!==r?yR(r,r=>{let i=bf(r,this,e,!n);bw(r,this,i,t,n||{})}):this._pending.push(()=>this.insertEmbed(e,t,n||{}))}delete(e,t){if(0===t)return;let n=this.doc;null!==n?yR(n,n=>{bC(n,bf(n,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,n){if(0===t)return;let r=this.doc;null!==r?yR(r,r=>{let i=bf(r,this,e,!1);null!==i.right&&bv(r,this,i,t,n)}):this._pending.push(()=>this.format(e,t,n))}removeAttribute(e){null!==this.doc?yR(this.doc,t=>{bt(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){null!==this.doc?yR(this.doc,n=>{bn(n,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return br(this,e)}getAttributes(){return bi(this)}_write(e){e.writeTypeRef(bJ)}}class bE{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??yJ()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(null!==e&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,e.deleted||t.constructor!==bO&&t.constructor!==bT||null===t._start)for(;null!==e;){let t=e.next;if(null!==t){e=t;break}e=e.parent===this._root?null:e.parent._item}else e=t._start;while(null!==e&&(e.deleted||!this._filter(e.content.type)))return(this._firstCall=!1,null===e)?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class bT extends y1{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new bT}clone(){let e=new bT;return e.insert(0,this.toArray().map(e=>e instanceof y1?e.clone():e)),e}get length(){return this.doc??yJ(),null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(e){return new bE(this,e)}querySelector(e){e=e.toUpperCase();let t=new bE(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),pU(new bE(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}
90_callObserver(e,t){y0(this,e,new bN(this,t,e))}toString(){return y6(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),y5(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){null!==this.doc?yR(this.doc,n=>{y7(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(null!==this.doc)yR(this.doc,n=>{y9(n,this,e&&e instanceof y1?e._item:e,t)});else{let n=this._prelimContent,r=null===e?0:n.findIndex(t=>t===e)+1;if(0===r&&null!==e)throw fA("Reference item not found");n.splice(r,0,...t)}}delete(e,t=1){null!==this.doc?yR(this.doc,n=>{be(n,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return y3(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return y8(this,e)}slice(e=0,t=this.length){return y2(this,e,t)}forEach(e){y5(this,e)}_write(e){e.writeTypeRef(bX)}}class bO extends bT{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new bO(this.nodeName)}clone(){let e=new bO(this.nodeName);var t,n,r=this.getAttributes();for(let i in r){t=r[i],n=i,e.setAttribute(n,t)}return e.insert(0,this.toArray().map(e=>e instanceof y1?e.clone():e)),e}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+'="'+e[r]+'"')}let i=this.nodeName.toLocaleLowerCase(),s=t.length>0?" "+t.join(" "):"";return`<${i}${s}>${super.toString()}</${i}>`}removeAttribute(e){null!==this.doc?yR(this.doc,t=>{bt(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){null!==this.doc?yR(this.doc,n=>{bn(n,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return br(this,e)}hasAttribute(e){return bs(this,e)}getAttributes(e){let t;return e?(t={},this._map.forEach((n,r)=>{let i=n;for(;null!==i&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;null!==i&&ym(i,e)&&(t[r]=i.content.getContent()[i.length-1])}),t):bi(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];"string"==typeof t&&r.setAttribute(e,t)}return y5(this,i=>{r.appendChild(i.toDOM(e,t,n))}),void 0!==n&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(bG),e.writeKey(this.nodeName)}}class bN extends yq{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{null===e?this.childListChanged=!0:this.attributesChanged.add(e)})}}class bD extends bd{constructor(e){super(),this.hookName=e}_copy(){return new bD(this.hookName)}clone(){let e=new bD(this.hookName);return this.forEach((t,n)=>{e.set(n,t)}),e}toDOM(e=document,t={},n){let r,i=t[this.hookName];return(r=void 0!==i?i.createDom(this):document.createElement(this.hookName)).setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(bY),e.writeKey(this.hookName)}}class bR extends bA{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new bR}clone(){let e=new bR;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return void 0!==n&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n="";for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=">"}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(bQ)}}class bI{constructor(e,t){this.id=e,this.length=t}get deleted(){throw fE()}mergeWith(e){return!1}write(e,t,n){throw fE()}integrate(e,t){throw fE()}}class bL extends bI{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),yv(e.doc.store,this)}write(e,t){e.writeInfo(0),e.writeLen(this.length-t)}getMissing(e,t){return null}}class b_{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new b_(this.content)}splice(e){throw fE()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class bP{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new bP(this.len)}splice(e){let t=new bP(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){gH(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}let bj=(e,t)=>new gJ({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class bz{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),null!==e.meta&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new bz(bj(this.doc.guid,this.opts))}splice(e){throw fE()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class b${constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new b$(this.embed)}splice(e){throw fE()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class bB{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new bB(this.key,this.value)}splice(e){throw fE()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}class bV{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new bV(this.arr)}splice(e){let t=new bV(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(void 0===t?"undefined":JSON.stringify(t))}}getRef(){return 2}}let bH="development"===ma("node_env");class bF{constructor(e){this.arr=e,bH&&f7(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new bF(this.arr)}splice(e){let t=new bF(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}}class bU{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new bU(this.str)}splice(e){let t=new bU(this.str.slice(e));this.str=this.str.slice(0,e);let n=this.str.charCodeAt(e-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(0===t?this.str:this.str.slice(t))}getRef(){return 4}}let bW=[e=>new ba,e=>new bd,e=>new bA,e=>new bO(e.readKey()),e=>new bT,e=>new bD(e.readKey()),e=>new bR],bq=0,bK=1,bJ=2,bG=3,bX=4,bY=5,bQ=6;class bZ{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new bZ(this.type._copy())}splice(e){throw fE()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}
90delete(e){let t=this.type._start;for(;null!==t;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;null!==t;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;null!==t;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}let b0=(e,t)=>{let n,r=t,i=0;do i>0&&(r=yr(r.client,r.clock+i)),n=yx(e,r),i=r.clock-n.id.clock,r=n.redone;while(null!==r&&n instanceof b5)return{item:n,diff:i}},b1=(e,t)=>{for(;null!==e&&e.keep!==t;)e.keep=t,e=e.parent._item},b2=(e,t,n)=>{let{client:r,clock:i}=t.id,s=new b5(yr(r,i+n),t,yr(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&s.markDeleted(),t.keep&&(s.keep=!0),null!==t.redone&&(s.redone=yr(t.redone.client,t.redone.clock+n)),t.right=s,null!==s.right&&(s.right.left=s),e._mergeStructs.push(s),null!==s.parentSub&&null===s.right&&s.parent._map.set(s.parentSub,s),t.length=n,s},b3=(e,t)=>pq(e,e=>g$(e.deletions,t)),b4=(e,t,n,r,i,s)=>{let o,l=e.doc,a=l.store,c=l.clientID,d=t.redone;if(null!==d)return yC(e,d);let h=t.parent._item,u=null;if(null!==h&&!0===h.deleted){if(null===h.redone&&(!n.has(h)||null===b4(e,h,n,r,i,s)))return null;for(;null!==h.redone;)h=yC(e,h.redone)}let p=null===h?t.parent:h.content.type;if(null===t.parentSub){for(u=t.left,o=t;null!==u;){let t=u;for(;null!==t&&t.parent._item!==h;)t=null===t.redone?null:yC(e,t.redone);if(null!==t&&t.parent._item===h){u=t;break}u=u.left}for(;null!==o;){let t=o;for(;null!==t&&t.parent._item!==h;)t=null===t.redone?null:yC(e,t.redone);if(null!==t&&t.parent._item===h){o=t;break}o=o.right}}else{if(o=null,t.right&&!i){for(u=t;null!==u&&null!==u.right&&(u.right.redone||g$(r,u.right.id)||b3(s.undoStack,u.right.id)||b3(s.redoStack,u.right.id));)for(u=u.right;u.redone;)u=yC(e,u.redone);if(u&&null!==u.right)return null}else u=p._map.get(t.parentSub)||null;null!==u&&u.parent._item!==h&&(u=p._map.get(t.parentSub)||null)}let f=yw(a,c),m=yr(c,f),g=new b5(m,u,u&&u.lastId,o,o&&o.id,p,t.parentSub,t.content.copy());return t.redone=m,b1(g,!0),g.integrate(e,0),g};class b5 extends bI{constructor(e,t,n,r,i,s,o,l){super(e,l.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=s,this.parentSub=o,this.redone=null,this.content=l,this.info=2*!!this.content.isCountable()}set marker(e){(8&this.info)>0!==e&&(this.info^=8)}get marker(){return(8&this.info)>0}get keep(){return(1&this.info)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(2&this.info)>0}get deleted(){return(4&this.info)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=yw(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=yw(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===yt&&this.id.client!==this.parent.client&&this.parent.clock>=yw(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=yM(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=yC(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===bL||this.right&&this.right.constructor===bL)this.parent=null;else if(this.parent){if(this.parent.constructor===yt){let e=yx(t,this.parent);e.constructor===bL?this.parent=null:this.parent=e.content.type}}else this.left&&this.left.constructor===b5?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===b5&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=yM(e,e.doc.store,yr(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let t,n=this.left;if(null!==n)t=n.right;else if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start;let r=new Set,i=new Set;for(;null!==t&&t!==this.right;){if(i.add(t),r.add(t),yn(this.origin,t.origin)){if(t.id.client<this.id.client)n=t,r.clear();else if(yn(this.rightOrigin,t.rightOrigin))break}else if(null!==t.origin&&i.has(yx(e.doc.store,t.origin)))r.has(yx(e.doc.store,t.origin))||(n=t,r.clear());else break;t=t.right}this.left=n}if(null!==this.left){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(e)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),yv(e.doc.store,this),this.content.integrate(e,this),yO(e,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(e)}else new bL(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;null!==e&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;null!==e&&e.deleted;)e=e.left;return e}get lastId(){return 1===this.length?this.id:yr(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&yn(e.origin,this.lastId)&&this.right===e&&yn(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&null===this.redone&&null===e.redone&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,null!==this.right&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&null===this.parentSub&&(t._length-=this.length),this.markDeleted(),gH(e.deleteSet,this.id.client,this.id.clock,this.length),yO(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw fT();if(this.content.gc(e),t){var n;let t;n=new bL(this.id,this.length),(t=e.clients.get(this.id.client))[yk(t,this.id.clock)]=n}else this.content=new bP(this.length)}write(e,t){let n=t>0?yr(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,s=31&this.content.getRef()|128*(null!==n)|64*(null!==r)|32*(null!==i);if(e.writeInfo(s),null!==n&&e.writeLeftID(n),null!==r&&e.writeRightID(r),null===n&&null===r){let t=this.parent;if(void 0!==t._item){let n=t._item;if(null===n){let n=yi(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===yt?(e.writeParentInfo(!1),e.writeLeftID(t)):fT();null!==i&&e.writeString(i)}this.content.write(e,t)}}let b6=(e,t)=>b8[31&t](e),b8=[()=>{fT()},e=>new bP(e.readLen()),e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();"undefined"===t?n.push(void 0):n.push(JSON.parse(t))}return new bV(n)},e=>new b_(e.readBuf()),e=>new bU(e.readString()),e=>new b$(e.readJSON()),e=>new bB(e.readKey(),e.readJSON()),e=>new bZ(bW[e.readTypeRef()](e)),e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new bF(n)},e=>
90new bz(bj(e.readString(),e.readAny())),()=>{fT()}];class b9 extends bI{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){fT()}write(e,t){e.writeInfo(10),fd(e.restEncoder,this.length-t)}getMissing(e,t){return null}}let b7="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,we="__ $YJS$ __";!0===b7[we]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),b7[we]=!0,e.s(["Array",0,ba,"ContentFormat",0,bB,"ContentString",0,bU,"ContentType",0,bZ,"Doc",0,gJ,"Item",0,b5,"Map",0,bd,"RelativePosition",0,yo,"Snapshot",0,yu,"Text",0,bA,"UndoManager",0,yP,"XmlElement",0,bO,"XmlFragment",0,bT,"XmlText",0,bR,"applyUpdate",0,(e,t,n)=>g4(e,t,n,gX),"applyUpdateV2",0,g4,"compareRelativePositions",0,(e,t)=>e===t||null!==e&&null!==t&&e.tname===t.tname&&yn(e.item,t.item)&&yn(e.type,t.type)&&e.assoc===t.assoc,"createAbsolutePositionFromRelativePosition",0,yh,"createDeleteSet",0,gF,"createID",0,yr,"createRelativePositionFromJSON",0,yl,"createRelativePositionFromTypeIndex",0,yd,"createSnapshot",0,yp,"decodeStateVector",0,g5,"encodeStateAsUpdate",0,(e,t)=>((e,t=new Uint8Array([0]),n=new g2)=>{((e,t,n=new Map)=>{g3(e,t.store,n),gW(e,gU(t.store))})(n,e,g5(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(((e,t,n=gQ,r=g2)=>{let i=g5(t),s=new r,o=new yz(s),l=new n(fR(e)),a=new yj(l,!1);for(;a.curr;){let e=a.curr,t=e.id.client,n=i.get(t)||0;if(a.curr.constructor===b9){a.next();continue}if(e.id.clock+e.length>n)for(yF(o,e,p1(n-e.id.clock,0)),a.next();a.curr&&a.curr.id.client===t;)yF(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===t&&a.curr.id.clock+a.curr.length<=n;)a.next()}return yU(o),gW(s,gq(l)),s.toUint8Array()})(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===g0)return y$(r.map((e,t)=>0===t?e:((e,t,n,r)=>{let i=new n(fR(e)),s=new yj(i,!1),o=new r,l=new yz(o);for(let e=s.curr;null!==e;e=s.next())yF(l,t(e),0);return yU(l),gW(o,gq(i)),o.toUint8Array()})(e,mt,gQ,g0)));else if(n.constructor===g2)return yV(r)}return r[0]})(e,t,new g0),"encodeStateVector",0,e=>((e,t=new g1)=>(e instanceof Map?g6(t,e):g6(t,yb(e.store)),t.toUint8Array()))(e,new gZ),"findIndexSS",0,yk,"findRootTypeKey",0,yi,"isDeleted",0,g$,"isParentOf",0,ys,"iterateDeletedStructs",0,gz,"mergeUpdates",0,y$,"snapshot",0,yf,"transact",0,yR,"typeListToArraySnapshot",0,y4],616009);let wt=/[\uD800-\uDBFF]/,wn=/[\uDC00-\uDFFF]/,wr=(e,t)=>e>>>t|e<<32-t,wi=e=>wr(e,2)^wr(e,13)^wr(e,22),ws=e=>wr(e,6)^wr(e,11)^wr(e,25),wo=e=>wr(e,7)^wr(e,18)^e>>>3,wl=e=>wr(e,17)^wr(e,19)^e>>>10,wa=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),wc=new Uint32Array([0x6a09e66
907,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]);class wd{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(wc),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=wl(t[e-2])+t[e-7]+wo(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],l=e[5],a=e[6],c=e[7];for(let e=0,d,h;e<64;e++)d=c+ws(o)+(o&l^~o&a)+wa[e]+t[e]>>>0,h=wi(n)+(n&r^n&i^r&i)>>>0,c=a,a=l,l=o,o=s+d>>>0,s=i,i=r,r=n,n=d+h>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=s,e[4]+=o,e[5]+=l,e[6]+=a,e[7]+=c}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<8*n;n||(this._W[r-(t%4!=0)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/0x20000000,this._W[15]=8*e.byteLength,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[4*e+t]=this._H[e]>>>(3-t)*8;return i}}let wh=new td("y-sync"),wu=new td("y-undo");new td("yjs-cursor");let wp=(e,t)=>void 0===t?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!g$(t.ds,e.id),wf=[{light:"#ecd44433",dark:"#ecd444"}],wm=(e,{colors:t=wf,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1,l=new wb(e,s),a=new tl({props:{editable:e=>{let t=wh.getState(e);return null==t.snapshot&&null==t.prevSnapshot}},key:wh,state:{init:(i,s)=>({type:e,doc:e.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(wh);if(void 0!==n)for(let e in t=Object.assign({},t),n)t[e]=n[e];return e.docChanged&&(t.addToHistory=!1!==e.getMeta("addToHistory")),t.isChangeOrigin=void 0!==n&&!!n.isChangeOrigin,t.isUndoRedoOperation=void 0!==n&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,null!==l.prosemirrorView&&void 0!==n&&(null!=n.snapshot||null!=n.prevSnapshot)&&gw(0,()=>{null!=l.prosemirrorView&&(null==n.restore?l._renderSnapshot(n.snapshot,n.prevSnapshot,t):(l._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),t}},view:e=>(l.initView(e),null==s&&l._forceRerender(),i(),{update:()=>{let t=a.getState(e.state);if(null==t.snapshot&&null==t.prevSnapshot&&(o||null!==e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content))){if(o=!0,!1===t.addToHistory&&!t.isChangeOrigin){let t=wu.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}l.mux(()=>{t.doc.transact(n=>{n.meta.set("addToHistory",t.addToHistory),l._prosemirrorChanged(e.state.doc)},wh)})}},destroy:()=>{l.destroy()}})});return a},wg=(e,t,n,r)=>{if(null==n||!(null===r||n>1&&r<=1||wq(t,e,n,r)))return r;let i=wW(t,e,n);return null!==i?i:r},wy=(e,t)=>{let n=t.selection.jsonID;return{type:n,depth:"nodeRange"===n?t.selection.depth:void 0,anchor:wV(t.selection.anchor,e.type,e.mapping),head:wV(t.selection.head,e.type,e.mapping),absAnchor:t.selection.anchor,absHead:t.selection.head}};class wb{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=(()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else void 0!==n&&n()}})(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{null===this.beforeTransactionSelection&&null!=this.prosemirrorView&&(this.beforeTransactionSelection=wy(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return!!this.prosemirrorView.hasFocus()&&(ms&&null===this._domSelectionInView&&(gw(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView)}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(null==e||null==e.anchorNode)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),0===t.getClientRects().length&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=gh.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||(t=yp(gF(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(wh,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>wv(e,this.prosemirrorView.state.schema,this)).filter(e=>
90null!==e),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new C(b.from(e),0,0));t.setMeta(wh,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=null!==this.beforeTransactionSelection?null:this.prosemirrorView.state.selection,t=this.type.toArray().map(e=>wv(e,this.prosemirrorView.state.schema,this)).filter(e=>null!==e),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new C(b.from(t),0,0));if(e){let t=p0(p1(e.anchor,0),n.doc.content.size),r=p0(p1(e.head,0),n.doc.content.size);n.setSelection(e3.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(wh,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||(e=yf(this.doc)),e instanceof Uint8Array||t instanceof Uint8Array)if(e instanceof Uint8Array&&t instanceof Uint8Array||fT(),g4(r=new gJ({gc:!1}),t),t=yf(r),g4(r,e),e=yf(r),null===i._item){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[],t=yk(e,i._item.id.clock);i=e[t].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let s=n.permanentUserData;s&&s.dss.forEach(e=>{gz(r,e,e=>{})});let o=(e,t)=>{let r="added"===e?s.getUserByClientId(t.client):s.getUserByDeletedId(t);return{user:r,type:e,color:((e,t,n)=>{if(!e.has(n)){let r;if(e.size<t.length){let n=pV();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,(r=t)[pG(fK()*r.length)])}return e.get(n)})(n.colorMapping,n.colors,r)}},l=y4(i,new yu(t.ds,e.sv)).map(n=>!n._item.deleted||wp(n._item,e)||wp(n._item,t)?wv(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>null!==e),a=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new C(b.from(l),0,0));this.prosemirrorView.dispatch(a.setMeta(wh,{isChangeOrigin:!0}))},wh)})}_typeChanged(e,t){if(null==this.prosemirrorView)return;let n=wh.getState(this.prosemirrorView.state);0===e.length||null!=n.snapshot||null!=n.prevSnapshot?this.renderSnapshot(n.snapshot,n.prevSnapshot):this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);gz(t,t.deleteSet,e=>{if(e.constructor===b5){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e),this.mapping.clear();let n=this.type.toArray().map(e=>ww(e,this.prosemirrorView.state.schema,this)).filter(e=>null!==e),r=this.prosemirrorView.state.doc,i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new C(b.from(n),0,0));((e,t,n,r)=>{if(null!==t&&null!==t.anchor&&null!==t.head)if("all"===t.type)e.setSelection(new e8(e.doc));else if("node"===t.type){var i,s;let r,o=wF(n.doc,n.type,t.anchor,n.mapping);null!==o&&e.setSelection((i=e,s=o,(r=i.doc.resolve(s)).nodeAfter?e5.create(i.doc,s):e3.near(r)))}else if("nodeRange"===t.type){let r=((e,t,n,r)=>{if(null===t||null===n)return null;
90let i=Math.min(Math.max(t,0),e.doc.content.size),s=Math.min(Math.max(n,0),e.doc.content.size);try{let t=eZ.fromJSON(e.doc,{type:"nodeRange",anchor:i,head:s,depth:r});if(!t.ranges.length)return e3.near(e.doc.resolve(i));return t}catch(t){return e3.near(e.doc.resolve(i))}})(e,wF(n.doc,n.type,t.anchor,n.mapping),wF(n.doc,n.type,t.head,n.mapping),t.depth);null!==r&&e.setSelection(r)}else{let i=wF(n.doc,n.type,t.anchor,n.mapping),s=wF(n.doc,n.type,t.head,n.mapping);null!=r&&(i=wg(e.doc,r,t.absAnchor,i),s=wg(e.doc,r,t.absHead,s)),null===i&&(i=s),null===s&&(s=i),null!==i&&null!==s&&e.setSelection(e3.between(e.doc.resolve(i),e.doc.resolve(s)))}})(i,this.beforeTransactionSelection,this,r),i=i.setMeta(wh,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof yP}),null!==this.beforeTransactionSelection&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)})}_prosemirrorChanged(e){this.doc.transact(()=>{w$(this.doc,this.type,e,this),this.beforeTransactionSelection=wy(this,this.prosemirrorView.state)},wh)}initView(e){null!=this.prosemirrorView&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){null!=this.prosemirrorView&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}let ww=(e,t,n,r,i,s)=>{let o=n.mapping.get(e);if(void 0===o)if(e instanceof bO)return wv(e,t,n,r,i,s);else throw fE();return o},wv=(e,t,n,r,i,s)=>{let o=[],l=e=>{if(e instanceof bO){let l=ww(e,t,n,r,i,s);null!==l&&o.push(l)}else{let l=e._item.right?.content?.type;l instanceof bA&&!l._item.deleted&&l._item.id.client===l.doc.clientID&&(e.applyDelta([{retain:e.length},...l.toDelta()]),l.doc.transact(e=>{l._item.delete(e)}));let a=wk(e,t,n,r,i,s);null!==a&&a.forEach(e=>{null!==e&&o.push(e)})}};void 0===r||void 0===i?e.toArray().forEach(l):y4(e,new yu(i.ds,r.sv)).forEac
90h(l);try{let l=e.getAttributes(r);void 0!==r&&(wp(e._item,r)?wp(e._item,i)||(l.ychange=s?s("added",e._item.id):{type:"added"}):l.ychange=s?s("removed",e._item.id):{type:"removed"});let a=t.node(e.nodeName,l,o);return n.mapping.set(e,a),a}catch(t){return e.doc.transact(t=>{e._item.delete(t)},wh),n.mapping.delete(e),null}},wk=(e,t,n,r,i,s)=>{let o=[],l=e.toDelta(r,i,s);try{for(let e=0;e<l.length;e++){let n=l[e];o.push(t.text(n.insert,wj(n.attributes,t)))}}catch(t){return e.doc.transact(t=>{e._item.delete(t)},wh),null}return o},wx=(e,t)=>{let n,r;return e instanceof Array?(n=new bR,r=e.map(e=>({insert:e.text,attributes:wz(e.marks,t)})),n.applyDelta(r),t.mapping.set(n,e),n):((e,t)=>{let n=new bO(e.type.name);for(let t in e.attrs){let r=e.attrs[t];null!==r&&"ychange"!==t&&n.setAttribute(t,r)}return n.insert(0,wM(e).map(e=>wx(e,t))),t.mapping.set(n,e),n})(e,t)},wS=e=>"object"==typeof e&&null!==e,wC=(e,t)=>{let n=Object.keys(e).filter(t=>null!==e[t]),r=n.length===Object.keys(t).filter(e=>null!==t[e]).length;for(let i=0;i<n.length&&r;i++){let s=n[i],o=e[s],l=t[s];r="ychange"===s||o===l||wS(o)&&wS(l)&&wC(o,l)}return r},wM=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},wA=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&f5(e.attributes||{}).length===t[n].marks.length&&f6(e.attributes,(e,r)=>{let i=wP(r),s=t[n].marks;return!!s.find(e=>e.type.name===i)&&wC(e,s.find(e=>e.type.name===i)?.attrs)}))},wE=(e,t)=>{if(e instanceof bO&&!(t instanceof Array)&&wB(e,t)){let n=wM(t);return e._length===n.length&&wC(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>wE(e,n[t]))}return e instanceof bR&&t instanceof Array&&wA(e,t)},wT=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),wO=(e,t,n,r)=>{n>0&&(e.slice(t,t+n).forEach(e=>r.mapping.delete(e)),e.delete(t,n))},wN=(e,t,n,r,i,s)=>{if(r<i){let o=[];for(let e=r;e<i;e++)o.push(wx(n[e],s));e.insert(t,o)}},wD=(e,t,n,r)=>t instanceof bR&&n instanceof Array?(wA(t,n)?r.mapping.set(t,n):wL(t,n,r),!0):!!(t instanceof bO&&!(n instanceof Array)&&wB(t,n))&&(wE(t,n)?r.mapping.set(t,n):w$(e,t,n,r),!0),wR=(e,t,n,r,i,s,o,l,a)=>{let c=p0(s-i,l-o);for(let s=0;s<c;s++)wD(e,r[i+s],n[o+s],a)||(wO(t,o+s,1,a),wN(t,o+s,n,o+s,o+s+1,a));wO(t,o+c,s-i-c,a),wN(t,o+c,n,o+c,l,a)},wI=(e,t,n)=>{let r=e.toArray(),i=wM(t),s=i.length,o=r.length,l=p0(o,s),a=0,c=0,d=!1;for(;a<l;a++){let e=r[a],t=i[a];if(wT(n.mapping.get(e),t))d=!0;else if(!wE(e,t))break}for(;a+c<l;c++){let e=r[o-c-1],t=i[s-c-1];if(wT(n.mapping.get(e),t))d=!0;else if(!wE(e,t))break}return{equalityFactor:a+c,foundMappedChild:d}},wL=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=(e=>{let t="",n=e._start,r={};for(;null!==n;)!n.deleted&&(n.countable&&n.content instanceof bU?t+=n.content.str:n.content instanceof bB&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}})(e),s=t.map(e=>({insert:e.text,attributes:Object.assign({},r,wz(e.marks,n))})),{insert:o,remove:l,index:a}=((e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&wt.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&wn.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}})(i,s.map(e=>e.insert).join(""));e.delete(a,l),e.insert(a,o),e.applyDelta(s.map(e=>({retain:e.insert.length,attributes:e.attributes})))},w_=/(.*)(--[a-zA-Z0-9+/=]{8})$/,wP=e=>w_.exec(e)?.[1]??e,wj=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(wP(r),e[r]));return n},wz=(e,t)=>{let n={};return e.forEach(e=>{if("ychange"!==e.type.name){let r,i;n[pB(t.isOMark,e.type,()=>!e.type.excludes(e.type))?`${e.type.name}--${mu((e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)})((r=e.toJSON(),i=fo(e=>fw(e,r)),new wd().digest(i))))}`:e.type.name]=e.attrs}}),n},w$=(e,t,n,r)=>{if(t instanceof bO&&t.nodeName!==n.type.name)throw Error("node name mismatch!");if(r.mapping.set(t,n),t instanceof bO){let e=t.getAttributes(),r=n.attrs;for(let n in r)null!==r[n]?e[n]!==r[n]&&"ychange"!==n&&t.setAttribute(n,r[n]):t.removeAttribute(n);for(let n in e)void 0===r[n]&&t.removeAttribute(n)}let i=wM(n),s=i.length,o=t.toArray(),l=o.length,a=p0(s,l);if(((e,t,n,r,i)=>{let s=((e,t,n)=>{let r=new Map;t.forEach((e,t)=>{r.has(e)||r.set(e,t)});let i=[];if(e.forEach((e,s)=>{let o=n.mapping.get(e),l=r.get(o);void 0!==l&&wT(o,t[l])&&i.push({yIndex:s,pIndex:l,yChild:e})}),0===i.length)return[];let s=Array(i.length),o=[];for(let e=0;e<i.length;e++){let t=0,n=o.length;for(;t<n;){let r=t+n>>1;i[o[r]].pIndex<i[e].pIndex?t=r+1:n=r}s[e]=t>0?o[t-1]:-1,o[t]=e}let l=[];for(let e=o[o.length-1];-1!==e;e=s[e])l.push(i[e]);return l.reverse()})(r,n,i);if(s.length<2||!s.some(e=>e.yIndex!==e.pIndex)||s.some(e=>{let t=n[e.pIndex];return!(e.yChild instanceof bR&&t instanceof Array||e.yChild instanceof bO&&!(t instanceof Array))}))return!1;let o=0,l=0;for(let a of s){wR(e,t,n,r,o,a.yIndex,l,a.pIndex,i);let s=n[a.pIndex];wD(e,a.yChild,s,i),o=a.yIndex+1,l=a.pIndex+1}return wR(e,t,n,r,o,r.length,l,n.length,i),!0})(e,t,i,o,r))return;let c=0,d=0;for(;c<a;c++){let e=o[c],t=i[c];if(!wT(r.mapping.get(e),t))if(wE(e,t))r.mapping.set(e,t);else break}for(;d+c+1<a;d++){let e=o[l-d-1],t=i[s-d-1];if(!wT(r.mapping.get(e),t))if(wE(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;l-c-d>0&&s-c-d>0;){let n=o[c],a=i[c],h=o[l-d-1],u=i[s-d-1];if(n instanceof bR&&a instanceof Array)wA(n,a)||wL(n,a,r),c+=1;else{let i=n instanceof bO&&wB(n,a),s=h instanceof bO&&wB(h,u);if(i&&s){let e=wI(n,a,r),t=wI(h,u,r);
90e.foundMappedChild&&!t.foundMappedChild?s=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:s=!1}i?(w$(e,n,a,r),c+=1):s?(w$(e,h,u,r),d+=1):(r.mapping.delete(t.get(c)),t.delete(c,1),t.insert(c,[wx(a,r)]),c+=1)}}let n=l-c-d;if(1===l&&0===s&&o[0]instanceof bR?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(c,c+n).forEach(e=>r.mapping.delete(e)),t.delete(c,n)),c+d<s){let e=[];for(let t=c;t<s-d;t++)e.push(wx(i[t],r));t.insert(c,e)}},wh)},wB=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,wV=(e,t,n)=>{if(0===e)return yd(t,0,-1);let r=null===t._first?null:t._first.content.type;for(;null!==r&&t!==r;){if(r instanceof bR){if(r._length>=e)return yd(r,e,-1);if(e-=r._length,null!==r._item&&null!==r._item.next)r=r._item.next.content.type;else{do r=null===r._item?null:r._item.parent,e--;while(r!==t&&null!==r&&null!==r._item&&null===r._item.next)null!==r&&r!==t&&(r=null===r._item?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(null!==r._first&&e<i)r=r._first.content.type,e--;else{if(1===e&&0===r._length&&i>1)return new yo(null===r._item?null:r._item.id,null===r._item?yi(r):null,null);if(e-=i,null!==r._item&&null!==r._item.next)r=r._item.next.content.type;else{if(0===e)return new yo(null===(r=null===r._item?r:r._item.parent)._item?null:r._item.id,null===r._item?yi(r):null,null);do r=r._item.parent,e--;while(r!==t&&null===r._item.next)r!==t&&(r=r._item.next.content.type)}}}if(null===r)throw fT();if(0===e&&r.constructor!==bR&&r!==t)return wH(r._item.parent,r._item)}return yd(t,t._length,-1)},wH=(e,t)=>{let n=null,r=null;return null===e._item?r=yi(e):n=yr(e._item.id.client,e._item.id.clock),new yo(n,r,t.id)},wF=(e,t,n,r)=>{let i=yh(n,e);if(null===i||i.type!==t&&!ys(t,i.type._item))return null;let s=i.type,o=0;if(s.constructor===bR)o=i.index;else if(null===s._item||!s._item.deleted){let e=s._first,t=0;for(;t<s._length&&t<i.index&&null!==e;){if(!e.deleted){let n=e.content.type;if(t++,n instanceof bR)o+=n._length;else{let e=r.get(n);if(null==e)return null;o+=e.nodeSize}}e=e.right}o+=1}for(;s!==t&&null!==s._item;){let e=s._item.parent;if(null===e._item||!e._item.deleted){o+=1;let t=e._first;for(;null!==t;){let e=t.content.type;if(e===s)break;if(!t.deleted)if(e instanceof bR)o+=e._length;else{let t=r.get(e);if(null==t)return null;o+=t.nodeSize}t=t.right}}s=e}let l=o-1;return((e,t,n)=>{if(null===n)return!1;let r=yh(t,e);return null!==r&&r.type instanceof bR&&null!==t.item&&n<=1})(e,n,l)?null:l},wU=(e,t)=>{if(e===t)return!0;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])},wW=(e,t,n)=>{let r,i=0,s=0;for(;s<e.childCount;s++){let t=e.child(s);if(i+t.nodeSize>n)break;i+=t.nodeSize}if(s>=e.childCount)return null;let o=e.child(s),l=e.resolve(n),a=(r,o=!1)=>{let a=0;for(let t=0;t<=s;t++)r(e.child(t))&&a++;let c=0,d=-1,h=null,u=0;for(let e=0;e<t.childCount;e++){let n=t.child(e);r(n)&&++c===a&&(d=u,h=n),u+=n.nodeSize}if(null===h||o&&(1!==a||1!==c))return null;var p=d,f=h;if(0===l.depth){let e=p+(n-i);return Math.max(p+1,Math.min(e,p+f.nodeSize-1))}return((e,t,n)=>{let r=t+1,i=n;for(let t=1;t<e.depth;t++){let n=e.index(t);if(n>=i.childCount)return null;for(let e=0;e<n;e++)r+=i.child(e).nodeSize;if(r+=1,(i=i.child(n)).type!==e.node(t+1).type)return null}return i.isTextblock?r+Math.min(e.parentOffset,i.content.size):null})(l,p,f)},c=e=>e.type===o.type&&wU(e.attrs,o.attrs),d=o.textContent,h=a(e=>c(e)&&e.textContent===d);if(null!==h)return h;let u=a(e=>e.type===o.type&&e.textContent===d);if(null!==u)return u;if(r=o.type.spec.attrs||{},Object.keys(o.attrs).some(e=>{let t=r[e];return null==t||!Object.prototype.hasOwnProperty.call(t,"default")||t.default!==o.attrs[e]})){let e=a(c,!0);if(null!==e)return e}return a(e=>c(e)&&""!==d&&""!==e.textContent&&(d.startsWith(e.textContent)||e.textContent.startsWith(d)),!0)},wq=(e,t,n,r)=>{if(null===r)return!1;let i=e.resolve(n),s=t.resolve(r);if(!i.parent.isTextblock)return!1;if(!s.parent.isTextblock||i.parent.textContent!==s.parent.textContent||0!==i.parentOffset&&0===s.parentOffset)return!0;let o=0===i.parentOffset&&0===s.parentOffset,l=i.parentOffset!==s.parentOffset||i.parent.type!==s.parent.type||!wU(i.parent.attrs,s.parent.attrs);if(o||l){let i=wW(e,t,n);return null!==i&&i!==r}return!1},wK=e=>{let t=wu.getState(e).undoManager;if(null!=t)return t.undo(),!0},wJ=e=>{let t=wu.getState(e).undoManager;if(null!=t)return t.redo(),!0},wG=new Set(["paragraph"]),wX=({protectedNodes:e=wG,trackedOrigins:t=[],undoManager:n=null}={})=>new tl({key:wu,state:{init:(r,i)=>{let s=wh.getState(i),o=n;if(!o){let n=s.doc,r=new Set(n?n._observers.get("destroy"):[]);o=new yP(s.type,{trackedOrigins:new Set([wh].concat(t)),deleteFilter:t=>!(t instanceof b5)||!(t.content instanceof bZ)||!(t.content.type instanceof bA||t.content.type instanceof bO&&e.has(t.content.type.nodeName))||0===t.content.type._length,captureTransaction:e=>!1!==e.meta.get("addToHistory")});let i=n?n._observers.get("destroy"):new Set;o._yTiptapDocDestroyListeners=Array.from(i||[]).filter(e=>!r.has(e))}
90return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=wh.getState(r).binding,s=t.undoManager,o=s.undoStack.length>0,l=s.redoStack.length>0;return i?{undoManager:s,prevSel:wy(i,n),hasUndoOps:o,hasRedoOps:l}:o!==t.hasUndoOps||l!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}):t}},view:e=>{let t=wh.getState(e.state),n=wu.getState(e.state).undoManager;return n.on("stack-item-added",({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,wu.getState(e.state).prevSel)}),n.on("stack-item-popped",({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy();let e=n._yTiptapDocDestroyListeners;e&&n.doc&&(e.forEach(e=>n.doc.off("destroy",e)),n._yTiptapDocDestroyListeners=null)}}}});function wY(e){return!!e.getMeta(wh)}function wQ(e,t){let n=wh.getState(e);return wV(t,n.type,n.binding.mapping)}e.s(["absolutePositionToRelativePosition",0,wV,"redo",0,wJ,"relativePositionToAbsolutePosition",0,wF,"undo",0,wK,"ySyncPlugin",0,wm,"ySyncPluginKey",0,wh,"yUndoPlugin",0,wX,"yUndoPluginKey",0,wu],732200);var wZ=class e extends s4{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};let w0=oX.create({name:"collaboration",priority:1e3,addOptions:()=>({document:null,field:"default",fragment:null,provider:null}),addStorage:()=>({isDisabled:!1}),onCreate(){this.editor.extensionManager.extensions.find(e=>"undoRedo"===e.name)&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>(function(e,t,n){let r=e instanceof wZ?e.yRelativePosition:null;if(wY(t)&&r){let e;return{position:new wZ(wF((e=wh.getState(n)).doc,e.type,r,e.binding.mapping)||0,r),mapResult:null}}let i=s5(e,t),s=i.position.position;return{position:new wZ(s,null!=r?r:wQ(n,s)),mapResult:i.mapResult}})(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>new wZ(e,wQ(this.editor.state,e))},addCommands:()=>({undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta("preventDispatch",!0),0!==wu.getState(t).undoManager.undoStack.length&&(!n||wK(t))),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta("preventDispatch",!0),0!==wu.getState(t).undoManager.redoStack.length&&(!n||wJ(t)))}),addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=wX(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=wu.getState(e.state);t.restore&&(t.restore(),t.restore=()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on("afterTransaction",t.afterTransactionHandler),t._observers=n},(null==r?void 0:r.destroy)&&r.destroy()}}},[wm(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,this.editor.options.enableContentCheck&&new tl({key:new td("filterInvalidContent"),filterTransaction:t=>{if(!wY(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit("contentError",{error:t,editor:this.editor,disableCollaboration:()=>{var t;null==(t=e.doc)||t.destroy()}}),!0}}})].filter(Boolean)}}),w1=(0,c.lazy)(()=>e.A(226394)),w2={note:"ℹ",tip:"💡",warning:"⚠",accent:"★"},w3="application/x-palette-document-block",w4="application/x-palette-studio-asset";e.s(["ASSET_MIME",0,w4,"DocumentEditor",0,function({model:e,onCh
90ange:t,images:n,assets:r,zoom:i,collaboration:s}){let{t:o}=(0,aJ.useTranslation)(),d=(0,pj.useStudioTools)(),u=(0,c.useRef)(null),f=(0,c.useRef)([]),[m,g]=(0,c.useState)(0),[y,b]=(0,c.useState)(""),[w,v]=(0,c.useState)(null),[k,x]=(0,c.useState)(!1),S=(0,c.useRef)(null),C=async(e,t)=>{let r=u.current;if(!r)return;if(!pN(e))return void b(o("studio.imageFailed"));let i={pos:t??r.state.selection.from};f.current.push(i),b("");try{let t=await n.upload(e);r.isDestroyed||r.chain().focus().insertContentAt(i.pos,{type:"image",attrs:{id:crypto.randomUUID(),src:t,alt:e.name.replace(/\.[a-z0-9]+$/i,"")}}).run()}catch{b(o("studio.imageFailed"))}finally{f.current=f.current.filter(e=>e!==i)}},M=oX.create({name:"studioBlockHandles",addProseMirrorPlugins:()=>[new tl({props:{decorations(e){let t=[];return e.doc.forEach((e,n,r)=>t.push(r$.widget(n,()=>{let e=document.createElement("button");return e.type="button",e.className="studio-block-grip",e.textContent="â ¿",e.draggable=!0,e.setAttribute("aria-label",`${o("studio.moveBlock")} ${r+1}`),e.title=o("studio.blockDragHint"),e.addEventListener("dragstart",e=>{e.dataTransfer?.setData(w3,String(r)),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")}),e.addEventListener("click",()=>{u.current&&pS(u.current,n)}),e.addEventListener("keydown",e=>{e.altKey&&["ArrowUp","ArrowDown"].includes(e.key)&&u.current&&(e.preventDefault(),px(u.current,r,r+("ArrowUp"===e.key?-1:1)))}),e},{side:-1,stopEvent:()=>!0}))),rH.create(e.doc,t)}}})]}),A=function(e={},t=[]){let n=(0,h.useRef)(e);n.current=e;let[r]=(0,h.useState)(()=>new l0(n)),i=(0,p.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,h.useDebugValue)(i),(0,h.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,h.useState)(()=>new lY(e.editor)),r=(0,lW.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:lF);lX(()=>n.watch(e.editor),[e.editor,n]),(0,h.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({extensions:[...pv.map(e=>s&&"starterKit"===e.name?e.configure({undoRedo:!1}):e),M,...s?[w0.configure({document:s.doc,field:"document",yUndoOptions:{undoManager:s.undo}})]:[]],content:s?void 0:e.doc,immediatelyRender:!1,onUpdate:({editor:n})=>{s||t({...e,doc:n.getJSON()})},onTransaction:({transaction:e})=>{for(let t of f.current)t.pos=e.mapping.map(t.pos);g(e=>e+1)},onSelectionUpdate:({editor:e})=>{e.state.selection instanceof e5&&["chart","image","stats"].includes(e.state.selection.node.type.name)&&d.open("properties");let t=s&&wh.getState(e.state);t?.binding&&s?.provider.awareness?.setLocalStateField("selection",{kind:"document",from:wV(e.state.selection.from,t.type,t.binding.mapping),to:wV(e.state.selection.to,t.type,t.binding.mapping),quote:e.state.doc.textBetween(e.state.selection.from,e.state.selection.to).slice(0,160)})},editorProps:{attributes:{role:"textbox","aria-multiline":"true","aria-label":o("studio.document"),class:"studio-document"},handleDrop:(e,t)=>{let n=t.dataTransfer,i=e.posAtCoords({left:t.clientX,top:t.clientY})?.pos??e.state.doc.content.size;if(n?.types.includes(w3)&&u.current){t.preventDefault();let e=pk(u.current),r=Number(n.getData(w3)),s=e.findIndex(e=>i<e.pos+e.size);return Number.isInteger(r)&&px(u.current,r,s<0?e.length-1:s),!0}if(n?.types.includes(w4)){t.preventDefault();let e=r.find(e=>e.url===n.getData(w4));return e&&u.current?.chain().focus().insertContentAt(i,{type:"image",attrs:{id:crypto.randomUUID(),src:e.url,alt:e.title}}).run(),!0}if(n?.files.length){for(let e of(t.preventDefault(),Array.from(n.files)))C(e,i);return!0}return!1},handlePaste:(e,t)=>
90{let n=Array.from(t.clipboardData?.files||[]);return!!n.length&&(t.preventDefault(),n.forEach(e=>void C(e)),!0)}}});if(u.current=A,(0,c.useEffect)(()=>(d.insert.current=(e,t)=>{A&&!A.isDestroyed&&A.chain().focus().insertContent({type:"image",attrs:{id:crypto.randomUUID(),src:e,alt:t}}).run()},()=>{d.insert.current=null}),[A,d.insert]),(0,c.useEffect)(()=>{!s&&A&&JSON.stringify(A.getJSON())!==JSON.stringify(e.doc)&&A.commands.setContent(e.doc,{emitUpdate:!1})},[A,e.doc,s]),(0,c.useEffect)(()=>{A?.setEditable(!s?.readOnly,!1)},[A,s?.readOnly]),(0,c.useEffect)(()=>{if(A&&s)return s.anchor.current=e=>{if("document"===e.kind)try{let t=wh.getState(A.state),n=wF(s.doc,t.type,yl(e.from),t.binding.mapping),r=wF(s.doc,t.type,yl(e.to),t.binding.mapping);null!==n&&null!==r&&A.chain().focus().setTextSelection({from:n,to:r}).scrollIntoView().run()}catch{}},()=>{s.anchor.current=null}},[A,s]),!A)return null;let E=()=>A.chain().focus(),T=e=>{let t=null;A.state.doc.descendants((n,r)=>{n.type.name===e&&r<=A.state.selection.from&&(t=r)}),null!==t&&A.commands.setNodeSelection(t),d.open("properties")},O=pk(A),N=A.state.selection.from,D=Math.max(0,O.findIndex(e=>N>=e.pos&&N<e.pos+e.size)),R=A.state.selection instanceof e5?A.state.selection.node:null,I=e=>{if(!R)return;let t=null;if(A.state.doc.descendants((e,n)=>{(R.attrs.id?e.attrs.id===R.attrs.id:e===R)&&(t=n)}),null!==t){let n=A.state.doc.nodeAt(t);A.view.dispatch(A.state.tr.setNodeMarkup(t,void 0,{...n.attrs,...e}))}},L=O[D],_=e=>sM(t=>t.type.name===e)(A.state.selection),P=(e,t)=>{let n=_(e);n&&A.view.dispatch(A.state.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,...t}))},j=(e,t)=>{let n=A.state.selection.$from;n.depth>
901?E().insertContentAt(n.after(1),e).run():E().insertContent(e).run(),t?T(t):d.open("properties")},z=e=>({type:"paragraph",...e?{content:[{type:"text",text:e}]}:{}}),$=a.TEMPLATES.find(t=>t.id===e.templateId)?.accent||"#17483d",B=_("banner"),V=_("callout"),H=_("columns"),F=[["bar",aj.default],["line",az.default],["area",a$.default],["pie",aB.default],["donut",aB.default],["stacked-bar",aH.default],["scatter",aV.default]],U=(e,t,n,r=o(`studio.${e}`))=>(0,l.jsxs)("button",{type:"button",onClick:n,children:[(0,l.jsx)(t,{size:18,"aria-hidden":!0}),(0,l.jsx)("span",{children:r})]},e),W=[["bold",as.default,()=>E().toggleBold().run()],["italic",ao.default,()=>E().toggleItalic().run()],["underline",al.default,()=>E().toggleUnderline().run()],["strike",aa.default,()=>E().toggleStrike().run()],["code",ak.default,()=>E().toggleCode().run()],["bulletList",ad.default,()=>E().toggleBulletList().run()],["orderedList",ah.default,()=>E().toggleOrderedList().run()],["taskList",aU.default,()=>E().toggleTaskList().run()]],q={bold:"bold",italic:"italic",underline:"underline",strike:"strike",code:"inlineCode",bulletList:"list",orderedList:"orderedList",taskList:"checklist"};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"studio-tools studio-fmt",role:"toolbar","aria-label":o("studio.formatting"),children:[(0,l.jsxs)("select",{"aria-label":o("studio.textStyle"),value:A.isActive("heading")?String(A.getAttributes("heading").level):"paragraph",onChange:e=>"paragraph"===e.target.value?E().setParagraph().run():E().setHeading({level:Number(e.target.value)}).run(),children:[(0,l.jsx)("option",{value:"paragraph",children:o("studio.paragraph")}),[1,2,3,4].map(e=>(0,l.jsx)("option",{value:e,children:o(`studio.h${e}`)},e))]}),(0,l.jsx)("select",{"aria-label":o("studio.fontFamily"),value:A.getAttributes("textStyle").fontFamily||"Arial",onChange:e=>E().setMark("textStyle",{fontFamily:e.target.value}).run(),children:a.STUDIO_FONTS.map(e=>(0,l.jsx)("option",{children:e},e))}),(0,l.jsx)("input",{className:"studio-font-size","aria-label":o("studio.fontSize"),type:"number",min:8,max:96,value:A.getAttributes("textStyle").fontSize||15,onChange:e=>A.chain().setMark("textStyle",{fontSize:Math.max(8,Math.min(96,Number(e.target.value)))}).run()}),(0,l.jsx)("input",{"aria-label":o("studio.color"),type:"color",value:A.getAttributes("textStyle").color||"#172a27",onChange:e=>A.chain().setMark("textStyle",{color:e.target.value}).run()}),(0,l.jsxs)("label",{className:"studio-highlight",title:o("studio.highlightColor"),children:[(0,l.jsx)(ax.default,{size:14,"aria-hidden":!0}),(0,l.jsx)("input",{"aria-label":o("studio.highlightColor"),type:"color",value:A.getAttributes("textStyle").background||"#fff3a3",onChange:e=>A.chain().setMark("textStyle",{background:e.target.value}).run()})]}),(0,l.jsx)("span",{className:"studio-sep","aria-hidden":!0}),W.map(([e,t,n])=>(0,l.jsx)("button",{"aria-label":o(`studio.${q[e]}`),title:o(`studio.${q[e]}`),"aria-pressed":A.isActive(e),onMouseDown:e=>e.preventDefault(),onClick:n,children:(0,l.jsx)(t,{size:16})},e)),(0,l.jsx)("button",{"aria-label":o("studio.link"),title:o("studio.link"),"aria-pressed":A.isActive("link"),onClick:()=>{v(String(A.getAttributes("link").href||"https://")),d.open("properties")},children:(0,l.jsx)(ac.default,{size:16})}),[["left",au.default],["center",ap.default],["right",af.default],["justify",am.default]].map(([e,t])=>(0,l.jsx)("button",{"aria-label":o(`studio.align${e[0].toUpperCase()}${e.slice(1)}`),"aria-pressed":A.isActive({textAlign:e}),onMouseDown:e=>e.preventDefault(),onClick:()=>E().setTextAlign(e).run(),children:(0,l.jsx)(t,{size:16})},e)),(0,l.jsxs)("button",{onClick:()=>d.open("insert"),children:[(0,l.jsx)(aw.Plus,{size:16}),o("studio.toolsInsert")]})]}),y&&(0,l.jsx)("p",{role:"alert",className:"studio-notice",children:y}),(0,l.jsxs)("div",{className:"studio-document-scroll",children:[(0,l.jsx)("style",{children:(0,a.documentStyles)(e,!0)}),(0,l.jsx)("div",{className:"studio-document-page",style:{zoom:i/100},children:(0,l.jsx)(lG,{editor:A})})]}),(0,l.jsx)(pj.StudioPanel,{tool:"insert",children:(0,l.jsxs)("div",{className:"studio-elements",children:[(0,l.jsxs)("section",{children:[(0,l.jsx)("strong",{children:o("studio.elements.text")}),(0,l.jsxs)("div",{className:"studio-element-grid",children:[U("h1",aS.default,()=>E().setHeading({level:1}).run()),U("h2",aC.default,()=>E().setHeading({level:2}).run()),U("h3",aM.default,()=>E().setHeading({level:3}).run()),U("addText",aA.default,()=>E().insertContent({type:"paragraph"}).run()),U("quote",aE.default,()=>E().toggleBlockquote().run()),U("codeBlock",ak.default,()=>E().toggleCodeBlock().run()),U("rule",aT.Minus,()=>E().setHorizontalRule().run())]})]}),(0,l.jsxs)("section",{children:[(0,l.jsx)("strong",{children:o("studio.elements.layout")}),(0,l.jsxs)("div",{className:"studio-element-grid",children:[a.BANNER_VARIANTS.map(e=>U(`banner${e[0].toUpperCase()}${e.slice(1)}`,aO.default,()=>j({type:"banner",attrs:{variant:e},content:[{type:"heading",attrs:{level:"cover"===e?1:2},content:[{type:"text",text:o("studio.bannerTitle")}]},z(o("studio.bannerSubtitle"))]}))),U("columns2",aN.default,()=>j({type:"columns",content:[{type:"column",content:[z(o("studio.columnText"))]}
90,{type:"column",content:[z(o("studio.columnText"))]}]})),U("columns3",aD.default,()=>j({type:"columns",content:[1,2,3].map(()=>({type:"column",content:[z(o("studio.columnText"))]}))})),[["note",aR.default],["tip",aI.default],["warning",aL.default],["accent",a_.default]].map(([e,t])=>U(`callout${e[0].toUpperCase()}${e.slice(1)}`,t,()=>j({type:"callout",attrs:{tone:e,icon:w2[e]},content:[z(o(`studio.callout${e[0].toUpperCase()}${e.slice(1)}`))]})))]})]}),(0,l.jsxs)("section",{children:[(0,l.jsx)("strong",{children:o("studio.elements.data")}),(0,l.jsxs)("div",{className:"studio-element-grid",children:[U("table",aP.default,()=>E().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()),U("stats",aF.default,()=>j({type:"stats",attrs:{id:crypto.randomUUID(),items:[{value:"48%",label:o("studio.statLabel")},{value:"12.4k",label:o("studio.statLabel")},{value:"3.2×",label:o("studio.statLabel")}]}},"stats")),F.map(([e,t])=>U(`chart-${e}`,t,()=>j({type:"chart",attrs:{id:crypto.randomUUID(),chart:{...structuredClone(pE),type:e,..."scatter"===e?{x:["1","2","3"]}:{}}}},"chart"),o(`studio.chartTypes.${e}`)))]})]}),(0,l.jsxs)("section",{children:[(0,l.jsx)("strong",{children:o("studio.elements.lists")}),(0,l.jsxs)("div",{className:"studio-element-grid",children:[U("list",ad.default,()=>E().toggleBulletList().run()),U("orderedList",ah.default,()=>E().toggleOrderedList().run()),U("checklist",aU.default,()=>E().toggleTaskList().run())]})]}),(0,l.jsxs)("section",{children:[(0,l.jsx)("strong",{children:o("studio.elements.media")}),(0,l.jsxs)("div",{className:"studio-element-grid",children:[(0,l.jsxs)("label",{className:"studio-import",children:[(0,l.jsx)(aW.ImagePlus,{size:18,"aria-hidden":!0}),(0,l.jsx)("span",{children:o("studio.insertImage")}),(0,l.jsx)("input",{className:"rlBare",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:e=>{e.target.files?.[0]&&C(e.target.files[0]),e.target.value=""}})]}),U("generateImage",aq.default,()=>{E().insertContent({type:"image",attrs:{id:crypto.randomUUID(),alt:o("studio.newImage"),prompt:o("studio.newImage"),aspect:"16:9"}}).run(),T("image")}),U("graphics",aK.default,()=>x(!0))]})]}),k&&(0,l.jsx)("section",{children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsx)("p",{role:"status",children:o("studio.loading")}),children:(0,l.jsx)(w1,{accent:e.brand?.accent||$,onInsert:(e,t)=>E().insertContent({type:"image",attrs:{id:crypto.randomUUID(),src:e,alt:t}}).run()})})})]})}),(0,l.jsxs)(pj.StudioPanel,{tool:"layers",children:[(0,l.jsx)("p",{className:"studio-help",children:o("studio.blockDragHint")}),(0,l.jsx)("div",{className:"studio-outline",children:O.map((e,t)=>(0,l.jsxs)("div",{className:"studio-outline-row","data-selected":t===D,draggable:!0,onDragStart:e=>{S.current=t,e.dataTransfer.setData(w3,String(t))},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),null!==S.current&&px(A,S.current,t),S.current=null},children:[(0,l.jsx)(av.default,{size:14,"aria-hidden":!0}),(0,l.jsx)("button",{onClick:()=>{pS(A,e.pos),["chart","image","stats"].includes(e.type)&&d.open("properties")},children:e.label.slice(0,70)}),(0,l.jsx)("button",{"aria-label":`${o("studio.moveEarlier")} ${t+1}`,disabled:0===t,onClick:()=>px(A,t,t-1),children:(0,l.jsx)(ag.ChevronUp,{size:14})}),(0,l.jsx)("button",{"aria-label":`${o("studio.moveLater")} ${t+1}`,disabled:t===O.length-1,onClick:()=>px(A,t,t+1),children:(0,l.jsx)(ay.ChevronDown,{size:14})})]},e.pos))})]}),(0,l.jsxs)(pj.StudioPanel,{tool:"properties",children:[null!==w&&(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsxs)("label",{children:[o("studio.linkUrl"),(0,l.jsx)("input",{value:w,onChange:e=>v(e.target.value)})]}),(0,l.jsx)("button",{disabled:!/^https?:\/\//i.test(w),onClick:()=>{E().extendMarkRange("link").setLink({href:w}).run(),v(null)},children:o("studio.applyLink")}),(0,l.jsx)("button",{onClick:()=>{E().unsetLink().run(),v(null)},children:o("studio.removeLink")})]}),R?.type.name==="chart"?(0,l.jsx)(pI,{value:JSON.stringify(R.attrs.chart),onChange:e=>I({chart:JSON.parse(e)})},R.attrs.id||N):R?.type.name==="image"?(0,l.jsx)(pD,{props:R.attrs,images:n,assets:r,t:o,onPatch:I}
90,R.attrs.id||N):R?.type.name==="stats"?(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsx)("strong",{children:o("studio.stats")}),(0,l.jsx)(pP,{items:R.attrs.items,onChange:e=>I({items:e})})]}):B?(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsx)("strong",{children:o("studio.banner")}),(0,l.jsxs)("label",{className:"studio-field",children:[o("studio.bannerVariant"),(0,l.jsx)("select",{"aria-label":o("studio.bannerVariant"),value:String(B.node.attrs.variant),onChange:e=>P("banner",{variant:e.target.value}),children:a.BANNER_VARIANTS.map(e=>(0,l.jsx)("option",{value:e,children:o(`studio.banner${e[0].toUpperCase()}${e.slice(1)}`)},e))})]}),(0,l.jsxs)("label",{className:"studio-field",children:[o("studio.bannerFill"),(0,l.jsx)("input",{"aria-label":o("studio.bannerFill"),type:"color",value:String(B.node.attrs.fill||$),onChange:e=>P("banner",{fill:e.target.value})})]}),B.node.attrs.fill&&(0,l.jsx)("button",{onClick:()=>P("banner",{fill:null}),children:o("studio.resetBrand")}),(0,l.jsx)(pD,{props:{src:B.node.attrs.image||"",alt:o("studio.bannerImage"),aspect:"21:9",prompt:""},images:n,assets:r,t:o,onPatch:e=>{"src"in e&&P("banner",{image:e.src||null})}},B.pos)]}):V?(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsx)("strong",{children:o("studio.callout")}),(0,l.jsxs)("label",{className:"studio-field",children:[o("studio.calloutTone"),(0,l.jsx)("select",{"aria-label":o("studio.calloutTone"),value:String(V.node.attrs.tone),onChange:e=>P("callout",{tone:e.target.value,icon:w2[e.target.value]}),children:a.CALLOUT_TONES.map(e=>(0,l.jsx)("option",{value:e,children:o(`studio.callout${e[0].toUpperCase()}${e.slice(1)}`)},e))})]}),(0,l.jsxs)("label",{className:"studio-field",children:[o("studio.calloutIcon"),(0,l.jsx)("input",{"aria-label":o("studio.calloutIcon"),value:String(V.node.attrs.icon||""),maxLength:4,onChange:e=>P("callout",{icon:e.target.value||null})})]})]}):H?(0,l.jsx)("p",{className:"studio-help",children:o("studio.columnsHint",{count:H.node.childCount})}):(0,l.jsx)("p",{className:"studio-help",children:o("studio.selectionHint")}),A.isActive("table")&&(0,l.jsx)("div",{className:"studio-insert-grid",children:["addRowAfter","addColumnAfter","deleteRow","deleteColumn","deleteTable"].map((e,t)=>(0,l.jsx)("button",{onClick:()=>E()[e]().run(),children:o(`studio.${["addRow","addColumn","deleteRow","deleteColumn","deleteTable"][t]}`)},e))}),L&&(0,l.jsxs)("div",{className:"studio-property-section",children:[(0,l.jsx)("strong",{children:o("studio.block")}),(0,l.jsxs)("div",{className:"studio-tools",children:[(0,l.jsxs)("button",{disabled:0===D,onClick:()=>px(A,D,D-1),children:[(0,l.jsx)(ag.ChevronUp,{size:16}),o("studio.moveEarlier")]}),(0,l.jsxs)("button",{disabled:D===O.length-1,onClick:()=>px(A,D,D+1),children:[(0,l.jsx)(ay.ChevronDown,{size:16}),o("studio.moveLater")]}),(0,l.jsxs)("button",{onClick:()=>E().deleteRange({from:L.pos,to:L.pos+L.size}).run(),children:[(0,l.jsx)(ab.default,{size:16}),o("studio.deleteElement")]})]})]})]})]})}],708584)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.