@opengis/richtext 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/richtext.css +1 -0
- package/dist/richtext.js +25602 -0
- package/dist/richtext.umd.cjs +143 -0
- package/package.json +58 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
(function(g,ve){typeof exports=="object"&&typeof module<"u"?module.exports=ve(require("vue")):typeof define=="function"&&define.amd?define(["vue"],ve):(g=typeof globalThis<"u"?globalThis:g||self,g.richtext=ve(g.Vue))})(this,function(g){"use strict";function ve(t){this.content=t}ve.prototype={constructor:ve,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new ve(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ve(n)},addToStart:function(t,e){return new ve([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ve(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new ve(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ve.from(t),t.size?new ve(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ve.from(t),t.size?new ve(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ve.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},ve.from=function(t){if(t instanceof ve)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ve(e)};function fu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=fu(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function pu(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=t.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||l.content.size){let c=pu(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,s){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",i=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new M(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let s=0,i=0;i<n;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,n-i-1))),r.push(l),o+=l.nodeSize),i=a}return new M(r,o)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new M(o,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return fu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return pu(this,e,n,r)}findIndex(e,n=-1){if(e==0)return fs(0,e);if(e==this.size)return fs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let s=this.child(r),i=o+s.nodeSize;if(i>=e)return i==e||n>0?fs(r+1,i):fs(r,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const dl={index:0,offset:0};function fs(t,e){return dl.index=t,dl.offset=e,dl}function ps(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ps(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ps(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ce=class cu{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ps(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return cu.none;if(e instanceof cu)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ce.none=[];class hs extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=mu(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(hu(this.content,e+this.openStart,n+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,n){if(!n)return D.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(M.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new D(e,r,o)}}D.empty=new D(M.empty,0,0);function hu(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:i,offset:l}=t.findIndex(n);if(o==e||s.isText){if(l!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(hu(s.content,e-o-1,n-o-1)))}function mu(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),i=t.maybeChild(o);if(s==e||i.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=mu(i.content,e-s-1,n);return l&&t.replaceChild(o,i.copy(l))}function Vg(t,e,n){if(n.openStart>t.depth)throw new hs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hs("Inconsistent open depths");return gu(t,e,n,0)}function gu(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let i=gu(t,e,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,l=i.content;return tr(i,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Hg(n,t);return tr(s,bu(t,i,l,e,r))}else return tr(s,ms(t,e,r))}function yu(t,e){if(!e.type.compatibleContent(t.type))throw new hs("Cannot join "+e.type.name+" onto "+t.type.name)}function fl(t,e,n){let r=t.node(n);return yu(r,e.node(n)),r}function er(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function co(t,e,n,r){let o=(e||t).node(n),s=0,i=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(er(t.nodeAfter,r),s++));for(let l=s;l<i;l++)er(o.child(l),r);e&&e.depth==n&&e.textOffset&&er(e.nodeBefore,r)}function tr(t,e){return t.type.checkContent(e),t.copy(e)}function bu(t,e,n,r,o){let s=t.depth>o&&fl(t,e,o+1),i=r.depth>o&&fl(n,r,o+1),l=[];return co(null,t,o,l),s&&i&&e.index(o)==n.index(o)?(yu(s,i),er(tr(s,bu(t,e,n,r,o+1)),l)):(s&&er(tr(s,ms(t,e,o+1)),l),co(e,n,o,l),i&&er(tr(i,ms(n,r,o+1)),l)),co(r,null,o,l),new M(l)}function ms(t,e,n){let r=[];if(co(null,t,n,r),t.depth>n){let o=fl(t,e,n+1);er(tr(o,ms(t,e,n+1)),r)}return co(e,null,n,r),new M(r)}function Hg(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(M.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class uo{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ce.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new gs(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,s=n;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),c=s-a;if(r.push(i,l,o+a),!c||(i=i.child(l),i.isText))break;s=c-1,o+=a+1}return new uo(n,r,s)}static resolveCached(e,n){let r=Eu.get(e);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else Eu.set(e,r=new Ug);let o=r.elts[r.i]=uo.resolve(e,n);return r.i=(r.i+1)%zg,o}}class Ug{constructor(){this.elts=[],this.i=0}}const zg=12,Eu=new WeakMap;class gs{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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)}}const jg=Object.create(null);let On=class uu{constructor(e,n,r,o=ce.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||M.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,n,r,o=0){this.content.nodesBetween(e,n,r,o,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,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}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,n,r){return this.type==e&&ps(this.attrs,n||e.defaultAttrs||jg)&&ce.sameSet(this.marks,r||ce.none)}copy(e=null){return e==this.content?this:new uu(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new uu(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let o=this.resolve(e),s=this.resolve(n),i=r?0:o.sharedDepth(n),l=o.start(i),c=o.node(i).content.cut(o.pos-l,s.pos-l);return new D(c,o.depth-i,s.depth-i)}replace(e,n,r){return Vg(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return uo.resolveCached(this,e)}resolveNoCache(e){return uo.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),wu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.validEnd:!1}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=ce.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=M.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};On.prototype.text=void 0;class ys extends On{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ys(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ys(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class nr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Wg(e,n);if(r.next==null)return nr.empty;let o=ku(r);r.next&&r.err("Unexpected trailing text");let s=Qg(Xg(o));return Zg(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let s=n;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!n||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=s(d,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
2
|
+
`)}}nr.empty=new nr(!0);class Wg{constructor(e,n){this.string=e,this.nodeTypes=n,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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ku(t){let e=[];do e.push(Kg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Kg(t){let e=[];do e.push(qg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qg(t){let e=Yg(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Jg(t,e);else break;return e}function Cu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Jg(t,e){let n=Cu(t),r=n;return t.eat(",")&&(t.next!="}"?r=Cu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Gg(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(e)&&o.push(i)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function Yg(t){if(t.eat("(")){let e=ku(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Gg(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Xg(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function o(i,l){i.forEach(a=>a.to=l)}function s(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=s(i.exprs[a],l);if(a==i.exprs.length-1)return c;o(c,l=n())}else if(i.type=="star"){let a=n();return r(l,a),o(s(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=n();return o(s(i.expr,l),a),o(s(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(s(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=n();o(s(i.expr,a),u),a=u}if(i.max==-1)o(s(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=n();r(a,u),o(s(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Su(t,e){return e-t}function vu(t,e){let n=[];return r(e),n.sort(Su);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:l,to:a}=s[i];!l&&n.indexOf(a)==-1&&r(a)}}}function Qg(t){let e=Object.create(null);return n(vu(t,0));function n(r){let o=[];r.forEach(i=>{t[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);vu(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new nr(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let l=o[i][1].sort(Su);s.next.push({type:o[i][0],next:e[l.join(",")]||n(l)})}return s}}function Zg(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];i.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function xu(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Tu(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Ou(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function Nu(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new ty(t,r,e[r]);return n}let Au=class Bg{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Nu(e,r.attrs),this.defaultAttrs=xu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==nr.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:Tu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new On(this,this.computeAttrs(e),M.from(n),ce.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new On(this,this.computeAttrs(e),n,ce.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(M.empty,!0);return s?new On(this,e,n.append(s),ce.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ou(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ce.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new Bg(s,n,i));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ey(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class ty{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ey(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bs{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Nu(e,o.attrs),this.excluded=null;let s=xu(this.attrs);this.instance=s?new ce(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ce(this,Tu(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new bs(s,o++,n,i)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ou(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class _u{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=ve.from(e.nodes),n.marks=ve.from(e.marks||{}),this.nodes=Au.compile(this.spec.nodes,this),this.marks=bs.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=nr.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Mu(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:Mu(this,i.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Au){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new ys(r,r.defaultAttrs,e,ce.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return On.fromJSON(this,e)}markFromJSON(e){return ce.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Mu(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],i=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ny(t){return t.tag!=null}function ry(t){return t.style!=null}let Ar=class du{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(ny(o))this.tags.push(o);else if(ry(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Du(this,n,!1);return r.addAll(e,ce.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Du(this,n,!0);return r.addAll(e,ce.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(iy(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(i.getAttrs){let a=i.getAttrs(n);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let l=n[i];if((l.priority==null?50:l.priority)<s)break}n.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Pu(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Pu(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new du(e,du.schemaRules(e)))}};const Ru={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},oy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Lu={ol:!0,ul:!0},fo=1,pl=2,po=4;function Iu(t,e,n){return e!=null?(e?fo:0)|(e==="full"?pl:0):t&&t.whitespace=="pre"?fo|pl:n&~po}class Es{constructor(e,n,r,o,s,i){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=ce.none,this.match=s||(i&po?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&fo)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ru.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Du{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=Iu(null,n.preserveWhitespace,0)|(r?po:0);o?s=new Es(o.type,o.attrs,ce.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new Es(null,null,ce.none,!0,null,i):s=new Es(e.schema.topNodeType,null,ce.none,!0,null,i),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,s=o.options&pl?"full":this.localPreserveWS||(o.options&fo)>0;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],l=e.previousSibling;(!i||l&&l.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;Lu.hasOwnProperty(i)&&this.parser.normalizeLists&&sy(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:oy.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Ru.hasOwnProperty(i))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(s,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];i!=l;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let i=ce.none;for(let l of o.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Bu(l.type,e.type))&&(i=l.addToSet(i));return s.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=Iu(e,s,i.options);i.options&po&&i.content.length==0&&(l|=po);let a=ce.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Bu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Es(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=fo)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function sy(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Lu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function iy(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Pu(t){let e={};for(let n in t)e[n]=t[n];return e}function Bu(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],i=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&i(u))return!0}};if(i(o.contentMatch))return!0}}class rr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=hl(n).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let l=0,a=0;for(;l<s.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)o=s.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,n);u&&(s.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=ws(hl(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&ws(hl(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return ws(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new rr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Fu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Fu(e.marks)}}function Fu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function hl(t){return t.document||window.document}const $u=new WeakMap;function ly(t){let e=$u.get(t);return e===void 0&&$u.set(t,e=ay(t)),e}function ay(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function ws(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=ly(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:h}=ws(t,f,n,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}const Vu=65535,Hu=Math.pow(2,16);function cy(t,e){return t+e*Hu}function Uu(t){return t&Vu}function uy(t){return(t-(t&Vu))/Hu}const zu=1,ju=2,ks=4,Wu=8;class ml{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Wu)>0}get deletedBefore(){return(this.delInfo&(zu|ks))>0}get deletedAfter(){return(this.delInfo&(ju|ks))>0}get deletedAcross(){return(this.delInfo&ks)>0}}class ht{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ht.empty)return ht.empty}recover(e){let n=0,r=Uu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+uy(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,p=a+o+(f<0?0:u);if(r)return p;let h=e==(n<0?a:d)?null:cy(l/3,e-a),m=e==a?ju:e==d?zu:ks;return(n<0?e!=a:e!=d)&&(m|=Wu),new ml(p,m,h)}o+=u-c}return r?e+o:new ml(e+o,0,null)}touches(e,n){let r=0,o=Uu(n),s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],l=i-(this.inverted?s:0),a=i+(this.inverted?0:s),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new ht(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ht.empty:new ht(e<0?[0,-e,0]:[0,0,e])}}ht.empty=new ht([]);class ho{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ho(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new ho;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let s=this.from;s<this.to;s++){let i=this._maps[s],l=i.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new ml(e,o,null)}}const gl=Object.create(null);class Ue{getMap(){return ht.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=gl[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in gl)throw new RangeError("Duplicate use of step JSON ID "+e);return gl[e]=n,n.prototype.jsonID=e,n}}class Ne{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ne(e,null)}static fail(e){return new Ne(null,e)}static fromReplace(e,n,r,o){try{return Ne.ok(e.replace(n,r,o))}catch(s){if(s instanceof hs)return Ne.fail(s.message);throw s}}}function yl(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(yl(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return M.fromArray(r)}class Nn extends Ue{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new D(yl(n.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return Ne.fromReplace(e,this.from,this.to,s)}invert(){return new Wt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Nn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nn(n.from,n.to,e.markFromJSON(n.mark))}}Ue.jsonID("addMark",Nn);class Wt extends Ue{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(yl(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Ne.fromReplace(e,this.from,this.to,r)}invert(){return new Nn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Wt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Wt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Wt(n.from,n.to,e.markFromJSON(n.mark))}}Ue.jsonID("removeMark",Wt);class An extends Ue{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new D(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new An(this.pos,n.marks[o]);return new An(this.pos,this.mark)}}return new or(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new An(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new An(n.pos,e.markFromJSON(n.mark))}}Ue.jsonID("addNodeMark",An);class or extends Ue{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new D(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new An(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new or(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new or(n.pos,e.markFromJSON(n.mark))}}Ue.jsonID("removeNodeMark",or);class Le extends Ue{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&bl(e,this.from,this.to)?Ne.fail("Structure replace would overwrite content"):Ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ht([this.from,this.to-this.from,this.slice.size])}invert(e){return new Le(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Le(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Le)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Le(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Le(e.from,this.to,n,this.structure)}else return null}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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Le(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}Ue.jsonID("replace",Le);class Ie extends Ue{constructor(e,n,r,o,s,i,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=l}apply(e){if(this.structure&&(bl(e,this.from,this.gapFrom)||bl(e,this.gapTo,this.to)))return Ne.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ne.fromReplace(e,this.from,this.to,r):Ne.fail("Content does not fit in gap")}getMap(){return new ht([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ie(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new Ie(n.pos,r.pos,o,s,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ie(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ue.jsonID("replaceAround",Ie);function bl(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function dy(t,e,n,r){let o=[],s=[],i,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+a.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(i&&i.to==f&&i.mark.eq(d[m])?i.to=p:o.push(i=new Wt(f,p,d[m])));l&&l.to==f?l.to=p:s.push(l=new Nn(f,p,r))}}),o.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function fy(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(i,l)=>{if(!i.isInline)return;s++;let a=null;if(r instanceof bs){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==s-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=c,f.step=s):o.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),o.forEach(i=>t.step(new Wt(i.from,i.to,i.style)))}function El(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new Le(l,u,D.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Wt(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new D(M.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new Le(l+f.index,l+f.index+f[0].length,h))}}l=u}if(!r.validEnd){let a=r.fillBefore(M.empty,!0);t.replace(l,l,new D(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function py(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _r(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),s=t.$from.index(r),i=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(s,i,n))return r;if(r==0||o.type.spec.isolating||!py(o,s,i))break}return null}function hy(t,e,n){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),l=o.after(s+1),a=i,c=l,u=M.empty,d=0;for(let h=s,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=M.from(r.node(h).copy(u)),d++):a--;let f=M.empty,p=0;for(let h=s,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=M.from(o.node(h).copy(f)),p++):c++;t.step(new Ie(a,c,i,l,new D(u.append(f),d,p),u.size-d,!0))}function wl(t,e,n=null,r=t){let o=my(t,e),s=o&&gy(r,e);return s?o.map(Ku).concat({type:e,attrs:n}).concat(s.map(Ku)):null}function Ku(t){return{type:t,attrs:null}}function my(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return n.canReplaceWith(r,o,i)?s:null}function gy(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:i}function yy(t,e,n){let r=M.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let l=n[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new Ie(o,s,o,s,new D(r,0,0),n.length,!0))}function by(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(i,l)=>{let a=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,a)&&Ey(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&Ju(t,i,l,s),El(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(l,1),f=u.map(l+i.nodeSize,1);return t.step(new Ie(d,f,d+1,f-1,new D(M.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&qu(t,i,l,s),!1}})}function qu(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+s+i.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Ju(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function Ey(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function wy(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ie(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new D(M.from(i),0,0),1,!0))}function un(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>s;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let l=o.indexAfter(s),a=r&&r[0];return o.node(s).canReplaceWith(l,l,a?a.type:o.node(s+1).type)}function ky(t,e,n=1,r){let o=t.doc.resolve(e),s=M.empty,i=M.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){s=M.from(o.node(l).copy(s));let u=r&&r[c];i=M.from(u?u.type.create(u.attrs,i):o.node(l).copy(i))}t.step(new Le(e,e,new D(s.append(i),n,n),!0))}function _n(t,e){let n=t.resolve(e),r=n.index();return Gu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),i=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Gu(t,e){return!!(t&&e&&!t.isLeaf&&Cy(t,e))}function Cs(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,i,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):n>0?(s=r.node(o+1),l++,i=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),i=r.node(o+1)),s&&!s.isTextblock&&Gu(s,i)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function Sy(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),i=s.node().type;if(o&&i.inlineContent){let u=i.whitespace=="pre",d=!!i.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Ju(t,u.node(),u.before(),l)}i.inlineContent&&El(t,e+n-1,i,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new Le(c,a.map(e+n,-1),D.empty,!0)),r===!0){let u=t.doc.resolve(c);qu(t,u.node(),u.before(),t.steps.length)}return t}function vy(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function xy(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),c=r.node(i),u=!1;if(s==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function Ss(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return Yu(o,s,r)?new Le(e,n,r):new Ty(o,s,r).fit()}function Yu(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ty{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=M.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,l=o.depth;for(;i&&l&&s.childCount==1;)s=s.firstChild.content,i--,l--;let a=new D(s,i,l);return e>-1?new Ie(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Le(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=kl(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(i?c.matchType(i.type)||(d=c.fillBefore(M.from(i),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=kl(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=kl(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new D(mo(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new D(mo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let p=l.size+e-(i.content.size-i.openEnd);for(;c<l.childCount;){let m=l.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(d=y,u.push(Xu(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=go(this.placed,n,M.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<p;m++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=h?e==0?D.empty:new D(mo(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new D(mo(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Cl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),i=Cl(e,n,o,r,s);if(i){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Cl(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=go(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=go(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=go(this.placed,this.frontier.length,n))}}function mo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(mo(t.firstChild.content,e-1,n)))}function go(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(go(t.lastChild.content,e-1,n)))}function kl(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Xu(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Xu(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function Cl(t,e,n,r,o){let s=t.node(e),i=o?t.indexAfter(e):t.index(e);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,i);return l&&!Oy(n,s.content,i)?l:null}function Oy(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Ny(t){return t.spec.defining||t.spec.definingForContent}function Ay(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(Yu(o,s,r))return t.step(new Le(e,n,r));let i=Zu(o,t.doc.resolve(n));i[i.length-1]==0&&i.pop();let l=-(o.depth+1);i.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;i.indexOf(f)>-1?l=f:o.before(f)==p&&i.splice(1,0,-f)}let a=i.indexOf(l),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=Ny(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<i.length;m++){let y=i[(m+a)%i.length],b=!0;y<0&&(b=!1,y=-y);let w=o.node(y-1),k=o.index(y-1);if(w.canReplaceWith(k,k,h.type,h.marks))return t.replace(o.before(y),b?s.after(y):n,new D(Qu(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=i.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=i[f];p<0||(e=o.before(p),n=s.after(p))}}function Qu(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(Qu(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(t).append(t);t=i.append(s.matchFragment(i).fillBefore(M.empty,!0))}return t}function _y(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=vy(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new D(M.from(r),0,0))}function My(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=Zu(r,o);for(let i=0;i<s.length;i++){let l=s[i],a=i==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}function Zu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Mr extends Ue{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Ne.fromReplace(e,this.pos,this.pos+1,new D(M.from(o),0,n.isLeaf?0:1))}getMap(){return ht.empty}invert(e){return new Mr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mr(n.pos,n.attr,n.value)}}Ue.jsonID("attr",Mr);class yo extends Ue{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ne.ok(r)}getMap(){return ht.empty}invert(e){return new yo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yo(n.attr,n.value)}}Ue.jsonID("docAttr",yo);let Rr=class extends Error{};Rr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Rr.prototype=Object.create(Error.prototype),Rr.prototype.constructor=Rr,Rr.prototype.name="TransformError";class Sl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ho}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Rr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let o=Ss(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new D(M.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Ay(this,e,n,r),this}replaceRangeWith(e,n,r){return _y(this,e,n,r),this}deleteRange(e,n){return My(this,e,n),this}lift(e,n){return hy(this,e,n),this}join(e,n=1){return Sy(this,e,n),this}wrap(e,n){return yy(this,e,n),this}setBlockType(e,n=e,r,o=null){return by(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return wy(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Mr(e,n,r)),this}setDocAttribute(e,n){return this.step(new yo(e,n)),this}addNodeMark(e,n){return this.step(new An(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ce)n.isInSet(r.marks)&&this.step(new or(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new or(e,s)),o=s.removeFromSet(o);for(let l=i.length-1;l>=0;l--)this.step(i[l])}return this}split(e,n=1,r){return ky(this,e,n,r),this}addMark(e,n,r){return dy(this,e,n,r),this}removeMark(e,n,r){return fy(this,e,n,r),this}clearIncompatible(e,n,r){return El(this,e,n,r),this}}const vl=Object.create(null);class z{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ed(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?D.empty:n),l==0&&rd(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:l}=o[s],a=e.mapping.slice(r),c=a.map(i.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),rd(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new j(e):Lr(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=n<0?Lr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Lr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(i)return i}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new kt(e.node(0))}static atStart(e){return Lr(e,e,0,0,1)||new kt(e)}static atEnd(e){return Lr(e,e,e.content.size,e.childCount,-1)||new kt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=vl[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in vl)throw new RangeError("Duplicate use of selection JSON ID "+e);return vl[e]=n,n.prototype.jsonID=e,n}getBookmark(){return j.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class ed{constructor(e,n){this.$from=e,this.$to=n}}let td=!1;function nd(t){!td&&!t.parent.inlineContent&&(td=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class j extends z{constructor(e,n=e){nd(e),nd(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return z.near(r);let o=e.resolve(n.map(this.anchor));return new j(o.parent.inlineContent?o:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof j&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new j(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=z.findFrom(n,r,!0)||z.findFrom(n,-r,!0);if(s)n=s.$head;else return z.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(z.findFrom(e,-r,!0)||z.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new j(e,n)}}z.jsonID("text",j);class vs{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vs(e.map(this.anchor),e.map(this.head))}resolve(e){return j.between(e.resolve(this.anchor),e.resolve(this.head))}}class U extends z{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?z.near(s):new U(s)}content(){return new D(M.from(this.node),0,0)}eq(e){return e instanceof U&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new xl(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new U(e.resolve(n.anchor))}static create(e,n){return new U(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}U.prototype.visible=!1,z.jsonID("node",U);class xl{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vs(r,r):new xl(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&U.isSelectable(r)?new U(n):z.near(n)}}class kt extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=z.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new kt(e)}map(e){return new kt(e)}eq(e){return e instanceof kt}getBookmark(){return Ry}}z.jsonID("all",kt);const Ry={map(){return this},resolve(t){return new kt(t)}};function Lr(t,e,n,r,o,s=!1){if(e.inlineContent)return j.create(t,n);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let l=e.child(i);if(l.isAtom){if(!s&&U.isSelectable(l))return U.create(t,n-(o<0?l.nodeSize:0))}else{let a=Lr(t,l,n+o,o<0?l.childCount:0,o,s);if(a)return a}n+=l.nodeSize*o}return null}function rd(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Le||o instanceof Ie))return;let s=t.mapping.maps[r],i;s.forEach((l,a,c,u)=>{i==null&&(i=u)}),t.setSelection(z.near(t.doc.resolve(i),n))}const od=1,xs=2,sd=4;class Ly extends Sl{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|od)&~xs,this.storedMarks=null,this}get selectionSet(){return(this.updated&od)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xs,this}ensureMarks(e){return ce.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(this.updated&xs)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xs,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ce.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),this.selection.empty||this.setSelection(z.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=sd,this}get scrolledIntoView(){return(this.updated&sd)>0}}function id(t,e){return!e||!t?t:t.bind(e)}class bo{constructor(e,n,r){this.name=e,this.init=id(n.init,r),this.apply=id(n.apply,r)}}const Iy=[new bo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new bo("selection",{init(t,e){return t.selection||z.atStart(e.doc)},apply(t){return t.selection}}),new bo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new bo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Iy.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new bo(r.key,r.spec.state,r))})}}class Ir{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=o?o[i].n:0,c=o?o[i].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}o&&(o[i]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ir(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new Ly(this)}static create(e){let n=new Tl(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ir(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Tl(this.schema,e.plugins),r=n.fields,o=new Ir(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Tl(e.schema,e.plugins),s=new Ir(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=On.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=z.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[i.name]=c.fromJSON.call(a,e,n[l],s);return}}s[i.name]=i.init(e,s)}}),s}}function ld(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ld(o,e,{})),n[r]=o}return n}class Ae{constructor(e){this.spec=e,this.props={},e.props&&ld(e.props,this,this.props),this.key=e.key?e.key.key:ad("plugin")}getState(e){return e[this.key]}}const Ol=Object.create(null);function ad(t){return t in Ol?t+"$"+ ++Ol[t]:(Ol[t]=0,t+"$")}class De{constructor(e="key"){this.key=ad(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Dr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Nl=null;const dn=function(t,e,n){let r=Nl||(Nl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Dy=function(){Nl=null},sr=function(t,e,n,r){return n&&(cd(t,e,n,r,-1)||cd(t,e,n,r,1))},Py=/^(img|br|input|textarea|hr)$/i;function cd(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ct(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Eo(t)||Py.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(t)+(o<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=i,e=o<0?Ct(t):0}else return!1}}function Ct(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function By(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ct(t)}else if(t.parentNode&&!Eo(t))e=Ve(t),t=t.parentNode;else return null}}function Fy(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Eo(t))e=Ve(t)+1,t=t.parentNode;else return null}}function $y(t,e,n){for(let r=e==0,o=e==Ct(t);r||o;){if(t==n)return!0;let s=Ve(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Ct(t)}}function Eo(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ts=function(t){return t.focusNode&&sr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ir(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Vy(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hy(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ct(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ct(r.startContainer),r.startOffset)}}}const Kt=typeof navigator<"u"?navigator:null,ud=typeof document<"u"?document:null,Mn=Kt&&Kt.userAgent||"",Al=/Edge\/(\d+)/.exec(Mn),dd=/MSIE \d/.exec(Mn),_l=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mn),rt=!!(dd||_l||Al),Rn=dd?document.documentMode:_l?+_l[1]:Al?+Al[1]:0,Pt=!rt&&/gecko\/(\d+)/i.test(Mn);Pt&&+(/Firefox\/(\d+)/.exec(Mn)||[0,0])[1];const Ml=!rt&&/Chrome\/(\d+)/.exec(Mn),ze=!!Ml,fd=Ml?+Ml[1]:0,Ge=!rt&&!!Kt&&/Apple Computer/.test(Kt.vendor),Pr=Ge&&(/Mobile\/\w+/.test(Mn)||!!Kt&&Kt.maxTouchPoints>2),St=Pr||(Kt?/Mac/.test(Kt.platform):!1),Uy=Kt?/Win/.test(Kt.platform):!1,fn=/Android \d/.test(Mn),wo=!!ud&&"webkitFontSmoothing"in ud.documentElement.style,zy=wo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function jy(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function pn(t,e){return typeof t=="number"?t:t[e]}function Wy(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function pd(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let i=n||t.dom;i;){if(i.nodeType!=1){i=Dr(i);continue}let l=i,a=l==s.body,c=a?jy(s):Wy(l),u=0,d=0;if(e.top<c.top+pn(r,"top")?d=-(c.top-e.top+pn(o,"top")):e.bottom>c.bottom-pn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+pn(o,"top")-c.top:e.bottom-c.bottom+pn(o,"bottom")),e.left<c.left+pn(r,"left")?u=-(c.left-e.left+pn(o,"left")):e.right>c.right-pn(r,"right")&&(u=e.right-c.right+pn(o,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let p=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-p,y=l.scrollTop-h;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:Dr(i)}}function Ky(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=n+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=t.root.elementFromPoint(s,i);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:hd(t.dom)}}function hd(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Dr(r));return e}function qy({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;md(n,r==0?0:r-e)}function md(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Br=null;function Jy(t){if(t.setActive)return t.setActive();if(Br)return t.focus(Br);let e=hd(t);t.focus(Br==null?{get preventScroll(){return Br={preventScroll:!0},!0}}:void 0),Br||(Br=!1,md(e,0))}function gd(t,e){let n,r=2e8,o,s=0,i=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=dn(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=i&&h.bottom>=l){i=Math.max(h.bottom,i),l=Math.min(h.top,l);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(s=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?Gy(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:gd(n,o)}function Gy(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Ln(r,1);if(s.top!=s.bottom&&Rl(e,s))return{node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Rl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Yy(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Xy(t,e,n){let{node:r,offset:o}=gd(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function Qy(t,e,n,r){let o=-1;for(let s=e,i=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!i&&a.left>r.left||a.top>r.top?o=l.posBefore:(!i&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),i=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function yd(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let i=t.childNodes[s];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Rl(e,c))return yd(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function Zy(t,e){let n=t.dom.ownerDocument,r,o=0,s=Hy(n,e.left,e.top);s&&({node:r,offset:o}=s);let i=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!Rl(e,c)||(i=yd(t.dom,e,c),!i))return null}if(Ge)for(let c=i;r&&c;c=Dr(c))c.draggable&&(r=void 0);if(i=Yy(i,e),r){if(Pt&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;wo&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=Qy(t,r,o,e))}l==null&&(l=Xy(t,i,e));let a=t.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function bd(t){return t.top<t.bottom||t.left<t.right}function Ln(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(bd(r))return r}return Array.prototype.find.call(n,bd)||t.getBoundingClientRect()}const e0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ed(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=wo||Pt;if(r.nodeType==3)if(i&&(e0.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=Ln(dn(r,o,o),n);if(Pt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Ln(dn(r,o-1,o-1),-1);if(c.top==a.top){let u=Ln(dn(r,o,o+1),-1);if(u.top!=a.top)return ko(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,ko(Ln(dn(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Ct(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Ll(a.getBoundingClientRect(),!1)}if(s==null&&o<Ct(r)){let a=r.childNodes[o];if(a.nodeType==1)return Ll(a.getBoundingClientRect(),!0)}return Ll(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Ct(r))){let a=r.childNodes[o-1],c=a.nodeType==3?dn(a,Ct(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ko(Ln(c,1),!1)}if(s==null&&o<Ct(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?dn(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return ko(Ln(c,-1),!0)}return ko(Ln(r.nodeType==3?dn(r):r,-n),n>=0)}function ko(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ll(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function wd(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function t0(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return wd(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let i=Ed(t,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=dn(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const n0=/[\u0590-\u08ac]/;function r0(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,l=t.domSelection();return l?!n0.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:i:wd(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),y=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let kd=null,Cd=null,Sd=!1;function o0(t,e,n){return kd==e&&Cd==n?Sd:(kd=e,Cd=n,Sd=n=="up"||n=="down"?t0(t,e,n):r0(t,e,n))}const vt=0,vd=1,lr=2,qt=3;class Co{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=vt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,i;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Ve(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let l=o.children[i];if(l.size){o=l;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],l=s+i.size;if(l>e||i instanceof Od){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof xd&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Ve(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Ve(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let i=r,l=0;;l++){let a=this.children[l],c=i+a.size;if(o==-1&&e<=c){let u=i+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=i;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ve(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Ve(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),i=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],y=h+m.size;if(s>h&&i<y)return m.setSelection(e-h-m.border,n-h-m.border,r,o);h=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Pt||Ge)&&e==n){let{node:p,offset:h}=l;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==`
|
|
6
|
+
`),d&&h==p.nodeValue.length)for(let m=p,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Ve(y)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=p.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Pt&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&Ge)&&sr(l.node,l.offset,u.anchorNode,u.anchorOffset)&&sr(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!d){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let h=l;l=a,a=h}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],i=r+s.size;if(r==i?e<=i&&n>=r:e<i&&n>r){let l=r+s.border,a=i-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==i?lr:vd,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=qt:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?lr:qt}r=i}this.dirty=lr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?lr:vd;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class xd extends Co{constructor(e,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==vt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||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 s0 extends Co{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ar extends Co{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=rr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ar(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&qt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=vt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=vt}}slice(e,n,r){let o=ar.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=Dl(s,n,i,r)),e>0&&(s=Dl(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class In extends Co{constructor(e,n,r,o,s,i,l,a,c){super(e,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,s,i){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=rr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=_d(u,r,n),c?a=new i0(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new Os(e,n,r,o,u,f,s):new In(e,n,r,o,u,d||null,f,s,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==vt&&e.eq(this.node)&&Ns(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,s=e.composing?this.localCompositionInfo(e,n):null,i=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new a0(this,i&&i.node,e);d0(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?ce.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,d,p,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==lr)&&(i&&this.protectLocalComposition(e,i),Nd(this.contentDOM,this.children,e),Pr&&f0(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof j)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let i=s.nodeValue,l=p0(this.node.content,i,r-n,o-n);return l<0?null:{node:s,pos:l,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let i=new s0(this,s,n,o);e.input.compositionNodes.push(i),this.children=Dl(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==qt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=vt}updateOuterDeco(e){if(Ns(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ad(this.dom,this.nodeDOM,Il(this.outerDeco,this.node,n),Il(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Td(t,e,n,r,o){_d(r,e,t);let s=new In(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class Os extends In{constructor(e,n,r,o,s,i,l){super(e,n,r,o,s,null,i,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==qt||this.dirty!=vt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=vt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=vt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),s=document.createTextNode(o.text);return new Os(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=qt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Od extends Co{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==vt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class i0 extends In{constructor(e,n,r,o,s,i,l,a,c,u){super(e,n,r,o,s,i,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==qt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Nd(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let i=e[s],l=i.dom;if(l.parentNode==t){for(;l!=r;)r=Md(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(i instanceof ar){let a=r?r.previousSibling:t.lastChild;Nd(i.contentDOM,i.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Md(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const So=function(t){t&&(this.nodeName=t)};So.prototype=Object.create(null);const cr=[new So];function Il(t,e,n){if(t.length==0)return cr;let r=n?cr[0]:new So,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new So(i.nodeName));for(let l in i){let a=i[l];a!=null&&(n&&o.length==1&&o.push(r=new So(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Ad(t,e,n,r){if(n==cr&&r==cr)return e;let o=e;for(let s=0;s<r.length;s++){let i=r[s],l=n[s];if(s){let a;l&&l.nodeName==i.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=cr[0]),o=a}l0(o,l||cr[0],i)}return o}function l0(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function _d(t,e,n){return Ad(t,t,cr,Il(e,n,t.nodeType!=1))}function Ns(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Md(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class a0{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=c0(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,s=this.stack.length>>1,i=Math.min(s,e.length);for(;o<i&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=vt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=ar.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(e,n,r))s=this.top.children.indexOf(i,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let i=this.top.children[o];return i.dirty==qt&&i.dom==i.contentDOM&&(i.dirty=lr),i.update(e,n,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof In){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=qt&&Ns(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=lr,d.updateChildren(o,i+1),d.dirty=vt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,i){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Ns(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=In.create(this.top,n,r,o,s,i);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,s){let i=In.create(this.top,e,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new xd(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ar;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Os)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ge||ze)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Od(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function c0(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,i=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof ar)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,s.set(l,o),i.push(l)}}return{index:o,matched:s,matches:i.reverse()}}function u0(t,e){return t.type.side-e.type.side}function d0(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(s,u),c),s+=u.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let u,d;for(;i<o.length&&o[i].to==s;){let y=o[i++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(u0);for(let y=0;y<d.length;y++)n(d[y],c,!!a)}else n(u,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)l.push(o[i++]);let h=s+f.nodeSize;if(f.isText){let y=h;i<o.length&&o[i].from<y&&(y=o[i].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<h&&(a=f.cut(y-s),f=f.cut(0,y-s),h=y,p=-1)}else for(;i<o.length&&o[i].to<h;)i++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(s,f),p),s=h}}function f0(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function p0(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let i=t.child(o++),l=s;if(s+=i.nodeSize,!i.isText)continue;let a=i.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Dl(t,e,n,r,o){let s=[];for(let i=0,l=0;i<t.length;i++){let a=t[i],c=l,u=l+=a.size;c>=n||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),o&&(s.push(o),o=void 0),u>n&&s.push(a.slice(n-c,a.size,r)))}return s}function Pl(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let l=r.resolve(i),a,c;if(Ts(n)){for(a=i;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&U.isSelectable(d)&&o.parent&&!(d.isInline&&$y(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new U(i==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[a,i]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(i)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Fl(t,u,l,d)}return c}function Rd(t){return t.editable?t.hasFocus():$d(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function hn(t,e=!1){let n=t.state.selection;if(Pd(t,n),!!Rd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ze){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&sr(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)m0(t);else{let{anchor:r,head:o}=n,s,i;Ld&&!(n instanceof j)&&(n.$from.parent.inlineContent||(s=Id(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=Id(t,n.to))),t.docView.setSelection(r,o,t,e),Ld&&(s&&Dd(s),i&&Dd(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&h0(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Ld=Ge||ze&&fd<63;function Id(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ge&&o&&o.contentEditable=="false")return Bl(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return Bl(o);if(s)return Bl(s)}}function Bl(t){return t.contentEditable="true",Ge&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Dd(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function h0(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Rd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function m0(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,Ve(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&rt&&Rn<=11&&(r.disabled=!0,r.disabled=!1)}function Pd(t,e){if(e instanceof U){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Bd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Bd(t)}function Bd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Fl(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||j.between(e,n,r)}function Fd(t){return t.editable&&!t.hasFocus()?!1:$d(t)}function $d(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function g0(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return sr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function $l(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&z.findFrom(s,e)}function Dn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Vd(t,e,n){let r=t.state.selection;if(r instanceof j)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Dn(t,new j(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=$l(t.state,e);return o&&o instanceof U?Dn(t,o):!1}else if(!(St&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let l=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=t.docView.descAt(l))&&!i.contentDOM?U.isSelectable(s)?Dn(t,new U(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):wo?Dn(t,new j(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof U&&r.node.isInline)return Dn(t,new j(e>0?r.$to:r.$from));{let o=$l(t.state,e);return o?Dn(t,o):!1}}}function As(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fr(t,e){return e<0?y0(t):b0(t)}function y0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(Pt&&n.nodeType==1&&r<As(n)&&vo(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(vo(l,-1))o=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Hd(n))break;{let l=n.previousSibling;for(;l&&vo(l,-1);)o=n.parentNode,s=Ve(l),l=l.previousSibling;if(l)n=l,r=As(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Vl(t,n,r):o&&Vl(t,o,s)}function b0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=As(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(vo(l,1))s=n,i=++r;else break}else{if(Hd(n))break;{let l=n.nextSibling;for(;l&&vo(l,1);)s=l.parentNode,i=Ve(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=As(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Vl(t,s,i)}function Hd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function E0(t,e){for(;t&&e==t.childNodes.length&&!Eo(t);)e=Ve(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function w0(t,e){for(;t&&!e&&!Eo(t);)e=Ve(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Vl(t,e,n){if(e.nodeType!=3){let s,i;(i=E0(e,n))?(e=i,n=0):(s=w0(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ts(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&hn(t)},50)}function Ud(t,e){let n=t.state.doc.resolve(e);if(!(ze||Uy)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function zd(t,e,n){let r=t.state.selection;if(r instanceof j&&!r.empty||n.indexOf("s")>-1||St&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=$l(t.state,e);if(i&&i instanceof U)return Dn(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,l=r instanceof kt?z.near(i,e):z.findFrom(i,e);return l?Dn(t,l):!1}return!1}function jd(t,e){if(!(t.state.selection instanceof j))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let i=t.state.tr;return e<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),t.dispatch(i),!0}return!1}function Wd(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function k0(t){if(!Ge||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Wd(t,r,"true"),setTimeout(()=>Wd(t,r,"false"),20)}return!1}function C0(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function S0(t,e){let n=e.keyCode,r=C0(e);if(n==8||St&&n==72&&r=="c")return jd(t,-1)||Fr(t,-1);if(n==46&&!e.shiftKey||St&&n==68&&r=="c")return jd(t,1)||Fr(t,1);if(n==13||n==27)return!0;if(n==37||St&&n==66&&r=="c"){let o=n==37?Ud(t,t.state.selection.from)=="ltr"?-1:1:-1;return Vd(t,o,r)||Fr(t,o)}else if(n==39||St&&n==70&&r=="c"){let o=n==39?Ud(t,t.state.selection.from)=="ltr"?1:-1:1;return Vd(t,o,r)||Fr(t,o)}else{if(n==38||St&&n==80&&r=="c")return zd(t,-1,r)||Fr(t,-1);if(n==40||St&&n==78&&r=="c")return k0(t)||zd(t,1,r)||Fr(t,1);if(r==(St?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Hl(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let i=t.someProp("clipboardSerializer")||rr.fromSchema(t.state.schema),l=Zd(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Xd[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=l.createElement(u[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
7
|
+
|
|
8
|
+
`);return{dom:a,text:f,slice:e}}function Kd(t,e,n,r,o){let s=o.parent.type.spec.code,i,l;if(!n&&!e)return null;let a=e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return e?new D(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
9
|
+
`))),0,0):D.empty;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:p}=t.state,h=rr.fromSchema(p);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=i.appendChild(document.createElement("p"));m&&y.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=O0(n),wo&&N0(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ar.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!v0.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=A0(Yd(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen(x0(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d<l.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=Yd(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t)}),l}const v0=/^(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 x0(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,i=[];if(t.forEach(l=>{if(!i)return;let a=o.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&s.length&&Jd(a,s,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Gd(i[i.length-1],s.length));let u=qd(l,a);i.push(u),o=o.matchType(u.type),s=a}}),i)return M.from(i)}return t}function qd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function Jd(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=Jd(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(M.from(qd(n,t,o+1))))}}function Gd(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Gd(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function Ul(t,e,n,r,o,s){let i=e<0?t.firstChild:t.lastChild,l=i.content;return t.childCount>1&&(s=0),o<r-1&&(l=Ul(l,e,n,r,o+1,s)),o>=n&&(l=e<0?i.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(l))}function Yd(t,e,n){return e<t.openStart&&(t=new D(Ul(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Ul(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Xd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Qd=null;function Zd(){return Qd||(Qd=document.implementation.createHTMLDocument("title"))}let zl=null;function T0(t){let e=window.trustedTypes;return e?(zl||(zl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),zl.createHTML(t)):t}function O0(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Zd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Xd[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=T0(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function N0(t){let e=t.querySelectorAll(ze?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function A0(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:s,openEnd:i}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=M.from(a.create(r[l+1],o)),s++,i++}return new D(o,s,i)}const Ye={},Xe={},_0={touchstart:!0,touchmove:!0};class M0{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function R0(t){for(let e in Ye){let n=Ye[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{I0(t,r)&&!Wl(t,r)&&(t.editable||!(r.type in Xe))&&n(t,r)},_0[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),jl(t)}function Pn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function L0(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function jl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Wl(t,r))})}function Wl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function I0(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function D0(t,e){!Wl(t,e)&&Ye[e.type]&&(t.editable||!(e.type in Xe))&&Ye[e.type](t,e)}Xe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!tf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(fn&&ze&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Pr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,ir(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||S0(t,n)?n.preventDefault():Pn(t,"key")},Xe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Xe.keypress=(t,e)=>{let n=e;if(tf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||St&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof j)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function _s(t){return{left:t.clientX,top:t.clientY}}function P0(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Kl(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,l=>i>s.depth?l(t,n,s.nodeAfter,s.before(i),o,!0):l(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function $r(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function B0(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&U.isSelectable(r)?($r(t,new U(n)),!0):!1}function F0(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof U&&(r=n.node);let s=t.state.doc.resolve(e);for(let i=s.depth+1;i>0;i--){let l=i>s.depth?s.nodeAfter:s.node(i);if(U.isSelectable(l)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?($r(t,U.create(t.state.doc,o)),!0):!1}function $0(t,e,n,r,o){return Kl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?F0(t,n):B0(t,n))}function V0(t,e,n,r){return Kl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function H0(t,e,n,r){return Kl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||U0(t,n,r)}function U0(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?($r(t,j.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),l=o.before(s);if(i.inlineContent)$r(t,j.create(r,l+1,l+1+i.content.size));else if(U.isSelectable(i))$r(t,U.create(r,l));else continue;return!0}}function ql(t){return Ms(t)}const ef=St?"metaKey":"ctrlKey";Ye.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ql(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&P0(n,t.input.lastClick)&&!n[ef]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=t.posAtCoords(_s(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new z0(t,i,n,!!r)):(s=="doubleClick"?V0:H0)(t,i.pos,i.inside,n)?n.preventDefault():Pn(t,"pointer"))};class z0{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ef],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),i=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,i=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof U&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pt&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Pn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>hn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(_s(e))),this.updateAllowDefault(e),this.allowDefault||!n?Pn(this.view,"pointer"):$0(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||ze&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?($r(this.view,z.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Pn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Pn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ye.touchstart=t=>{t.input.lastTouch=Date.now(),ql(t),Pn(t,"pointer")},Ye.touchmove=t=>{t.input.lastTouch=Date.now(),Pn(t,"pointer")},Ye.contextmenu=t=>ql(t);function tf(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const j0=fn?5e3:-1;Xe.compositionstart=Xe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof j&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Ms(t,!0),t.markCursor=null;else if(Ms(t,!e.selection.empty),Pt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let l=t.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}t.input.composing=!0}nf(t,j0)},Xe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,nf(t,20))};function nf(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ms(t),e))}function rf(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=K0());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function W0(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=By(e.focusNode,e.focusOffset),r=Fy(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function K0(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ms(t,e=!1){if(!(fn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),rf(t),e||t.docView&&t.docView.dirty){let n=Pl(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function q0(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const xo=rt&&Rn<15||Pr&&zy<604;Ye.copy=Xe.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=xo?null:n.clipboardData,i=r.content(),{dom:l,text:a}=Hl(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):q0(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function J0(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function G0(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?To(t,r.value,null,o,e):To(t,r.textContent,r.innerHTML,o,e)},50)}function To(t,e,n,r,o){let s=Kd(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,s||D.empty)))return!0;if(!s)return!1;let i=J0(s),l=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function of(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xe.paste=(t,e)=>{let n=e;if(t.composing&&!fn)return;let r=xo?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&To(t,of(r),r.getData("text/html"),o,n)?n.preventDefault():G0(t,n)};class sf{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Y0=St?"altKey":"ctrlKey";function lf(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Y0]}Ye.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(_s(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof U?o.to-1:o.to))){if(r&&r.mightDrag)i=U.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(i=U.create(t.state.doc,d.posBefore))}}let l=(i||t.state.selection).content(),{dom:a,text:c,slice:u}=Hl(t,l);(!n.dataTransfer.files.length||!ze||fd>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(xo?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",xo||n.dataTransfer.setData("text/plain",c),t.dragging=new sf(u,lf(t,n),i)},Ye.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Xe.dragover=Xe.dragenter=(t,e)=>e.preventDefault(),Xe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(_s(n));if(!o)return;let s=t.state.doc.resolve(o.pos),i=r&&r.slice;i?t.someProp("transformPasted",h=>{i=h(i,t)}):i=Kd(t,of(n.dataTransfer),xo?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&lf(t,n));if(t.someProp("handleDrop",h=>h(t,n,i||D.empty,l))){n.preventDefault();return}if(!i)return;n.preventDefault();let a=i?xy(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let c=t.state.tr;if(l){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&U.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new U(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,b,w)=>h=w),c.setSelection(Fl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ye.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hn(t)},20))},Ye.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ye.beforeinput=(t,e)=>{if(ze&&fn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,ir(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Xe)Ye[t]=Xe[t];function Oo(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Rs{constructor(e,n){this.toDOM=e,this.spec=n||ur,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:i}=e.mapResult(n.from+o,this.side<0?-1:1);return i?null:new Qe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Rs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Oo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Bn{constructor(e,n){this.attrs=e,this.spec=n||ur}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new Qe(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Bn&&Oo(this.attrs,e.attrs)&&Oo(this.spec,e.spec)}static is(e){return e.type instanceof Bn}destroy(){}}class Jl{constructor(e,n){this.attrs=e,this.spec=n||ur}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let i=e.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new Qe(s.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Jl&&Oo(this.attrs,e.attrs)&&Oo(this.spec,e.spec)}destroy(){}}class Qe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Qe(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Qe(e,e,new Rs(n,r))}static inline(e,n,r,o){return new Qe(e,n,new Bn(r,o))}static node(e,n,r,o){return new Qe(e,n,new Jl(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Bn}get widget(){return this.type instanceof Rs}}const Vr=[],ur={};class Ee{constructor(e,n){this.local=e.length?e:Vr,this.children=n.length?n:Vr}static create(e,n){return n.length?Ls(n,e,0,ur):je}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let l=this.children[i]+1;this.children[i+2].findInner(e-l,n-l,r,o+l,s)}}map(e,n,r){return this==je||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ur)}mapInner(e,n,r,o,s){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(i||(i=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?X0(this.children,i||[],e,n,r,o,s):i?new Ee(i.sort(dr),Vr):je}add(e,n){return n.length?this==je?Ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=cf(n,l,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<a;)s+=3;o[s]==a?o[s+2]=o[s+2].addInner(l,u,c+1):o.splice(s,0,a,a+l.nodeSize,Ls(u,l,c+1,ur)),s+=3}});let i=af(s?uf(n):n,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new Ee(i.length?this.local.concat(i).sort(dr):this.local,o||this.children)}remove(e){return e.length==0||this==je?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,l+1);c!=je?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<e.length;s++)if(i=e[s])for(let l=0;l<o.length;l++)o[l].eq(i,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Ee(o,r):je}forChild(e,n){if(this==je)return this;if(n.isLeaf)return Ee.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,i=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>s&&a.type instanceof Bn){let c=Math.max(s,a.from)-s,u=Math.min(i,a.to)-s;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new Ee(o.sort(dr),Vr);return r?new Fn([l,r]):l}return r||je}eq(e){if(this==e)return!0;if(!(e instanceof Ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Gl(this.localsInner(e))}localsInner(e){if(this==je)return Vr;if(e.inlineContent||!this.local.some(Bn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Bn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Ee.empty=new Ee([],[]),Ee.removeOverlap=Gl;const je=Ee.empty;class Fn{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,ur));return Fn.from(r)}forChild(e,n){if(n.isLeaf)return Ee.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=je&&(s instanceof Fn?r=r.concat(s.members):r.push(s))}return Fn.from(r)}eq(e){if(!(e instanceof Fn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?Gl(r?n:n.sort(dr)):Vr}static from(e){switch(e.length){case 0:return je;case 1:return e[0];default:return new Fn(e.every(n=>n instanceof Ee)?e:e.reduce((n,r)=>n.concat(r instanceof Ee?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function X0(t,e,n,r,o,s,i){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,h,m)=>{let y=m-h-(p-f);for(let b=0;b<l.length;b+=3){let w=l[b+1];if(w<0||f>w+u-d)continue;let k=l[b]+u-d;p>=k?l[b+1]=f<=k?-2:-1:f>=u&&y&&(l[b]+=y,l[b+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),y=r.maybeChild(h);if(y&&m==d&&m+y.nodeSize==p){let b=l[c+2].mapInner(n,y,u+1,t[c]+s+1,i);b!=je?(l[c]=d,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Q0(l,t,e,n,o,s,i),u=Ls(c,r,0,i);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Ee(e.sort(dr),l)}function af(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Qe(o.from+e,o.to+e,o.type))}return n}function Q0(t,e,n,r,o,s,i){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):i.onRemove&&i.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function cf(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,i;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function uf(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ls(t,e,n,r){let o=[],s=!1;e.forEach((l,a)=>{let c=cf(t,l,a+n);if(c){s=!0;let u=Ls(c,l,n+a+1,r);u!=je&&o.push(a,a+l.nodeSize,u)}});let i=af(s?uf(t):t,-n).sort(dr);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||(r.onRemove&&r.onRemove(i[l].spec),i.splice(l--,1));return i.length||o.length?new Ee(i,o):je}function dr(t,e){return t.from-e.from||t.to-e.to}function Gl(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),df(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),df(e,o,r.copy(s.from,r.to)));break}}}return e}function df(t,e,n){for(;e<t.length&&dr(n,t[e])>0;)e++;t.splice(e,0,n)}function Yl(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=je&&e.push(r)}),t.cursorWrapper&&e.push(Ee.create(t.state.doc,[t.cursorWrapper.deco])),Fn.from(e)}const Z0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},eb=rt&&Rn<=11;class tb{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 nb{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tb,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);rt&&Rn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),eb&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,Z0)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(Fd(this.view)){if(this.suppressingSelectionUpdates)return hn(this.view);if(rt&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&sr(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 n=new Set,r;for(let s=e.focusNode;s;s=Dr(s))n.add(s);for(let s=e.anchorNode;s;s=Dr(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Fd(e)&&!this.ignoreSelectionChange(r),s=-1,i=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(s=s<0?d.from:Math.min(d.from,s),i=i<0?d.to:Math.max(d.to,i),d.typeOver&&(l=!0))}if(Pt&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||sb(e,d)!=p)&&f.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ts(r)&&(c=Pl(e))&&c.eq(z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),rb(e)),this.handleDOMChange(s,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(rt&&Rn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let i=o&&o.parentNode==e.target?Ve(o)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=s&&s.parentNode==e.target?Ve(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ff=new WeakMap,pf=!1;function rb(t){if(!ff.has(t)&&(ff.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Pt,pf)return;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."),pf=!0}}function hf(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return sr(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function ob(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return hf(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?hf(t,n):null}function sb(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ib(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:i,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ts(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ze&&t.input.lastKeyCode===8)for(let y=s;y>o;y--){let b=r.childNodes[y-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||Ar.fromSchema(t.state.schema),p=d.resolve(i),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:lb,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),h={anchor:y+i,head:b+i}}return{doc:m,sel:h,from:i,to:l}}function lb(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ab=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function cb(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=Pl(t,_);if(P&&!t.state.selection.eq(P)){if(ze&&fn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Z=>Z(t,ir(13,"Enter"))))return;let V=t.state.tr.setSelection(P);_=="pointer"?V.setMeta("pointer",!0):_=="key"&&V.scrollIntoView(),s&&V.setMeta("composition",s),t.dispatch(V)}return}let i=t.state.doc.resolve(e),l=i.sharedDepth(n);e=i.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=ib(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=fb(d.content,c.doc.content,c.from,f,p);if(h&&t.input.domChangeCount++,(Pr&&t.input.lastIOSEnter>Date.now()-225||fn)&&o.some(_=>_.nodeType==1&&!ab.test(_.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",_=>_(t,ir(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof j&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let _=mf(t,t.state.doc,c.sel);if(_&&!_.eq(t.state.selection)){let P=t.state.tr.setSelection(_);s&&P.setMeta("composition",s),t.dispatch(P)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof j&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),rt&&Rn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),y=c.doc.resolveNoCache(h.endB-c.from),b=u.resolve(h.start),w=m.sameParent(y)&&m.parent.inlineContent&&b.end()>=h.endA,k;if((Pr&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"",""))&&(k=z.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",_=>_(t,ir(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&db(u,h.start,h.endA,m,y)&&t.someProp("handleKeyDown",_=>_(t,ir(8,"Backspace")))){fn&&ze&&t.domObserver.suppressSelectionUpdates();return}ze&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),fn&&!w&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,y=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,ir(13,"Enter"))})},20));let E=h.start,x=h.endA,v=_=>{let P=_||t.state.tr.replace(E,x,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let V=mf(t,P.doc,c.sel);V&&!(ze&&t.composing&&V.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(V.head==E||V.head==P.mapping.map(x)-1)||rt&&V.empty&&V.head==E)&&P.setSelection(V)}return s&&P.setMeta("composition",s),P.scrollIntoView()},T;if(w){if(m.pos==y.pos){rt&&Rn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>hn(t),20));let _=v(t.state.tr.delete(E,x)),P=u.resolve(h.start).marksAcross(u.resolve(h.endA));P&&_.ensureMarks(P),t.dispatch(_)}else if(h.endA==h.endB&&(T=ub(m.parent.content.cut(m.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let _=v(t.state.tr);T.type=="add"?_.addMark(E,x,T.mark):_.removeMark(E,x,T.mark),t.dispatch(_)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let _=m.parent.textBetween(m.parentOffset,y.parentOffset),P=()=>v(t.state.tr.insertText(_,E,x));t.someProp("handleTextInput",V=>V(t,E,x,_,P))||t.dispatch(P())}}else t.dispatch(v())}function mf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Fl(t,e.resolve(n.anchor),e.resolve(n.head))}function ub(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,i,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(o.length==1&&s.length==0)l=o[0],i="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&s.length==1)l=s[0],i="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(M.from(c).eq(t))return{mark:l,type:i}}function db(t,e,n,r,o){if(n-e<=o.pos-r.pos||Xl(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=t.resolve(Xl(s,!0,!0));return!i.parent.isTextblock||i.pos>n||Xl(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function Xl(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function fb(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:i,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,s-Math.min(i,l));r-=i+a-s}if(i<s&&t.size<e.size){let a=r<=s&&r>=i?s-r:0;s-=a,s&&s<e.size&&gf(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-i),i=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<t.size&&gf(t.textBetween(s-1,s+1))&&(s+=a?1:-1),i=s+(i-l),l=s}return{start:s,endA:i,endB:l}}function gf(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class yf{constructor(e,n){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 M0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Cf),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=wf(this),Ef(this),this.nodeViews=kf(this),this.docView=Td(this.state.doc,bf(this),Yl(this),this.dom,this),this.domObserver=new nb(this,(r,o,s,i)=>cb(this,r,o,s,i)),this.domObserver.start(),R0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&jl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(rf(this),i=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=kf(this);hb(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&jl(this),this.editable=wf(this),Ef(this);let a=Yl(this),c=bf(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(i=!0);let f=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&Ky(this);if(i){this.domObserver.stop();let p=d&&(rt||ze)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&pb(o.selection,e.selection);if(d){let h=ze?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=W0(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Td(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&g0(this))?hn(this,p):(Pd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&qy(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof U){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&pd(this,n.getBoundingClientRect(),e)}else pd(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){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new sf(e.slice,e.move,o<0?void 0:U.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[e];if(l!=null&&(o=n?n(l):l))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let l=s[i].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(rt){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(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Jy(this.dom),hn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Zy(this,e)}coordsAtPos(e,n=1){return Ed(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return o0(this,n||this.state,e)}pasteHTML(e,n){return To(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return To(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Hl(this,e)}destroy(){this.docView&&(L0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Dy())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return D0(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ge&&this.root.nodeType===11&&Vy(this.dom.ownerDocument)==this.dom&&ob(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yf.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function bf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Qe.node(0,t.state.doc.content.size,e)]}function Ef(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Qe.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function wf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function pb(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function kf(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function hb(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Cf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var $n={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:"'"},Is={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mb=typeof navigator<"u"&&/Mac/.test(navigator.platform),gb=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),He=0;He<10;He++)$n[48+He]=$n[96+He]=String(He);for(var He=1;He<=24;He++)$n[He+111]="F"+He;for(var He=65;He<=90;He++)$n[He]=String.fromCharCode(He+32),Is[He]=String.fromCharCode(He);for(var Ql in $n)Is.hasOwnProperty(Ql)||(Is[Ql]=$n[Ql]);function yb(t){var e=mb&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||gb&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Is:$n)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const bb=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Eb=typeof navigator<"u"&&/Win/.test(navigator.platform);function wb(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))bb?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function kb(t){let e=Object.create(null);for(let n in t)e[wb(n)]=t[n];return e}function Zl(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Cb(t){return new Ae({props:{handleKeyDown:ea(t)}})}function ea(t){let e=kb(t);return function(n,r){let o=yb(r),s,i=e[Zl(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Zl(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Eb&&r.ctrlKey&&r.altKey)&&(s=$n[r.keyCode])&&s!=o){let l=e[Zl(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const ta=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Sf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const vf=(t,e,n)=>{let r=Sf(t,n);if(!r)return!1;let o=na(r);if(!o){let i=r.blockRange(),l=i&&_r(i);return l==null?!1:(e&&e(t.tr.lift(i,l).scrollIntoView()),!0)}let s=o.nodeBefore;if(Lf(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Hr(s,"end")||U.isSelectable(s)))for(let i=r.depth;;i--){let l=Ss(t.doc,r.before(i),r.after(i),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Hr(s,"end")?z.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):U.create(a.doc,o.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},Sb=(t,e,n)=>{let r=Sf(t,n);if(!r)return!1;let o=na(r);return o?xf(t,o,e):!1},vb=(t,e,n)=>{let r=Of(t,n);if(!r)return!1;let o=ra(r);return o?xf(t,o,e):!1};function xf(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let i=e.nodeAfter,l=i,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Ss(t.doc,s,a,D.empty);if(!c||c.from!=s||c instanceof Le&&c.slice.size>=a-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(j.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Hr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Tf=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=na(r)}let i=s&&s.nodeBefore;return!i||!U.isSelectable(i)?!1:(e&&e(t.tr.setSelection(U.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function na(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Of(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Nf=(t,e,n)=>{let r=Of(t,n);if(!r)return!1;let o=ra(r);if(!o)return!1;let s=o.nodeAfter;if(Lf(t,o,e,1))return!0;if(r.parent.content.size==0&&(Hr(s,"start")||U.isSelectable(s))){let i=Ss(t.doc,r.before(),r.after(),D.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=t.tr.step(i);l.setSelection(Hr(s,"start")?z.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):U.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Af=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=ra(r)}let i=s&&s.nodeAfter;return!i||!U.isSelectable(i)?!1:(e&&e(t.tr.setSelection(U.create(t.doc,s.pos)).scrollIntoView()),!0)};function ra(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const xb=(t,e)=>{let n=t.selection,r=n instanceof U,o;if(r){if(n.node.isTextblock||!_n(t.doc,n.from))return!1;o=n.from}else if(o=Cs(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(U.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Tb=(t,e)=>{let n=t.selection,r;if(n instanceof U){if(n.node.isTextblock||!_n(t.doc,n.to))return!1;r=n.to}else if(r=Cs(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Ob=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&_r(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},_f=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
10
|
+
`).scrollIntoView()),!0)};function oa(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Nb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),i=oa(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,i.createAndFill());a.setSelection(z.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Mf=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof kt||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=oa(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(i,s.createAndFill());l.setSelection(j.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Rf=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(un(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&_r(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function Ab(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof U&&e.selection.node.isBlock)return!r.parentOffset||!un(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,l,a=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),l=oa(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(a&&l?{type:l}:null),i=p;break}else{if(p==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof j||e.selection instanceof kt)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=un(u.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=un(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(i).type!=l){let p=u.mapping.map(r.before(i)),h=u.doc.resolve(p);l&&r.node(i-1).canReplaceWith(h.index(),h.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(i)),l)}return n&&n(u.scrollIntoView()),!0}}const _b=Ab(),Mb=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(U.create(t.doc,o))),!0)};function Rb(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||_n(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Lf(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,l,a=o.type.spec.isolating||s.type.spec.isolating;if(!a&&Rb(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(l=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&l.matchType(i[0]||s.type).validEnd){if(n){let p=e.pos+s.nodeSize,h=M.empty;for(let b=i.length-1;b>=0;b--)h=M.from(i[b].create(null,h));h=M.from(o.copy(h));let m=t.tr.step(new Ie(e.pos-1,p,e.pos,p,new D(h,1,0),i.length,!0)),y=m.doc.resolve(p+2*i.length);y.nodeAfter&&y.nodeAfter.type==o.type&&_n(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:z.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&_r(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Hr(s,"start",!0)&&Hr(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=s,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let b=M.empty;for(let k=h.length-1;k>=0;k--)b=M.from(h[k].copy(b));let w=t.tr.step(new Ie(e.pos-h.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new D(b,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function If(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(j.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const Lb=If(-1),Ib=If(1);function Db(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),l=i&&wl(i,t,e);return l?(r&&r(n.tr.wrap(i,l).scrollIntoView()),!0):!1}}function Df(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:i},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(i,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[i];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function sa(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}sa(ta,vf,Tf),sa(ta,Nf,Af),sa(_f,Mf,Rf,_b),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Pb(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let l=r?n.tr:null;return Bb(l,i,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Bb(t,e,n,r=null){let o=!1,s=e,i=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=i.resolve(e.start-2);s=new gs(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new gs(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=wl(s,n,r,e);return l?(t&&Fb(t,e,l,o,n),!0):!1}function Fb(t,e,n,r,o){let s=M.empty;for(let u=n.length-1;u>=0;u--)s=M.from(n[u].type.create(n[u].attrs,s));t.step(new Ie(e.start-(r?2:0),e.end,e.start,e.end,new D(s,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==o&&(i=u+1);let l=n.length-i,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&un(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function $b(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Vb(e,n,t,s):Hb(e,n,s):!0:!1}}function Vb(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new Ie(s-1,i,s,i,new D(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new gs(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const l=_r(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(s,-1)-1);return _n(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function Hb(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,i.content.append(a?M.empty:M.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new Ie(d-(l?1:0),f+(a?1:0),d+1,f-1,new D((l?M.empty:M.from(o.copy(M.empty))).append(a?M.empty:M.from(o.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Ub(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let i=s.startIndex;if(i==0)return!1;let l=s.parent,a=l.child(i-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=M.from(c?t.create():null),d=new D(M.from(t.create(null,M.from(l.type.create(null,u)))),c?3:1,0),f=s.start,p=s.end;n(e.tr.step(new Ie(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function Ds(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}class Ps{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(){const{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:s}=r,i=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:i}=o,l=[],a=!!e,c=e||s.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...m)=>{const y=this.buildProps(c,n),b=p(...m)(y);return l.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:r}=this,o=!1,s=e||r.tr,i=this.buildProps(s,o);return{...Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...u)=>c(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,o)}}buildProps(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:i}=o,l={tr:e,editor:o,view:i,state:Ds({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}class zb{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}once(e,n){const r=(...o)=>{this.off(e,r),n.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function F(t,e,n){return t.config[e]===void 0&&t.parent?F(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?F(t.parent,e,n):null}):t.config[e]}function Bs(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Pf(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bs(t),o=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage,extensions:o},a=F(i,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...s,...p}})})})})}),o.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage},a=F(i,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:i.name,name:u,attribute:f})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function pe(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const l=s?s.split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=s}),r},{})}function ia(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>pe(n,r),{})}function Bf(t){return typeof t=="function"}function G(t,e=void 0,...n){return Bf(t)?e?t.bind(e)(...n):t(...n):t}function jb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Wb(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ff(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,i)=>{const l=i.attribute.parseHTML?i.attribute.parseHTML(n):Wb(n.getAttribute(i.name));return l==null?s:{...s,[i.name]:l}},{});return{...r,...o}}}}function $f(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&jb(n)?!1:n!=null))}function Kb(t,e){var n;const r=Pf(t),{nodeExtensions:o,markExtensions:s}=Bs(t),i=(n=o.find(c=>F(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,w)=>{const k=F(w,"extendNodeSchema",d);return{...b,...k?k(c):{}}},{}),p=$f({...f,content:G(F(c,"content",d)),marks:G(F(c,"marks",d)),group:G(F(c,"group",d)),inline:G(F(c,"inline",d)),atom:G(F(c,"atom",d)),selectable:G(F(c,"selectable",d)),draggable:G(F(c,"draggable",d)),code:G(F(c,"code",d)),whitespace:G(F(c,"whitespace",d)),linebreakReplacement:G(F(c,"linebreakReplacement",d)),defining:G(F(c,"defining",d)),isolating:G(F(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var w;return[b.name,{default:(w=b?.attribute)===null||w===void 0?void 0:w.default}]}))}),h=G(F(c,"parseHTML",d));h&&(p.parseDOM=h.map(b=>Ff(b,u)));const m=F(c,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:ia(b,u)}));const y=F(c,"renderText",d);return y&&(p.toText=y),[c.name,p]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,b)=>{const w=F(b,"extendMarkSchema",d);return{...y,...w?w(c):{}}},{}),p=$f({...f,inclusive:G(F(c,"inclusive",d)),excludes:G(F(c,"excludes",d)),group:G(F(c,"group",d)),spanning:G(F(c,"spanning",d)),code:G(F(c,"code",d)),attrs:Object.fromEntries(u.map(y=>{var b;return[y.name,{default:(b=y?.attribute)===null||b===void 0?void 0:b.default}]}))}),h=G(F(c,"parseHTML",d));h&&(p.parseDOM=h.map(y=>Ff(y,u)));const m=F(c,"renderHTML",d);return m&&(p.toDOM=y=>m({mark:y,HTMLAttributes:ia(y,u)})),[c.name,p]}));return new _u({topNode:i,nodes:l,marks:a})}function la(t,e){return e.nodes[t]||e.marks[t]||null}function Vf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function aa(t,e){const n=rr.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const qb=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,i,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:o,pos:s,parent:i,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),n};function ca(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Fs{constructor(e){this.find=e.find,this.handler=e.handler}}const Jb=(t,e)=>{if(ca(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,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};function $s(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=qb(c)+s;return i.forEach(f=>{if(u)return;const p=Jb(d,f.find);if(!p)return;const h=a.state.tr,m=Ds({state:a.state,transaction:h}),y={from:r-(p[0].length-s.length),to:o},{commands:b,chain:w,can:k}=new Ps({editor:n,state:m});f.handler({state:m,range:y,match:p,commands:b,chain:w,can:k})===null||!h.steps.length||(h.setMeta(l,{transform:h,from:r,to:o,text:s}),a.dispatch(h),u=!0)}),u}function Gb(t){const{editor:e,rules:n}=t,r=new Ae({state:{init(){return null},apply(o,s,i){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=aa(M.from(u),i.schema);const{from:d}=a,f=d+u.length;$s({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,l){return $s({editor:e,from:s,to:i,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&$s({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?$s({editor:e,from:i.pos,to:i.pos,text:`
|
|
11
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Yb(t){return Object.prototype.toString.call(t).slice(8,-1)}function Vs(t){return Yb(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Hs(t,e){const n={...t};return Vs(t)&&Vs(e)&&Object.keys(e).forEach(r=>{Vs(e[r])&&Vs(t[r])?n[r]=Hs(t[r],e[r]):n[r]=e[r]}),n}class ot{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(F(this,"addOptions",{name:this.name}))),this.storage=G(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ot(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Hs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ot(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(F(n,"addOptions",{name:n.name})),n.storage=G(F(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(c=>c?.type.name===n.name))return!1;const a=i.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}}function Xb(t){return typeof t=="number"}class Qb{constructor(e){this.find=e.find,this.handler=e.handler}}const Zb=(t,e,n)=>{if(ca(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function e1(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Ps({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const m=Math.max(r,h),y=Math.min(o,h+p.content.size),b=p.textBetween(m-h,y-h,void 0,"");Zb(b,s.find,i).forEach(k=>{if(k.index===void 0)return;const E=m+k.index+1,x=E+k[0].length,v={from:n.tr.mapping.map(E),to:n.tr.mapping.map(x)},T=s.handler({state:n,range:v,match:k,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});d.push(T)})}),d.every(p=>p!==null)}const t1=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function n1(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:p,pasteEvt:h})=>{const m=u.tr,y=Ds({state:u,transaction:m});if(!(!e1({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new Ae({view(d){const f=p=>{var h;r=!((h=d.dom.parentElement)===null||h===void 0)&&h.contains(p.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(d,f)=>(s=r===d.dom.parentElement,l=f,!1),paste:(d,f)=>{var p;const h=(p=f.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return i=f,o=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!o,y=h.getMeta("uiEvent")==="drop"&&!s,b=h.getMeta("applyPasteRules"),w=!!b;if(!m&&!y&&!w)return;if(w){let{text:x}=b;typeof x=="string"?x=x:x=aa(M.from(x),p.schema);const{from:v}=b,T=v+x.length,_=t1(x);return a({rule:u,state:p,from:v,to:{b:T},pasteEvt:_})}const k=f.doc.content.findDiffStart(p.doc.content),E=f.doc.content.findDiffEnd(p.doc.content);if(!(!Xb(k)||!E||k===E.b))return a({rule:u,state:p,from:k,to:E,pasteEvt:i})}}))}function r1(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Ur{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Ur.resolve(e),this.schema=Kb(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Ur.sort(Ur.flatten(e)),r=r1(n.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},o=F(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(e){return e.sort((r,o)=>{const s=F(r,"priority")||100,i=F(o,"priority")||100;return s>i?-1:s<i?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:la(n.name,this.schema)},o=F(n,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){const{editor:e}=this,n=Ur.sort([...this.extensions].reverse()),r=[],o=[],s=n.map(i=>{const l={name:i.name,options:i.options,storage:i.storage,editor:e,type:la(i.name,this.schema)},a=[],c=F(i,"addKeyboardShortcuts",l);let u={};if(i.type==="mark"&&F(i,"exitable",l)&&(u.ArrowRight=()=>ot.handleExit({editor:e,mark:i})),c){const m=Object.fromEntries(Object.entries(c()).map(([y,b])=>[y,()=>b({editor:e})]));u={...u,...m}}const d=Cb(u);a.push(d);const f=F(i,"addInputRules",l);Vf(i,e.options.enableInputRules)&&f&&r.push(...f());const p=F(i,"addPasteRules",l);Vf(i,e.options.enablePasteRules)&&p&&o.push(...p());const h=F(i,"addProseMirrorPlugins",l);if(h){const m=h();a.push(...m)}return a}).flat();return[Gb({editor:e,rules:r}),...n1({editor:e,rules:o}),...s]}get attributes(){return Pf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Bs(this.extensions);return Object.fromEntries(n.filter(r=>!!F(r,"addNodeView")).map(r=>{const o=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Pe(r.name,this.schema)},i=F(r,"addNodeView",s);if(!i)return[];const l=(a,c,u,d,f)=>{const p=ia(a,o);return i()({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:p})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:la(e.name,this.schema)};e.type==="mark"&&(!((n=G(F(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const o=F(e,"onBeforeCreate",r),s=F(e,"onCreate",r),i=F(e,"onUpdate",r),l=F(e,"onSelectionUpdate",r),a=F(e,"onTransaction",r),c=F(e,"onFocus",r),u=F(e,"onBlur",r),d=F(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class Be{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(F(this,"addOptions",{name:this.name}))),this.storage=G(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Be(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Hs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Be({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(F(n,"addOptions",{name:n.name})),n.storage=G(F(n,"addStorage",{name:n.name,options:n.options})),n}}function Hf(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
12
|
+
|
|
13
|
+
`,textSerializers:i={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=s);const p=i?.[a.type.name];if(p)return u&&(l+=p({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function ua(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const o1=Be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ae({key:new De("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=ua(n);return Hf(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),s1=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),i1=(t=!1)=>({commands:e})=>e.setContent("",t),l1=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{t.doc.nodesBetween(s.pos,i.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),p=d.blockRange(f);if(!p)return;const h=_r(p);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},a1=t=>e=>t(e),c1=()=>({state:t,dispatch:e})=>Mf(t,e),u1=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const i=r.mapping.map(e);return r.insert(i,s.content),r.setSelection(new j(r.doc.resolve(i-1))),!0},d1=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const l=o.before(s),a=o.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1},f1=t=>({tr:e,state:n,dispatch:r})=>{const o=Pe(t,n.schema),s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const a=s.before(i),c=s.after(i);e.delete(a,c).scrollIntoView()}return!0}return!1},p1=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},h1=()=>({state:t,dispatch:e})=>ta(t,e),m1=()=>({commands:t})=>t.keyboardShortcut("Enter"),g1=()=>({state:t,dispatch:e})=>Nb(t,e);function Us(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:ca(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Uf(t,e,n={}){return t.find(r=>r.type===e&&Us(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function zf(t,e,n={}){return!!Uf(t,e,n)}function da(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!Uf([...o.node.marks],e,n)))return;let i=o.index,l=t.start()+o.offset,a=i+1,c=l+o.node.nodeSize;for(;i>0&&zf([...t.parent.child(i-1).marks],e,n);)i-=1,l-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&zf([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Vn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const y1=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Vn(t,r.schema),{doc:i,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=da(a,s,e);if(d&&d.from<=c&&d.to>=u){const f=j.create(i,d.from,d.to);n.setSelection(f)}}return!0},b1=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function fa(t){return t instanceof j}function mn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function jf(t,e=null){if(!e)return null;const n=z.atStart(t),r=z.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?j.create(t,mn(0,o,s),mn(t.content.size,o,s)):j.create(t,mn(e,o,s),mn(e,o,s))}function pa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const E1=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{pa()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!fa(n.state.selection))return i(),!0;const l=jf(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},w1=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),k1=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Wf=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Wf(r)}return t};function zs(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Wf(n)}function js(t,e,n){if(t instanceof On||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(l=>e.nodeFromJSON(l)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),js("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,l="";const a=new _u({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Ar.fromSchema(a).parseSlice(zs(t),n.parseOptions):Ar.fromSchema(a).parse(zs(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Ar.fromSchema(e);return n.slice?s.parseSlice(zs(t),n.parseOptions).content:s.parse(zs(t),n.parseOptions)}return js("",e,n)}function C1(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Le||o instanceof Ie))return;const s=t.mapping.maps[r];let i=0;s.forEach((l,a,c,u)=>{i===0&&(i=u)}),t.setSelection(z.near(t.doc.resolve(i),n))}const S1=t=>!("type"in t),v1=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=js(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(i=n.errorOnInvalidContent)!==null&&i!==void 0?i:s.options.enableContentCheck})}catch(h){return s.emit("contentError",{editor:s,error:h,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,d=!0;if((S1(l)?l:[l]).forEach(h=>{h.check(),u=u?h.isText&&h.marks.length===0:!1,d=d?h.isBlock:!1}),a===c&&d){const{parent:h}=r.doc.resolve(a);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(a-=1,c+=1)}let p;if(u){if(Array.isArray(e))p=e.map(h=>h.text||"").join("");else if(e instanceof M){let h="";e.forEach(m=>{m.text&&(h+=m.text)}),p=h}else typeof e=="object"&&e&&e.text?p=e.text:p=e;r.insertText(p,a,c)}else p=l,r.replaceWith(a,c,p);n.updateSelection&&C1(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:p}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:p})}return!0},x1=()=>({state:t,dispatch:e})=>xb(t,e),T1=()=>({state:t,dispatch:e})=>Tb(t,e),O1=()=>({state:t,dispatch:e})=>vf(t,e),N1=()=>({state:t,dispatch:e})=>Nf(t,e),A1=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Cs(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},_1=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Cs(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},M1=()=>({state:t,dispatch:e})=>Sb(t,e),R1=()=>({state:t,dispatch:e})=>vb(t,e);function Kf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function L1(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))pa()||Kf()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const I1=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=L1(t).split(/-(?!$)/),i=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function No(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?Pe(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=o-r,c=l.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>Us(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const D1=(t,e={})=>({state:n,dispatch:r})=>{const o=Pe(t,n.schema);return No(n,o,e)?Ob(n,r):!1},P1=()=>({state:t,dispatch:e})=>Rf(t,e),B1=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return $b(r)(e,n)},F1=()=>({state:t,dispatch:e})=>_f(t,e);function Ws(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function qf(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const $1=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=Ws(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=Pe(t,r.schema)),l==="mark"&&(i=Vn(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{s&&s===c.type&&n.setNodeMarkup(u,void 0,qf(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&n.addMark(u,u+c.nodeSize,i.create(qf(d.attrs,e)))})})}),!0):!1},V1=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),H1=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),U1=()=>({state:t,dispatch:e})=>Tf(t,e),z1=()=>({state:t,dispatch:e})=>Af(t,e),j1=()=>({state:t,dispatch:e})=>Mb(t,e),W1=()=>({state:t,dispatch:e})=>Ib(t,e),K1=()=>({state:t,dispatch:e})=>Lb(t,e);function ha(t,e,n={},r={}){return js(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const q1=(t,e=!1,n={},r={})=>({editor:o,tr:s,dispatch:i,commands:l})=>{var a,c;const{doc:u}=s;if(n.preserveWhitespace!=="full"){const d=ha(t,o.schema,n,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck});return i&&s.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return i&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})};function ma(t,e){const n=Vn(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{i.push(...a.marks)});const l=i.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function J1(t,e){const n=new Sl(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function G1(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Y1(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function Jf(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ga(t){return e=>Jf(e.$from,t)}function Gf(t,e){const n={from:0,to:t.content.size};return Hf(t,n,e)}function X1(t,e){const n=Pe(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,l=>{s.push(l)});const i=s.reverse().find(l=>l.type.name===n.name);return i?{...i.attrs}:{}}function Yf(t,e){const n=Ws(typeof e=="string"?e:e.name,t.schema);return n==="node"?X1(t,e):n==="mark"?ma(t,e):{}}function Q1(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Z1(t){const e=Q1(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function eE(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((l,a)=>{i.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;i.push({from:l,to:a})}i.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Z1(r)}function ya(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=da(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}function Ks(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}function ba(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Vn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Us(d.attrs,n,{strict:!1}));let i=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(m,y)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(p,y),w=Math.min(h,y+m.nodeSize),k=w-b;i+=k,l.push(...m.marks.map(E=>({mark:E,from:b,to:w})))})}),i===0)return!1;const a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Us(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=i}function tE(t,e,n={}){if(!e)return No(t,null,n)||ba(t,null,n);const r=Ws(e,t.schema);return r==="node"?No(t,e,n):r==="mark"?ba(t,e,n):!1}function Xf(t,e){const{nodeExtensions:n}=Bs(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=G(F(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Ea(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(s=>{o!==!1&&(Ea(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function nE(t){return t instanceof U}function Qf(t,e,n){const o=t.state.doc.content.size,s=mn(e,0,o),i=mn(n,0,o),l=t.coordsAtPos(s),a=t.coordsAtPos(i,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),p=f-d,h=u-c,b={top:c,bottom:u,left:d,right:f,width:p,height:h,x:d,y:c};return{...b,toJSON:()=>b}}function rE(t,e,n){var r;const{selection:o}=e;let s=null;if(fa(o)&&(s=o.$cursor),s){const l=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:i}=o;return i.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=p&&h}return!c}),c})}const oE=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:l}=s,a=Vn(t,r.schema);if(o)if(i){const c=ma(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),m=Math.min(p+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(h,m,a.create({...b.attrs,...e}))}):n.addMark(h,m,a.create(e))})});return rE(r,n,a)},sE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),iE=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=Pe(t,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:l})=>Df(s,{...i,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Df(s,{...i,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},lE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=mn(t,0,r.content.size),s=U.create(r,o);e.setSelection(s)}return!0},aE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=j.atStart(r).from,l=j.atEnd(r).to,a=mn(o,i,l),c=mn(s,i,l),u=j.create(r,a,c);e.setSelection(u)}return!0},cE=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return Ub(r)(e,n)};function Zf(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}const uE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=e,{$from:l,$to:a}=s,c=o.extensionManager.attributes,u=Ks(c,l.node().type.name,l.node().attrs);if(s instanceof U&&s.node.isBlock)return!l.parentOffset||!un(i,l.pos)?!1:(r&&(t&&Zf(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:G1(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=un(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!h&&un(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(h&&(s instanceof j&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),y=e.doc.resolve(m);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&Zf(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return h},dE=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const l=Pe(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let b=M.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let _=a.depth-w;_>=a.depth-3;_-=1)b=M.from(a.node(_).copy(b));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...Ks(f,a.node().type.name,a.node().attrs),...e},x=((i=l.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(E))||void 0;b=b.append(M.from(l.createAndFill(null,x)||void 0));const v=a.before(a.depth-(w-1));n.replace(v,a.after(-k),new D(b,4-w,0));let T=-1;n.doc.nodesBetween(v,n.doc.content.size,(_,P)=>{if(T>-1)return!1;_.isTextblock&&_.content.size===0&&(T=P+1)}),T>-1&&n.setSelection(j.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,h={...Ks(f,d.type.name,d.attrs),...e},m={...Ks(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const y=p?[{type:l,attrs:h},{type:p,attrs:m}]:[{type:l,attrs:h}];if(!un(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:w}=r,{splittableMarks:k}=s.extensionManager,E=w||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!E||!o)return!0;const x=E.filter(v=>k.includes(v.type.name));n.ensureMarks(x)}return!0},wa=(t,e)=>{const n=ga(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&_n(t.doc,n.pos)&&t.join(n.pos),!0},ka=(t,e)=>{const n=ga(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&_n(t.doc,r)&&t.join(r),!0};var fE=Object.freeze({__proto__:null,blur:s1,clearContent:i1,clearNodes:l1,command:a1,createParagraphNear:c1,cut:u1,deleteCurrentNode:d1,deleteNode:f1,deleteRange:p1,deleteSelection:h1,enter:m1,exitCode:g1,extendMarkRange:y1,first:b1,focus:E1,forEach:w1,insertContent:k1,insertContentAt:v1,joinBackward:O1,joinDown:T1,joinForward:N1,joinItemBackward:A1,joinItemForward:_1,joinTextblockBackward:M1,joinTextblockForward:R1,joinUp:x1,keyboardShortcut:I1,lift:D1,liftEmptyBlock:P1,liftListItem:B1,newlineInCode:F1,resetAttributes:$1,scrollIntoView:V1,selectAll:H1,selectNodeBackward:U1,selectNodeForward:z1,selectParentNode:j1,selectTextblockEnd:W1,selectTextblockStart:K1,setContent:q1,setMark:oE,setMeta:sE,setNode:iE,setNodeSelection:lE,setTextSelection:aE,sinkListItem:cE,splitBlock:uE,splitListItem:dE,toggleList:(t,e,n,r={})=>({editor:o,tr:s,state:i,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=Pe(t,i.schema),h=Pe(e,i.schema),{selection:m,storedMarks:y}=i,{$from:b,$to:w}=m,k=b.blockRange(w),E=y||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const x=ga(v=>Xf(v.type.name,d))(m);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(h);if(Xf(x.node.type.name,d)&&p.validContent(x.node.content)&&l)return a().command(()=>(s.setNodeMarkup(x.pos,p),!0)).command(()=>wa(s,p)).command(()=>ka(s,p)).run()}return!n||!E||!l?a().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>wa(s,p)).command(()=>ka(s,p)).run():a().command(()=>{const v=u().wrapInList(p,r),T=E.filter(_=>f.includes(_.type.name));return s.ensureMarks(T),v?!0:c.clearNodes()}).wrapInList(p,r).command(()=>wa(s,p)).command(()=>ka(s,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=Vn(t,r.schema);return ba(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const s=Pe(t,r.schema),i=Pe(e,r.schema),l=No(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(i,a):o.setNode(s,{...a,...n})},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const o=Pe(t,n.schema);return No(n,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const i=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)i.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else i.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=n,a=Vn(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&i){let{from:f,to:p}=l;const h=(s=c.marks().find(y=>y.type===a))===null||s===void 0?void 0:s.attrs,m=da(c,a,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=Ws(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=Pe(t,r.schema)),l==="mark"&&(i=Vn(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,p,h;n.selection.empty?r.doc.nodesBetween(c,u,(m,y)=>{s&&s===m.type&&(p=Math.max(y,c),h=Math.min(y+m.nodeSize,u),d=y,f=m)}):r.doc.nodesBetween(c,u,(m,y)=>{y<c&&s&&s===m.type&&(p=Math.max(y,c),h=Math.min(y+m.nodeSize,u),d=y,f=m),y>=c&&y<=u&&(s&&s===m.type&&n.setNodeMarkup(y,void 0,{...m.attrs,...e}),i&&m.marks.length&&m.marks.forEach(b=>{if(i===b.type){const w=Math.max(y,c),k=Math.min(y+m.nodeSize,u);n.addMark(w,k,i.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),i&&f.marks.length&&f.marks.forEach(m=>{i===m.type&&n.addMark(p,h,i.create({...m.attrs,...e}))}))}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const o=Pe(t,n.schema);return Db(o,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const o=Pe(t,n.schema);return Pb(o,e)(n,r)}});const pE=Be.create({name:"commands",addCommands(){return{...fE}}}),hE=Be.create({name:"drop",addProseMirrorPlugins(){return[new Ae({key:new De("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),mE=Be.create({name:"editable",addProseMirrorPlugins(){return[new Ae({key:new De("editable"),props:{editable:()=>this.editor.options.editable}})]}}),gE=Be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ae({key:new De("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),yE=Be.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,y=d.pos-d.parentOffset,b=m&&h.parent.childCount===1?y===d.pos:z.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return pa()||Kf()?s:o},addProseMirrorPlugins(){return[new Ae({key:new De("clearDocument"),appendTransaction:(t,e,n)=>{const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:l}=e.selection,a=z.atStart(e.doc).from,c=z.atEnd(e.doc).to;if(s||!(i===a&&l===c)||!Ea(n.doc))return;const f=n.tr,p=Ds({state:n,transaction:f}),{commands:h}=new Ps({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),bE=Be.create({name:"paste",addProseMirrorPlugins(){return[new Ae({key:new De("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),EE=Be.create({name:"tabindex",addProseMirrorPlugins(){return[new Ae({key:new De("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class fr{get name(){return this.node.type.name}constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new fr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new fr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new fr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=this.pos+r+(s?0:1),l=this.resolvedPos.doc.resolve(i);if(!o&&l.depth<=this.depth)return;const a=new fr(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new fr(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,i=Object.keys(n);for(let l=0;l<i.length;l+=1){const a=i[l];if(s[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===e&&s.every(a=>n[a]===i.node.attrs[a])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const wE=`.ProseMirror {
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ProseMirror {
|
|
18
|
+
word-wrap: break-word;
|
|
19
|
+
white-space: pre-wrap;
|
|
20
|
+
white-space: break-spaces;
|
|
21
|
+
-webkit-font-variant-ligatures: none;
|
|
22
|
+
font-variant-ligatures: none;
|
|
23
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ProseMirror [contenteditable="false"] {
|
|
27
|
+
white-space: normal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ProseMirror pre {
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
img.ProseMirror-separator {
|
|
39
|
+
display: inline !important;
|
|
40
|
+
border: none !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
width: 0 !important;
|
|
43
|
+
height: 0 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ProseMirror-gapcursor {
|
|
47
|
+
display: none;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
position: absolute;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ProseMirror-gapcursor:after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -2px;
|
|
58
|
+
width: 20px;
|
|
59
|
+
border-top: 1px solid black;
|
|
60
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes ProseMirror-cursor-blink {
|
|
64
|
+
to {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ProseMirror-hideselection *::selection {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror-hideselection * {
|
|
78
|
+
caret-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
+
display: block;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
86
|
+
opacity: 0
|
|
87
|
+
}`;function kE(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}let CE=class extends zb{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:o})=>this.options.onDrop(n,r,o)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=kE(wE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=Bf(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;r=n.filter(l=>!l.key.startsWith(i))}),n.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,n;const o=[...this.options.enableCoreExtensions?[mE,o1.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),pE,gE,yE,EE,hE,bE].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ur(o,this)}createCommandManager(){this.commandManager=new Ps({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=ha(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(i){if(!(i instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(i.message))throw i;this.emit("contentError",{editor:this,error:i,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=ha(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=jf(n,this.options.autofocus);this.view=new yf(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Ir.create({doc:n,selection:r||void 0})});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(i=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(i)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=e.getMeta("focus"),s=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Yf(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return tE(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return aa(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
88
|
+
|
|
89
|
+
`,textSerializers:r={}}=e||{};return Gf(this.state.doc,{blockSeparator:n,textSerializers:{...ua(this.schema),...r}})}get isEmpty(){return Ea(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new fr(n,this)}get $doc(){return this.$pos(0)}};function pr(t){return new Fs({find:t.find,handler:({state:e,range:n,match:r})=>{const o=G(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,i=r[r.length-1],l=r[0];if(i){const a=l.search(/\S/),c=n.from+l.indexOf(i),u=c+i.length;if(ya(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+a,c);const f=n.from+a+i.length;s.addMark(n.from+a,f,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function SE(t){return new Fs({find:t.find,handler:({state:e,range:n,match:r})=>{const o=G(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,i+r[0].length-1),s.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?i:i-1;s.insert(c,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(l))}s.scrollIntoView()}})}function Ca(t){return new Fs({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=G(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Ao(t){return new Fs({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=G(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),c=a&&wl(a,t.type,s);if(!c)return null;if(i.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(y=>p.includes(y.type.name));i.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,s).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&_n(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)}})}class Fe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(F(this,"addOptions",{name:this.name}))),this.storage=G(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Fe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Hs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Fe(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(F(n,"addOptions",{name:n.name})),n.storage=G(F(n,"addStorage",{name:n.name,options:n.options})),n}}function Hn(t){return new Qb({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=G(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:i}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(ya(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(y=>y===t.type&&y!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+l.length,i.addMark(n.from+u,c,t.type.create(s||{})),i.removeStoredMark(t.type)}}})}var st="top",xt="bottom",Tt="right",it="left",Sa="auto",_o=[st,xt,Tt,it],zr="start",Mo="end",vE="clippingParents",ep="viewport",Ro="popper",xE="reference",tp=_o.reduce(function(t,e){return t.concat([e+"-"+zr,e+"-"+Mo])},[]),np=[].concat(_o,[Sa]).reduce(function(t,e){return t.concat([e,e+"-"+zr,e+"-"+Mo])},[]),TE="beforeRead",OE="read",NE="afterRead",AE="beforeMain",_E="main",ME="afterMain",RE="beforeWrite",LE="write",IE="afterWrite",DE=[TE,OE,NE,AE,_E,ME,RE,LE,IE];function Jt(t){return t?(t.nodeName||"").toLowerCase():null}function mt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function hr(t){var e=mt(t).Element;return t instanceof e||t instanceof Element}function Ot(t){var e=mt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function va(t){if(typeof ShadowRoot>"u")return!1;var e=mt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function PE(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},s=e.elements[n];!Ot(s)||!Jt(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function BE(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],s=e.attributes[r]||{},i=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=i.reduce(function(a,c){return a[c]="",a},{});!Ot(o)||!Jt(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(a){o.removeAttribute(a)}))})}}const rp={name:"applyStyles",enabled:!0,phase:"write",fn:PE,effect:BE,requires:["computeStyles"]};function Gt(t){return t.split("-")[0]}var mr=Math.max,qs=Math.min,jr=Math.round;function xa(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function op(){return!/^((?!chrome|android).)*safari/i.test(xa())}function Wr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,s=1;e&&Ot(t)&&(o=t.offsetWidth>0&&jr(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&jr(r.height)/t.offsetHeight||1);var i=hr(t)?mt(t):window,l=i.visualViewport,a=!op()&&n,c=(r.left+(a&&l?l.offsetLeft:0))/o,u=(r.top+(a&&l?l.offsetTop:0))/s,d=r.width/o,f=r.height/s;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function Ta(t){var e=Wr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function sp(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&va(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function gn(t){return mt(t).getComputedStyle(t)}function FE(t){return["table","td","th"].indexOf(Jt(t))>=0}function Un(t){return((hr(t)?t.ownerDocument:t.document)||window.document).documentElement}function Js(t){return Jt(t)==="html"?t:t.assignedSlot||t.parentNode||(va(t)?t.host:null)||Un(t)}function ip(t){return!Ot(t)||gn(t).position==="fixed"?null:t.offsetParent}function $E(t){var e=/firefox/i.test(xa()),n=/Trident/i.test(xa());if(n&&Ot(t)){var r=gn(t);if(r.position==="fixed")return null}var o=Js(t);for(va(o)&&(o=o.host);Ot(o)&&["html","body"].indexOf(Jt(o))<0;){var s=gn(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Lo(t){for(var e=mt(t),n=ip(t);n&&FE(n)&&gn(n).position==="static";)n=ip(n);return n&&(Jt(n)==="html"||Jt(n)==="body"&&gn(n).position==="static")?e:n||$E(t)||e}function Oa(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Io(t,e,n){return mr(t,qs(e,n))}function VE(t,e,n){var r=Io(t,e,n);return r>n?n:r}function lp(){return{top:0,right:0,bottom:0,left:0}}function ap(t){return Object.assign({},lp(),t)}function cp(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var HE=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,ap(typeof e!="number"?e:cp(e,_o))};function UE(t){var e,n=t.state,r=t.name,o=t.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Gt(n.placement),a=Oa(l),c=[it,Tt].indexOf(l)>=0,u=c?"height":"width";if(!(!s||!i)){var d=HE(o.padding,n),f=Ta(s),p=a==="y"?st:it,h=a==="y"?xt:Tt,m=n.rects.reference[u]+n.rects.reference[a]-i[a]-n.rects.popper[u],y=i[a]-n.rects.reference[a],b=Lo(s),w=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,k=m/2-y/2,E=d[p],x=w-f[u]-d[h],v=w/2-f[u]/2+k,T=Io(E,v,x),_=a;n.modifiersData[r]=(e={},e[_]=T,e.centerOffset=T-v,e)}}function zE(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||sp(e.elements.popper,o)&&(e.elements.arrow=o))}const jE={name:"arrow",enabled:!0,phase:"main",fn:UE,effect:zE,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Kr(t){return t.split("-")[1]}var WE={top:"auto",right:"auto",bottom:"auto",left:"auto"};function KE(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:jr(n*o)/o||0,y:jr(r*o)/o||0}}function up(t){var e,n=t.popper,r=t.popperRect,o=t.placement,s=t.variation,i=t.offsets,l=t.position,a=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=i.x,p=f===void 0?0:f,h=i.y,m=h===void 0?0:h,y=typeof u=="function"?u({x:p,y:m}):{x:p,y:m};p=y.x,m=y.y;var b=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),k=it,E=st,x=window;if(c){var v=Lo(n),T="clientHeight",_="clientWidth";if(v===mt(n)&&(v=Un(n),gn(v).position!=="static"&&l==="absolute"&&(T="scrollHeight",_="scrollWidth")),v=v,o===st||(o===it||o===Tt)&&s===Mo){E=xt;var P=d&&v===x&&x.visualViewport?x.visualViewport.height:v[T];m-=P-r.height,m*=a?1:-1}if(o===it||(o===st||o===xt)&&s===Mo){k=Tt;var V=d&&v===x&&x.visualViewport?x.visualViewport.width:v[_];p-=V-r.width,p*=a?1:-1}}var Z=Object.assign({position:l},c&&WE),q=u===!0?KE({x:p,y:m},mt(n)):{x:p,y:m};if(p=q.x,m=q.y,a){var re;return Object.assign({},Z,(re={},re[E]=w?"0":"",re[k]=b?"0":"",re.transform=(x.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",re))}return Object.assign({},Z,(e={},e[E]=w?m+"px":"",e[k]=b?p+"px":"",e.transform="",e))}function qE(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,a=l===void 0?!0:l,c={placement:Gt(e.placement),variation:Kr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,up(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:i,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,up(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const JE={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:qE,data:{}};var Gs={passive:!0};function GE(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,a=mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,Gs)}),l&&a.addEventListener("resize",n.update,Gs),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,Gs)}),l&&a.removeEventListener("resize",n.update,Gs)}}const YE={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:GE,data:{}};var XE={left:"right",right:"left",bottom:"top",top:"bottom"};function Ys(t){return t.replace(/left|right|bottom|top/g,function(e){return XE[e]})}var QE={start:"end",end:"start"};function dp(t){return t.replace(/start|end/g,function(e){return QE[e]})}function Na(t){var e=mt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Aa(t){return Wr(Un(t)).left+Na(t).scrollLeft}function ZE(t,e){var n=mt(t),r=Un(t),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;var c=op();(c||!c&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:s,height:i,x:l+Aa(t),y:a}}function ew(t){var e,n=Un(t),r=Na(t),o=(e=t.ownerDocument)==null?void 0:e.body,s=mr(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=mr(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Aa(t),a=-r.scrollTop;return gn(o||n).direction==="rtl"&&(l+=mr(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:a}}function _a(t){var e=gn(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function fp(t){return["html","body","#document"].indexOf(Jt(t))>=0?t.ownerDocument.body:Ot(t)&&_a(t)?t:fp(Js(t))}function Do(t,e){var n;e===void 0&&(e=[]);var r=fp(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),s=mt(r),i=o?[s].concat(s.visualViewport||[],_a(r)?r:[]):r,l=e.concat(i);return o?l:l.concat(Do(Js(i)))}function Ma(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function tw(t,e){var n=Wr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function pp(t,e,n){return e===ep?Ma(ZE(t,n)):hr(e)?tw(e,n):Ma(ew(Un(t)))}function nw(t){var e=Do(Js(t)),n=["absolute","fixed"].indexOf(gn(t).position)>=0,r=n&&Ot(t)?Lo(t):t;return hr(r)?e.filter(function(o){return hr(o)&&sp(o,r)&&Jt(o)!=="body"}):[]}function rw(t,e,n,r){var o=e==="clippingParents"?nw(t):[].concat(e),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(a,c){var u=pp(t,c,r);return a.top=mr(u.top,a.top),a.right=qs(u.right,a.right),a.bottom=qs(u.bottom,a.bottom),a.left=mr(u.left,a.left),a},pp(t,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function hp(t){var e=t.reference,n=t.element,r=t.placement,o=r?Gt(r):null,s=r?Kr(r):null,i=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,a;switch(o){case st:a={x:i,y:e.y-n.height};break;case xt:a={x:i,y:e.y+e.height};break;case Tt:a={x:e.x+e.width,y:l};break;case it:a={x:e.x-n.width,y:l};break;default:a={x:e.x,y:e.y}}var c=o?Oa(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case zr:a[c]=a[c]-(e[u]/2-n[u]/2);break;case Mo:a[c]=a[c]+(e[u]/2-n[u]/2);break}}return a}function Po(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,s=n.strategy,i=s===void 0?t.strategy:s,l=n.boundary,a=l===void 0?vE:l,c=n.rootBoundary,u=c===void 0?ep:c,d=n.elementContext,f=d===void 0?Ro:d,p=n.altBoundary,h=p===void 0?!1:p,m=n.padding,y=m===void 0?0:m,b=ap(typeof y!="number"?y:cp(y,_o)),w=f===Ro?xE:Ro,k=t.rects.popper,E=t.elements[h?w:f],x=rw(hr(E)?E:E.contextElement||Un(t.elements.popper),a,u,i),v=Wr(t.elements.reference),T=hp({reference:v,element:k,placement:o}),_=Ma(Object.assign({},k,T)),P=f===Ro?_:v,V={top:x.top-P.top+b.top,bottom:P.bottom-x.bottom+b.bottom,left:x.left-P.left+b.left,right:P.right-x.right+b.right},Z=t.modifiersData.offset;if(f===Ro&&Z){var q=Z[o];Object.keys(V).forEach(function(re){var Te=[Tt,xt].indexOf(re)>=0?1:-1,Se=[st,xt].indexOf(re)>=0?"y":"x";V[re]+=q[Se]*Te})}return V}function ow(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,a=n.allowedAutoPlacements,c=a===void 0?np:a,u=Kr(r),d=u?l?tp:tp.filter(function(h){return Kr(h)===u}):_o,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var p=f.reduce(function(h,m){return h[m]=Po(t,{placement:m,boundary:o,rootBoundary:s,padding:i})[Gt(m)],h},{});return Object.keys(p).sort(function(h,m){return p[h]-p[m]})}function sw(t){if(Gt(t)===Sa)return[];var e=Ys(t);return[dp(t),e,dp(e)]}function iw(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,a=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,h=p===void 0?!0:p,m=n.allowedAutoPlacements,y=e.options.placement,b=Gt(y),w=b===y,k=a||(w||!h?[Ys(y)]:sw(y)),E=[y].concat(k).reduce(function(wt,tt){return wt.concat(Gt(tt)===Sa?ow(e,{placement:tt,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:m}):tt)},[]),x=e.rects.reference,v=e.rects.popper,T=new Map,_=!0,P=E[0],V=0;V<E.length;V++){var Z=E[V],q=Gt(Z),re=Kr(Z)===zr,Te=[st,xt].indexOf(q)>=0,Se=Te?"width":"height",de=Po(e,{placement:Z,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),me=Te?re?Tt:it:re?xt:st;x[Se]>v[Se]&&(me=Ys(me));var Oe=Ys(me),dt=[];if(s&&dt.push(de[q]<=0),l&&dt.push(de[me]<=0,de[Oe]<=0),dt.every(function(wt){return wt})){P=Z,_=!1;break}T.set(Z,dt)}if(_)for(var Me=h?3:1,Et=function(tt){var Rt=E.find(function(sn){var pt=T.get(sn);if(pt)return pt.slice(0,tt).every(function(ln){return ln})});if(Rt)return P=Rt,"break"},ft=Me;ft>0;ft--){var Ut=Et(ft);if(Ut==="break")break}e.placement!==P&&(e.modifiersData[r]._skip=!0,e.placement=P,e.reset=!0)}}const lw={name:"flip",enabled:!0,phase:"main",fn:iw,requiresIfExists:["offset"],data:{_skip:!1}};function mp(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function gp(t){return[st,Tt,xt,it].some(function(e){return t[e]>=0})}function aw(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,s=e.modifiersData.preventOverflow,i=Po(e,{elementContext:"reference"}),l=Po(e,{altBoundary:!0}),a=mp(i,r),c=mp(l,o,s),u=gp(a),d=gp(c);e.modifiersData[n]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const cw={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:aw};function uw(t,e,n){var r=Gt(t),o=[it,st].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[it,Tt].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function dw(t){var e=t.state,n=t.options,r=t.name,o=n.offset,s=o===void 0?[0,0]:o,i=np.reduce(function(u,d){return u[d]=uw(d,e.rects,s),u},{}),l=i[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=i}const fw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:dw};function pw(t){var e=t.state,n=t.name;e.modifiersData[n]=hp({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const hw={name:"popperOffsets",enabled:!0,phase:"read",fn:pw,data:{}};function mw(t){return t==="x"?"y":"x"}function gw(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,a=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,h=n.tetherOffset,m=h===void 0?0:h,y=Po(e,{boundary:a,rootBoundary:c,padding:d,altBoundary:u}),b=Gt(e.placement),w=Kr(e.placement),k=!w,E=Oa(b),x=mw(E),v=e.modifiersData.popperOffsets,T=e.rects.reference,_=e.rects.popper,P=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,V=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),Z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(v){if(s){var re,Te=E==="y"?st:it,Se=E==="y"?xt:Tt,de=E==="y"?"height":"width",me=v[E],Oe=me+y[Te],dt=me-y[Se],Me=p?-_[de]/2:0,Et=w===zr?T[de]:_[de],ft=w===zr?-_[de]:-T[de],Ut=e.elements.arrow,wt=p&&Ut?Ta(Ut):{width:0,height:0},tt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:lp(),Rt=tt[Te],sn=tt[Se],pt=Io(0,T[de],wt[de]),ln=k?T[de]/2-Me-pt-Rt-V.mainAxis:Et-pt-Rt-V.mainAxis,Lt=k?-T[de]/2+Me+pt+sn+V.mainAxis:ft+pt+sn+V.mainAxis,an=e.elements.arrow&&Lo(e.elements.arrow),Qn=an?E==="y"?an.clientTop||0:an.clientLeft||0:0,zt=(re=Z?.[E])!=null?re:0,cn=me+ln-zt-Qn,It=me+Lt-zt,jt=Io(p?qs(Oe,cn):Oe,me,p?mr(dt,It):dt);v[E]=jt,q[E]=jt-me}if(l){var Sn,C=E==="x"?st:it,S=E==="x"?xt:Tt,R=v[x],$=x==="y"?"height":"width",fe=R+y[C],se=R-y[S],Q=[st,it].indexOf(b)!==-1,N=(Sn=Z?.[x])!=null?Sn:0,L=Q?fe:R-T[$]-_[$]-N+V.altAxis,ee=Q?R+T[$]+_[$]-N-V.altAxis:se,ge=p&&Q?VE(L,R,ee):Io(p?L:fe,R,p?ee:se);v[x]=ge,q[x]=ge-R}e.modifiersData[r]=q}}const yw={name:"preventOverflow",enabled:!0,phase:"main",fn:gw,requiresIfExists:["offset"]};function bw(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Ew(t){return t===mt(t)||!Ot(t)?Na(t):bw(t)}function ww(t){var e=t.getBoundingClientRect(),n=jr(e.width)/t.offsetWidth||1,r=jr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function kw(t,e,n){n===void 0&&(n=!1);var r=Ot(e),o=Ot(e)&&ww(e),s=Un(e),i=Wr(t,o,n),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!n)&&((Jt(e)!=="body"||_a(s))&&(l=Ew(e)),Ot(e)?(a=Wr(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):s&&(a.x=Aa(s))),{x:i.left+l.scrollLeft-a.x,y:i.top+l.scrollTop-a.y,width:i.width,height:i.height}}function Cw(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var a=e.get(l);a&&o(a)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||o(s)}),r}function Sw(t){var e=Cw(t);return DE.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function vw(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function xw(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var yp={placement:"bottom",modifiers:[],strategy:"absolute"};function bp(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Tw(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,s=o===void 0?yp:o;return function(l,a,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},yp,s),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},d=[],f=!1,p={state:u,setOptions:function(b){var w=typeof b=="function"?b(u.options):b;m(),u.options=Object.assign({},s,u.options,w),u.scrollParents={reference:hr(l)?Do(l):l.contextElement?Do(l.contextElement):[],popper:Do(a)};var k=Sw(xw([].concat(r,u.options.modifiers)));return u.orderedModifiers=k.filter(function(E){return E.enabled}),h(),p.update()},forceUpdate:function(){if(!f){var b=u.elements,w=b.reference,k=b.popper;if(bp(w,k)){u.rects={reference:kw(w,Lo(k),u.options.strategy==="fixed"),popper:Ta(k)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var E=0;E<u.orderedModifiers.length;E++){if(u.reset===!0){u.reset=!1,E=-1;continue}var x=u.orderedModifiers[E],v=x.fn,T=x.options,_=T===void 0?{}:T,P=x.name;typeof v=="function"&&(u=v({state:u,options:_,name:P,instance:p})||u)}}}},update:vw(function(){return new Promise(function(y){p.forceUpdate(),y(u)})}),destroy:function(){m(),f=!0}};if(!bp(l,a))return p;p.setOptions(c).then(function(y){!f&&c.onFirstUpdate&&c.onFirstUpdate(y)});function h(){u.orderedModifiers.forEach(function(y){var b=y.name,w=y.options,k=w===void 0?{}:w,E=y.effect;if(typeof E=="function"){var x=E({state:u,name:b,instance:p,options:k}),v=function(){};d.push(x||v)}})}function m(){d.forEach(function(y){return y()}),d=[]}return p}}var Ow=[YE,hw,JE,rp,fw,lw,yw,jE,cw],Nw=Tw({defaultModifiers:Ow}),Aw="tippy-box",Ep="tippy-content",_w="tippy-backdrop",wp="tippy-arrow",kp="tippy-svg-arrow",gr={passive:!0,capture:!0},Cp=function(){return document.body};function Mw(t,e){return{}.hasOwnProperty.call(t,e)}function Ra(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function La(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Sp(t,e){return typeof t=="function"?t.apply(void 0,e):t}function vp(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function Rw(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function Lw(t){return t.split(/\s+/).filter(Boolean)}function qr(t){return[].concat(t)}function xp(t,e){t.indexOf(e)===-1&&t.push(e)}function Iw(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function Dw(t){return t.split("-")[0]}function Xs(t){return[].slice.call(t)}function Tp(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Bo(){return document.createElement("div")}function Fo(t){return["Element","Fragment"].some(function(e){return La(t,e)})}function Pw(t){return La(t,"NodeList")}function Bw(t){return La(t,"MouseEvent")}function Fw(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function $w(t){return Fo(t)?[t]:Pw(t)?Xs(t):Array.isArray(t)?t:Xs(document.querySelectorAll(t))}function Ia(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Op(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function Vw(t){var e,n=qr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Hw(t,e){var n=e.clientX,r=e.clientY;return t.every(function(o){var s=o.popperRect,i=o.popperState,l=o.props,a=l.interactiveBorder,c=Dw(i.placement),u=i.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,h=c==="left"?u.right.x:0,m=s.top-r+d>a,y=r-s.bottom-f>a,b=s.left-n+p>a,w=n-s.right-h>a;return m||y||b||w})}function Da(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){t[r](o,n)})}function Np(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Yt={isTouch:!1},Ap=0;function Uw(){Yt.isTouch||(Yt.isTouch=!0,window.performance&&document.addEventListener("mousemove",_p))}function _p(){var t=performance.now();t-Ap<20&&(Yt.isTouch=!1,document.removeEventListener("mousemove",_p)),Ap=t}function zw(){var t=document.activeElement;if(Fw(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function jw(){document.addEventListener("touchstart",Uw,gr),window.addEventListener("blur",zw)}var Ww=typeof window<"u"&&typeof document<"u",Kw=Ww?!!window.msCrypto:!1;function Jr(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Mp(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function qw(t){return Mp(`
|
|
90
|
+
%ctippy.js
|
|
91
|
+
|
|
92
|
+
%c`+Mp(t)+`
|
|
93
|
+
|
|
94
|
+
%c👷 This is a development-only message. It will be removed in production.
|
|
95
|
+
`)}function Rp(t){return[qw(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var $o;process.env.NODE_ENV!=="production"&&Jw();function Jw(){$o=new Set}function yn(t,e){if(t&&!$o.has(e)){var n;$o.add(e),(n=console).warn.apply(n,Rp(e))}}function Pa(t,e){if(t&&!$o.has(e)){var n;$o.add(e),(n=console).error.apply(n,Rp(e))}}function Gw(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Pa(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Pa(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var Lp={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Yw={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},gt=Object.assign({appendTo:Cp,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Lp,Yw),Xw=Object.keys(gt),Qw=function(e){process.env.NODE_ENV!=="production"&&Pp(e,[]);var n=Object.keys(e);n.forEach(function(r){gt[r]=e[r]})};function Ip(t){var e=t.plugins||[],n=e.reduce(function(r,o){var s=o.name,i=o.defaultValue;if(s){var l;r[s]=t[s]!==void 0?t[s]:(l=gt[s])!=null?l:i}return r},{});return Object.assign({},t,n)}function Zw(t,e){var n=e?Object.keys(Ip(Object.assign({},gt,{plugins:e}))):Xw,r=n.reduce(function(o,s){var i=(t.getAttribute("data-tippy-"+s)||"").trim();if(!i)return o;if(s==="content")o[s]=i;else try{o[s]=JSON.parse(i)}catch{o[s]=i}return o},{});return r}function Dp(t,e){var n=Object.assign({},e,{content:Sp(e.content,[t])},e.ignoreAttributes?{}:Zw(t,e.plugins));return n.aria=Object.assign({},gt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function Pp(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var o=Rw(gt,Object.keys(Lp)),s=!Mw(o,r);s&&(s=e.filter(function(i){return i.name===r}).length===0),yn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
96
|
+
|
|
97
|
+
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
98
|
+
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var ek=function(){return"innerHTML"};function Ba(t,e){t[ek()]=e}function Bp(t){var e=Bo();return t===!0?e.className=wp:(e.className=kp,Fo(t)?e.appendChild(t):Ba(e,t)),e}function Fp(t,e){Fo(e.content)?(Ba(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ba(t,e.content):t.textContent=e.content)}function Fa(t){var e=t.firstElementChild,n=Xs(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Ep)}),arrow:n.find(function(r){return r.classList.contains(wp)||r.classList.contains(kp)}),backdrop:n.find(function(r){return r.classList.contains(_w)})}}function $p(t){var e=Bo(),n=Bo();n.className=Aw,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Bo();r.className=Ep,r.setAttribute("data-state","hidden"),Fp(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props);function o(s,i){var l=Fa(e),a=l.box,c=l.content,u=l.arrow;i.theme?a.setAttribute("data-theme",i.theme):a.removeAttribute("data-theme"),typeof i.animation=="string"?a.setAttribute("data-animation",i.animation):a.removeAttribute("data-animation"),i.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof i.maxWidth=="number"?i.maxWidth+"px":i.maxWidth,i.role?a.setAttribute("role",i.role):a.removeAttribute("role"),(s.content!==i.content||s.allowHTML!==i.allowHTML)&&Fp(c,t.props),i.arrow?u?s.arrow!==i.arrow&&(a.removeChild(u),a.appendChild(Bp(i.arrow))):a.appendChild(Bp(i.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:o}}$p.$$tippy=!0;var tk=1,Qs=[],$a=[];function nk(t,e){var n=Dp(t,Object.assign({},gt,Ip(Tp(e)))),r,o,s,i=!1,l=!1,a=!1,c=!1,u,d,f,p=[],h=vp(cn,n.interactiveDebounce),m,y=tk++,b=null,w=Iw(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},E={id:y,reference:t,popper:Bo(),popperInstance:b,props:n,state:k,plugins:w,clearDelayTimeouts:L,setProps:ee,setContent:ge,show:vn,hide:io,hideWithInteractivity:Zn,enable:Q,disable:N,unmount:xn,destroy:iu};if(!n.render)return process.env.NODE_ENV!=="production"&&Pa(!0,"render() function has not been supplied."),E;var x=n.render(E),v=x.popper,T=x.onUpdate;v.setAttribute("data-tippy-root",""),v.id="tippy-"+E.id,E.popper=v,t._tippy=E,v._tippy=E;var _=w.map(function(A){return A.fn(E)}),P=t.hasAttribute("aria-expanded");return an(),Me(),me(),Oe("onCreate",[E]),n.showOnCreate&&fe(),v.addEventListener("mouseenter",function(){E.props.interactive&&E.state.isVisible&&E.clearDelayTimeouts()}),v.addEventListener("mouseleave",function(){E.props.interactive&&E.props.trigger.indexOf("mouseenter")>=0&&Te().addEventListener("mousemove",h)}),E;function V(){var A=E.props.touch;return Array.isArray(A)?A:[A,0]}function Z(){return V()[0]==="hold"}function q(){var A;return!!((A=E.props.render)!=null&&A.$$tippy)}function re(){return m||t}function Te(){var A=re().parentNode;return A?Vw(A):document}function Se(){return Fa(v)}function de(A){return E.state.isMounted&&!E.state.isVisible||Yt.isTouch||u&&u.type==="focus"?0:Ra(E.props.delay,A?0:1,gt.delay)}function me(A){A===void 0&&(A=!1),v.style.pointerEvents=E.props.interactive&&!A?"":"none",v.style.zIndex=""+E.props.zIndex}function Oe(A,H,K){if(K===void 0&&(K=!0),_.forEach(function(oe){oe[A]&&oe[A].apply(oe,H)}),K){var ie;(ie=E.props)[A].apply(ie,H)}}function dt(){var A=E.props.aria;if(A.content){var H="aria-"+A.content,K=v.id,ie=qr(E.props.triggerTarget||t);ie.forEach(function(oe){var nt=oe.getAttribute(H);if(E.state.isVisible)oe.setAttribute(H,nt?nt+" "+K:K);else{var Dt=nt&&nt.replace(K,"").trim();Dt?oe.setAttribute(H,Dt):oe.removeAttribute(H)}})}}function Me(){if(!(P||!E.props.aria.expanded)){var A=qr(E.props.triggerTarget||t);A.forEach(function(H){E.props.interactive?H.setAttribute("aria-expanded",E.state.isVisible&&H===re()?"true":"false"):H.removeAttribute("aria-expanded")})}}function Et(){Te().removeEventListener("mousemove",h),Qs=Qs.filter(function(A){return A!==h})}function ft(A){if(!(Yt.isTouch&&(a||A.type==="mousedown"))){var H=A.composedPath&&A.composedPath()[0]||A.target;if(!(E.props.interactive&&Np(v,H))){if(qr(E.props.triggerTarget||t).some(function(K){return Np(K,H)})){if(Yt.isTouch||E.state.isVisible&&E.props.trigger.indexOf("click")>=0)return}else Oe("onClickOutside",[E,A]);E.props.hideOnClick===!0&&(E.clearDelayTimeouts(),E.hide(),l=!0,setTimeout(function(){l=!1}),E.state.isMounted||Rt())}}}function Ut(){a=!0}function wt(){a=!1}function tt(){var A=Te();A.addEventListener("mousedown",ft,!0),A.addEventListener("touchend",ft,gr),A.addEventListener("touchstart",wt,gr),A.addEventListener("touchmove",Ut,gr)}function Rt(){var A=Te();A.removeEventListener("mousedown",ft,!0),A.removeEventListener("touchend",ft,gr),A.removeEventListener("touchstart",wt,gr),A.removeEventListener("touchmove",Ut,gr)}function sn(A,H){ln(A,function(){!E.state.isVisible&&v.parentNode&&v.parentNode.contains(v)&&H()})}function pt(A,H){ln(A,H)}function ln(A,H){var K=Se().box;function ie(oe){oe.target===K&&(Da(K,"remove",ie),H())}if(A===0)return H();Da(K,"remove",d),Da(K,"add",ie),d=ie}function Lt(A,H,K){K===void 0&&(K=!1);var ie=qr(E.props.triggerTarget||t);ie.forEach(function(oe){oe.addEventListener(A,H,K),p.push({node:oe,eventType:A,handler:H,options:K})})}function an(){Z()&&(Lt("touchstart",zt,{passive:!0}),Lt("touchend",It,{passive:!0})),Lw(E.props.trigger).forEach(function(A){if(A!=="manual")switch(Lt(A,zt),A){case"mouseenter":Lt("mouseleave",It);break;case"focus":Lt(Kw?"focusout":"blur",jt);break;case"focusin":Lt("focusout",jt);break}})}function Qn(){p.forEach(function(A){var H=A.node,K=A.eventType,ie=A.handler,oe=A.options;H.removeEventListener(K,ie,oe)}),p=[]}function zt(A){var H,K=!1;if(!(!E.state.isEnabled||Sn(A)||l)){var ie=((H=u)==null?void 0:H.type)==="focus";u=A,m=A.currentTarget,Me(),!E.state.isVisible&&Bw(A)&&Qs.forEach(function(oe){return oe(A)}),A.type==="click"&&(E.props.trigger.indexOf("mouseenter")<0||i)&&E.props.hideOnClick!==!1&&E.state.isVisible?K=!0:fe(A),A.type==="click"&&(i=!K),K&&!ie&&se(A)}}function cn(A){var H=A.target,K=re().contains(H)||v.contains(H);if(!(A.type==="mousemove"&&K)){var ie=$().concat(v).map(function(oe){var nt,Dt=oe._tippy,lo=(nt=Dt.popperInstance)==null?void 0:nt.state;return lo?{popperRect:oe.getBoundingClientRect(),popperState:lo,props:n}:null}).filter(Boolean);Hw(ie,A)&&(Et(),se(A))}}function It(A){var H=Sn(A)||E.props.trigger.indexOf("click")>=0&&i;if(!H){if(E.props.interactive){E.hideWithInteractivity(A);return}se(A)}}function jt(A){E.props.trigger.indexOf("focusin")<0&&A.target!==re()||E.props.interactive&&A.relatedTarget&&v.contains(A.relatedTarget)||se(A)}function Sn(A){return Yt.isTouch?Z()!==A.type.indexOf("touch")>=0:!1}function C(){S();var A=E.props,H=A.popperOptions,K=A.placement,ie=A.offset,oe=A.getReferenceClientRect,nt=A.moveTransition,Dt=q()?Fa(v).arrow:null,lo=oe?{getBoundingClientRect:oe,contextElement:oe.contextElement||re()}:t,Pg={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(al){var ao=al.state;if(q()){var IA=Se(),au=IA.box;["placement","reference-hidden","escaped"].forEach(function(cl){cl==="placement"?au.setAttribute("data-placement",ao.placement):ao.attributes.popper["data-popper-"+cl]?au.setAttribute("data-"+cl,""):au.removeAttribute("data-"+cl)}),ao.attributes.popper={}}}},Nr=[{name:"offset",options:{offset:ie}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!nt}},Pg];q()&&Dt&&Nr.push({name:"arrow",options:{element:Dt,padding:3}}),Nr.push.apply(Nr,H?.modifiers||[]),E.popperInstance=Nw(lo,v,Object.assign({},H,{placement:K,onFirstUpdate:f,modifiers:Nr}))}function S(){E.popperInstance&&(E.popperInstance.destroy(),E.popperInstance=null)}function R(){var A=E.props.appendTo,H,K=re();E.props.interactive&&A===Cp||A==="parent"?H=K.parentNode:H=Sp(A,[K]),H.contains(v)||H.appendChild(v),E.state.isMounted=!0,C(),process.env.NODE_ENV!=="production"&&yn(E.props.interactive&&A===gt.appendTo&&K.nextElementSibling!==v,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
|
|
99
|
+
|
|
100
|
+
`,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
|
|
101
|
+
|
|
102
|
+
`,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
|
|
103
|
+
|
|
104
|
+
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function $(){return Xs(v.querySelectorAll("[data-tippy-root]"))}function fe(A){E.clearDelayTimeouts(),A&&Oe("onTrigger",[E,A]),tt();var H=de(!0),K=V(),ie=K[0],oe=K[1];Yt.isTouch&&ie==="hold"&&oe&&(H=oe),H?r=setTimeout(function(){E.show()},H):E.show()}function se(A){if(E.clearDelayTimeouts(),Oe("onUntrigger",[E,A]),!E.state.isVisible){Rt();return}if(!(E.props.trigger.indexOf("mouseenter")>=0&&E.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(A.type)>=0&&i)){var H=de(!1);H?o=setTimeout(function(){E.state.isVisible&&E.hide()},H):s=requestAnimationFrame(function(){E.hide()})}}function Q(){E.state.isEnabled=!0}function N(){E.hide(),E.state.isEnabled=!1}function L(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(s)}function ee(A){if(process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("setProps")),!E.state.isDestroyed){Oe("onBeforeUpdate",[E,A]),Qn();var H=E.props,K=Dp(t,Object.assign({},H,Tp(A),{ignoreAttributes:!0}));E.props=K,an(),H.interactiveDebounce!==K.interactiveDebounce&&(Et(),h=vp(cn,K.interactiveDebounce)),H.triggerTarget&&!K.triggerTarget?qr(H.triggerTarget).forEach(function(ie){ie.removeAttribute("aria-expanded")}):K.triggerTarget&&t.removeAttribute("aria-expanded"),Me(),me(),T&&T(H,K),E.popperInstance&&(C(),$().forEach(function(ie){requestAnimationFrame(ie._tippy.popperInstance.forceUpdate)})),Oe("onAfterUpdate",[E,A])}}function ge(A){E.setProps({content:A})}function vn(){process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("show"));var A=E.state.isVisible,H=E.state.isDestroyed,K=!E.state.isEnabled,ie=Yt.isTouch&&!E.props.touch,oe=Ra(E.props.duration,0,gt.duration);if(!(A||H||K||ie)&&!re().hasAttribute("disabled")&&(Oe("onShow",[E],!1),E.props.onShow(E)!==!1)){if(E.state.isVisible=!0,q()&&(v.style.visibility="visible"),me(),tt(),E.state.isMounted||(v.style.transition="none"),q()){var nt=Se(),Dt=nt.box,lo=nt.content;Ia([Dt,lo],0)}f=function(){var Nr;if(!(!E.state.isVisible||c)){if(c=!0,v.offsetHeight,v.style.transition=E.props.moveTransition,q()&&E.props.animation){var lu=Se(),al=lu.box,ao=lu.content;Ia([al,ao],oe),Op([al,ao],"visible")}dt(),Me(),xp($a,E),(Nr=E.popperInstance)==null||Nr.forceUpdate(),Oe("onMount",[E]),E.props.animation&&q()&&pt(oe,function(){E.state.isShown=!0,Oe("onShown",[E])})}},R()}}function io(){process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("hide"));var A=!E.state.isVisible,H=E.state.isDestroyed,K=!E.state.isEnabled,ie=Ra(E.props.duration,1,gt.duration);if(!(A||H||K)&&(Oe("onHide",[E],!1),E.props.onHide(E)!==!1)){if(E.state.isVisible=!1,E.state.isShown=!1,c=!1,i=!1,q()&&(v.style.visibility="hidden"),Et(),Rt(),me(!0),q()){var oe=Se(),nt=oe.box,Dt=oe.content;E.props.animation&&(Ia([nt,Dt],ie),Op([nt,Dt],"hidden"))}dt(),Me(),E.props.animation?q()&&sn(ie,E.unmount):E.unmount()}}function Zn(A){process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("hideWithInteractivity")),Te().addEventListener("mousemove",h),xp(Qs,h),h(A)}function xn(){process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("unmount")),E.state.isVisible&&E.hide(),E.state.isMounted&&(S(),$().forEach(function(A){A._tippy.unmount()}),v.parentNode&&v.parentNode.removeChild(v),$a=$a.filter(function(A){return A!==E}),E.state.isMounted=!1,Oe("onHidden",[E]))}function iu(){process.env.NODE_ENV!=="production"&&yn(E.state.isDestroyed,Jr("destroy")),!E.state.isDestroyed&&(E.clearDelayTimeouts(),E.unmount(),Qn(),delete t._tippy,E.state.isDestroyed=!0,Oe("onDestroy",[E]))}}function Gr(t,e){e===void 0&&(e={});var n=gt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(Gw(t),Pp(e,n)),jw();var r=Object.assign({},e,{plugins:n}),o=$w(t);if(process.env.NODE_ENV!=="production"){var s=Fo(r.content),i=o.length>1;yn(s&&i,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
105
|
+
|
|
106
|
+
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
107
|
+
|
|
108
|
+
`,`1) content: element.innerHTML
|
|
109
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var l=o.reduce(function(a,c){var u=c&&nk(c,r);return u&&a.push(u),a},[]);return Fo(t)?l[0]:l}Gr.defaultProps=gt,Gr.setDefaultProps=Qw,Gr.currentInput=Yt,Object.assign({},rp,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),Gr.setDefaultProps({render:$p});class rk{constructor({editor:e,element:n,view:r,tippyOptions:o={},updateDelay:s=250,shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:l,state:a,from:c,to:u})=>{const{doc:d,selection:f}=a,{empty:p}=f,h=!d.textBetween(c,u).length&&fa(a.selection),m=this.element.contains(document.activeElement);return!(!(l.hasFocus()||m)||p||h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,a)=>{const c=!a?.selection.eq(l.state.selection),u=!a?.doc.eq(l.state.doc);!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,u,a)},this.updateDelay))},this.updateHandler=(l,a,c,u)=>{var d,f,p;const{state:h,composing:m}=l,{selection:y}=h;if(m||!a&&!c)return;this.createTooltip();const{ranges:w}=y,k=Math.min(...w.map(v=>v.$from.pos)),E=Math.max(...w.map(v=>v.$to.pos));if(!((d=this.shouldShow)===null||d===void 0?void 0:d.call(this,{editor:this.editor,element:this.element,view:l,state:h,oldState:u,from:k,to:E}))){this.hide();return}(f=this.tippy)===null||f===void 0||f.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(nE(h.selection)){let v=l.nodeDOM(k);if(v){const T=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(T&&(v=T.firstChild),v)return v.getBoundingClientRect()}}return Qf(l,k,E)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Gr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,o=r.selection.from!==r.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,n);return}const s=!n?.selection.eq(e.state.selection),i=!n?.doc.eq(e.state.doc);this.updateHandler(e,s,i,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Vp=t=>new Ae({key:typeof t.pluginKey=="string"?new De(t.pluginKey):t.pluginKey,view:e=>new rk({view:e,...t})});Be.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Vp({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class ok{getTextContent(e){return Gf(e,{textSerializers:ua(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:o={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:i,state:l})=>{const{selection:a}=l,{$anchor:c,empty:u}=a,d=c.depth===1,f=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!i.hasFocus()||!u||!d||!f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:i})=>{var l;if(this.preventHide){this.preventHide=!1;return}i?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(i.relatedTarget))||i?.relatedTarget!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=i=>{this.blurHandler({event:i})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Gr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,o,s;const{state:i}=e,{doc:l,selection:a}=i,{from:c,to:u}=a;if(n&&n.doc.eq(l)&&n.selection.eq(a))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:i,oldState:n}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>Qf(e,c,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Hp=t=>new Ae({key:typeof t.pluginKey=="string"?new De(t.pluginKey):t.pluginKey,view:e=>new ok({view:e,...t})});Be.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Hp({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),g.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=g.ref(null);return g.onMounted(()=>{const{updateDelay:r,editor:o,pluginKey:s,shouldShow:i,tippyOptions:l}=t;o.registerPlugin(Vp({updateDelay:r,editor:o,element:n.value,pluginKey:s,shouldShow:i,tippyOptions:l}))}),g.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return g.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Up(t){return g.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class sk extends CE{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Up(this.view.state),this.reactiveExtensionStorage=Up(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),g.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const ik=g.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=g.ref(),n=g.getCurrentInstance();return g.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&g.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const o=g.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:o}),r.createNodeViews()})}),g.onBeforeUnmount(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return g.h("div",{ref:t=>{this.rootEl=t}})}});g.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=g.ref(null);return g.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:s,shouldShow:i}=t;o.registerPlugin(Hp({pluginKey:r,editor:o,element:n.value,tippyOptions:s,shouldShow:i}))}),g.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return g.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),g.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return g.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),g.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return g.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const lk=(t={})=>{const e=g.shallowRef();return g.onMounted(()=>{e.value=new sk(t)}),g.onBeforeUnmount(()=>{var n,r,o;const s=(n=e.value)===null||n===void 0?void 0:n.options.element,i=s?.cloneNode(!0);(r=s?.parentNode)===null||r===void 0||r.replaceChild(i,s),(o=e.value)===null||o===void 0||o.destroy()}),e},ak=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ck=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,uk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,dk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,fk=ot.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[pr({find:ak,type:this.type}),pr({find:uk,type:this.type})]},addPasteRules(){return[Hn({find:ck,type:this.type}),Hn({find:dk,type:this.type})]}}),pk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,hk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,mk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,gk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,yk=ot.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[pr({find:pk,type:this.type}),pr({find:mk,type:this.type})]},addPasteRules(){return[Hn({find:hk,type:this.type}),Hn({find:gk,type:this.type})]}}),bk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ek=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wk=ot.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[pr({find:bk,type:this.type})]},addPasteRules(){return[Hn({find:Ek,type:this.type})]}}),kk=/(^|[^`])`([^`]+)`(?!`)/,Ck=/(^|[^`])`([^`]+)`(?!`)/g,Sk=ot.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[pr({find:kk,type:this.type})]},addPasteRules(){return[Hn({find:Ck,type:this.type})]}}),vk=/^```([a-z]+)?[\s\n]$/,xk=/^~~~([a-z]+)?[\s\n]$/,Tk=Fe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",pe(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
|
|
110
|
+
|
|
111
|
+
`);return!s||!i?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(z.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ca({find:vk,type:this.type,getAttributes:t=>({language:t[1]})}),Ca({find:xk,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ae({key:new De("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!n||!s)return!1;const{tr:i,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
112
|
+
`));return i.replaceSelectionWith(this.type.create({language:s},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(j.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),Ok="listItem",zp="textStyle",jp=/^\s*([-+*])\s$/,Nk=Fe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ok,this.editor.getAttributes(zp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ao({find:jp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ao({find:jp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zp),editor:this.editor})),[t]}}),Ak="listItem",Wp="textStyle",Kp=/^(\d+)\.\s$/,_k=Fe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",pe(this.options.HTMLAttributes,n),0]:["ol",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ak,this.editor.getAttributes(Wp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ao({find:Kp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ao({find:Kp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Wp)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Mk=Fe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",pe(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Rk=/^\s*>\s$/,Lk=Fe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ao({find:Rk,type:this.type})]}}),Ik=Fe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",pe(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
113
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,a=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&i){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Zs=200,$e=function(){};$e.prototype.append=function(e){return e.length?(e=$e.from(e),!this.length&&e||e.length<Zs&&this.leafAppend(e)||this.length<Zs&&e.leafPrepend(this)||this.appendInner(e)):this},$e.prototype.prepend=function(e){return e.length?$e.from(e).append(this):this},$e.prototype.appendInner=function(e){return new Dk(this,e)},$e.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?$e.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},$e.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},$e.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},$e.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(e(s,i))},n,r),o},$e.from=function(e){return e instanceof $e?e:e&&e.length?new qp(e):$e.empty};var qp=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,i,l){for(var a=s;a<i;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,i,l){for(var a=s-1;a>=i;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Zs)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Zs)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}($e);$e.empty=new qp([]);var Dk=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,i){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(s,l),i)===!1||s>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,s)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,i){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(s,l)-l,i+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(o,l),s,i)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}($e);const Pk=500;class Bt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),s=o.maps.length),s--,u.push(d);return}if(o){u.push(new Xt(d.map));let p=d.step.map(o.slice(s)),h;p&&i.maybeStep(p).doc&&(h=i.mapping.maps[i.mapping.maps.length-1],c.push(new Xt(h,void 0,void 0,c.length+u.length))),s--,h&&o.appendMap(h,s)}else i.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(s)):d.selection,a=new Bt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,n,r,o){let s=[],i=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Xt(e.mapping.maps[u],d,n),p;(p=a&&a.merge(f))&&(f=p,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),n&&(i++,n=void 0),o||(a=f)}let c=i-r.depth;return c>Fk&&(l=Bk(l,c),i-=c),new Bt(l.append(s),i)}remapping(e,n){let r=new ho;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new Bt(this.items.append(e.map(n=>new Xt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let p=s.getMirror(--a);if(p==null)return;i=Math.min(i,p);let h=s.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(s.slice(a+1,p));y&&l++,r.push(new Xt(h,m,y))}else r.push(new Xt(h))},o);let c=[];for(let f=n;f<i;f++)c.push(new Xt(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Bt(u,l);return d.emptyItemCount()>Pk&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((i,l)=>{if(l>=e)o.push(i),i.selection&&s++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=i.selection&&i.selection.map(n.slice(r));u&&s++;let d=new Xt(c.invert(),a,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else i.map&&r--},this.items.length,0),new Bt($e.from(o.reverse()),s)}}Bt.empty=new Bt($e.empty,0);function Bk(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Xt{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Xt(n.getMap().invert(),n,this.selection)}}}class zn{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const Fk=20;function $k(t,e,n,r){let o=n.getMeta(yr),s;if(o)return o.historyState;n.getMeta(Uk)&&(t=new zn(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(yr))return i.getMeta(yr).redo?new zn(t.done.addTransform(n,void 0,r,ei(e)),t.undone,Jp(n.mapping.maps),t.prevTime,t.prevComposition):new zn(t.done,t.undone.addTransform(n,void 0,r,ei(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Vk(n,t.prevRanges)),c=i?Va(t.prevRanges,n.mapping):Jp(n.mapping.maps);return new zn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,ei(e)),Bt.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new zn(t.done.rebased(n,s),t.undone.rebased(n,s),Va(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new zn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Va(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Vk(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function Jp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,i)=>e.push(s,i));return e}function Va(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function Hk(t,e,n){let r=ei(e),o=yr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),a=new zn(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(i).setMeta(yr,{redo:n,historyState:a})}let Ha=!1,Gp=null;function ei(t){let e=t.plugins;if(Gp!=e){Ha=!1,Gp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ha=!0;break}}return Ha}const yr=new De("history"),Uk=new De("closeHistory");function zk(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ae({key:yr,state:{init(){return new zn(Bt.empty,Bt.empty,null,0,-1)},apply(e,n,r){return $k(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Xp:r=="historyRedo"?Qp:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Yp(t,e){return(n,r)=>{let o=yr.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=Hk(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Xp=Yp(!1,!0),Qp=Yp(!0,!0),jk=Be.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Xp(t,e),redo:()=>({state:t,dispatch:e})=>Qp(t,e)}},addProseMirrorPlugins(){return[zk(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()}}}),Wk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Kk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,qk=ot.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[pr({find:Wk,type:this.type})]},addPasteRules(){return[Hn({find:Kk,type:this.type})]}}),Jk=ot.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Gk=ot.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Yk=ot.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Xk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Qk="ελ1υ2бг1ел3дети4ею2католик6ом3мкд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",Yr=(t,e)=>{for(const n in e)t[n]=e[n];return t},Ua="numeric",za="ascii",ja="alpha",Vo="asciinumeric",Ho="alphanumeric",Wa="domain",Zp="emoji",Zk="scheme",eC="slashscheme",Ka="whitespace";function tC(t,e){return t in e||(e[t]=[]),e[t]}function br(t,e,n){e[Ua]&&(e[Vo]=!0,e[Ho]=!0),e[za]&&(e[Vo]=!0,e[ja]=!0),e[Vo]&&(e[Ho]=!0),e[ja]&&(e[Ho]=!0),e[Ho]&&(e[Wa]=!0),e[Zp]&&(e[Wa]=!0);for(const r in e){const o=tC(r,n);o.indexOf(t)<0&&o.push(t)}}function nC(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function lt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}lt.groups={},lt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||lt.groups;let o;return e&&e.j?o=e:(o=new lt(e),n&&r&&br(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(t[i]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||lt.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let i,l=o.go(t);if(l?(i=new lt,Yr(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new lt,s){if(r)if(i.t&&typeof i.t=="string"){const a=Yr(nC(i.t,r),n);br(s,a,r)}else n&&br(s,n,r);i.t=s}return o.j[t]=i,i}};const Y=(t,e,n,r,o)=>t.ta(e,n,r,o),we=(t,e,n,r,o)=>t.tr(e,n,r,o),eh=(t,e,n,r,o)=>t.ts(e,n,r,o),I=(t,e,n,r,o)=>t.tt(e,n,r,o),bn="WORD",qa="UWORD",th="ASCIINUMERICAL",nh="ALPHANUMERICAL",Uo="LOCALHOST",Ja="TLD",Ga="UTLD",ti="SCHEME",Xr="SLASH_SCHEME",Ya="NUM",Xa="WS",Qa="NL",zo="OPENBRACE",jo="CLOSEBRACE",ni="OPENBRACKET",ri="CLOSEBRACKET",oi="OPENPAREN",si="CLOSEPAREN",ii="OPENANGLEBRACKET",li="CLOSEANGLEBRACKET",ai="FULLWIDTHLEFTPAREN",ci="FULLWIDTHRIGHTPAREN",ui="LEFTCORNERBRACKET",di="RIGHTCORNERBRACKET",fi="LEFTWHITECORNERBRACKET",pi="RIGHTWHITECORNERBRACKET",hi="FULLWIDTHLESSTHAN",mi="FULLWIDTHGREATERTHAN",gi="AMPERSAND",yi="APOSTROPHE",bi="ASTERISK",jn="AT",Ei="BACKSLASH",wi="BACKTICK",ki="CARET",Wn="COLON",Za="COMMA",Ci="DOLLAR",Qt="DOT",Si="EQUALS",ec="EXCLAMATION",Nt="HYPHEN",Wo="PERCENT",vi="PIPE",xi="PLUS",Ti="POUND",Ko="QUERY",tc="QUOTE",rh="FULLWIDTHMIDDLEDOT",nc="SEMI",Zt="SLASH",qo="TILDE",Oi="UNDERSCORE",oh="EMOJI",Ni="SYM";var sh=Object.freeze({__proto__:null,ALPHANUMERICAL:nh,AMPERSAND:gi,APOSTROPHE:yi,ASCIINUMERICAL:th,ASTERISK:bi,AT:jn,BACKSLASH:Ei,BACKTICK:wi,CARET:ki,CLOSEANGLEBRACKET:li,CLOSEBRACE:jo,CLOSEBRACKET:ri,CLOSEPAREN:si,COLON:Wn,COMMA:Za,DOLLAR:Ci,DOT:Qt,EMOJI:oh,EQUALS:Si,EXCLAMATION:ec,FULLWIDTHGREATERTHAN:mi,FULLWIDTHLEFTPAREN:ai,FULLWIDTHLESSTHAN:hi,FULLWIDTHMIDDLEDOT:rh,FULLWIDTHRIGHTPAREN:ci,HYPHEN:Nt,LEFTCORNERBRACKET:ui,LEFTWHITECORNERBRACKET:fi,LOCALHOST:Uo,NL:Qa,NUM:Ya,OPENANGLEBRACKET:ii,OPENBRACE:zo,OPENBRACKET:ni,OPENPAREN:oi,PERCENT:Wo,PIPE:vi,PLUS:xi,POUND:Ti,QUERY:Ko,QUOTE:tc,RIGHTCORNERBRACKET:di,RIGHTWHITECORNERBRACKET:pi,SCHEME:ti,SEMI:nc,SLASH:Zt,SLASH_SCHEME:Xr,SYM:Ni,TILDE:qo,TLD:Ja,UNDERSCORE:Oi,UTLD:Ga,UWORD:qa,WORD:bn,WS:Xa});const En=/[a-z]/,Jo=new RegExp("\\p{L}","u"),rc=new RegExp("\\p{Emoji}","u"),wn=/\d/,oc=/\s/,ih="\r",sc=`
|
|
114
|
+
`,rC="️",oC="",ic="";let Ai=null,_i=null;function sC(t=[]){const e={};lt.groups=e;const n=new lt;Ai==null&&(Ai=ah(Xk)),_i==null&&(_i=ah(Qk)),I(n,"'",yi),I(n,"{",zo),I(n,"}",jo),I(n,"[",ni),I(n,"]",ri),I(n,"(",oi),I(n,")",si),I(n,"<",ii),I(n,">",li),I(n,"(",ai),I(n,")",ci),I(n,"「",ui),I(n,"」",di),I(n,"『",fi),I(n,"』",pi),I(n,"<",hi),I(n,">",mi),I(n,"&",gi),I(n,"*",bi),I(n,"@",jn),I(n,"`",wi),I(n,"^",ki),I(n,":",Wn),I(n,",",Za),I(n,"$",Ci),I(n,".",Qt),I(n,"=",Si),I(n,"!",ec),I(n,"-",Nt),I(n,"%",Wo),I(n,"|",vi),I(n,"+",xi),I(n,"#",Ti),I(n,"?",Ko),I(n,'"',tc),I(n,"/",Zt),I(n,";",nc),I(n,"~",qo),I(n,"_",Oi),I(n,"\\",Ei),I(n,"・",rh);const r=we(n,wn,Ya,{[Ua]:!0});we(r,wn,r);const o=we(r,En,th,{[Vo]:!0}),s=we(r,Jo,nh,{[Ho]:!0}),i=we(n,En,bn,{[za]:!0});we(i,wn,o),we(i,En,i),we(o,wn,o),we(o,En,o);const l=we(n,Jo,qa,{[ja]:!0});we(l,En),we(l,wn,s),we(l,Jo,l),we(s,wn,s),we(s,En),we(s,Jo,s);const a=I(n,sc,Qa,{[Ka]:!0}),c=I(n,ih,Xa,{[Ka]:!0}),u=we(n,oc,Xa,{[Ka]:!0});I(n,ic,u),I(c,sc,a),I(c,ic,u),we(c,oc,u),I(u,ih),I(u,sc),we(u,oc,u),I(u,ic,u);const d=we(n,rc,oh,{[Zp]:!0});I(d,"#"),we(d,rc,d),I(d,rC,d);const f=I(d,oC);I(f,"#"),we(f,rc,d);const p=[[En,i],[wn,o]],h=[[En,null],[Jo,l],[wn,s]];for(let m=0;m<Ai.length;m++)Kn(n,Ai[m],Ja,bn,p);for(let m=0;m<_i.length;m++)Kn(n,_i[m],Ga,qa,h);br(Ja,{tld:!0,ascii:!0},e),br(Ga,{utld:!0,alpha:!0},e),Kn(n,"file",ti,bn,p),Kn(n,"mailto",ti,bn,p),Kn(n,"http",Xr,bn,p),Kn(n,"https",Xr,bn,p),Kn(n,"ftp",Xr,bn,p),Kn(n,"ftps",Xr,bn,p),br(ti,{scheme:!0,ascii:!0},e),br(Xr,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){const y=t[m][0],w=t[m][1]?{[Zk]:!0}:{[eC]:!0};y.indexOf("-")>=0?w[Wa]=!0:En.test(y)?wn.test(y)?w[Vo]=!0:w[za]=!0:w[Ua]=!0,eh(n,y,y,w)}return eh(n,"localhost",Uo,{ascii:!0}),n.jd=new lt(Ni),{start:n,tokens:Yr({groups:e},sh)}}function lh(t,e){const n=iC(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let s=0,i=0;for(;i<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;i<r&&(a=l.go(n[i]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[i].length,f++),c+=n[i].length,s+=n[i].length,i++;s-=d,i-=f,c-=d,o.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return o}function iC(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,i=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(i),r+=i.length}return e}function Kn(t,e,n,r,o){let s;const i=e.length;for(let l=0;l<i-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new lt(r),s.jr=o.slice(),t.j[a]=s),t=s}return s=new lt(n),s.jr=o.slice(),t.j[e[i-1]]=s,s}function ah(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let i=parseInt(t.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Go={defaultProtocol:"http",events:null,format:ch,formatHref:ch,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function lc(t,e=null){let n=Yr({},Go);t&&(n=Yr(n,t instanceof lc?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}lc.prototype={o:Go,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Go[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function ch(t){return t}function uh(t,e){this.t="token",this.v=t,this.tk=e}uh.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Go.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),s=this.toFormattedString(t),i={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=r,l&&(i.class=l),a&&(i.target=a),c&&(i.rel=c),u&&Yr(i,u),{tagName:o,attributes:i,content:s,eventListeners:d}}};function Mi(t,e){class n extends uh{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const dh=Mi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fh=Mi("text"),lC=Mi("nl"),Ri=Mi("url",{isLink:!0,toHref(t=Go.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Uo&&t[1].t===Wn}}),At=t=>new lt(t);function aC({groups:t}){const e=t.domain.concat([gi,bi,jn,Ei,wi,ki,Ci,Si,Nt,Ya,Wo,vi,xi,Ti,Zt,Ni,qo,Oi]),n=[yi,Wn,Za,Qt,ec,Wo,Ko,tc,nc,ii,li,zo,jo,ri,ni,oi,si,ai,ci,ui,di,fi,pi,hi,mi],r=[gi,yi,bi,Ei,wi,ki,Ci,Si,Nt,zo,jo,Wo,vi,xi,Ti,Ko,Zt,Ni,qo,Oi],o=At(),s=I(o,qo);Y(s,r,s),Y(s,t.domain,s);const i=At(),l=At(),a=At();Y(o,t.domain,i),Y(o,t.scheme,l),Y(o,t.slashscheme,a),Y(i,r,s),Y(i,t.domain,i);const c=I(i,jn);I(s,jn,c),I(l,jn,c),I(a,jn,c);const u=I(s,Qt);Y(u,r,s),Y(u,t.domain,s);const d=At();Y(c,t.domain,d),Y(d,t.domain,d);const f=I(d,Qt);Y(f,t.domain,d);const p=At(dh);Y(f,t.tld,p),Y(f,t.utld,p),I(c,Uo,p);const h=I(d,Nt);I(h,Nt,h),Y(h,t.domain,d),Y(p,t.domain,d),I(p,Qt,f),I(p,Nt,h);const m=I(p,Wn);Y(m,t.numeric,dh);const y=I(i,Nt),b=I(i,Qt);I(y,Nt,y),Y(y,t.domain,i),Y(b,r,s),Y(b,t.domain,i);const w=At(Ri);Y(b,t.tld,w),Y(b,t.utld,w),Y(w,t.domain,i),Y(w,r,s),I(w,Qt,b),I(w,Nt,y),I(w,jn,c);const k=I(w,Wn),E=At(Ri);Y(k,t.numeric,E);const x=At(Ri),v=At();Y(x,e,x),Y(x,n,v),Y(v,e,x),Y(v,n,v),I(w,Zt,x),I(E,Zt,x);const T=I(l,Wn),_=I(a,Wn),P=I(_,Zt),V=I(P,Zt);Y(l,t.domain,i),I(l,Qt,b),I(l,Nt,y),Y(a,t.domain,i),I(a,Qt,b),I(a,Nt,y),Y(T,t.domain,x),I(T,Zt,x),I(T,Ko,x),Y(V,t.domain,x),Y(V,e,x),I(V,Zt,x);const Z=[[zo,jo],[ni,ri],[oi,si],[ii,li],[ai,ci],[ui,di],[fi,pi],[hi,mi]];for(let q=0;q<Z.length;q++){const[re,Te]=Z[q],Se=I(x,re);I(v,re,Se),I(Se,Te,x);const de=At(Ri);Y(Se,e,de);const me=At();Y(Se,n),Y(de,e,de),Y(de,n,me),Y(me,e,de),Y(me,n,me),I(de,Te,x),I(me,Te,x)}return I(o,Uo,w),I(o,Qa,lC),{start:o,tokens:sh}}function cC(t,e,n){let r=n.length,o=0,s=[],i=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)i.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(i.push(n[o]),o++);else{i.length>0&&(s.push(ac(fh,e,i)),i=[]),o-=f,u-=f;const p=d.t,h=n.slice(o-u,o);s.push(ac(p,e,h))}}return i.length>0&&s.push(ac(fh,e,i)),s}function ac(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const uC=typeof console<"u"&&console&&console.warn||(()=>{}),dC="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ye={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fC(){return lt.groups={},ye.scanner=null,ye.parser=null,ye.tokenQueue=[],ye.pluginQueue=[],ye.customSchemes=[],ye.initialized=!1,ye}function ph(t,e=!1){if(ye.initialized&&uC(`linkifyjs: already initialized - will not register custom scheme "${t}" ${dC}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
115
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
116
|
+
2. Cannot start or end with "-"
|
|
117
|
+
3. "-" cannot repeat`);ye.customSchemes.push([t,e])}function pC(){ye.scanner=sC(ye.customSchemes);for(let t=0;t<ye.tokenQueue.length;t++)ye.tokenQueue[t][1]({scanner:ye.scanner});ye.parser=aC(ye.scanner.tokens);for(let t=0;t<ye.pluginQueue.length;t++)ye.pluginQueue[t][1]({scanner:ye.scanner,parser:ye.parser});return ye.initialized=!0,ye}function cc(t){return ye.initialized||pC(),cC(ye.parser.start,t,lh(ye.scanner.start,t))}cc.scan=lh;function hh(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new lc(n),o=cc(t),s=[];for(let i=0;i<o.length;i++){const l=o[i];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function hC(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function mC(t){return new Ae({key:new De("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,l=J1(n.doc,[...e]);if(eE(l).forEach(({newRange:c})=>{const u=Y1(r.doc,c,p=>p.isTextblock);let d,f;if(u.length>1?(d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")),d&&f){const p=f.split(" ").filter(b=>b!=="");if(p.length<=0)return!1;const h=p[p.length-1],m=d.pos+f.lastIndexOf(h);if(!h)return!1;const y=cc(h).map(b=>b.toObject(t.defaultProtocol));if(!hC(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{ya(b.from,b.to,r.doc).some(w=>w.mark.type===t.type)||i.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!i.steps.length)return i}})}function gC(t){return new Ae({key:new De("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let i=r.target;const l=[];for(;i.nodeName!=="DIV";)l.push(i),i=i.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;const a=Yf(e.state,t.type.name),c=r.target,u=(o=c?.href)!==null&&o!==void 0?o:a.href,d=(s=c?.target)!==null&&s!==void 0?s:a.target;return c&&u?(window.open(u,d),!0):!1}}})}function yC(t){return new Ae({key:new De("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:s}=o,{empty:i}=s;if(i)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=hh(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(t.editor.commands.setMark(t.type,{href:a.href}),!0)}}})}const bC=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Er(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(bC,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}const EC=ot.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(t=>{if(typeof t=="string"){ph(t);return}ph(t.scheme,t.optionalSlashes)})},onDestroy(){fC()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Er(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Er(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Er(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",pe(this.options.HTMLAttributes,t),0]:["a",pe(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Er(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Er(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Hn({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=hh(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!Er(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(mC({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Er(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(gC({type:this.type})),this.options.linkOnPaste&&t.push(yC({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),wC=ot.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=ma(t,this.type);return Object.entries(n).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),kC=Be.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),CC=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,SC=Fe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",pe(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[SE({find:CC,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var uc,dc;if(typeof WeakMap<"u"){let t=new WeakMap;uc=e=>t.get(e),dc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;uc=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},dc=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var ke=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,i=o+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;i<this.height&&this.map[e+this.width*l]==n;l++)i++;return{left:r,top:o,right:s,bottom:i}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:s,bottom:i}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:i==this.height)?null:this.map[r+this.width*(n<0?s-1:i)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:s}=this.findCell(t),{left:i,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,i),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const s=r*this.width+o,i=this.map[s];n[i]||(n[i]=!0,!(o==t.left&&o&&this.map[s-1]==i||r==t.top&&r&&this.map[s-this.width]==i)&&e.push(i))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==t){let i=e+t*this.width;const l=(t+1)*this.width;for(;i<l&&this.map[i]<o;)i++;return i==l?s-1:this.map[i]}o=s}}static get(t){return uc(t)||dc(t,vC(t))}};function vC(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=xC(t),n=t.childCount,r=[];let o=0,s=null;const i=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let h=0;;h++){for(;o<r.length&&r[o]!=0;)o++;if(h==d.childCount)break;const m=d.child(h),{colspan:y,rowspan:b,colwidth:w}=m.attrs;for(let k=0;k<b;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-k});break}const E=o+k*e;for(let x=0;x<y;x++){r[E+x]==0?r[E+x]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:y-x});const v=w&&w[x];if(v){const T=(E+x)%e*2,_=i[T];_==null||_!=v&&i[T+1]==1?(i[T]=v,i[T+1]=1):_==v&&i[T+1]++}}}o+=y,u+=m.nodeSize}const f=(c+1)*e;let p=0;for(;o<f;)r[o++]==0&&p++;p&&(s||(s=[])).push({type:"missing",row:c,n:p}),u++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new ke(e,n,r,s);let a=!1;for(let c=0;!a&&c<i.length;c+=2)i[c]!=null&&i[c+1]<n&&(a=!0);return a&&TC(l,i,t),l}function xC(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let s=0;if(n)for(let i=0;i<r;i++){const l=t.child(i);for(let a=0;a<l.childCount;a++){const c=l.child(a);i+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let i=0;i<o.childCount;i++){const l=o.child(i);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function TC(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const s=t.map[o];if(r[s])continue;r[s]=!0;const i=n.nodeAt(s);if(!i)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=i.attrs;for(let c=0;c<a.colspan;c++){const u=(o+c)%t.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=OC(a)))[c]=d)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function OC(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function We(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var qn=new De("selectingCells");function Qr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function NC(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Ft(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Li(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Qr(e.$head)||AC(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function AC(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function fc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function _C(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function pc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function mh(t,e,n){const r=t.node(-1),o=ke.get(r),s=t.start(-1),i=o.nextCell(t.pos-s,e,n);return i==null?null:t.node(0).resolve(s+i)}function wr(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function gh(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function MC(t,e,n){const r=We(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var he=class Tn extends z{constructor(e,n=e){const r=e.node(-1),o=ke.get(r),s=e.start(-1),i=o.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=o.cellsInRect(i).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new ed(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(fc(r)&&fc(o)&&pc(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Tn.rowSelection(r,o):s&&this.isColSelection()?Tn.colSelection(r,o):new Tn(r,o)}return j.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=ke.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},i=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let u=a*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(s[f])continue;s[f]=!0;const p=n.findCell(f);let h=e.nodeAt(f);if(!h)throw RangeError(`No cell with offset ${f} found`);const m=o.left-p.left,y=p.right-o.right;if(m>0||y>0){let b=h.attrs;if(m>0&&(b=wr(b,0,m)),y>0&&(b=wr(b,b.colspan-y,y)),p.left<o.left){if(h=h.type.createAndFill(b),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else h=h.type.create(b,h.content)}if(p.top<o.top||p.bottom>o.bottom){const b={...h.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?h=h.type.createAndFill(b):h=h.type.create(b,h.content)}c.push(h)}i.push(e.child(a).copy(M.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:i;return new D(M.from(l),1,1)}replace(e,n=D.empty){const r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){const{$from:l,$to:a}=o[i],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),i?D.empty:n)}const s=z.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new D(M.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=ke.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let i=0;i<s.length;i++)e(n.nodeAt(s[i]),o+s[i])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=ke.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.top<=l.top?(i.top>0&&(e=a.resolve(s+o.map[i.left])),l.bottom<o.height&&(n=a.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+o.map[l.left])),i.bottom<o.height&&(e=a.resolve(s+o.map[o.width*(o.height-1)+i.right-1]))),new Tn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ke.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const i=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==n.width}eq(e){return e instanceof Tn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=ke.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.left<=l.left?(i.left>0&&(e=a.resolve(s+o.map[i.top*o.width])),l.right<o.width&&(n=a.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+o.map[l.top*o.width])),i.right<o.width&&(e=a.resolve(s+o.map[o.width*(i.top+1)-1]))),new Tn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Tn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Tn(e.resolve(n),e.resolve(r))}getBookmark(){return new RC(this.$anchorCell.pos,this.$headCell.pos)}};he.prototype.visible=!1,z.jsonID("cell",he);var RC=class Fg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fg(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&pc(n,r)?new he(n,r):z.near(r,1)}};function LC(t){if(!(t.selection instanceof he))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Qe.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Ee.create(t.doc,e)}function IC({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function DC({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function PC(t,e,n){const r=(e||t).selection,o=(e||t).doc;let s,i;if(r instanceof U&&(i=r.node.type.spec.tableRole)){if(i=="cell"||i=="header_cell")s=he.create(o,r.from);else if(i=="row"){const l=o.resolve(r.from+1);s=he.rowSelection(l,l)}else if(!n){const l=ke.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=he.create(o,a+1,c)}}else r instanceof j&&IC(r)?s=j.create(o,r.from):r instanceof j&&DC(r)&&(s=j.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var BC=new De("fix-tables");function yh(t,e,n,r){const o=t.childCount,s=e.childCount;e:for(let i=0,l=0;i<s;i++){const a=e.child(i);for(let c=l,u=Math.min(o,i+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?yh(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function bh(t,e){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=FC(t,o,s,n))};return e?e.doc!=t.doc&&yh(e.doc,t.doc,0,r):t.doc.descendants(r),n}function FC(t,e,n,r){const o=ke.get(e);if(!o.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<o.height;a++)s.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)s[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,wr(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let i,l;for(let a=0;a<s.length;a++)s[a]&&(i==null&&(i=a),l=a);for(let a=0,c=n+1;a<o.height;a++){const u=e.child(a),d=c+u.nodeSize,f=s[a];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const h=[];for(let y=0;y<f;y++){const b=We(t.schema)[p].createAndFill();b&&h.push(b)}const m=(a==0||i==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),h)}c=d}return r.setMeta(BC,{fixTables:!0})}function en(t){const e=t.selection,n=Li(t),r=n.node(-1),o=n.start(-1),s=ke.get(r);return{...e instanceof he?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function Eh(t,{map:e,tableStart:n,table:r},o){let s=o>0?-1:0;MC(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let i=0;i<e.height;i++){const l=i*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,gh(c.attrs,o-e.colCount(a))),i+=c.attrs.rowspan-1}else{const a=s==null?We(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(i,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function $C(t,e){if(!Ft(t))return!1;if(e){const n=en(t);e(Eh(t.tr,n,n.left))}return!0}function VC(t,e){if(!Ft(t))return!1;if(e){const n=en(t);e(Eh(t.tr,n,n.right))}return!0}function HC(t,{map:e,table:n,tableStart:r},o){const s=t.mapping.maps.length;for(let i=0;i<e.height;){const l=i*e.width+o,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(s).map(r+a),null,wr(u,o-e.colCount(a)));else{const d=t.mapping.slice(s).map(r+a);t.delete(d,d+c.nodeSize)}i+=u.rowspan}}function UC(t,e){if(!Ft(t))return!1;if(e){const n=en(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;HC(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=ke.get(s)}e(r)}return!0}function zC(t,e,n){var r;const o=We(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function wh(t,{map:e,tableStart:n,table:r},o){var s;let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const l=[];let a=o>0?-1:0;zC(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?We(r.type.schema).cell:(s=r.nodeAt(e.map[u+a*e.width]))==null?void 0:s.type,f=d?.createAndFill();f&&l.push(f)}return t.insert(i,We(r.type.schema).row.create(null,l)),t}function jC(t,e){if(!Ft(t))return!1;if(e){const n=en(t);e(wh(t.tr,n,n.top))}return!0}function WC(t,e){if(!Ft(t))return!1;if(e){const n=en(t);e(wh(t.tr,n,n.bottom))}return!0}function KC(t,{map:e,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const i=s+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(s+r,i+r);const a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+m),h),c+=p.colspan-1}}}}function qC(t,e){if(!Ft(t))return!1;if(e){const n=en(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;KC(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=ke.get(n.table)}e(r)}return!0}function kh(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function JC({width:t,height:e,map:n},r){let o=r.top*t+r.left,s=o,i=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[i]==n[i+t])return!0;o++,i++}return!1}function Ch(t,e){const n=t.selection;if(!(n instanceof he)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=en(t),{map:o}=r;if(JC(o,r))return!1;if(e){const s=t.tr,i={};let l=M.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],p=r.table.nodeAt(f);if(!(i[f]||!p))if(i[f]=!0,a==null)a=f,c=p;else{kh(p)||(l=l.append(p.content));const h=s.mapping.map(f+r.tableStart);s.delete(h,h+p.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...gh(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=kh(c)?a+1:u;s.replaceWith(d+r.tableStart,u+r.tableStart,l)}s.setSelection(new he(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function Sh(t,e){const n=We(t.schema);return GC(({node:r})=>n[r.type.spec.tableRole])(t,e)}function GC(t){return(e,n)=>{var r;const o=e.selection;let s,i;if(o instanceof he){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{if(s=NC(o.$from),!s)return!1;i=(r=Qr(o.$from))==null?void 0:r.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=en(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let f;for(let p=u.top;p<u.bottom;p++){let h=u.map.positionAt(p,u.left,u.table);p==u.top&&(h+=s.nodeSize);for(let m=u.left,y=0;m<u.right;m++,y++)m==u.left&&p==u.top||d.insert(f=d.mapping.map(h+u.tableStart,1),t({node:s,row:p,col:m}).createAndFill(a[y]))}d.setNodeMarkup(i,t({node:s,row:u.top,col:u.left}),a[0]),o instanceof he&&d.setSelection(new he(d.doc.resolve(o.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function YC(t,e){return function(n,r){if(!Ft(n))return!1;const o=Li(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof he?n.selection.forEachCell((i,l)=>{i.attrs[t]!==e&&s.setNodeMarkup(l,null,{...i.attrs,[t]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function XC(t){return function(e,n){if(!Ft(e))return!1;if(n){const r=We(e.schema),o=en(e),s=e.tr,i=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=i.map(a=>o.table.nodeAt(a));for(let a=0;a<i.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(o.tableStart+i[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<i.length;a++)s.setNodeMarkup(o.tableStart+i[a],r.header_cell,l[a].attrs);n(s)}return!0}}function vh(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function Yo(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?XC(t):function(n,r){if(!Ft(n))return!1;if(r){const o=We(n.schema),s=en(n),i=n.tr,l=vh("row",s,o),a=vh("column",s,o),u=(t==="column"?l:t==="row"?a:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:s.map.height}:t=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,f=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(d).forEach(p=>{const h=p+s.tableStart,m=i.doc.nodeAt(h);m&&i.setNodeMarkup(h,f,m.attrs)}),r(i)}return!0}}Yo("row",{useDeprecatedLogic:!0}),Yo("column",{useDeprecatedLogic:!0});var QC=Yo("cell",{useDeprecatedLogic:!0});function ZC(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const s=t.node(-1).child(r),i=s.lastChild;if(i)return o-1-i.nodeSize;o-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function xh(t){return function(e,n){if(!Ft(e))return!1;const r=ZC(Li(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(j.between(o,_C(o))).scrollIntoView())}return!0}}function eS(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ii(t,e){const n=t.selection;if(!(n instanceof he))return!1;if(e){const r=t.tr,o=We(t.schema).cell.createAndFill().content;n.forEachCell((s,i)=>{s.content.eq(o)||r.replace(r.mapping.map(i+1),r.mapping.map(i+s.nodeSize-1),new D(o,0,0))}),r.docChanged&&e(r)}return!0}function tS(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,i=o.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=hc(We(i).row,new D(c,u,d)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?hc(We(i).row,new D(e,n,r)).content:e);else return null;return nS(i,l)}function nS(t,e){const n=[];for(let o=0;o<e.length;o++){const s=e[o];for(let i=s.childCount-1;i>=0;i--){const{rowspan:l,colspan:a}=s.child(i).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(M.empty),n[o]<r){const s=We(t).cell.createAndFill(),i=[];for(let l=n[o];l<r;l++)i.push(s);e[o]=e[o].append(M.from(i))}return{height:e.length,width:r,rows:e}}function hc(t,e){const n=t.createAndFill();return new Sl(n).replace(0,n.content.size,e).doc}function rS({width:t,height:e,rows:n},r,o){if(t!=r){const s=[],i=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=s[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(wr(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)s[l+p]=(s[l+p]||0)+f.attrs.colspan}i.push(M.from(c))}n=i,t=r}if(e!=o){const s=[];for(let i=0,l=0;i<o;i++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);i+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}s.push(M.from(a))}n=s,e=o}return{width:t,height:e,rows:n}}function oS(t,e,n,r,o,s,i){const l=t.doc.type.schema,a=We(l);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const p=n.child(d);f+=p.nodeSize;const h=[];let m;p.lastChild==null||p.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)h.push(m);t.insert(t.mapping.slice(i).map(f-1+r),h)}if(s>e.height){const d=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,o);h++){const y=h>=e.width?!1:n.nodeAt(e.map[m+h]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,M.from(d)),p=[];for(let h=e.height;h<s;h++)p.push(f);t.insert(t.mapping.slice(i).map(r+n.nodeSize-2),p)}return!!(c||u)}function Th(t,e,n,r,o,s,i,l){if(i==0||i==e.height)return!1;let a=!1;for(let c=o;c<s;c++){const u=i*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=n.nodeAt(d),{top:p,left:h}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:i-p}),t.insert(t.mapping.slice(l).map(e.positionAt(i,h,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-i})),c+=f.attrs.colspan-1}}return a}function Oh(t,e,n,r,o,s,i,l){if(i==0||i==e.width)return!1;let a=!1;for(let c=o;c<s;c++){const u=c*e.width+i,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=n.nodeAt(d),p=e.colCount(d),h=t.mapping.slice(l).map(d+r);t.setNodeMarkup(h,null,wr(f.attrs,i-p,f.attrs.colspan-(i-p))),t.insert(h+f.nodeSize,f.type.createAndFill(wr(f.attrs,0,i-p))),c+=f.attrs.rowspan-1}}return a}function Nh(t,e,n,r,o){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let i=ke.get(s);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=t.tr;let f=0;function p(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");i=ke.get(s),f=d.mapping.maps.length}oS(d,i,s,n,c,u,f)&&p(),Th(d,i,s,n,a,c,l,f)&&p(),Th(d,i,s,n,a,c,u,f)&&p(),Oh(d,i,s,n,l,u,a,f)&&p(),Oh(d,i,s,n,l,u,c,f)&&p();for(let h=l;h<u;h++){const m=i.positionAt(h,a,s),y=i.positionAt(h,c,s);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(y+n),new D(o.rows[h-l],0,0))}p(),d.setSelection(new he(d.doc.resolve(n+i.positionAt(l,a,s)),d.doc.resolve(n+i.positionAt(u-1,c-1,s)))),e(d)}var sS=ea({ArrowLeft:Pi("horiz",-1),ArrowRight:Pi("horiz",1),ArrowUp:Pi("vert",-1),ArrowDown:Pi("vert",1),"Shift-ArrowLeft":Bi("horiz",-1),"Shift-ArrowRight":Bi("horiz",1),"Shift-ArrowUp":Bi("vert",-1),"Shift-ArrowDown":Bi("vert",1),Backspace:Ii,"Mod-Backspace":Ii,Delete:Ii,"Mod-Delete":Ii});function Di(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Pi(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof he)return Di(n,r,z.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const i=Ah(o,t,e);if(i==null)return!1;if(t=="horiz")return Di(n,r,z.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(i),a=mh(l,t,e);let c;return a?c=z.near(a,1):e<0?c=z.near(n.doc.resolve(l.before(-1)),-1):c=z.near(n.doc.resolve(l.after(-1)),1),Di(n,r,c)}}}function Bi(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let i;if(s instanceof he)i=s;else{const a=Ah(o,t,e);if(a==null)return!1;i=new he(n.doc.resolve(a))}const l=mh(i.$headCell,t,e);return l?Di(n,r,new he(i.$anchorCell,l)):!1}}function iS(t,e){const n=t.state.doc,r=Qr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new he(r))),!0):!1}function lS(t,e,n){if(!Ft(t.state))return!1;let r=tS(n);const o=t.state.selection;if(o instanceof he){r||(r={width:1,height:1,rows:[M.from(hc(We(t.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),l=ke.get(s).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=rS(r,l.right-l.left,l.bottom-l.top),Nh(t.state,t.dispatch,i,l,r),!0}else if(r){const s=Li(t.state),i=s.start(-1);return Nh(t.state,t.dispatch,i,ke.get(s.node(-1)).findCell(s.pos-i),r),!0}else return!1}function aS(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=_h(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof he)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Qr(t.state.selection.$anchor))!=null&&((n=mc(t,e))==null?void 0:n.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(a,c){let u=mc(t,c);const d=qn.getState(t.state)==null;if(!u||!pc(a,u))if(d)u=a;else return;const f=new he(a,u);if(d||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);d&&p.setMeta(qn,a.pos),t.dispatch(p)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",l),qn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(qn,-1))}function l(a){const c=a,u=qn.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(_h(t,c.target)!=r&&(d=mc(t,e),!d))return i();d&&s(d,c)}t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",l)}function Ah(t,e,n){if(!(t.state.selection instanceof j))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function _h(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function mc(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Qr(t.state.doc.resolve(n.pos)):null}var cS=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),gc(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,gc(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function gc(t,e,n,r,o,s){var i;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:h}=u.child(d).attrs;for(let m=0;m<p;m++,f++){const y=o==f?s:h&&h[m],b=y?y+"px":"";if(l+=y||r,y||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=b,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(i=c.parentNode)==null||i.removeChild(c),c=d}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var yt=new De("tableColumnResizing");function uS({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=cS,lastColumnResizable:o=!0}={}){const s=new Ae({key:yt,state:{init(i,l){var a,c;const u=(c=(a=s.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=We(l.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new dS(-1,!1)},apply(i,l){return l.apply(i)}},props:{attributes:i=>{const l=yt.getState(i);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(i,l)=>{fS(i,l,t,o)},mouseleave:i=>{pS(i)},mousedown:(i,l)=>{hS(i,l,e,n)}},decorations:i=>{const l=yt.getState(i);if(l&&l.activeHandle>-1)return ES(i,l.activeHandle)},nodeViews:{}}});return s}var dS=class ul{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(yt);if(r&&r.setHandle!=null)return new ul(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ul(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return fc(e.doc.resolve(o))||(o=-1),new ul(o,n.dragging)}return n}};function fS(t,e,n,r){if(!t.editable)return;const o=yt.getState(t.state);if(o&&!o.dragging){const s=gS(e.target);let i=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?i=Mh(t,e,"left",n):a-e.clientX<=n&&(i=Mh(t,e,"right",n))}if(i!=o.activeHandle){if(!r&&i!==-1){const l=t.state.doc.resolve(i),a=l.node(-1),c=ke.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Lh(t,i)}}}function pS(t){if(!t.editable)return;const e=yt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Lh(t,-1)}function hS(t,e,n,r){var o;if(!t.editable)return!1;const s=(o=t.dom.ownerDocument.defaultView)!=null?o:window,i=yt.getState(t.state);if(!i||i.activeHandle==-1||i.dragging)return!1;const l=t.state.doc.nodeAt(i.activeHandle),a=mS(t,i.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(yt,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=yt.getState(t.state);f?.dragging&&(yS(t,f.activeHandle,Rh(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(yt,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=yt.getState(t.state);if(f&&f.dragging){const p=Rh(f.dragging,d,n);Ih(t,f.activeHandle,p,r)}}return Ih(t,i.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function mS(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],a--);return l/a}function gS(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Mh(t,e,n,r){const o=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:i}=s,l=Qr(t.state.doc.resolve(i));if(!l)return-1;if(n=="right")return l.pos;const a=ke.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Rh(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Lh(t,e){t.dispatch(t.state.tr.setMeta(yt,{setHandle:e}))}function yS(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),s=ke.get(o),i=r.start(-1),l=s.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:l-s.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const h=f.colwidth?f.colwidth.slice():bS(f.colspan);h[p]=n,a.setNodeMarkup(i+d,null,{...f,colwidth:h})}a.docChanged&&t.dispatch(a)}function Ih(t,e,n,r){const o=t.state.doc.resolve(e),s=o.node(-1),i=o.start(-1),l=ke.get(s).colCount(o.pos-i)+o.nodeAfter.attrs.colspan-1;let a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&gc(s,a.firstChild,a,r,l,n)}function bS(t){return Array(t).fill(0)}function ES(t,e){var n;const r=[],o=t.doc.resolve(e),s=o.node(-1);if(!s)return Ee.empty;const i=ke.get(s),l=o.start(-1),a=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=a+c*i.width;if((a==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){const d=i.map[u],f=l+d+s.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=yt.getState(t))!=null&&n.dragging&&r.push(Qe.node(l+d,l+d+s.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Qe.widget(f,p))}}return Ee.create(t.doc,r)}function wS({allowTableNodeSelection:t=!1}={}){return new Ae({key:qn,state:{init(){return null},apply(e,n){const r=e.getMeta(qn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:s}=e.mapping.mapResult(n);return o?null:s}},props:{decorations:LC,handleDOMEvents:{mousedown:aS},createSelectionBetween(e){return qn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:iS,handleKeyDown:sS,handlePaste:lS},appendTransaction(e,n,r){return PC(r,bh(r,n),t)}})}function yc(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Dh(t,e,n,r,o,s){var i;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:h}=u.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const y=o===f?s:h&&h[m],b=y?`${y}px`:"";if(l+=y||r,y||(a=!1),c){if(c.style.width!==b){const[w,k]=yc(r,y);c.style.setProperty(w,k)}c=c.nextSibling}else{const w=document.createElement("col"),[k,E]=yc(r,y);w.style.setProperty(k,E),e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(i=c.parentNode)===null||i===void 0||i.removeChild(c),c=d}a?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class kS{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Dh(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Dh(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function CS(t,e,n,r){let o=0,s=!0;const i=[],l=t.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:p,colwidth:h}=l.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const y=n===f?r:h&&h[m];o+=y||e,y||(s=!1);const[b,w]=yc(e,y);i.push(["col",{style:`${b}: ${w}`}])}}const a=s?`${o}px`:"",c=s?"":`${o}px`;return{colgroup:["colgroup",{},...i],tableWidth:a,tableMinWidth:c}}function Ph(t,e){return t.createAndFill()}function SS(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function vS(t,e,n,r,o){const s=SS(t),i=[],l=[];for(let c=0;c<n;c+=1){const u=Ph(s.cell);if(u&&l.push(u),r){const d=Ph(s.header_cell);d&&i.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(s.row.createChecked(null,r&&c===0?i:l));return s.table.createChecked(null,a)}function xS(t){return t instanceof he}const Fi=({editor:t})=>{const{selection:e}=t.state;if(!xS(e))return!1;let n=0;const r=Jf(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},TS=Fe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:kS,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=CS(t,this.options.cellMinWidth);return["table",pe(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const i=vS(s.schema,t,e,n);if(o){const l=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(j.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>$C(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>VC(t,e),deleteColumn:()=>({state:t,dispatch:e})=>UC(t,e),addRowBefore:()=>({state:t,dispatch:e})=>jC(t,e),addRowAfter:()=>({state:t,dispatch:e})=>WC(t,e),deleteRow:()=>({state:t,dispatch:e})=>qC(t,e),deleteTable:()=>({state:t,dispatch:e})=>eS(t,e),mergeCells:()=>({state:t,dispatch:e})=>Ch(t,e),splitCell:()=>({state:t,dispatch:e})=>Sh(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Yo("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Yo("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>QC(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Ch(t,e)?!0:Sh(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>YC(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>xh(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>xh(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&bh(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=he.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Fi,"Mod-Backspace":Fi,Delete:Fi,"Mod-Delete":Fi}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[uS({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],wS({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:G(F(t,"tableRole",e))}}}),OS=Be.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}}),NS=Fe.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",pe(this.options.HTMLAttributes,t),0]}}),AS=Fe.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",pe(this.options.HTMLAttributes,t),0]}}),_S=Fe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",pe(this.options.HTMLAttributes,t),0]}}),MS=Fe.create({name:"doc",topNode:!0,content:"block+"});class Ce extends z{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ce.valid(r)?new Ce(r):z.near(r)}content(){return D.empty}eq(e){return e instanceof Ce&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ce(e.resolve(n.pos))}getBookmark(){return new bc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!RS(e)||!LS(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ce.valid(e))return e;let o=e.pos,s=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){s=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;o+=n;let a=e.doc.resolve(o);if(Ce.valid(a))return a}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!U.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let l=e.doc.resolve(o);if(Ce.valid(l))return l}return null}}}Ce.prototype.visible=!1,Ce.findFrom=Ce.findGapCursorFrom,z.jsonID("gapcursor",Ce);class bc{constructor(e){this.pos=e}map(e){return new bc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ce.valid(n)?new Ce(n):z.near(n)}}function RS(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function LS(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function IS(){return new Ae({props:{decorations:FS,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ce.valid(n)?new Ce(n):null},handleClick:PS,handleKeyDown:DS,handleDOMEvents:{beforeinput:BS}}})}const DS=ea({ArrowLeft:$i("horiz",-1),ArrowRight:$i("horiz",1),ArrowUp:$i("vert",-1),ArrowDown:$i("vert",1)});function $i(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof j){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Ce.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new Ce(c))),!0):!1}}function PS(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ce.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&U.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ce(r))),!0)}function BS(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ce))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=M.empty;for(let i=r.length-1;i>=0;i--)o=M.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return s.setSelection(j.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function FS(t){if(!(t.selection instanceof Ce))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(t.doc,[Qe.widget(t.selection.head,e,{key:"gapcursor"})])}const $S=Be.create({name:"gapCursor",addProseMirrorPlugins(){return[IS()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=G(F(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),VS=Fe.create({name:"text",group:"inline"}),HS=Be.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Ke=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},US={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function zS(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleBlockquote&&s.toggleBlockquote(...i)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[g.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const jS=Ke(US,[["render",zS]]),WS={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function KS(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleBulletList&&s.toggleBulletList(...i)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const qS=Ke(WS,[["render",KS]]),JS={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function GS(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleOrderedList&&s.toggleOrderedList(...i)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const YS=Ke(JS,[["render",GS]]),XS={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function QS(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleCodeBlock&&s.toggleCodeBlock(...i)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const ZS=Ke(XS,[["render",QS]]),ev={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function tv(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleBold&&s.toggleBold(...i)),class:g.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bold")}])},e[1]||(e[1]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),g.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const nv=Ke(ev,[["render",tv]]),rv={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function ov(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...i)=>s.toggleItalic&&s.toggleItalic(...i)),class:g.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("italic")}])},e[1]||(e[1]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),g.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const sv=Ke(rv,[["render",ov]]),Xo=async(t,e,n,r=10)=>{if(!e||!n)return;await g.nextTick();const o=await n?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const i=await parseInt(e?.getBoundingClientRect()?.height),l=await parseInt(e?.getBoundingClientRect()?.width),a=await parseInt(n?.getBoundingClientRect()?.height),c=await parseInt(n?.getBoundingClientRect()?.width),u=await window.innerHeight,d=await window.innerWidth;let f=0,p=0;const h=s.bottom+r+a;switch(t){case"top":s.top-o.height-r<0?f=s.top-o.height+r+a+i:f=s.top-o.height-r,d>c+s.right+30?p=s.left-o.width/2+s.width/2:p=d-30-c;break;case"bottom":u>h?f=s.bottom+r:f=s.bottom-r-a-i,p=s.left-o.width/2+s.width/2;break;case"left":f=s.top-o.height/2+s.height/2,s.left-o.width-r>0?p=s.left-o.width-r:p=10;break;case"right":f=s.top-o.height/2+s.height/2,d-l>c?p=s.right+r:p=d-30-c;break;case"top-right":s.top-o.height-r<0?f=s.top-o.height+r+a+i:f=s.top-o.height-r,d-l>c?p=s.right+r:p=d-30-c;break;case"top-left":s.top-o.height-r<0?f=s.top-o.height+r+a+i:f=s.top-o.height-r,s.left-o.width-r>0?p=s.left-o.width-r:p=10;break;case"top-start":s.top-o.height-r<0?f=s.top-o.height+r+a+i:f=s.top-o.height-r,s.left>0?p=s.left:p=10;break;case"bottom-right":u>h?f=s.bottom+r:f=s.bottom-r-a-i,d-l>c?p=s.left:p=d-30-c;break;case"bottom-left":u>h?f=s.bottom+r:f=s.bottom-r-a-i,s.left>0?p=s.right-c:p=10;break;case"bottom-start":u>h?f=s.bottom+r:f=s.bottom-r-a-i,s.left>0?p=s.left:p=10;break}f+a>u?f=u-a-r:f<0&&(f=r),p+c>d?p=d-c-r:p<0&&(p=r),n instanceof HTMLElement&&(n.style.top=`${f}px`,n.style.left=`${p}px`,n.style.position="fixed")},iv={class:"text-center"},lv={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Qo={__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"#modal"}},emits:["isvisible"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=g.ref(!1),i=g.ref([]),l=g.ref(null),a=g.ref(null),c=g.ref(null);g.watch(s,k=>{k?(u(),window.addEventListener("resize",()=>Xo(r.placement,a.value,c.value)),Xo(r.placement,a.value,c.value)):window.removeEventListener("resize",()=>Xo(r.placement,a.value,c.value)),o("isvisible",k)}),g.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",w,!0),u()}),g.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),d()});const u=()=>{let k=l.value;for(;k&&k!==document.body;)(k.scrollHeight>k.clientHeight||k.scrollWidth>k.clientWidth)&&(k.addEventListener("scroll",m),i.value.push(k)),k=k.parentElement;document.body&&(document.body.addEventListener("scroll",m),i.value.push(document.body))},d=()=>{i.value.forEach(k=>{k.removeEventListener("scroll",m)}),i.value=[]},f=()=>{s.value=!0,Xo(r.placement,a.value,c.value)},p=()=>{s.value=!1},h=async()=>{await Xo(r.placement,a.value,c.value),s.value=!s.value},m=()=>{s.value=!1},y=k=>{if(!k){s.value=!1;return}a.value?.contains(k.target)||c.value?.contains(k.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},w=k=>{s.value&&c.value&&!c.value.contains(k.target)&&(s.value=!1)};return e({togglePopover:h}),(k,E)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"popover",ref:l,class:"vs-popover inline-block"},[g.createElementVNode("div",iv,[t.trigger==="click"?(g.openBlock(),g.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:a,onClick:h,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(k.$slots,"reference",{},()=>[E[0]||(E[0]=g.createElementVNode("button",null,"Click me!",-1))])],2)):g.createCommentVNode("",!0),t.trigger==="hover"?(g.openBlock(),g.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:a,onMouseover:f,onMouseleave:p,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(k.$slots,"reference",{},()=>[E[1]||(E[1]=g.createElementVNode("button",null,"Click me!",-1))])],34)):g.createCommentVNode("",!0),(g.openBlock(),g.createBlock(g.Teleport,{to:t.teleport},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",{class:g.normalizeClass(["vsTailwind vs-popover__content",t.placement]),ref_key:"contentPop",ref:c,style:g.normalizeStyle({width:t.width?t.width+"px":"fit-content",zIndex:10002})},[g.createElementVNode("div",lv,[g.renderSlot(k.$slots,"default",{},()=>[E[2]||(E[2]=g.createElementVNode("span",null,"Popover content",-1))])])],6),[[g.vShow,s.value]])]),_:3})],8,["to"]))])],512))}},av={class:"w-[30px] h-[30px] rounded-full hover:bg-gray-100 justify-center items-center relative flex"},cv={class:"flex w-[160px] flex-wrap gap-[4px]"},uv=["onClick"],dv={__name:"vs-editor-color",props:{editor:Object},setup(t){const e=t,n=g.ref("popover"),r=g.ref("#000000"),o=g.ref(["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]),s=i=>{e.editor&&(e.editor.chain().focus().setColor(i).run(),r.value=i,n.value&&n.value.togglePopover())};return(i,l)=>(g.openBlock(),g.createBlock(Qo,{ref_key:"popover",ref:n,placement:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",av,[l[0]||(l[0]=g.createElementVNode("svg",{class:"text-gray-500",height:"16",width:"16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"})],-1)),g.createElementVNode("span",{class:"absolute h-[2px] w-[40%] bottom-[10px] left-[9px]",style:g.normalizeStyle({backgroundColor:r.value})},null,4)])]),default:g.withCtx(()=>[g.createElementVNode("div",null,[g.createElementVNode("ul",cv,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,a=>(g.openBlock(),g.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:g.normalizeStyle({backgroundColor:a}),onClick:c=>s(a),key:a},null,12,uv))),128))])])]),_:1},512))}},fv={__name:"vs-editor-underline",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(g.openBlock(),g.createElementBlock("button",{onClick:n,class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[t.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},o[0]||(o[0]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),g.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)]),2))}},pv={__name:"vs-editor-strike",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(g.openBlock(),g.createElementBlock("button",{onClick:n,class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[t.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},o[0]||(o[0]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M5 12l14 0"}),g.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)]),2))}},hv={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:t}){t==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")},closeByClickBack(t,e){e&&t.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},mv={key:0,class:"vsTailwind ui-dialog__wrapper"},gv={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},yv={class:"font-medium text-gray-800 dark:text-[#ffffff]"},bv={class:"ui-dialog__content p-4"},Ev={key:0,class:"flex justify-end gap-x-2"};function wv(t,e,n,r,o,s){return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[n.visible?(g.openBlock(),g.createElementBlock("div",mv,[g.createElementVNode("div",{onMousedown:e[1]||(e[1]=i=>s.closeByClickBack(i,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[g.createElementVNode("div",gv,[g.createElementVNode("h3",yv,g.toDisplayString(n.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...i)=>s.handleClose&&s.handleClose(...i))},e[2]||(e[2]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",bv,[g.renderSlot(t.$slots,"default",{},void 0,!0)]),s.hasSlot?(g.openBlock(),g.createElementBlock("div",Ev,[g.renderSlot(t.$slots,"footer",{handleClose:s.handleClose},void 0,!0)])):g.createCommentVNode("",!0)],2)]),_:3})],32)])):g.createCommentVNode("",!0)])}const kv=Ke(hv,[["render",wv],["__scopeId","data-v-6d4e684d"]]),Cv={},Sv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function vv(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",Sv,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),g.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const xv=Ke(Cv,[["render",vv]]),Tv={},Ov={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function Nv(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",Ov,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),g.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const Av=Ke(Tv,[["render",Nv]]),_v={},Mv={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function Rv(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",Mv,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),g.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)]))}const Lv=Ke(_v,[["render",Rv]]),Iv=g.defineComponent({components:{IconClose:xv,IconSearch:Av,IconEmail:Lv},props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:t}=await this.$refs;await t.focus()}}}),Dv={class:"vs-form-text relative bg-white rounded-lg"},Pv={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},Bv=["disabled","type","placeholder"];function Fv(t,e,n,r,o,s){const i=g.resolveComponent("IconClose"),l=g.resolveComponent("IconSearch"),a=g.resolveComponent("IconEmail");return g.openBlock(),g.createElementBlock("div",Dv,[t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...c)=>t.clearInput&&t.clearInput(...c))},[g.createVNode(i,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),t.icon&&t.icon==="search"?(g.openBlock(),g.createElementBlock("div",{key:1,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",t.iconStylePosition])},[g.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):t.icon&&t.icon==="email"?(g.openBlock(),g.createElementBlock("div",Pv,[g.createVNode(a,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(g.openBlock(),g.createElementBlock("i",{key:3,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+t.icon,t.iconStylePosition]])},null,2)),t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...c)=>t.clearInput&&t.clearInput(...c))},[g.createVNode(i,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),g.withDirectives(g.createElementVNode("input",g.mergeProps({ref:"vsText",disabled:t.disabled,type:t.type,onInput:e[2]||(e[2]=(...c)=>t.handleInput&&t.handleInput(...c)),placeholder:t.placeholder,"onUpdate:modelValue":e[3]||(e[3]=c=>t.value=c)},t.style?.attrs||t.attrs||{},{onFocus:e[4]||(e[4]=(...c)=>t.handleFocus&&t.handleFocus(...c)),onBlur:e[5]||(e[5]=(...c)=>t.handleBlur&&t.handleBlur(...c)),class:[[t.inputStyle,t.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,Bv),[[g.vModelDynamic,t.value]])])}const Bh=Ke(Iv,[["render",Fv],["__scopeId","data-v-00f5150b"]]);/*!
|
|
118
|
+
* shared v11.1.7
|
|
119
|
+
* (c) 2025 kazuya kawaguchi
|
|
120
|
+
* Released under the MIT License.
|
|
121
|
+
*/const $t=typeof window<"u";let bt,kr;if(process.env.NODE_ENV!=="production"){const t=$t&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&(bt=e=>{t.mark(e)},kr=(e,n,r)=>{t.measure(e,n,r),t.clearMarks(n),t.clearMarks(r)})}const $v=/\{([0-9a-zA-Z]+)\}/g;function Vi(t,...e){return e.length===1&&te(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace($v,(n,r)=>e.hasOwnProperty(r)?e[r]:"")}const tn=(t,e=!1)=>e?Symbol.for(t):Symbol(t),Vv=(t,e,n)=>Hv({l:t,k:e,s:n}),Hv=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),_e=t=>typeof t=="number"&&isFinite(t),Uv=t=>Ec(t)==="[object Date]",Zr=t=>Ec(t)==="[object RegExp]",Hi=t=>X(t)&&Object.keys(t).length===0,Re=Object.assign,zv=Object.create,le=(t=null)=>zv(t);let Fh;const Cr=()=>Fh||(Fh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:le());function $h(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const jv=Object.prototype.hasOwnProperty;function Vt(t,e){return jv.call(t,e)}const be=Array.isArray,ue=t=>typeof t=="function",B=t=>typeof t=="string",ne=t=>typeof t=="boolean",te=t=>t!==null&&typeof t=="object",Wv=t=>te(t)&&ue(t.then)&&ue(t.catch),Vh=Object.prototype.toString,Ec=t=>Vh.call(t),X=t=>Ec(t)==="[object Object]",Kv=t=>t==null?"":be(t)||X(t)&&t.toString===Vh?JSON.stringify(t,null,2):String(t);function wc(t,e=""){return t.reduce((n,r,o)=>o===0?n+r:n+e+r,"")}const Hh=2;function qv(t,e=0,n=t.length){const r=t.split(/\r?\n/);let o=0;const s=[];for(let i=0;i<r.length;i++)if(o+=r[i].length+1,o>=e){for(let l=i-Hh;l<=i+Hh||n>o;l++){if(l<0||l>=r.length)continue;const a=l+1;s.push(`${a}${" ".repeat(3-String(a).length)}| ${r[l]}`);const c=r[l].length;if(l===i){const u=e-(o-c)+1,d=Math.max(1,n>o?c-u:n-e);s.push(" | "+" ".repeat(u)+"^".repeat(d))}else if(l>i){if(n>o){const u=Math.max(Math.min(n-o,c),1);s.push(" | "+"^".repeat(u))}o+=c+1}}break}return s.join(`
|
|
122
|
+
`)}function Jn(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const Uh={};function kc(t){Uh[t]||(Uh[t]=!0,Jn(t))}function Cc(){const t=new Map;return{events:t,on(n,r){const o=t.get(n);o&&o.push(r)||t.set(n,[r])},off(n,r){const o=t.get(n);o&&o.splice(o.indexOf(r)>>>0,1)},emit(n,r){(t.get(n)||[]).slice().map(o=>o(r)),(t.get("*")||[]).slice().map(o=>o(n,r))}}}const Ui=t=>!te(t)||be(t);function zi(t,e){if(Ui(t)||Ui(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:r,des:o}=n.pop();Object.keys(r).forEach(s=>{s!=="__proto__"&&(te(r[s])&&!te(o[s])&&(o[s]=Array.isArray(r[s])?[]:le()),Ui(o[s])||Ui(r[s])?o[s]=r[s]:n.push({src:r[s],des:o[s]}))})}}/*!
|
|
123
|
+
* message-compiler v11.1.7
|
|
124
|
+
* (c) 2025 kazuya kawaguchi
|
|
125
|
+
* Released under the MIT License.
|
|
126
|
+
*/function Jv(t,e,n){return{line:t,column:e,offset:n}}function Sc(t,e,n){return{start:t,end:e}}const W={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},Gv=17,Yv={[W.EXPECTED_TOKEN]:"Expected token: '{0}'",[W.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[W.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[W.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[W.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[W.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[W.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[W.EMPTY_PLACEHOLDER]:"Empty placeholder",[W.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[W.INVALID_LINKED_FORMAT]:"Invalid linked format",[W.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[W.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[W.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[W.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[W.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[W.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function eo(t,e,n={}){const{domain:r,messages:o,args:s}=n,i=process.env.NODE_ENV!=="production"?Vi((o||Yv)[t]||"",...s||[]):t,l=new SyntaxError(String(i));return l.code=t,e&&(l.location=e),l.domain=r,l}function Xv(t){throw t}const Qv=/<\/?[\w\s="/.':;#-\/]+>/,Zv=t=>Qv.test(t),kn=" ",ex="\r",Ze=`
|
|
127
|
+
`,tx="\u2028",nx="\u2029";function rx(t){const e=t;let n=0,r=1,o=1,s=0;const i=T=>e[T]===ex&&e[T+1]===Ze,l=T=>e[T]===Ze,a=T=>e[T]===nx,c=T=>e[T]===tx,u=T=>i(T)||l(T)||a(T)||c(T),d=()=>n,f=()=>r,p=()=>o,h=()=>s,m=T=>i(T)||a(T)||c(T)?Ze:e[T],y=()=>m(n),b=()=>m(n+s);function w(){return s=0,u(n)&&(r++,o=0),i(n)&&n++,n++,o++,e[n]}function k(){return i(n+s)&&s++,s++,e[n+s]}function E(){n=0,r=1,o=1,s=0}function x(T=0){s=T}function v(){const T=n+s;for(;T!==n;)w();s=0}return{index:d,line:f,column:p,peekOffset:h,charAt:m,currentChar:y,currentPeek:b,next:w,peek:k,reset:E,resetPeek:x,skipToPeek:v}}const Gn=void 0,ox=".",zh="'",sx="tokenizer";function ix(t,e={}){const n=e.location!==!1,r=rx(t),o=()=>r.index(),s=()=>Jv(r.line(),r.column(),r.index()),i=s(),l=o(),a={currentType:13,offset:l,startLoc:i,endLoc:i,lastType:13,lastOffset:l,lastStartLoc:i,lastEndLoc:i,braceNest:0,inLinked:!1,text:""},c=()=>a,{onError:u}=e;function d(C,S,R,...$){const fe=c();if(S.column+=R,S.offset+=R,u){const se=n?Sc(fe.startLoc,S):null,Q=eo(C,se,{domain:sx,args:$});u(Q)}}function f(C,S,R){C.endLoc=s(),C.currentType=S;const $={type:S};return n&&($.loc=Sc(C.startLoc,C.endLoc)),R!=null&&($.value=R),$}const p=C=>f(C,13);function h(C,S){return C.currentChar()===S?(C.next(),S):(d(W.EXPECTED_TOKEN,s(),0,S),"")}function m(C){let S="";for(;C.currentPeek()===kn||C.currentPeek()===Ze;)S+=C.currentPeek(),C.peek();return S}function y(C){const S=m(C);return C.skipToPeek(),S}function b(C){if(C===Gn)return!1;const S=C.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S===95}function w(C){if(C===Gn)return!1;const S=C.charCodeAt(0);return S>=48&&S<=57}function k(C,S){const{currentType:R}=S;if(R!==2)return!1;m(C);const $=b(C.currentPeek());return C.resetPeek(),$}function E(C,S){const{currentType:R}=S;if(R!==2)return!1;m(C);const $=C.currentPeek()==="-"?C.peek():C.currentPeek(),fe=w($);return C.resetPeek(),fe}function x(C,S){const{currentType:R}=S;if(R!==2)return!1;m(C);const $=C.currentPeek()===zh;return C.resetPeek(),$}function v(C,S){const{currentType:R}=S;if(R!==7)return!1;m(C);const $=C.currentPeek()===".";return C.resetPeek(),$}function T(C,S){const{currentType:R}=S;if(R!==8)return!1;m(C);const $=b(C.currentPeek());return C.resetPeek(),$}function _(C,S){const{currentType:R}=S;if(!(R===7||R===11))return!1;m(C);const $=C.currentPeek()===":";return C.resetPeek(),$}function P(C,S){const{currentType:R}=S;if(R!==9)return!1;const $=()=>{const se=C.currentPeek();return se==="{"?b(C.peek()):se==="@"||se==="|"||se===":"||se==="."||se===kn||!se?!1:se===Ze?(C.peek(),$()):Z(C,!1)},fe=$();return C.resetPeek(),fe}function V(C){m(C);const S=C.currentPeek()==="|";return C.resetPeek(),S}function Z(C,S=!0){const R=(fe=!1,se="")=>{const Q=C.currentPeek();return Q==="{"||Q==="@"||!Q?fe:Q==="|"?!(se===kn||se===Ze):Q===kn?(C.peek(),R(!0,kn)):Q===Ze?(C.peek(),R(!0,Ze)):!0},$=R();return S&&C.resetPeek(),$}function q(C,S){const R=C.currentChar();return R===Gn?Gn:S(R)?(C.next(),R):null}function re(C){const S=C.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36}function Te(C){return q(C,re)}function Se(C){const S=C.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36||S===45}function de(C){return q(C,Se)}function me(C){const S=C.charCodeAt(0);return S>=48&&S<=57}function Oe(C){return q(C,me)}function dt(C){const S=C.charCodeAt(0);return S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102}function Me(C){return q(C,dt)}function Et(C){let S="",R="";for(;S=Oe(C);)R+=S;return R}function ft(C){let S="";for(;;){const R=C.currentChar();if(R==="{"||R==="}"||R==="@"||R==="|"||!R)break;if(R===kn||R===Ze)if(Z(C))S+=R,C.next();else{if(V(C))break;S+=R,C.next()}else S+=R,C.next()}return S}function Ut(C){y(C);let S="",R="";for(;S=de(C);)R+=S;return C.currentChar()===Gn&&d(W.UNTERMINATED_CLOSING_BRACE,s(),0),R}function wt(C){y(C);let S="";return C.currentChar()==="-"?(C.next(),S+=`-${Et(C)}`):S+=Et(C),C.currentChar()===Gn&&d(W.UNTERMINATED_CLOSING_BRACE,s(),0),S}function tt(C){return C!==zh&&C!==Ze}function Rt(C){y(C),h(C,"'");let S="",R="";for(;S=q(C,tt);)S==="\\"?R+=sn(C):R+=S;const $=C.currentChar();return $===Ze||$===Gn?(d(W.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),$===Ze&&(C.next(),h(C,"'")),R):(h(C,"'"),R)}function sn(C){const S=C.currentChar();switch(S){case"\\":case"'":return C.next(),`\\${S}`;case"u":return pt(C,S,4);case"U":return pt(C,S,6);default:return d(W.UNKNOWN_ESCAPE_SEQUENCE,s(),0,S),""}}function pt(C,S,R){h(C,S);let $="";for(let fe=0;fe<R;fe++){const se=Me(C);if(!se){d(W.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${S}${$}${C.currentChar()}`);break}$+=se}return`\\${S}${$}`}function ln(C){return C!=="{"&&C!=="}"&&C!==kn&&C!==Ze}function Lt(C){y(C);let S="",R="";for(;S=q(C,ln);)R+=S;return R}function an(C){let S="",R="";for(;S=Te(C);)R+=S;return R}function Qn(C){const S=R=>{const $=C.currentChar();return $==="{"||$==="@"||$==="|"||$==="("||$===")"||!$||$===kn?R:(R+=$,C.next(),S(R))};return S("")}function zt(C){y(C);const S=h(C,"|");return y(C),S}function cn(C,S){let R=null;switch(C.currentChar()){case"{":return S.braceNest>=1&&d(W.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),C.next(),R=f(S,2,"{"),y(C),S.braceNest++,R;case"}":return S.braceNest>0&&S.currentType===2&&d(W.EMPTY_PLACEHOLDER,s(),0),C.next(),R=f(S,3,"}"),S.braceNest--,S.braceNest>0&&y(C),S.inLinked&&S.braceNest===0&&(S.inLinked=!1),R;case"@":return S.braceNest>0&&d(W.UNTERMINATED_CLOSING_BRACE,s(),0),R=It(C,S)||p(S),S.braceNest=0,R;default:{let fe=!0,se=!0,Q=!0;if(V(C))return S.braceNest>0&&d(W.UNTERMINATED_CLOSING_BRACE,s(),0),R=f(S,1,zt(C)),S.braceNest=0,S.inLinked=!1,R;if(S.braceNest>0&&(S.currentType===4||S.currentType===5||S.currentType===6))return d(W.UNTERMINATED_CLOSING_BRACE,s(),0),S.braceNest=0,jt(C,S);if(fe=k(C,S))return R=f(S,4,Ut(C)),y(C),R;if(se=E(C,S))return R=f(S,5,wt(C)),y(C),R;if(Q=x(C,S))return R=f(S,6,Rt(C)),y(C),R;if(!fe&&!se&&!Q)return R=f(S,12,Lt(C)),d(W.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,R.value),y(C),R;break}}return R}function It(C,S){const{currentType:R}=S;let $=null;const fe=C.currentChar();switch((R===7||R===8||R===11||R===9)&&(fe===Ze||fe===kn)&&d(W.INVALID_LINKED_FORMAT,s(),0),fe){case"@":return C.next(),$=f(S,7,"@"),S.inLinked=!0,$;case".":return y(C),C.next(),f(S,8,".");case":":return y(C),C.next(),f(S,9,":");default:return V(C)?($=f(S,1,zt(C)),S.braceNest=0,S.inLinked=!1,$):v(C,S)||_(C,S)?(y(C),It(C,S)):T(C,S)?(y(C),f(S,11,an(C))):P(C,S)?(y(C),fe==="{"?cn(C,S)||$:f(S,10,Qn(C))):(R===7&&d(W.INVALID_LINKED_FORMAT,s(),0),S.braceNest=0,S.inLinked=!1,jt(C,S))}}function jt(C,S){let R={type:13};if(S.braceNest>0)return cn(C,S)||p(S);if(S.inLinked)return It(C,S)||p(S);switch(C.currentChar()){case"{":return cn(C,S)||p(S);case"}":return d(W.UNBALANCED_CLOSING_BRACE,s(),0),C.next(),f(S,3,"}");case"@":return It(C,S)||p(S);default:{if(V(C))return R=f(S,1,zt(C)),S.braceNest=0,S.inLinked=!1,R;if(Z(C))return f(S,0,ft(C));break}}return R}function Sn(){const{currentType:C,offset:S,startLoc:R,endLoc:$}=a;return a.lastType=C,a.lastOffset=S,a.lastStartLoc=R,a.lastEndLoc=$,a.offset=o(),a.startLoc=s(),r.currentChar()===Gn?f(a,13):jt(r,a)}return{nextToken:Sn,currentOffset:o,currentPosition:s,context:c}}const lx="parser",ax=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function cx(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||n,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function ux(t={}){const e=t.location!==!1,{onError:n}=t;function r(b,w,k,E,...x){const v=b.currentPosition();if(v.offset+=E,v.column+=E,n){const T=e?Sc(k,v):null,_=eo(w,T,{domain:lx,args:x});n(_)}}function o(b,w,k){const E={type:b};return e&&(E.start=w,E.end=w,E.loc={start:k,end:k}),E}function s(b,w,k,E){e&&(b.end=w,b.loc&&(b.loc.end=k))}function i(b,w){const k=b.context(),E=o(3,k.offset,k.startLoc);return E.value=w,s(E,b.currentOffset(),b.currentPosition()),E}function l(b,w){const k=b.context(),{lastOffset:E,lastStartLoc:x}=k,v=o(5,E,x);return v.index=parseInt(w,10),b.nextToken(),s(v,b.currentOffset(),b.currentPosition()),v}function a(b,w){const k=b.context(),{lastOffset:E,lastStartLoc:x}=k,v=o(4,E,x);return v.key=w,b.nextToken(),s(v,b.currentOffset(),b.currentPosition()),v}function c(b,w){const k=b.context(),{lastOffset:E,lastStartLoc:x}=k,v=o(9,E,x);return v.value=w.replace(ax,cx),b.nextToken(),s(v,b.currentOffset(),b.currentPosition()),v}function u(b){const w=b.nextToken(),k=b.context(),{lastOffset:E,lastStartLoc:x}=k,v=o(8,E,x);return w.type!==11?(r(b,W.UNEXPECTED_EMPTY_LINKED_MODIFIER,k.lastStartLoc,0),v.value="",s(v,E,x),{nextConsumeToken:w,node:v}):(w.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,nn(w)),v.value=w.value||"",s(v,b.currentOffset(),b.currentPosition()),{node:v})}function d(b,w){const k=b.context(),E=o(7,k.offset,k.startLoc);return E.value=w,s(E,b.currentOffset(),b.currentPosition()),E}function f(b){const w=b.context(),k=o(6,w.offset,w.startLoc);let E=b.nextToken();if(E.type===8){const x=u(b);k.modifier=x.node,E=x.nextConsumeToken||b.nextToken()}switch(E.type!==9&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(E)),E=b.nextToken(),E.type===2&&(E=b.nextToken()),E.type){case 10:E.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(E)),k.key=d(b,E.value||"");break;case 4:E.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(E)),k.key=a(b,E.value||"");break;case 5:E.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(E)),k.key=l(b,E.value||"");break;case 6:E.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(E)),k.key=c(b,E.value||"");break;default:{r(b,W.UNEXPECTED_EMPTY_LINKED_KEY,w.lastStartLoc,0);const x=b.context(),v=o(7,x.offset,x.startLoc);return v.value="",s(v,x.offset,x.startLoc),k.key=v,s(k,x.offset,x.startLoc),{nextConsumeToken:E,node:k}}}return s(k,b.currentOffset(),b.currentPosition()),{node:k}}function p(b){const w=b.context(),k=w.currentType===1?b.currentOffset():w.offset,E=w.currentType===1?w.endLoc:w.startLoc,x=o(2,k,E);x.items=[];let v=null;do{const P=v||b.nextToken();switch(v=null,P.type){case 0:P.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(P)),x.items.push(i(b,P.value||""));break;case 5:P.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(P)),x.items.push(l(b,P.value||""));break;case 4:P.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(P)),x.items.push(a(b,P.value||""));break;case 6:P.value==null&&r(b,W.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,nn(P)),x.items.push(c(b,P.value||""));break;case 7:{const V=f(b);x.items.push(V.node),v=V.nextConsumeToken||null;break}}}while(w.currentType!==13&&w.currentType!==1);const T=w.currentType===1?w.lastOffset:b.currentOffset(),_=w.currentType===1?w.lastEndLoc:b.currentPosition();return s(x,T,_),x}function h(b,w,k,E){const x=b.context();let v=E.items.length===0;const T=o(1,w,k);T.cases=[],T.cases.push(E);do{const _=p(b);v||(v=_.items.length===0),T.cases.push(_)}while(x.currentType!==13);return v&&r(b,W.MUST_HAVE_MESSAGES_IN_PLURAL,k,0),s(T,b.currentOffset(),b.currentPosition()),T}function m(b){const w=b.context(),{offset:k,startLoc:E}=w,x=p(b);return w.currentType===13?x:h(b,k,E,x)}function y(b){const w=ix(b,Re({},t)),k=w.context(),E=o(0,k.offset,k.startLoc);return e&&E.loc&&(E.loc.source=b),E.body=m(w),t.onCacheKey&&(E.cacheKey=t.onCacheKey(b)),k.currentType!==13&&r(w,W.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,b[k.offset]||""),s(E,w.currentOffset(),w.currentPosition()),E}return{parse:y}}function nn(t){if(t.type===13)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function dx(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:s=>(n.helpers.add(s),s)}}function jh(t,e){for(let n=0;n<t.length;n++)vc(t[n],e)}function vc(t,e){switch(t.type){case 1:jh(t.cases,e),e.helper("plural");break;case 2:jh(t.items,e);break;case 6:{vc(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function fx(t,e={}){const n=dx(t);n.helper("normalize"),t.body&&vc(t.body,n);const r=n.context();t.helpers=Array.from(r.helpers)}function px(t){const e=t.body;return e.type===2?Wh(e):e.cases.forEach(n=>Wh(n)),t}function Wh(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const r=t.items[n];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===t.items.length){t.static=wc(e);for(let n=0;n<t.items.length;n++){const r=t.items[n];(r.type===3||r.type===9)&&delete r.value}}}}const hx="minifier";function to(t){switch(t.t=t.type,t.type){case 0:{const e=t;to(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let r=0;r<n.length;r++)to(n[r]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let r=0;r<n.length;r++)to(n[r]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;to(e.key),e.k=e.key,delete e.key,e.modifier&&(to(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw eo(W.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:hx,args:[t.type]})}delete t.type}const mx="parser";function gx(t,e){const{filename:n,breakLineCode:r,needIndent:o}=e,s=e.location!==!1,i={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};s&&t.loc&&(i.source=t.loc.source);const l=()=>i;function a(m,y){i.code+=m}function c(m,y=!0){const b=y?r:"";a(o?b+" ".repeat(m):b)}function u(m=!0){const y=++i.indentLevel;m&&c(y)}function d(m=!0){const y=--i.indentLevel;m&&c(y)}function f(){c(i.indentLevel)}return{context:l,push:a,indent:u,deindent:d,newline:f,helper:m=>`_${m}`,needIndent:()=>i.needIndent}}function yx(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),no(t,e.key),e.modifier?(t.push(", "),no(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function bx(t,e){const{helper:n,needIndent:r}=t;t.push(`${n("normalize")}([`),t.indent(r());const o=e.items.length;for(let s=0;s<o&&(no(t,e.items[s]),s!==o-1);s++)t.push(", ");t.deindent(r()),t.push("])")}function Ex(t,e){const{helper:n,needIndent:r}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(r());const o=e.cases.length;for(let s=0;s<o&&(no(t,e.cases[s]),s!==o-1);s++)t.push(", ");t.deindent(r()),t.push("])")}}function wx(t,e){e.body?no(t,e.body):t.push("null")}function no(t,e){const{helper:n}=t;switch(e.type){case 0:wx(t,e);break;case 1:Ex(t,e);break;case 2:bx(t,e);break;case 6:yx(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw eo(W.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:mx,args:[e.type]})}}const kx=(t,e={})=>{const n=B(e.mode)?e.mode:"normal",r=B(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
|
|
128
|
+
`,s=e.needIndent?e.needIndent:n!=="arrow",i=t.helpers||[],l=gx(t,{filename:r,breakLineCode:o,needIndent:s});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(s),i.length>0&&(l.push(`const { ${wc(i.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),no(l,t),l.deindent(s),l.push("}"),delete t.helpers;const{code:a,map:c}=l.context();return{ast:t,code:a,map:c?c.toJSON():void 0}};function Cx(t,e={}){const n=Re({},e),r=!!n.jit,o=!!n.minify,s=n.optimize==null?!0:n.optimize,l=ux(n).parse(t);return r?(s&&px(l),o&&to(l),{ast:l,code:""}):(fx(l,n),kx(l,n))}/*!
|
|
129
|
+
* core-base v11.1.7
|
|
130
|
+
* (c) 2025 kazuya kawaguchi
|
|
131
|
+
* Released under the MIT License.
|
|
132
|
+
*/function Sx(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Cr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Cr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function _t(t){return te(t)&&xc(t)===0&&(Vt(t,"b")||Vt(t,"body"))}const Kh=["b","body"];function vx(t){return Yn(t,Kh)}const qh=["c","cases"];function xx(t){return Yn(t,qh,[])}const Jh=["s","static"];function Tx(t){return Yn(t,Jh)}const Gh=["i","items"];function Ox(t){return Yn(t,Gh,[])}const Yh=["t","type"];function xc(t){return Yn(t,Yh)}const Xh=["v","value"];function ji(t,e){const n=Yn(t,Xh);if(n!=null)return n;throw Zo(e)}const Qh=["m","modifier"];function Nx(t){return Yn(t,Qh)}const Zh=["k","key"];function Ax(t){const e=Yn(t,Zh);if(e)return e;throw Zo(6)}function Yn(t,e,n){for(let r=0;r<e.length;r++){const o=e[r];if(Vt(t,o)&&t[o]!=null)return t[o]}return n}const em=[...Kh,...qh,...Jh,...Gh,...Zh,...Qh,...Xh,...Yh];function Zo(t){return new Error(`unhandled node type: ${t}`)}function Tc(t){return n=>_x(n,t)}function _x(t,e){const n=vx(e);if(n==null)throw Zo(0);if(xc(n)===1){const s=xx(n);return t.plural(s.reduce((i,l)=>[...i,tm(t,l)],[]))}else return tm(t,n)}function tm(t,e){const n=Tx(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const r=Ox(e).reduce((o,s)=>[...o,Oc(t,s)],[]);return t.normalize(r)}}function Oc(t,e){const n=xc(e);switch(n){case 3:return ji(e,n);case 9:return ji(e,n);case 4:{const r=e;if(Vt(r,"k")&&r.k)return t.interpolate(t.named(r.k));if(Vt(r,"key")&&r.key)return t.interpolate(t.named(r.key));throw Zo(n)}case 5:{const r=e;if(Vt(r,"i")&&_e(r.i))return t.interpolate(t.list(r.i));if(Vt(r,"index")&&_e(r.index))return t.interpolate(t.list(r.index));throw Zo(n)}case 6:{const r=e,o=Nx(r),s=Ax(r);return t.linked(Oc(t,s),o?Oc(t,o):void 0,t.type)}case 7:return ji(e,n);case 8:return ji(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const Mx="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Rx(t,e){e&&Zv(t)&&Jn(Vi(Mx,{source:t}))}const Lx=t=>t;let Wi=le();function Ix(t,e={}){let n=!1;const r=e.onError||Xv;return e.onError=o=>{n=!0,r(o)},{...Cx(t,e),detectError:n}}function Dx(t,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&B(t)){const n=ne(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Rx(t,n);const o=(e.onCacheKey||Lx)(t),s=Wi[o];if(s)return s;const{ast:i,detectError:l}=Ix(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),a=Tc(i);return l?a:Wi[o]=a}else{if(process.env.NODE_ENV!=="production"&&!_t(t))return Jn(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),()=>t;const n=t.cacheKey;if(n){const r=Wi[n];return r||(Wi[n]=Tc(t))}else return Tc(t)}}let es=null;function Px(t){es=t}function Bx(t,e,n){es&&es.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Fx=$x("function:translate");function $x(t){return e=>es&&es.emit(t,e)}const qe={INVALID_ARGUMENT:Gv,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},Vx=24;function Cn(t){return eo(t,null,process.env.NODE_ENV!=="production"?{messages:Hx}:void 0)}const Hx={[qe.INVALID_ARGUMENT]:"Invalid arguments",[qe.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[qe.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[qe.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[qe.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[qe.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[qe.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function Nc(t,e){return e.locale!=null?nm(e.locale):nm(t.locale)}let Ac;function nm(t){if(B(t))return t;if(ue(t)){if(t.resolvedOnce&&Ac!=null)return Ac;if(t.constructor.name==="Function"){const e=t();if(Wv(e))throw Cn(qe.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ac=e}else throw Cn(qe.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Cn(qe.NOT_SUPPORT_LOCALE_TYPE)}function Ux(t,e,n){return[...new Set([n,...be(e)?e:te(e)?Object.keys(e):B(e)?[e]:[n]])]}function rm(t,e,n){const r=B(n)?n:ts,o=t;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let i=[n];for(;be(i);)i=om(s,i,e);const l=be(e)||!X(e)?e:e.default?e.default:null;i=B(l)?[l]:l,be(i)&&om(s,i,!1),o.__localeChainCache.set(r,s)}return s}function om(t,e,n){let r=!0;for(let o=0;o<e.length&&ne(r);o++){const s=e[o];B(s)&&(r=zx(t,e[o],n))}return r}function zx(t,e,n){let r;const o=e.split("-");do{const s=o.join("-");r=jx(t,s,n),o.splice(-1,1)}while(o.length&&r===!0);return r}function jx(t,e,n){let r=!1;if(!t.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const o=e.replace(/!/g,"");t.push(o),(be(n)||X(n))&&n[o]&&(r=n[o])}return r}const Xn=[];Xn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Xn[1]={w:[1],".":[2],"[":[4],o:[7]},Xn[2]={w:[2],i:[3,0],0:[3,0]},Xn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Xn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Xn[5]={"'":[4,0],o:8,l:[5,0]},Xn[6]={'"':[4,0],o:8,l:[6,0]};const Wx=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Kx(t){return Wx.test(t)}function qx(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function Jx(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Gx(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Kx(e)?qx(e):"*"+e}function Yx(t){const e=[];let n=-1,r=0,o=0,s,i,l,a,c,u,d;const f=[];f[0]=()=>{i===void 0?i=l:i+=l},f[1]=()=>{i!==void 0&&(e.push(i),i=void 0)},f[2]=()=>{f[0](),o++},f[3]=()=>{if(o>0)o--,r=4,f[0]();else{if(o=0,i===void 0||(i=Gx(i),i===!1))return!1;f[1]()}};function p(){const h=t[n+1];if(r===5&&h==="'"||r===6&&h==='"')return n++,l="\\"+h,f[0](),!0}for(;r!==null;)if(n++,s=t[n],!(s==="\\"&&p())){if(a=Jx(s),d=Xn[r],c=d[a]||d.l||8,c===8||(r=c[0],c[1]!==void 0&&(u=f[c[1]],u&&(l=s,u()===!1))))return;if(r===7)return e}}const sm=new Map;function Xx(t,e){return te(t)?t[e]:null}function Qx(t,e){if(!te(t))return null;let n=sm.get(e);if(n||(n=Yx(e),n&&sm.set(e,n)),!n)return null;const r=n.length;let o=t,s=0;for(;s<r;){const i=n[s];if(em.includes(i)&&_t(o))return null;const l=o[i];if(l===void 0||ue(o))return null;o=l,s++}return o}const at={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},Zx=8,eT={[at.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[at.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[at.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[at.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[at.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[at.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[at.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function Sr(t,...e){return Vi(eT[t],...e)}const tT="11.1.7",Ki=-1,ts="en-US",qi="",im=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function nT(){return{upper:(t,e)=>e==="text"&&B(t)?t.toUpperCase():e==="vnode"&&te(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&B(t)?t.toLowerCase():e==="vnode"&&te(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&B(t)?im(t):e==="vnode"&&te(t)&&"__v_isVNode"in t?im(t.children):t}}let lm;function rT(t){lm=t}let am;function oT(t){am=t}let cm;function sT(t){cm=t}let um=null;const iT=t=>{um=t},lT=()=>um;let dm=null;const fm=t=>{dm=t},aT=()=>dm;let pm=0;function cT(t={}){const e=ue(t.onWarn)?t.onWarn:Jn,n=B(t.version)?t.version:tT,r=B(t.locale)||ue(t.locale)?t.locale:ts,o=ue(r)?ts:r,s=be(t.fallbackLocale)||X(t.fallbackLocale)||B(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:o,i=X(t.messages)?t.messages:_c(o),l=X(t.datetimeFormats)?t.datetimeFormats:_c(o),a=X(t.numberFormats)?t.numberFormats:_c(o),c=Re(le(),t.modifiers,nT()),u=t.pluralRules||le(),d=ue(t.missing)?t.missing:null,f=ne(t.missingWarn)||Zr(t.missingWarn)?t.missingWarn:!0,p=ne(t.fallbackWarn)||Zr(t.fallbackWarn)?t.fallbackWarn:!0,h=!!t.fallbackFormat,m=!!t.unresolving,y=ue(t.postTranslation)?t.postTranslation:null,b=X(t.processor)?t.processor:null,w=ne(t.warnHtmlMessage)?t.warnHtmlMessage:!0,k=!!t.escapeParameter,E=ue(t.messageCompiler)?t.messageCompiler:lm;process.env.NODE_ENV!=="production"&&ue(t.messageCompiler)&&kc(Sr(at.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const x=ue(t.messageResolver)?t.messageResolver:am||Xx,v=ue(t.localeFallbacker)?t.localeFallbacker:cm||Ux,T=te(t.fallbackContext)?t.fallbackContext:void 0,_=t,P=te(_.__datetimeFormatters)?_.__datetimeFormatters:new Map,V=te(_.__numberFormatters)?_.__numberFormatters:new Map,Z=te(_.__meta)?_.__meta:{};pm++;const q={version:n,cid:pm,locale:r,fallbackLocale:s,messages:i,modifiers:c,pluralRules:u,missing:d,missingWarn:f,fallbackWarn:p,fallbackFormat:h,unresolving:m,postTranslation:y,processor:b,warnHtmlMessage:w,escapeParameter:k,messageCompiler:E,messageResolver:x,localeFallbacker:v,fallbackContext:T,onWarn:e,__meta:Z};return q.datetimeFormats=l,q.numberFormats=a,q.__datetimeFormatters=P,q.__numberFormatters=V,process.env.NODE_ENV!=="production"&&(q.__v_emitter=_.__v_emitter!=null?_.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&Bx(q,n,Z),q}const _c=t=>({[t]:le()});function Ji(t,e){return t instanceof RegExp?t.test(e):t}function hm(t,e){return t instanceof RegExp?t.test(e):t}function Mc(t,e,n,r,o){const{missing:s,onWarn:i}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:o,groupId:`${o}:${e}`})}if(s!==null){const l=s(t,n,e,o);return B(l)?l:e}else return process.env.NODE_ENV!=="production"&&hm(r,e)&&i(Sr(at.NOT_FOUND_KEY,{key:e,locale:n})),e}function ns(t,e,n){const r=t;r.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function mm(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function uT(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let r=n+1;r<e.length;r++)if(mm(t,e[r]))return!0;return!1}const gm=typeof Intl<"u",ym={dateTimeFormat:gm&&typeof Intl.DateTimeFormat<"u",numberFormat:gm&&typeof Intl.NumberFormat<"u"};function bm(t,...e){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:i}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ym.dateTimeFormat)return s(Sr(at.CANNOT_FORMAT_DATE)),qi;const[a,c,u,d]=Rc(...e),f=ne(u.missingWarn)?u.missingWarn:t.missingWarn,p=ne(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,h=!!u.part,m=Nc(t,u),y=i(t,o,m);if(!B(a)||a==="")return new Intl.DateTimeFormat(m,d).format(c);let b={},w,k=null,E=m,x=null;const v="datetime format";for(let P=0;P<y.length;P++){if(w=x=y[P],process.env.NODE_ENV!=="production"&&m!==w&&Ji(p,a)&&s(Sr(at.FALLBACK_TO_DATE_FORMAT,{key:a,target:w})),process.env.NODE_ENV!=="production"&&m!==w){const V=t.__v_emitter;V&&V.emit("fallback",{type:v,key:a,from:E,to:x,groupId:`${v}:${a}`})}if(b=n[w]||{},k=b[a],X(k))break;Mc(t,a,w,f,v),E=x}if(!X(k)||!B(w))return r?Ki:a;let T=`${w}__${a}`;Hi(d)||(T=`${T}__${JSON.stringify(d)}`);let _=l.get(T);return _||(_=new Intl.DateTimeFormat(w,Re({},k,d)),l.set(T,_)),h?_.formatToParts(c):_.format(c)}const Em=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Rc(...t){const[e,n,r,o]=t,s=le();let i=le(),l;if(B(e)){const a=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!a)throw Cn(qe.INVALID_ISO_DATE_ARGUMENT);const c=a[3]?a[3].trim().startsWith("T")?`${a[1].trim()}${a[3].trim()}`:`${a[1].trim()}T${a[3].trim()}`:a[1].trim();l=new Date(c);try{l.toISOString()}catch{throw Cn(qe.INVALID_ISO_DATE_ARGUMENT)}}else if(Uv(e)){if(isNaN(e.getTime()))throw Cn(qe.INVALID_DATE_ARGUMENT);l=e}else if(_e(e))l=e;else throw Cn(qe.INVALID_ARGUMENT);return B(n)?s.key=n:X(n)&&Object.keys(n).forEach(a=>{Em.includes(a)?i[a]=n[a]:s[a]=n[a]}),B(r)?s.locale=r:X(r)&&(i=r),X(o)&&(i=o),[s.key||"",l,s,i]}function wm(t,e,n){const r=t;for(const o in n){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function km(t,...e){const{numberFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:i}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ym.numberFormat)return s(Sr(at.CANNOT_FORMAT_NUMBER)),qi;const[a,c,u,d]=Lc(...e),f=ne(u.missingWarn)?u.missingWarn:t.missingWarn,p=ne(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,h=!!u.part,m=Nc(t,u),y=i(t,o,m);if(!B(a)||a==="")return new Intl.NumberFormat(m,d).format(c);let b={},w,k=null,E=m,x=null;const v="number format";for(let P=0;P<y.length;P++){if(w=x=y[P],process.env.NODE_ENV!=="production"&&m!==w&&Ji(p,a)&&s(Sr(at.FALLBACK_TO_NUMBER_FORMAT,{key:a,target:w})),process.env.NODE_ENV!=="production"&&m!==w){const V=t.__v_emitter;V&&V.emit("fallback",{type:v,key:a,from:E,to:x,groupId:`${v}:${a}`})}if(b=n[w]||{},k=b[a],X(k))break;Mc(t,a,w,f,v),E=x}if(!X(k)||!B(w))return r?Ki:a;let T=`${w}__${a}`;Hi(d)||(T=`${T}__${JSON.stringify(d)}`);let _=l.get(T);return _||(_=new Intl.NumberFormat(w,Re({},k,d)),l.set(T,_)),h?_.formatToParts(c):_.format(c)}const Cm=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Lc(...t){const[e,n,r,o]=t,s=le();let i=le();if(!_e(e))throw Cn(qe.INVALID_ARGUMENT);const l=e;return B(n)?s.key=n:X(n)&&Object.keys(n).forEach(a=>{Cm.includes(a)?i[a]=n[a]:s[a]=n[a]}),B(r)?s.locale=r:X(r)&&(i=r),X(o)&&(i=o),[s.key||"",l,s,i]}function Sm(t,e,n){const r=t;for(const o in n){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const dT=t=>t,fT=t=>"",pT="text",hT=t=>t.length===0?"":wc(t),mT=Kv;function vm(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function gT(t){const e=_e(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(_e(t.named.count)||_e(t.named.n))?_e(t.named.count)?t.named.count:_e(t.named.n)?t.named.n:e:e}function yT(t,e){e.count||(e.count=t),e.n||(e.n=t)}function bT(t={}){const e=t.locale,n=gT(t),r=te(t.pluralRules)&&B(e)&&ue(t.pluralRules[e])?t.pluralRules[e]:vm,o=te(t.pluralRules)&&B(e)&&ue(t.pluralRules[e])?vm:void 0,s=b=>b[r(n,b.length,o)],i=t.list||[],l=b=>i[b],a=t.named||le();_e(t.pluralIndex)&&yT(n,a);const c=b=>a[b];function u(b,w){const k=ue(t.messages)?t.messages(b,!!w):te(t.messages)?t.messages[b]:!1;return k||(t.parent?t.parent.message(b):fT)}const d=b=>t.modifiers?t.modifiers[b]:dT,f=X(t.processor)&&ue(t.processor.normalize)?t.processor.normalize:hT,p=X(t.processor)&&ue(t.processor.interpolate)?t.processor.interpolate:mT,h=X(t.processor)&&B(t.processor.type)?t.processor.type:pT,y={list:l,named:c,plural:s,linked:(b,...w)=>{const[k,E]=w;let x="text",v="";w.length===1?te(k)?(v=k.modifier||v,x=k.type||x):B(k)&&(v=k||v):w.length===2&&(B(k)&&(v=k||v),B(E)&&(x=E||x));const T=u(b,!0)(y),_=x==="vnode"&&be(T)&&v?T[0]:T;return v?d(v)(_,x):_},message:u,type:h,interpolate:p,normalize:f,values:Re(le(),i,a)};return y}const xm=()=>"",Mt=t=>ue(t);function Tm(t,...e){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:i,messages:l}=t,[a,c]=Ic(...e),u=ne(c.missingWarn)?c.missingWarn:t.missingWarn,d=ne(c.fallbackWarn)?c.fallbackWarn:t.fallbackWarn,f=ne(c.escapeParameter)?c.escapeParameter:t.escapeParameter,p=!!c.resolvedMessage,h=B(c.default)||ne(c.default)?ne(c.default)?s?a:()=>a:c.default:n?s?a:()=>a:null,m=n||h!=null&&(B(h)||ue(h)),y=Nc(t,c);f&&ET(c);let[b,w,k]=p?[a,y,l[y]||le()]:Om(t,a,y,i,d,u),E=b,x=a;if(!p&&!(B(E)||_t(E)||Mt(E))&&m&&(E=h,x=E),!p&&(!(B(E)||_t(E)||Mt(E))||!B(w)))return o?Ki:a;if(process.env.NODE_ENV!=="production"&&B(E)&&t.messageCompiler==null)return Jn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${a}'.`),a;let v=!1;const T=()=>{v=!0},_=Mt(E)?E:Nm(t,a,w,E,x,T);if(v)return E;const P=ST(t,w,k,c),V=bT(P),Z=wT(t,_,V),q=r?r(Z,a):Z;if(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const re={timestamp:Date.now(),key:B(a)?a:Mt(E)?E.key:"",locale:w||(Mt(E)?E.locale:""),format:B(E)?E:Mt(E)?E.source:"",message:q};re.meta=Re({},t.__meta,lT()||{}),Fx(re)}return q}function ET(t){be(t.list)?t.list=t.list.map(e=>B(e)?$h(e):e):te(t.named)&&Object.keys(t.named).forEach(e=>{B(t.named[e])&&(t.named[e]=$h(t.named[e]))})}function Om(t,e,n,r,o,s){const{messages:i,onWarn:l,messageResolver:a,localeFallbacker:c}=t,u=c(t,r,n);let d=le(),f,p=null,h=n,m=null;const y="translate";for(let b=0;b<u.length;b++){if(f=m=u[b],process.env.NODE_ENV!=="production"&&n!==f&&!mm(n,f)&&Ji(o,e)&&l(Sr(at.FALLBACK_TO_TRANSLATE,{key:e,target:f})),process.env.NODE_ENV!=="production"&&n!==f){const x=t.__v_emitter;x&&x.emit("fallback",{type:y,key:e,from:h,to:m,groupId:`${y}:${e}`})}d=i[f]||le();let w=null,k,E;if(process.env.NODE_ENV!=="production"&&$t&&(w=window.performance.now(),k="intlify-message-resolve-start",E="intlify-message-resolve-end",bt&&bt(k)),(p=a(d,e))===null&&(p=d[e]),process.env.NODE_ENV!=="production"&&$t){const x=window.performance.now(),v=t.__v_emitter;v&&w&&p&&v.emit("message-resolve",{type:"message-resolve",key:e,message:p,time:x-w,groupId:`${y}:${e}`}),k&&E&&bt&&kr&&(bt(E),kr("intlify message resolve",k,E))}if(B(p)||_t(p)||Mt(p))break;if(!uT(f,u)){const x=Mc(t,e,f,s,y);x!==e&&(p=x)}h=m}return[p,f,d]}function Nm(t,e,n,r,o,s){const{messageCompiler:i,warnHtmlMessage:l}=t;if(Mt(r)){const f=r;return f.locale=f.locale||n,f.key=f.key||e,f}if(i==null){const f=()=>r;return f.locale=n,f.key=e,f}let a=null,c,u;process.env.NODE_ENV!=="production"&&$t&&(a=window.performance.now(),c="intlify-message-compilation-start",u="intlify-message-compilation-end",bt&&bt(c));const d=i(r,kT(t,n,o,r,l,s));if(process.env.NODE_ENV!=="production"&&$t){const f=window.performance.now(),p=t.__v_emitter;p&&a&&p.emit("message-compilation",{type:"message-compilation",message:r,time:f-a,groupId:`translate:${e}`}),c&&u&&bt&&kr&&(bt(u),kr("intlify message compilation",c,u))}return d.locale=n,d.key=e,d.source=r,d}function wT(t,e,n){let r=null,o,s;process.env.NODE_ENV!=="production"&&$t&&(r=window.performance.now(),o="intlify-message-evaluation-start",s="intlify-message-evaluation-end",bt&&bt(o));const i=e(n);if(process.env.NODE_ENV!=="production"&&$t){const l=window.performance.now(),a=t.__v_emitter;a&&r&&a.emit("message-evaluation",{type:"message-evaluation",value:i,time:l-r,groupId:`translate:${e.key}`}),o&&s&&bt&&kr&&(bt(s),kr("intlify message evaluation",o,s))}return i}function Ic(...t){const[e,n,r]=t,o=le();if(!B(e)&&!_e(e)&&!Mt(e)&&!_t(e))throw Cn(qe.INVALID_ARGUMENT);const s=_e(e)?String(e):(Mt(e),e);return _e(n)?o.plural=n:B(n)?o.default=n:X(n)&&!Hi(n)?o.named=n:be(n)&&(o.list=n),_e(r)?o.plural=r:B(r)?o.default=r:X(r)&&Re(o,r),[s,o]}function kT(t,e,n,r,o,s){return{locale:e,key:n,warnHtmlMessage:o,onError:i=>{if(s&&s(i),process.env.NODE_ENV!=="production"){const l=CT(r),a=`Message compilation error: ${i.message}`,c=i.location&&l&&qv(l,i.location.start.offset,i.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:i.message,start:i.location&&i.location.start.offset,end:i.location&&i.location.end.offset,groupId:`translate:${n}`}),console.error(c?`${a}
|
|
133
|
+
${c}`:a)}else throw i},onCacheKey:i=>Vv(e,n,i)}}function CT(t){if(B(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function ST(t,e,n,r){const{modifiers:o,pluralRules:s,messageResolver:i,fallbackLocale:l,fallbackWarn:a,missingWarn:c,fallbackContext:u}=t,f={locale:e,modifiers:o,pluralRules:s,messages:(p,h)=>{let m=i(n,p);if(m==null&&(u||h)){const[,,y]=Om(u||t,p,e,l,a,c);m=i(y,p)}if(B(m)||_t(m)){let y=!1;const w=Nm(t,p,e,m,p,()=>{y=!0});return y?xm:w}else return Mt(m)?m:xm}};return t.processor&&(f.processor=t.processor),r.list&&(f.list=r.list),r.named&&(f.named=r.named),_e(r.plural)&&(f.pluralIndex=r.plural),f}Sx();function vT(){return Am().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Am(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const xT=typeof Proxy=="function",TT="devtools-plugin:setup",OT="plugin:settings:set";let ro,Dc;function NT(){var t;return ro!==void 0||(typeof window<"u"&&window.performance?(ro=!0,Dc=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(ro=!0,Dc=globalThis.perf_hooks.performance):ro=!1),ro}function AT(){return NT()?Dc.now():Date.now()}class _T{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const i in e.settings){const l=e.settings[i];r[i]=l.defaultValue}const o=`__vue-devtools-plugin-settings__${e.id}`;let s=Object.assign({},r);try{const i=localStorage.getItem(o),l=JSON.parse(i);Object.assign(s,l)}catch{}this.fallbacks={getSettings(){return s},setSettings(i){try{localStorage.setItem(o,JSON.stringify(i))}catch{}s=i},now(){return AT()}},n&&n.on(OT,(i,l)=>{i===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(i,l)=>this.target?this.target.on[l]:(...a)=>{this.onQueue.push({method:l,args:a})}}),this.proxiedTarget=new Proxy({},{get:(i,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...a)=>(this.targetQueue.push({method:l,args:a,resolve:()=>{}}),this.fallbacks[l](...a)):(...a)=>new Promise(c=>{this.targetQueue.push({method:l,args:a,resolve:c})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function MT(t,e){const n=t,r=Am(),o=vT(),s=xT&&n.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))o.emit(TT,t,e);else{const i=s?new _T(n,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:i}),i&&e(i.proxiedTarget)}}/*!
|
|
134
|
+
* vue-i18n v11.1.7
|
|
135
|
+
* (c) 2025 kazuya kawaguchi
|
|
136
|
+
* Released under the MIT License.
|
|
137
|
+
*/const RT="11.1.7";function LT(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Cr().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Cr().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Cr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Cr().__INTLIFY_PROD_DEVTOOLS__=!1)}const ae={UNEXPECTED_RETURN_TYPE:Vx,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34,DUPLICATE_USE_I18N_CALLING:35};function et(t,...e){return eo(t,null,process.env.NODE_ENV!=="production"?{messages:IT,args:e}:void 0)}const IT={[ae.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[ae.INVALID_ARGUMENT]:"Invalid argument",[ae.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[ae.NOT_INSTALLED]:"Need to install with `app.use` function",[ae.UNEXPECTED_ERROR]:"Unexpected error",[ae.REQUIRED_VALUE]:"Required in value: {0}",[ae.INVALID_VALUE]:"Invalid value",[ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[ae.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[ae.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[ae.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly",[ae.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope"},Pc=tn("__translateVNode"),Bc=tn("__datetimeParts"),Fc=tn("__numberParts"),vr=tn("__enableEmitter"),rs=tn("__disableEmitter"),_m=tn("__setPluralRules"),Mm=tn("__injectWithOption"),$c=tn("__dispose"),rn={FALLBACK_TO_ROOT:Zx,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12},DT={[rn.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[rn.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[rn.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[rn.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead.
|
|
138
|
+
About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[rn.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead."};function ss(t,...e){return Vi(DT[t],...e)}function is(t){if(!te(t)||_t(t))return t;for(const e in t)if(Vt(t,e))if(!e.includes("."))te(t[e])&&is(t[e]);else{const n=e.split("."),r=n.length-1;let o=t,s=!1;for(let i=0;i<r;i++){if(n[i]==="__proto__")throw new Error(`unsafe key: ${n[i]}`);if(n[i]in o||(o[n[i]]=le()),!te(o[n[i]])){process.env.NODE_ENV!=="production"&&Jn(ss(rn.IGNORE_OBJ_FLATTEN,{key:n[i]})),s=!0;break}o=o[n[i]]}if(s||(_t(o)?em.includes(n[r])||delete t[e]:(o[n[r]]=t[e],delete t[e])),!_t(o)){const i=o[n[r]];te(i)&&is(i)}}return t}function Vc(t,e){const{messages:n,__i18n:r,messageResolver:o,flatJson:s}=e,i=X(n)?n:be(r)?le():{[t]:le()};if(be(r)&&r.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:a,resource:c}=l;a?(i[a]=i[a]||le(),zi(c,i[a])):zi(c,i)}else B(l)&&zi(JSON.parse(l),i)}),o==null&&s)for(const l in i)Vt(i,l)&&is(i[l]);return i}function Rm(t){return t.type}function Lm(t,e,n){let r=te(e.messages)?e.messages:le();"__i18nGlobal"in n&&(r=Vc(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{t.mergeLocaleMessage(s,r[s])});{if(te(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(i=>{t.mergeDateTimeFormat(i,e.datetimeFormats[i])})}if(te(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(i=>{t.mergeNumberFormat(i,e.numberFormats[i])})}}}function Im(t){return g.createVNode(g.Text,null,t,0)}const Dm="__INTLIFY_META__",Pm=()=>[],PT=()=>!1;let Bm=0;function Fm(t){return(e,n,r,o)=>t(n,r,g.getCurrentInstance()||void 0,o)}const BT=()=>{const t=g.getCurrentInstance();let e=null;return t&&(e=Rm(t)[Dm])?{[Dm]:e}:null};function Hc(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,o=t.flatJson,s=$t?g.ref:g.shallowRef;let i=ne(t.inheritLocale)?t.inheritLocale:!0;const l=s(e&&i?e.locale.value:B(t.locale)?t.locale:ts),a=s(e&&i?e.fallbackLocale.value:B(t.fallbackLocale)||be(t.fallbackLocale)||X(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:l.value),c=s(Vc(l.value,t)),u=s(X(t.datetimeFormats)?t.datetimeFormats:{[l.value]:{}}),d=s(X(t.numberFormats)?t.numberFormats:{[l.value]:{}});let f=e?e.missingWarn:ne(t.missingWarn)||Zr(t.missingWarn)?t.missingWarn:!0,p=e?e.fallbackWarn:ne(t.fallbackWarn)||Zr(t.fallbackWarn)?t.fallbackWarn:!0,h=e?e.fallbackRoot:ne(t.fallbackRoot)?t.fallbackRoot:!0,m=!!t.fallbackFormat,y=ue(t.missing)?t.missing:null,b=ue(t.missing)?Fm(t.missing):null,w=ue(t.postTranslation)?t.postTranslation:null,k=e?e.warnHtmlMessage:ne(t.warnHtmlMessage)?t.warnHtmlMessage:!0,E=!!t.escapeParameter;const x=e?e.modifiers:X(t.modifiers)?t.modifiers:{};let v=t.pluralRules||e&&e.pluralRules,T;T=(()=>{r&&fm(null);const N={version:RT,locale:l.value,fallbackLocale:a.value,messages:c.value,modifiers:x,pluralRules:v,missing:b===null?void 0:b,missingWarn:f,fallbackWarn:p,fallbackFormat:m,unresolving:!0,postTranslation:w===null?void 0:w,warnHtmlMessage:k,escapeParameter:E,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};N.datetimeFormats=u.value,N.numberFormats=d.value,N.__datetimeFormatters=X(T)?T.__datetimeFormatters:void 0,N.__numberFormatters=X(T)?T.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(N.__v_emitter=X(T)?T.__v_emitter:void 0);const L=cT(N);return r&&fm(L),L})(),ns(T,l.value,a.value);function P(){return[l.value,a.value,c.value,u.value,d.value]}const V=g.computed({get:()=>l.value,set:N=>{T.locale=N,l.value=N}}),Z=g.computed({get:()=>a.value,set:N=>{T.fallbackLocale=N,a.value=N,ns(T,l.value,N)}}),q=g.computed(()=>c.value),re=g.computed(()=>u.value),Te=g.computed(()=>d.value);function Se(){return ue(w)?w:null}function de(N){w=N,T.postTranslation=N}function me(){return y}function Oe(N){N!==null&&(b=Fm(N)),y=N,T.missing=b}function dt(N,L){return N!=="translate"||!L.resolvedMessage}const Me=(N,L,ee,ge,vn,io)=>{P();let Zn;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=e?aT():void 0),Zn=N(T)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=void 0)}if(ee!=="translate exists"&&_e(Zn)&&Zn===Ki||ee==="translate exists"&&!Zn){const[xn,iu]=L();if(process.env.NODE_ENV!=="production"&&e&&B(xn)&&dt(ee,iu)&&(h&&(Ji(p,xn)||hm(f,xn))&&Jn(ss(rn.FALLBACK_TO_ROOT,{key:xn,type:ee})),process.env.NODE_ENV!=="production")){const{__v_emitter:A}=T;A&&h&&A.emit("fallback",{type:ee,key:xn,to:"global",groupId:`${ee}:${xn}`})}return e&&h?ge(e):vn(xn)}else{if(io(Zn))return Zn;throw et(ae.UNEXPECTED_RETURN_TYPE)}};function Et(...N){return Me(L=>Reflect.apply(Tm,null,[L,...N]),()=>Ic(...N),"translate",L=>Reflect.apply(L.t,L,[...N]),L=>L,L=>B(L))}function ft(...N){const[L,ee,ge]=N;if(ge&&!te(ge))throw et(ae.INVALID_ARGUMENT);return Et(L,ee,Re({resolvedMessage:!0},ge||{}))}function Ut(...N){return Me(L=>Reflect.apply(bm,null,[L,...N]),()=>Rc(...N),"datetime format",L=>Reflect.apply(L.d,L,[...N]),()=>qi,L=>B(L)||be(L))}function wt(...N){return Me(L=>Reflect.apply(km,null,[L,...N]),()=>Lc(...N),"number format",L=>Reflect.apply(L.n,L,[...N]),()=>qi,L=>B(L)||be(L))}function tt(N){return N.map(L=>B(L)||_e(L)||ne(L)?Im(String(L)):L)}const sn={normalize:tt,interpolate:N=>N,type:"vnode"};function pt(...N){return Me(L=>{let ee;const ge=L;try{ge.processor=sn,ee=Reflect.apply(Tm,null,[ge,...N])}finally{ge.processor=null}return ee},()=>Ic(...N),"translate",L=>L[Pc](...N),L=>[Im(L)],L=>be(L))}function ln(...N){return Me(L=>Reflect.apply(km,null,[L,...N]),()=>Lc(...N),"number format",L=>L[Fc](...N),Pm,L=>B(L)||be(L))}function Lt(...N){return Me(L=>Reflect.apply(bm,null,[L,...N]),()=>Rc(...N),"datetime format",L=>L[Bc](...N),Pm,L=>B(L)||be(L))}function an(N){v=N,T.pluralRules=v}function Qn(N,L){return Me(()=>{if(!N)return!1;const ee=B(L)?L:l.value,ge=It(ee),vn=T.messageResolver(ge,N);return _t(vn)||Mt(vn)||B(vn)},()=>[N],"translate exists",ee=>Reflect.apply(ee.te,ee,[N,L]),PT,ee=>ne(ee))}function zt(N){let L=null;const ee=rm(T,a.value,l.value);for(let ge=0;ge<ee.length;ge++){const vn=c.value[ee[ge]]||{},io=T.messageResolver(vn,N);if(io!=null){L=io;break}}return L}function cn(N){const L=zt(N);return L??(e?e.tm(N)||{}:{})}function It(N){return c.value[N]||{}}function jt(N,L){if(o){const ee={[N]:L};for(const ge in ee)Vt(ee,ge)&&is(ee[ge]);L=ee[N]}c.value[N]=L,T.messages=c.value}function Sn(N,L){c.value[N]=c.value[N]||{};const ee={[N]:L};if(o)for(const ge in ee)Vt(ee,ge)&&is(ee[ge]);L=ee[N],zi(L,c.value[N]),T.messages=c.value}function C(N){return u.value[N]||{}}function S(N,L){u.value[N]=L,T.datetimeFormats=u.value,wm(T,N,L)}function R(N,L){u.value[N]=Re(u.value[N]||{},L),T.datetimeFormats=u.value,wm(T,N,L)}function $(N){return d.value[N]||{}}function fe(N,L){d.value[N]=L,T.numberFormats=d.value,Sm(T,N,L)}function se(N,L){d.value[N]=Re(d.value[N]||{},L),T.numberFormats=d.value,Sm(T,N,L)}Bm++,e&&$t&&(g.watch(e.locale,N=>{i&&(l.value=N,T.locale=N,ns(T,l.value,a.value))}),g.watch(e.fallbackLocale,N=>{i&&(a.value=N,T.fallbackLocale=N,ns(T,l.value,a.value))}));const Q={id:Bm,locale:V,fallbackLocale:Z,get inheritLocale(){return i},set inheritLocale(N){i=N,N&&e&&(l.value=e.locale.value,a.value=e.fallbackLocale.value,ns(T,l.value,a.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:q,get modifiers(){return x},get pluralRules(){return v||{}},get isGlobal(){return r},get missingWarn(){return f},set missingWarn(N){f=N,T.missingWarn=f},get fallbackWarn(){return p},set fallbackWarn(N){p=N,T.fallbackWarn=p},get fallbackRoot(){return h},set fallbackRoot(N){h=N},get fallbackFormat(){return m},set fallbackFormat(N){m=N,T.fallbackFormat=m},get warnHtmlMessage(){return k},set warnHtmlMessage(N){k=N,T.warnHtmlMessage=N},get escapeParameter(){return E},set escapeParameter(N){E=N,T.escapeParameter=N},t:Et,getLocaleMessage:It,setLocaleMessage:jt,mergeLocaleMessage:Sn,getPostTranslationHandler:Se,setPostTranslationHandler:de,getMissingHandler:me,setMissingHandler:Oe,[_m]:an};return Q.datetimeFormats=re,Q.numberFormats=Te,Q.rt=ft,Q.te=Qn,Q.tm=cn,Q.d=Ut,Q.n=wt,Q.getDateTimeFormat=C,Q.setDateTimeFormat=S,Q.mergeDateTimeFormat=R,Q.getNumberFormat=$,Q.setNumberFormat=fe,Q.mergeNumberFormat=se,Q[Mm]=n,Q[Pc]=pt,Q[Bc]=Lt,Q[Fc]=ln,process.env.NODE_ENV!=="production"&&(Q[vr]=N=>{T.__v_emitter=N},Q[rs]=()=>{T.__v_emitter=void 0}),Q}const $m="vue-i18n: composer properties",Uc={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},FT={"vue-i18n-resource-inspector":"Search for scopes ..."},$T={"vue-i18n-timeline":16764185};let zc;async function VT(t,e){return new Promise((n,r)=>{try{MT({id:"vue-devtools-plugin-vue-i18n",label:Uc["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[$m],app:t},o=>{zc=o,o.on.visitComponentTree(({componentInstance:i,treeNode:l})=>{HT(i,l,e)}),o.on.inspectComponent(({componentInstance:i,instanceData:l})=>{i.vnode.el&&i.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?i.vnode.el.__VUE_I18N__!==e.global.__composer&&Hm(l,i.vnode.el.__VUE_I18N__):Hm(l,i.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:Uc["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:FT["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(i=>{i.app===t&&i.inspectorId==="vue-i18n-resource-inspector"&&KT(i,e)});const s=new Map;o.on.getInspectorState(async i=>{if(i.app===t&&i.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),JT(i,e),i.nodeId==="global"){if(!s.has(i.app)){const[l]=await o.getComponentInstances(i.app);s.set(i.app,l)}o.highlightElement(s.get(i.app))}else{const l=qT(i.nodeId,e);l&&o.highlightElement(l)}}),o.on.editInspectorState(i=>{i.app===t&&i.inspectorId==="vue-i18n-resource-inspector"&&YT(i,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:Uc["vue-i18n-timeline"],color:$T["vue-i18n-timeline"]}),n(!0)})}catch(o){console.error(o),r(!1)}})}function Vm(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function HT(t,e,n){const r=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${Vm(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function Hm(t,e){const n=$m;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:jc(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function jc(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];ue(r)&&"source"in r?e[n]=WT(r):_t(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:te(r)?e[n]=jc(r):e[n]=r}),e}const UT={"<":"<",">":">",'"':""","&":"&"};function zT(t){return t.replace(/[<>"&]/g,jT)}function jT(t){return UT[t]||t}function WT(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${zT(t.source)}")`:"(?)"}`}}}function KT(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;n!==s&&t.rootNodes.push({id:s.id.toString(),label:`${Vm(r)} Scope`})}}function qT(t,e){let n=null;if(t!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===t){n=r;break}}return n}function Um(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function JT(t,e){const n=Um(t.nodeId,e);return n&&(t.state=GT(n)),null}function GT(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:jc(t.messages.value)}];e[o]=s;{const i="Datetime formats info",l=[{type:i,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[i]=l;const a="Datetime formats info",c=[{type:a,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[a]=c}return e}function ls(t,e){if(zc){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),zc.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function YT(t,e){const n=Um(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&B(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(B(t.state.value)||be(t.state.value)||te(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&ne(t.state.value)&&(n.inheritLocale=t.state.value)}}function XT(t){const e=B(t.locale)?t.locale:ts,n=B(t.fallbackLocale)||be(t.fallbackLocale)||X(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:e,r=ue(t.missing)?t.missing:void 0,o=ne(t.silentTranslationWarn)||Zr(t.silentTranslationWarn)?!t.silentTranslationWarn:!0,s=ne(t.silentFallbackWarn)||Zr(t.silentFallbackWarn)?!t.silentFallbackWarn:!0,i=ne(t.fallbackRoot)?t.fallbackRoot:!0,l=!!t.formatFallbackMessages,a=X(t.modifiers)?t.modifiers:{},c=t.pluralizationRules,u=ue(t.postTranslation)?t.postTranslation:void 0,d=B(t.warnHtmlInMessage)?t.warnHtmlInMessage!=="off":!0,f=!!t.escapeParameterHtml,p=ne(t.sync)?t.sync:!0;let h=t.messages;if(X(t.sharedMessages)){const x=t.sharedMessages;h=Object.keys(x).reduce((T,_)=>{const P=T[_]||(T[_]={});return Re(P,x[_]),T},h||{})}const{__i18n:m,__root:y,__injectWithOption:b}=t,w=t.datetimeFormats,k=t.numberFormats,E=t.flatJson;return{locale:e,fallbackLocale:n,messages:h,flatJson:E,datetimeFormats:w,numberFormats:k,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:i,fallbackFormat:l,modifiers:a,pluralRules:c,postTranslation:u,warnHtmlMessage:d,escapeParameter:f,messageResolver:t.messageResolver,inheritLocale:p,__i18n:m,__root:y,__injectWithOption:b}}function Wc(t={}){const e=Hc(XT(t)),{__extender:n}=t,r={id:e.id,get locale(){return e.locale.value},set locale(o){e.locale.value=o},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(o){e.fallbackLocale.value=o},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(o){e.setMissingHandler(o)},get silentTranslationWarn(){return ne(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=ne(o)?!o:o},get silentFallbackWarn(){return ne(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=ne(o)?!o:o},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(o){e.fallbackFormat=o},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(o){e.setPostTranslationHandler(o)},get sync(){return e.inheritLocale},set sync(o){e.inheritLocale=o},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){e.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(o){e.escapeParameter=o},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...o){return Reflect.apply(e.t,e,[...o])},rt(...o){return Reflect.apply(e.rt,e,[...o])},te(o,s){return e.te(o,s)},tm(o){return e.tm(o)},getLocaleMessage(o){return e.getLocaleMessage(o)},setLocaleMessage(o,s){e.setLocaleMessage(o,s)},mergeLocaleMessage(o,s){e.mergeLocaleMessage(o,s)},d(...o){return Reflect.apply(e.d,e,[...o])},getDateTimeFormat(o){return e.getDateTimeFormat(o)},setDateTimeFormat(o,s){e.setDateTimeFormat(o,s)},mergeDateTimeFormat(o,s){e.mergeDateTimeFormat(o,s)},n(...o){return Reflect.apply(e.n,e,[...o])},getNumberFormat(o){return e.getNumberFormat(o)},setNumberFormat(o,s){e.setNumberFormat(o,s)},mergeNumberFormat(o,s){e.mergeNumberFormat(o,s)}};return r.__extender=n,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[vr]&&s[vr](o)},r.__disableEmitter=()=>{const o=e;o[rs]&&o[rs]()}),r}function QT(t,e,n){return{beforeCreate(){const r=g.getCurrentInstance();if(!r)throw et(ae.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const s=o.i18n;if(o.__i18n&&(s.__i18n=o.__i18n),s.__root=e,this===this.$root)this.$i18n=zm(t,s);else{s.__injectWithOption=!0,s.__extender=n.__vueI18nExtend,this.$i18n=Wc(s);const i=this.$i18n;i.__extender&&(i.__disposer=i.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=zm(t,o);else{this.$i18n=Wc({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=t;o.__i18nGlobal&&Lm(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,i)=>this.$i18n.te(s,i),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),n.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const o=this.__v_emitter=Cc();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",ls)}},unmounted(){const r=g.getCurrentInstance();if(!r)throw et(ae.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",ls),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(r),delete this.$i18n}}}function zm(t,e){t.locale=e.locale||t.locale,t.fallbackLocale=e.fallbackLocale||t.fallbackLocale,t.missing=e.missing||t.missing,t.silentTranslationWarn=e.silentTranslationWarn||t.silentFallbackWarn,t.silentFallbackWarn=e.silentFallbackWarn||t.silentFallbackWarn,t.formatFallbackMessages=e.formatFallbackMessages||t.formatFallbackMessages,t.postTranslation=e.postTranslation||t.postTranslation,t.warnHtmlInMessage=e.warnHtmlInMessage||t.warnHtmlInMessage,t.escapeParameterHtml=e.escapeParameterHtml||t.escapeParameterHtml,t.sync=e.sync||t.sync,t.__composer[_m](e.pluralizationRules||t.pluralizationRules);const n=Vc(t.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(n).forEach(r=>t.mergeLocaleMessage(r,n[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>t.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>t.mergeNumberFormat(r,e.numberFormats[r])),t}const Kc={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function ZT({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((r,o)=>[...r,...o.type===g.Fragment?o.children:[o]],[]):e.reduce((n,r)=>{const o=t[r];return o&&(n[r]=o()),n},le())}function jm(){return g.Fragment}const Wm=g.defineComponent({name:"i18n-t",props:Re({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>_e(t)||!isNaN(t)}},Kc),setup(t,e){const{slots:n,attrs:r}=e,o=t.i18n||Gi({useScope:t.scope,__useComponent:!0});return()=>{const s=Object.keys(n).filter(d=>d[0]!=="_"),i=le();t.locale&&(i.locale=t.locale),t.plural!==void 0&&(i.plural=B(t.plural)?+t.plural:t.plural);const l=ZT(e,s),a=o[Pc](t.keypath,l,i),c=Re(le(),r),u=B(t.tag)||te(t.tag)?t.tag:jm();return g.h(u,c,a)}}});function eO(t){return be(t)&&!B(t[0])}function Km(t,e,n,r){const{slots:o,attrs:s}=e;return()=>{const i={part:!0};let l=le();t.locale&&(i.locale=t.locale),B(t.format)?i.key=t.format:te(t.format)&&(B(t.format.key)&&(i.key=t.format.key),l=Object.keys(t.format).reduce((f,p)=>n.includes(p)?Re(le(),f,{[p]:t.format[p]}):f,le()));const a=r(t.value,i,l);let c=[i.key];be(a)?c=a.map((f,p)=>{const h=o[f.type],m=h?h({[f.type]:f.value,index:p,parts:a}):[f.value];return eO(m)&&(m[0].key=`${f.type}-${p}`),m}):B(a)&&(c=[a]);const u=Re(le(),s),d=B(t.tag)||te(t.tag)?t.tag:jm();return g.h(d,u,c)}}const qm=g.defineComponent({name:"i18n-n",props:Re({value:{type:Number,required:!0},format:{type:[String,Object]}},Kc),setup(t,e){const n=t.i18n||Gi({useScope:t.scope,__useComponent:!0});return Km(t,e,Cm,(...r)=>n[Fc](...r))}});function tO(t,e){const n=t;if(t.mode==="composition")return n.__getInstance(e)||t.global;{const r=n.__getInstance(e);return r!=null?r.__composer:t.global.__composer}}function nO(t){const e=i=>{process.env.NODE_ENV!=="production"&&kc(ss(rn.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:l,value:a}=i;if(!l||!l.$)throw et(ae.UNEXPECTED_ERROR);const c=tO(t,l.$),u=Jm(a);return[Reflect.apply(c.t,c,[...Gm(u)]),c]};return{created:(i,l)=>{const[a,c]=e(l);$t&&t.global===c&&(i.__i18nWatcher=g.watch(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),i.__composer=c,i.textContent=a},unmounted:i=>{$t&&i.__i18nWatcher&&(i.__i18nWatcher(),i.__i18nWatcher=void 0,delete i.__i18nWatcher),i.__composer&&(i.__composer=void 0,delete i.__composer)},beforeUpdate:(i,{value:l})=>{if(i.__composer){const a=i.__composer,c=Jm(l);i.textContent=Reflect.apply(a.t,a,[...Gm(c)])}},getSSRProps:i=>{const[l]=e(i);return{textContent:l}}}}function Jm(t){if(B(t))return{path:t};if(X(t)){if(!("path"in t))throw et(ae.REQUIRED_VALUE,"path");return t}else throw et(ae.INVALID_VALUE)}function Gm(t){const{path:e,locale:n,args:r,choice:o,plural:s}=t,i={},l=r||{};return B(n)&&(i.locale=n),_e(o)&&(i.plural=o),_e(s)&&(i.plural=s),[e,l,i]}function rO(t,e,...n){const r=X(n[0])?n[0]:{};(ne(r.globalInstall)?r.globalInstall:!0)&&([Wm.name,"I18nT"].forEach(s=>t.component(s,Wm)),[qm.name,"I18nN"].forEach(s=>t.component(s,qm)),[Xm.name,"I18nD"].forEach(s=>t.component(s,Xm))),t.directive("t",nO(e))}const oO=tn("global-vue-i18n");function sO(t={}){const e=__VUE_I18N_LEGACY_API__&&ne(t.legacy)?t.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&kc(ss(rn.DEPRECATE_LEGACY_MODE));const n=ne(t.globalInjection)?t.globalInjection:!0,r=new Map,[o,s]=iO(t,e),i=tn(process.env.NODE_ENV!=="production"?"vue-i18n":"");function l(d){return r.get(d)||null}function a(d,f){r.set(d,f)}function c(d){r.delete(d)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(d,...f){if(process.env.NODE_ENV!=="production"&&(d.__VUE_I18N__=u),d.__VUE_I18N_SYMBOL__=i,d.provide(d.__VUE_I18N_SYMBOL__,u),X(f[0])){const m=f[0];u.__composerExtend=m.__composerExtend,u.__vueI18nExtend=m.__vueI18nExtend}let p=null;!e&&n&&(p=hO(d,u.global)),__VUE_I18N_FULL_INSTALL__&&rO(d,u,...f),__VUE_I18N_LEGACY_API__&&e&&d.mixin(QT(s,s.__composer,u));const h=d.unmount;if(d.unmount=()=>{p&&p(),u.dispose(),h()},process.env.NODE_ENV!=="production"){if(!await VT(d,u))throw et(ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const y=Cc();if(e){const b=s;b.__enableEmitter&&b.__enableEmitter(y)}else{const b=s;b[vr]&&b[vr](y)}y.on("*",ls)}},get global(){return s},dispose(){o.stop()},__instances:r,__getInstance:l,__setInstance:a,__deleteInstance:c};return u}function Gi(t={}){const e=g.getCurrentInstance();if(e==null)throw et(ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw et(ae.NOT_INSTALLED);const n=lO(e),r=cO(n),o=Rm(e),s=aO(t,o);if(s==="global")return Lm(r,t,o),r;if(s==="parent"){let a=uO(n,e,t.__useComponent);return a==null&&(process.env.NODE_ENV!=="production"&&Jn(ss(rn.NOT_FOUND_PARENT_SCOPE)),a=r),a}const i=n;let l=i.__getInstance(e);if(l==null){const a=Re({},t);"__i18n"in o&&(a.__i18n=o.__i18n),r&&(a.__root=r),l=Hc(a),i.__composerExtend&&(l[$c]=i.__composerExtend(l)),fO(i,e,l),i.__setInstance(e,l)}else if(process.env.NODE_ENV!=="production"&&s==="local")throw et(ae.DUPLICATE_USE_I18N_CALLING);return l}function iO(t,e){const n=g.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?n.run(()=>Wc(t)):n.run(()=>Hc(t));if(r==null)throw et(ae.UNEXPECTED_ERROR);return[n,r]}function lO(t){const e=g.inject(t.isCE?oO:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw et(t.isCE?ae.NOT_INSTALLED_WITH_PROVIDE:ae.UNEXPECTED_ERROR);return e}function aO(t,e){return Hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function cO(t){return t.mode==="composition"?t.global:t.global.__composer}function uO(t,e,n=!1){let r=null;const o=e.root;let s=dO(e,n);for(;s!=null;){const i=t;if(t.mode==="composition")r=i.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const l=i.__getInstance(s);l!=null&&(r=l.__composer,n&&r&&!r[Mm]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function dO(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function fO(t,e,n){let r=null;g.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=Cc();const o=n;o[vr]&&o[vr](r),r.on("*",ls)}},e),g.onUnmounted(()=>{const o=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",ls),o[rs]&&o[rs](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const s=o[$c];s&&(s(),delete o[$c])},e)}const pO=["locale","fallbackLocale","availableLocales"],Ym=["t","rt","d","n","tm","te"];function hO(t,e){const n=Object.create(null);return pO.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw et(ae.UNEXPECTED_ERROR);const i=g.isRef(s.value)?{get(){return s.value.value},set(l){s.value.value=l}}:{get(){return s.get&&s.get()}};Object.defineProperty(n,o,i)}),t.config.globalProperties.$i18n=n,Ym.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw et(ae.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${o}`,s)}),()=>{delete t.config.globalProperties.$i18n,Ym.forEach(o=>{delete t.config.globalProperties[`$${o}`]})}}const Xm=g.defineComponent({name:"i18n-d",props:Re({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Kc),setup(t,e){const n=t.i18n||Gi({useScope:t.scope,__useComponent:!0});return Km(t,e,Em,(...r)=>n[Bc](...r))}});if(LT(),rT(Dx),oT(Qx),sT(rm),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=Cr();t.__INTLIFY__=!0,Px(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const mO={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},gO={__name:"vs-editor-link",props:{editor:Object},setup(t){const{t:e}=Gi(),n=t,r=g.ref(!1),o=g.ref(""),s=()=>{n.editor.chain().focus().toggleLink({href:o.value}).run(),r.value=!1,o.value=""};return(i,l)=>(g.openBlock(),g.createElementBlock(g.Fragment,null,[g.createElementVNode("button",{onClick:l[0]||(l[0]=a=>r.value=!0),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},l[4]||(l[4]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])),g.createVNode(kv,{title:g.unref(e)("tiptap.linkTitle"),visible:r.value,"onUpdate:visible":l[3]||(l[3]=a=>r.value=a),size:"small"},{footer:g.withCtx(()=>[g.createElementVNode("div",mO,[g.createElementVNode("button",{style:{border:"1px solid #000"},onClick:l[2]||(l[2]=a=>{r.value=!1,o.value=""}),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},g.toDisplayString(g.unref(e)("tiptap.cancel")),1),g.createElementVNode("button",{onClick:s,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},g.toDisplayString(g.unref(e)("tiptap.create")),1)])]),default:g.withCtx(()=>[g.createVNode(Bh,{modelValue:o.value,"onUpdate:modelValue":l[1]||(l[1]=a=>o.value=a),placeholder:g.unref(e)("tiptap.linkTitle")},null,8,["modelValue","placeholder"])]),_:1},8,["title","visible"])],64))}},yO={class:"flex flex-col gap-[2px] p-[2px]"},bO=["onClick"],EO={__name:"vs-editor-table",props:{editor:Object},setup(t){const{$t:e}=g.getCurrentInstance().proxy,n=t,r=g.ref(!1),o=g.ref("popover"),s=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},i=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},l=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},a=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},d=[{text:e("tiptap.createTable"),function:s},{text:e("tiptap.addColumn"),function:i},{text:e("tiptap.addRow"),function:l},{text:e("tiptap.deleteColumn"),function:a},{text:e("tiptap.deleteRow"),function:c},{text:e("tiptap.deleteTable"),function:u}];return(f,p)=>(g.openBlock(),g.createBlock(Qo,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:p[0]||(p[0]=h=>r.value=h)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},p[1]||(p[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),g.createElementVNode("path",{d:"M3 10h18"}),g.createElementVNode("path",{d:"M10 3v18"})],-1)]),2)]),default:g.withCtx(()=>[g.createElementVNode("div",yO,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(d,(h,m)=>g.createElementVNode("button",{key:m,onClick:h?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},g.toDisplayString(h.text),9,bO)),64))])]),_:1},512))}},wO={},kO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function CO(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",kO,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M8 12l8 0"},null,-1),g.createElementVNode("path",{d:"M6 18l12 0"},null,-1)]))}const SO=Ke(wO,[["render",CO]]),vO={},xO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function TO(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",xO,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M10 12l10 0"},null,-1),g.createElementVNode("path",{d:"M6 18l14 0"},null,-1)]))}const OO=Ke(vO,[["render",TO]]),NO={},AO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function _O(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",AO,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M4 12l10 0"},null,-1),g.createElementVNode("path",{d:"M4 18l14 0"},null,-1)]))}const Qm={left:Ke(NO,[["render",_O]]),center:SO,right:OO},MO={class:"flex gap-[4px] p-1"},RO=["onClick"],LO={__name:"vs-editor-align",props:{editor:Object},setup(t){const e=t,n=g.ref(!1),r=g.ref("popover"),o=g.ref("left"),s=g.computed(()=>e.editor?.isActive({textAlign:"left"})),i=g.computed(()=>e.editor?.isActive({textAlign:"right"})),l=g.computed(()=>e.editor?.isActive({textAlign:"center"})),a=u=>{e.editor&&e.editor.chain().focus().setTextAlign(u).run()},c=g.ref([{id:"left",isActive:s},{id:"center",isActive:l},{id:"right",isActive:i}]);return(u,d)=>(g.openBlock(),g.createBlock(Qo,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:d[0]||(d[0]=f=>n.value=f)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[n.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(Qm)[o.value]),{height:"16",width:"16"}))],2)]),default:g.withCtx(()=>[g.createElementVNode("div",MO,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(c.value,f=>(g.openBlock(),g.createElementBlock("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":f?.isActive}]),key:f?.id,onClick:p=>a(f?.id)},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(Qm)[f?.id]),{height:"16",width:"16"}))],10,RO))),128))])]),_:1},512))}},IO={class:"flex flex-col gap-[2px] p-[2px]"},DO=["onClick"],PO={__name:"vs-editor-type-tag",props:{editor:Object},setup(t){const{$t:e}=g.getCurrentInstance().proxy,n=t,r=g.ref(!1),o=g.ref("popover"),s=()=>{n.editor&&(n.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},i=a=>{n.editor&&(n.editor?.chain().focus().toggleHeading({level:a}).run(),o.value.togglePopover())},l=[{text:"Заголовок 1",id:1,style:"font-[700] text-[30px]"},{text:"Заголовок 2",id:2,style:"font-[700] text-[26px]"},{text:"Заголовок 3",id:3,style:"font-[700] text-[22px]"},{text:"Заголовок 4",id:4,style:"font-[700] text-[18px]"},{text:"Заголовок 5",id:5,style:"font-[500] text-[16px]"},{text:"Заголовок 6",id:6,style:"font-[400] text-[14px]"}];return(a,c)=>(g.openBlock(),g.createBlock(Qo,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:c[0]||(c[0]=u=>r.value=u)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},c[1]||(c[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M3 7v-2h13v2"}),g.createElementVNode("path",{d:"M10 5v14"}),g.createElementVNode("path",{d:"M12 19h-4"}),g.createElementVNode("path",{d:"M15 13v-1h6v1"}),g.createElementVNode("path",{d:"M18 12v7"}),g.createElementVNode("path",{d:"M17 19h2"})],-1)]),2)]),default:g.withCtx(()=>[g.createElementVNode("div",IO,[g.createElementVNode("button",{onClick:s,class:g.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[t.editor?.isActive("paragraph")?"bg-gray-100":""]])},g.toDisplayString(g.unref(e)("tiptap.paragraph")),3),(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(l,(u,d)=>g.createElementVNode("button",{key:d,onClick:f=>i(u?.id),class:g.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,t.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},g.toDisplayString(g.unref(e)(`tiptap.heading${u?.id}`)),11,DO)),64))])]),_:1},512))}},BO={},FO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function $O(t,e,n,r,o,s){return g.openBlock(),g.createElementBlock("svg",FO,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const VO=Ke(BO,[["render",$O]]),HO={components:{VsText:Bh},events:["update:modelValue"],props:{modelValue:{type:String,default:()=>"#000000"},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}},UO={class:"flex items-center w-full"},zO=["disabled"];function jO(t,e,n,r,o,s){const i=g.resolveComponent("vs-text");return g.openBlock(),g.createElementBlock("div",UO,[g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>s.value=l),type:"color",class:g.normalizeClass(["w-10 h-10 py-[2px] px-[3px] dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,zO),[[g.vModelText,s.value]]),n.isTextInputShown?(g.openBlock(),g.createBlock(i,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=l=>s.value=l),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):g.createCommentVNode("",!0)])}const WO=Ke(HO,[["render",jO]]),KO={class:"w-[30px] h-[30px] rounded-full hover:bg-gray-100 justify-center items-center relative flex"},qO={class:"w-[160px]"},JO={class:"flex gap-[4px] mb-[8px]"},GO={class:"flex w-[160px] flex-wrap gap-[4px]"},YO=["onClick"],XO={bold:nv,italic:sv,color:dv,color_picker:{__name:"vs-editor-colorpicker",props:{editor:Object},setup(t){const e=t,n=g.ref("popover"),r=g.ref("#000000"),o=g.ref("#000000"),s=g.ref(["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]),i=a=>{e.editor&&(e.editor.chain().focus().setColor(a).run(),o.value=a,n.value&&n.value.togglePopover())},l=()=>{i(r.value),r.value=""};return(a,c)=>(g.openBlock(),g.createBlock(Qo,{ref_key:"popover",ref:n,placement:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",KO,[c[1]||(c[1]=g.createElementVNode("svg",{class:"text-gray-500",height:"16",width:"16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"})],-1)),g.createElementVNode("span",{class:"absolute h-[2px] w-[40%] bottom-[10px] left-[9px]",style:g.normalizeStyle({backgroundColor:o.value})},null,4)])]),default:g.withCtx(()=>[g.createElementVNode("div",qO,[g.createElementVNode("div",JO,[g.createVNode(WO,{modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=u=>r.value=u)},null,8,["modelValue"]),g.createElementVNode("button",{onClick:l,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[g.createVNode(VO,{class:"h-[24px] w-[24px] text-white"})])]),g.createElementVNode("ul",GO,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(s.value,u=>(g.openBlock(),g.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:g.normalizeStyle({backgroundColor:u}),onClick:d=>i(u),key:u},null,12,YO))),128))])])]),_:1},512))}},bullet_list:qS,ordered_list:YS,blockquote:jS,codeblock:ZS,underline:fv,strike:pv,link:gO,table:EO,text_align:LO,type_tag:PO};function Zm(t,e){return function(){return t.apply(e,arguments)}}const{toString:QO}=Object.prototype,{getPrototypeOf:qc}=Object,{iterator:Yi,toStringTag:eg}=Symbol,Xi=(t=>e=>{const n=QO.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ht=t=>(t=t.toLowerCase(),e=>Xi(e)===t),Qi=t=>e=>typeof e===t,{isArray:oo}=Array,as=Qi("undefined");function ZO(t){return t!==null&&!as(t)&&t.constructor!==null&&!as(t.constructor)&&ct(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const tg=Ht("ArrayBuffer");function eN(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&tg(t.buffer),e}const tN=Qi("string"),ct=Qi("function"),ng=Qi("number"),Zi=t=>t!==null&&typeof t=="object",nN=t=>t===!0||t===!1,el=t=>{if(Xi(t)!=="object")return!1;const e=qc(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(eg in t)&&!(Yi in t)},rN=Ht("Date"),oN=Ht("File"),sN=Ht("Blob"),iN=Ht("FileList"),lN=t=>Zi(t)&&ct(t.pipe),aN=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ct(t.append)&&((e=Xi(t))==="formdata"||e==="object"&&ct(t.toString)&&t.toString()==="[object FormData]"))},cN=Ht("URLSearchParams"),[uN,dN,fN,pN]=["ReadableStream","Request","Response","Headers"].map(Ht),hN=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function cs(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,o;if(typeof t!="object"&&(t=[t]),oo(t))for(r=0,o=t.length;r<o;r++)e.call(null,t[r],r,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),i=s.length;let l;for(r=0;r<i;r++)l=s[r],e.call(null,t[l],l,t)}}function rg(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,o;for(;r-- >0;)if(o=n[r],e===o.toLowerCase())return o;return null}const xr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,og=t=>!as(t)&&t!==xr;function Jc(){const{caseless:t}=og(this)&&this||{},e={},n=(r,o)=>{const s=t&&rg(e,o)||o;el(e[s])&&el(r)?e[s]=Jc(e[s],r):el(r)?e[s]=Jc({},r):oo(r)?e[s]=r.slice():e[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&cs(arguments[r],n);return e}const mN=(t,e,n,{allOwnKeys:r}={})=>(cs(e,(o,s)=>{n&&ct(o)?t[s]=Zm(o,n):t[s]=o},{allOwnKeys:r}),t),gN=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),yN=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},bN=(t,e,n,r)=>{let o,s,i;const l={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),s=o.length;s-- >0;)i=o[s],(!r||r(i,t,e))&&!l[i]&&(e[i]=t[i],l[i]=!0);t=n!==!1&&qc(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},EN=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},wN=t=>{if(!t)return null;if(oo(t))return t;let e=t.length;if(!ng(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},kN=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&qc(Uint8Array)),CN=(t,e)=>{const r=(t&&t[Yi]).call(t);let o;for(;(o=r.next())&&!o.done;){const s=o.value;e.call(t,s[0],s[1])}},SN=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},vN=Ht("HTMLFormElement"),xN=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),sg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),TN=Ht("RegExp"),ig=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};cs(n,(o,s)=>{let i;(i=e(o,s,t))!==!1&&(r[s]=i||o)}),Object.defineProperties(t,r)},ON=t=>{ig(t,(e,n)=>{if(ct(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ct(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},NN=(t,e)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return oo(t)?r(t):r(String(t).split(e)),n},AN=()=>{},_N=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function MN(t){return!!(t&&ct(t.append)&&t[eg]==="FormData"&&t[Yi])}const RN=t=>{const e=new Array(10),n=(r,o)=>{if(Zi(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[o]=r;const s=oo(r)?[]:{};return cs(r,(i,l)=>{const a=n(i,o+1);!as(a)&&(s[l]=a)}),e[o]=void 0,s}}return r};return n(t,0)},LN=Ht("AsyncFunction"),IN=t=>t&&(Zi(t)||ct(t))&&ct(t.then)&&ct(t.catch),lg=((t,e)=>t?setImmediate:e?((n,r)=>(xr.addEventListener("message",({source:o,data:s})=>{o===xr&&s===n&&r.length&&r.shift()()},!1),o=>{r.push(o),xr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ct(xr.postMessage)),DN=typeof queueMicrotask<"u"?queueMicrotask.bind(xr):typeof process<"u"&&process.nextTick||lg,O={isArray:oo,isArrayBuffer:tg,isBuffer:ZO,isFormData:aN,isArrayBufferView:eN,isString:tN,isNumber:ng,isBoolean:nN,isObject:Zi,isPlainObject:el,isReadableStream:uN,isRequest:dN,isResponse:fN,isHeaders:pN,isUndefined:as,isDate:rN,isFile:oN,isBlob:sN,isRegExp:TN,isFunction:ct,isStream:lN,isURLSearchParams:cN,isTypedArray:kN,isFileList:iN,forEach:cs,merge:Jc,extend:mN,trim:hN,stripBOM:gN,inherits:yN,toFlatObject:bN,kindOf:Xi,kindOfTest:Ht,endsWith:EN,toArray:wN,forEachEntry:CN,matchAll:SN,isHTMLForm:vN,hasOwnProperty:sg,hasOwnProp:sg,reduceDescriptors:ig,freezeMethods:ON,toObjectSet:NN,toCamelCase:xN,noop:AN,toFiniteNumber:_N,findKey:rg,global:xr,isContextDefined:og,isSpecCompliantForm:MN,toJSONObject:RN,isAsyncFn:LN,isThenable:IN,setImmediate:lg,asap:DN,isIterable:t=>t!=null&&ct(t[Yi])};function J(t,e,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}O.inherits(J,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.status}}});const ag=J.prototype,cg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{cg[t]={value:t}}),Object.defineProperties(J,cg),Object.defineProperty(ag,"isAxiosError",{value:!0}),J.from=(t,e,n,r,o,s)=>{const i=Object.create(ag);return O.toFlatObject(t,i,function(a){return a!==Error.prototype},l=>l!=="isAxiosError"),J.call(i,t.message,e,n,r,o),i.cause=t,i.name=t.name,s&&Object.assign(i,s),i};const PN=null;function Gc(t){return O.isPlainObject(t)||O.isArray(t)}function ug(t){return O.endsWith(t,"[]")?t.slice(0,-2):t}function dg(t,e,n){return t?t.concat(e).map(function(o,s){return o=ug(o),!n&&s?"["+o+"]":o}).join(n?".":""):e}function BN(t){return O.isArray(t)&&!t.some(Gc)}const FN=O.toFlatObject(O,{},null,function(e){return/^is[A-Z]/.test(e)});function tl(t,e,n){if(!O.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=O.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!O.isUndefined(y[m])});const r=n.metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&O.isSpecCompliantForm(e);if(!O.isFunction(o))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(O.isDate(h))return h.toISOString();if(O.isBoolean(h))return h.toString();if(!a&&O.isBlob(h))throw new J("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(h)||O.isTypedArray(h)?a&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,m,y){let b=h;if(h&&!y&&typeof h=="object"){if(O.endsWith(m,"{}"))m=r?m:m.slice(0,-2),h=JSON.stringify(h);else if(O.isArray(h)&&BN(h)||(O.isFileList(h)||O.endsWith(m,"[]"))&&(b=O.toArray(h)))return m=ug(m),b.forEach(function(k,E){!(O.isUndefined(k)||k===null)&&e.append(i===!0?dg([m],E,s):i===null?m:m+"[]",c(k))}),!1}return Gc(h)?!0:(e.append(dg(y,m,s),c(h)),!1)}const d=[],f=Object.assign(FN,{defaultVisitor:u,convertValue:c,isVisitable:Gc});function p(h,m){if(!O.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(h),O.forEach(h,function(b,w){(!(O.isUndefined(b)||b===null)&&o.call(e,b,O.isString(w)?w.trim():w,m,f))===!0&&p(b,m?m.concat(w):[w])}),d.pop()}}if(!O.isObject(t))throw new TypeError("data must be an object");return p(t),e}function fg(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Yc(t,e){this._pairs=[],t&&tl(t,this,e)}const pg=Yc.prototype;pg.append=function(e,n){this._pairs.push([e,n])},pg.toString=function(e){const n=e?function(r){return e.call(this,r,fg)}:fg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function $N(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hg(t,e,n){if(!e)return t;const r=n&&n.encode||$N;O.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(o?s=o(e,n):s=O.isURLSearchParams(e)?e.toString():new Yc(e,n).toString(r),s){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class mg{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){O.forEach(this.handlers,function(r){r!==null&&e(r)})}}const gg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},VN={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Yc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Xc=typeof window<"u"&&typeof document<"u",Qc=typeof navigator=="object"&&navigator||void 0,HN=Xc&&(!Qc||["ReactNative","NativeScript","NS"].indexOf(Qc.product)<0),UN=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zN=Xc&&window.location.href||"http://localhost",Je={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xc,hasStandardBrowserEnv:HN,hasStandardBrowserWebWorkerEnv:UN,navigator:Qc,origin:zN},Symbol.toStringTag,{value:"Module"})),...VN};function jN(t,e){return tl(t,new Je.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return Je.isNode&&O.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function WN(t){return O.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function KN(t){const e={},n=Object.keys(t);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],e[s]=t[s];return e}function yg(t){function e(n,r,o,s){let i=n[s++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),a=s>=n.length;return i=!i&&O.isArray(o)?o.length:i,a?(O.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!l):((!o[i]||!O.isObject(o[i]))&&(o[i]=[]),e(n,r,o[i],s)&&O.isArray(o[i])&&(o[i]=KN(o[i])),!l)}if(O.isFormData(t)&&O.isFunction(t.entries)){const n={};return O.forEachEntry(t,(r,o)=>{e(WN(r),o,n,0)}),n}return null}function qN(t,e,n){if(O.isString(t))try{return(e||JSON.parse)(t),O.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const us={transitional:gg,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=O.isObject(e);if(s&&O.isHTMLForm(e)&&(e=new FormData(e)),O.isFormData(e))return o?JSON.stringify(yg(e)):e;if(O.isArrayBuffer(e)||O.isBuffer(e)||O.isStream(e)||O.isFile(e)||O.isBlob(e)||O.isReadableStream(e))return e;if(O.isArrayBufferView(e))return e.buffer;if(O.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return jN(e,this.formSerializer).toString();if((l=O.isFileList(e))||r.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return tl(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),qN(e)):e}],transformResponse:[function(e){const n=this.transitional||us.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(O.isResponse(e)||O.isReadableStream(e))return e;if(e&&O.isString(e)&&(r&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(l){if(i)throw l.name==="SyntaxError"?J.from(l,J.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Je.classes.FormData,Blob:Je.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch"],t=>{us.headers[t]={}});const JN=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),GN=t=>{const e={};let n,r,o;return t&&t.split(`
|
|
139
|
+
`).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!n||e[n]&&JN[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},bg=Symbol("internals");function ds(t){return t&&String(t).trim().toLowerCase()}function nl(t){return t===!1||t==null?t:O.isArray(t)?t.map(nl):String(t)}function YN(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const XN=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Zc(t,e,n,r,o){if(O.isFunction(r))return r.call(this,e,n);if(o&&(e=n),!!O.isString(e)){if(O.isString(r))return e.indexOf(r)!==-1;if(O.isRegExp(r))return r.test(e)}}function QN(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function ZN(t,e){const n=O.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(o,s,i){return this[r].call(this,e,o,s,i)},configurable:!0})})}let ut=class{constructor(e){e&&this.set(e)}set(e,n,r){const o=this;function s(l,a,c){const u=ds(a);if(!u)throw new Error("header name must be a non-empty string");const d=O.findKey(o,u);(!d||o[d]===void 0||c===!0||c===void 0&&o[d]!==!1)&&(o[d||a]=nl(l))}const i=(l,a)=>O.forEach(l,(c,u)=>s(c,u,a));if(O.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(O.isString(e)&&(e=e.trim())&&!XN(e))i(GN(e),n);else if(O.isObject(e)&&O.isIterable(e)){let l={},a,c;for(const u of e){if(!O.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[c=u[0]]=(a=l[c])?O.isArray(a)?[...a,u[1]]:[a,u[1]]:u[1]}i(l,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=ds(e),e){const r=O.findKey(this,e);if(r){const o=this[r];if(!n)return o;if(n===!0)return YN(o);if(O.isFunction(n))return n.call(this,o,r);if(O.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ds(e),e){const r=O.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Zc(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let o=!1;function s(i){if(i=ds(i),i){const l=O.findKey(r,i);l&&(!n||Zc(r,r[l],l,n))&&(delete r[l],o=!0)}}return O.isArray(e)?e.forEach(s):s(e),o}clear(e){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!e||Zc(this,this[s],s,e,!0))&&(delete this[s],o=!0)}return o}normalize(e){const n=this,r={};return O.forEach(this,(o,s)=>{const i=O.findKey(r,s);if(i){n[i]=nl(o),delete n[s];return}const l=e?QN(s):String(s).trim();l!==s&&delete n[s],n[l]=nl(o),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return O.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=e&&O.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
140
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(o=>r.set(o)),r}static accessor(e){const r=(this[bg]=this[bg]={accessors:{}}).accessors,o=this.prototype;function s(i){const l=ds(i);r[l]||(ZN(o,i),r[l]=!0)}return O.isArray(e)?e.forEach(s):s(e),this}};ut.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),O.reduceDescriptors(ut.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),O.freezeMethods(ut);function eu(t,e){const n=this||us,r=e||n,o=ut.from(r.headers);let s=r.data;return O.forEach(t,function(l){s=l.call(n,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function Eg(t){return!!(t&&t.__CANCEL__)}function so(t,e,n){J.call(this,t??"canceled",J.ERR_CANCELED,e,n),this.name="CanceledError"}O.inherits(so,J,{__CANCEL__:!0});function wg(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new J("Request failed with status code "+n.status,[J.ERR_BAD_REQUEST,J.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function eA(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function tA(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,s=0,i;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),u=r[s];i||(i=c),n[o]=a,r[o]=c;let d=s,f=0;for(;d!==o;)f+=n[d++],d=d%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const p=u&&c-u;return p?Math.round(f*1e3/p):void 0}}function nA(t,e){let n=0,r=1e3/e,o,s;const i=(c,u=Date.now())=>{n=u,o=null,s&&(clearTimeout(s),s=null),t.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?i(c,u):(o=c,s||(s=setTimeout(()=>{s=null,i(o)},r-d)))},()=>o&&i(o)]}const rl=(t,e,n=3)=>{let r=0;const o=tA(50,250);return nA(s=>{const i=s.loaded,l=s.lengthComputable?s.total:void 0,a=i-r,c=o(a),u=i<=l;r=i;const d={loaded:i,total:l,progress:l?i/l:void 0,bytes:a,rate:c||void 0,estimated:c&&l&&u?(l-i)/c:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(d)},n)},kg=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Cg=t=>(...e)=>O.asap(()=>t(...e)),rA=Je.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Je.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Je.origin),Je.navigator&&/(msie|trident)/i.test(Je.navigator.userAgent)):()=>!0,oA=Je.hasStandardBrowserEnv?{write(t,e,n,r,o,s){const i=[t+"="+encodeURIComponent(e)];O.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),O.isString(r)&&i.push("path="+r),O.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function sA(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function iA(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Sg(t,e,n){let r=!sA(e);return t&&(r||n==!1)?iA(t,e):e}const vg=t=>t instanceof ut?{...t}:t;function Tr(t,e){e=e||{};const n={};function r(c,u,d,f){return O.isPlainObject(c)&&O.isPlainObject(u)?O.merge.call({caseless:f},c,u):O.isPlainObject(u)?O.merge({},u):O.isArray(u)?u.slice():u}function o(c,u,d,f){if(O.isUndefined(u)){if(!O.isUndefined(c))return r(void 0,c,d,f)}else return r(c,u,d,f)}function s(c,u){if(!O.isUndefined(u))return r(void 0,u)}function i(c,u){if(O.isUndefined(u)){if(!O.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function l(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const a={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(c,u,d)=>o(vg(c),vg(u),d,!0)};return O.forEach(Object.keys(Object.assign({},t,e)),function(u){const d=a[u]||o,f=d(t[u],e[u],u);O.isUndefined(f)&&d!==l||(n[u]=f)}),n}const xg=t=>{const e=Tr({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:l}=e;e.headers=i=ut.from(i),e.url=hg(Sg(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(O.isFormData(n)){if(Je.hasStandardBrowserEnv||Je.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((a=i.getContentType())!==!1){const[c,...u]=a?a.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Je.hasStandardBrowserEnv&&(r&&O.isFunction(r)&&(r=r(e)),r||r!==!1&&rA(e.url))){const c=o&&s&&oA.read(s);c&&i.set(o,c)}return e},lA=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const o=xg(t);let s=o.data;const i=ut.from(o.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:c}=o,u,d,f,p,h;function m(){p&&p(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function b(){if(!y)return;const k=ut.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),x={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:k,config:t,request:y};wg(function(T){n(T),m()},function(T){r(T),m()},x),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new J("Request aborted",J.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new J("Network Error",J.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const x=o.transitional||gg;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),r(new J(E,x.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,t,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y&&O.forEach(i.toJSON(),function(E,x){y.setRequestHeader(x,E)}),O.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),l&&l!=="json"&&(y.responseType=o.responseType),c&&([f,h]=rl(c,!0),y.addEventListener("progress",f)),a&&y.upload&&([d,p]=rl(a),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",p)),(o.cancelToken||o.signal)&&(u=k=>{y&&(r(!k||k.type?new so(null,t,y):k),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const w=eA(o.url);if(w&&Je.protocols.indexOf(w)===-1){r(new J("Unsupported protocol "+w+":",J.ERR_BAD_REQUEST,t));return}y.send(s||null)})},aA=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,o;const s=function(c){if(!o){o=!0,l();const u=c instanceof Error?c:this.reason;r.abort(u instanceof J?u:new so(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,s(new J(`timeout ${e} of ms exceeded`,J.ETIMEDOUT))},e);const l=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>O.asap(l),a}},cA=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,o;for(;r<n;)o=r+e,yield t.slice(r,o),r=o},uA=async function*(t,e){for await(const n of dA(t))yield*cA(n,e)},dA=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Tg=(t,e,n,r)=>{const o=uA(t,e);let s=0,i,l=a=>{i||(i=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:c,value:u}=await o.next();if(c){l(),a.close();return}let d=u.byteLength;if(n){let f=s+=d;n(f)}a.enqueue(new Uint8Array(u))}catch(c){throw l(c),c}},cancel(a){return l(a),o.return()}},{highWaterMark:2})},ol=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Og=ol&&typeof ReadableStream=="function",fA=ol&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Ng=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pA=Og&&Ng(()=>{let t=!1;const e=new Request(Je.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Ag=64*1024,tu=Og&&Ng(()=>O.isReadableStream(new Response("").body)),sl={stream:tu&&(t=>t.body)};ol&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!sl[e]&&(sl[e]=O.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new J(`Response type '${e}' is not supported`,J.ERR_NOT_SUPPORT,r)})})})(new Response);const hA=async t=>{if(t==null)return 0;if(O.isBlob(t))return t.size;if(O.isSpecCompliantForm(t))return(await new Request(Je.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(O.isArrayBufferView(t)||O.isArrayBuffer(t))return t.byteLength;if(O.isURLSearchParams(t)&&(t=t+""),O.isString(t))return(await fA(t)).byteLength},mA=async(t,e)=>{const n=O.toFiniteNumber(t.getContentLength());return n??hA(e)},nu={http:PN,xhr:lA,fetch:ol&&(async t=>{let{url:e,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:l,onUploadProgress:a,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:f}=xg(t);c=c?(c+"").toLowerCase():"text";let p=aA([o,s&&s.toAbortSignal()],i),h;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(a&&pA&&n!=="get"&&n!=="head"&&(y=await mA(u,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),v;if(O.isFormData(r)&&(v=x.headers.get("content-type"))&&u.setContentType(v),x.body){const[T,_]=kg(y,rl(Cg(a)));r=Tg(x.body,Ag,T,_)}}O.isString(d)||(d=d?"include":"omit");const b="credentials"in Request.prototype;h=new Request(e,{...f,signal:p,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:b?d:void 0});let w=await fetch(h,f);const k=tu&&(c==="stream"||c==="response");if(tu&&(l||k&&m)){const x={};["status","statusText","headers"].forEach(P=>{x[P]=w[P]});const v=O.toFiniteNumber(w.headers.get("content-length")),[T,_]=l&&kg(v,rl(Cg(l),!0))||[];w=new Response(Tg(w.body,Ag,T,()=>{_&&_(),m&&m()}),x)}c=c||"text";let E=await sl[O.findKey(sl,c)||"text"](w,t);return!k&&m&&m(),await new Promise((x,v)=>{wg(x,v,{data:E,headers:ut.from(w.headers),status:w.status,statusText:w.statusText,config:t,request:h})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new J("Network Error",J.ERR_NETWORK,t,h),{cause:b.cause||b}):J.from(b,b&&b.code,t,h)}})};O.forEach(nu,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const _g=t=>`- ${t}`,gA=t=>O.isFunction(t)||t===null||t===!1,Mg={getAdapter:t=>{t=O.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let s=0;s<e;s++){n=t[s];let i;if(r=n,!gA(n)&&(r=nu[(i=String(n)).toLowerCase()],r===void 0))throw new J(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+s]=r}if(!r){const s=Object.entries(o).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let i=e?s.length>1?`since :
|
|
141
|
+
`+s.map(_g).join(`
|
|
142
|
+
`):" "+_g(s[0]):"as no adapter specified";throw new J("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:nu};function ru(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new so(null,t)}function Rg(t){return ru(t),t.headers=ut.from(t.headers),t.data=eu.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mg.getAdapter(t.adapter||us.adapter)(t).then(function(r){return ru(t),r.data=eu.call(t,t.transformResponse,r),r.headers=ut.from(r.headers),r},function(r){return Eg(r)||(ru(t),r&&r.response&&(r.response.data=eu.call(t,t.transformResponse,r.response),r.response.headers=ut.from(r.response.headers))),Promise.reject(r)})}const Lg="1.10.0",il={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{il[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Ig={};il.transitional=function(e,n,r){function o(s,i){return"[Axios v"+Lg+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,l)=>{if(e===!1)throw new J(o(i," has been removed"+(n?" in "+n:"")),J.ERR_DEPRECATED);return n&&!Ig[i]&&(Ig[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,i,l):!0}},il.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function yA(t,e,n){if(typeof t!="object")throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const s=r[o],i=e[s];if(i){const l=t[s],a=l===void 0||i(l,s,t);if(a!==!0)throw new J("option "+s+" must be "+a,J.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new J("Unknown option "+s,J.ERR_BAD_OPTION)}}const ll={assertOptions:yA,validators:il},on=ll.validators;let Or=class{constructor(e){this.defaults=e||{},this.interceptors={request:new mg,response:new mg}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
143
|
+
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Tr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&ll.assertOptions(r,{silentJSONParsing:on.transitional(on.boolean),forcedJSONParsing:on.transitional(on.boolean),clarifyTimeoutError:on.transitional(on.boolean)},!1),o!=null&&(O.isFunction(o)?n.paramsSerializer={serialize:o}:ll.assertOptions(o,{encode:on.function,serialize:on.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ll.assertOptions(n,{baseUrl:on.spelling("baseURL"),withXsrfToken:on.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&O.merge(s.common,s[n.method]);s&&O.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),n.headers=ut.concat(i,s);const l=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,f;if(!a){const h=[Rg.bind(this),void 0];for(h.unshift.apply(h,l),h.push.apply(h,c),f=h.length,u=Promise.resolve(n);d<f;)u=u.then(h[d++],h[d++]);return u}f=l.length;let p=n;for(d=0;d<f;){const h=l[d++],m=l[d++];try{p=h(p)}catch(y){m.call(this,y);break}}try{u=Rg.call(this,p)}catch(h){return Promise.reject(h)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Tr(this.defaults,e);const n=Sg(e.baseURL,e.url,e.allowAbsoluteUrls);return hg(n,e.params,e.paramsSerializer)}};O.forEach(["delete","get","head","options"],function(e){Or.prototype[e]=function(n,r){return this.request(Tr(r||{},{method:e,url:n,data:(r||{}).data}))}}),O.forEach(["post","put","patch"],function(e){function n(r){return function(s,i,l){return this.request(Tr(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Or.prototype[e]=n(),Or.prototype[e+"Form"]=n(!0)});let bA=class $g{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(l=>{r.subscribe(l),s=l}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},e(function(s,i,l){r.reason||(r.reason=new so(s,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new $g(function(o){e=o}),cancel:e}}};function EA(t){return function(n){return t.apply(null,n)}}function wA(t){return O.isObject(t)&&t.isAxiosError===!0}const ou={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ou).forEach(([t,e])=>{ou[e]=t});function Dg(t){const e=new Or(t),n=Zm(Or.prototype.request,e);return O.extend(n,Or.prototype,e,{allOwnKeys:!0}),O.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return Dg(Tr(t,o))},n}const xe=Dg(us);xe.Axios=Or,xe.CanceledError=so,xe.CancelToken=bA,xe.isCancel=Eg,xe.VERSION=Lg,xe.toFormData=tl,xe.AxiosError=J,xe.Cancel=xe.CanceledError,xe.all=function(e){return Promise.all(e)},xe.spread=EA,xe.isAxiosError=wA,xe.mergeConfig=Tr,xe.AxiosHeaders=ut,xe.formToJSON=t=>yg(O.isHTMLForm(t)?new FormData(t):t),xe.getAdapter=Mg.getAdapter,xe.HttpStatusCode=ou,xe.default=xe;const{Axios:r_,AxiosError:o_,CanceledError:s_,isCancel:i_,CancelToken:l_,VERSION:a_,all:c_,Cancel:u_,isAxiosError:d_,spread:f_,toFormData:p_,AxiosHeaders:h_,HttpStatusCode:m_,formToJSON:g_,getAdapter:y_,mergeConfig:b_}=xe,kA=async t=>{try{const e=new FormData;e.append("unique","true"),e.append("file",t);const{data:n}=await xe.post("/file/upload/uploads?id=&form=&table=",e);return n?.result}catch(e){console.error(e)}},CA=async(t,e)=>{const n=e.clipboardData?.items;if(n){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:i}=t,{tr:l}=s,a=Ar.fromSchema(t.state.schema),c=new DOMParser().parseFromString(r,"text/html").body,u=a.parse(c),d=l.replaceSelectionWith(u);return i(d),e.preventDefault(),!0}if(o){const{state:s,dispatch:i}=t,{tr:l}=s,a=l.insertText(o,s.selection.from,s.selection.to);return i(a),e.preventDefault(),!0}for(let s=0;s<n.length;s++){const i=n[s];if(i.type.startsWith("image/")){const l=i.getAsFile();if(l){const a=await kA(l),{schema:c}=t.state,u=c.nodes.image.create({src:a?.file_path}),d=t.state.tr.replaceSelectionWith(u);return t.dispatch(d),e.preventDefault(),!0}}}}return!1},SA=Fe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,pe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ca({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),vA=["font-[700] text-[30px]","font-[700] text-[26px]","font-[700] text-[22px]","font-[700] text-[18px]","font-[500] text-[16px]","font-[400] text-[14px]"],xA=SA.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:t=>{const e=t.level||1;return{class:`heading-level-${e} ${vA[e-1]}`}}}}}}),TA=Fe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}).configure({HTMLAttributes:{class:"min-h-[1rem]"}}),OA={class:"bg-white border border border-solid border-gray-200 rounded-xl"},NA={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},AA={__name:"vs-richtext",props:{modelValue:{type:String,default:()=>""},toolbar:{type:Array,default:()=>["bold","italic","underline","text_align","color","color_picker","blockquote","bullet_list","ordered_list","codeblock","text_more","strike","link","table"]}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,o=lk({content:n.modelValue,extensions:[MS,VS,fk,yk,wk,Sk,Tk,Nk,_k,Mk,Lk,Ik,jk,TA,Jk,HS,wC,Yk,qk,Gk,xA,$S,kC,OS.configure({types:["heading","paragraph"]}),SC,TS.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),_S,AS,NS,EC.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0})],editorProps:{handlePaste:CA}}),s=g.computed(()=>n.toolbar.map(l=>XO[l]));g.watch(o,l=>{l&&o.value.on("update",a=>{const c=a.editor.getHTML();c!==n.modelValue&&r("update:modelValue",c==='<p class="min-h-[1rem]"></p>'?null:c)})});const i=()=>{o.value&&!o.value.isFocused&&o.value.commands.focus()};return(l,a)=>(g.openBlock(),g.createElementBlock("div",OA,[g.createElementVNode("div",NA,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(s.value,c=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(c),{editor:g.unref(o)},null,8,["editor"]))),256))]),g.createElementVNode("div",{onClick:i,class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800"},[g.createVNode(g.unref(ik),{editor:g.unref(o),class:"relative w-full"},null,8,["editor"])])]))}},_A={},MA={},RA={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",linkTitle:"Enter Link",create:"Create",cancel:"Cancel"},LA={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},su=sO({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{..._A,tiptap:RA},uk:{...MA,tiptap:LA}}});return{install:(t,e={})=>{if(e.i18nConfig){const n=e.i18nConfig,r=su.global?.messages?.value||su.messages;r&&n.global?.messages?.value&&Object.keys(r).forEach(o=>{n.global.mergeLocaleMessage?n.global.mergeLocaleMessage(o,r[o]):n.global.setLocaleMessage(o,r[o])})}else t.use(su);t.component("vs-richtext",AA)}}});
|