reactjs-tiptap-editor 0.0.45 → 0.0.47

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.
@@ -1,17 +1,17 @@
1
- "use strict";const Xp=require("react"),Qp=require("react-dom");function oe(n){this.content=n}oe.prototype={constructor:oe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new oe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new oe(t)},addToStart:function(n,e){return new oe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new oe(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new oe(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=oe.from(n),n.size?new oe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=oe.from(n),n.size?new oe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=oe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};oe.from=function(n){if(n instanceof oe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new oe(e)};function Tu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Tu(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Eu(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,f=Math.min(s.text.length,l.text.length);for(;c<f&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Eu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let f=l+1;a.nodesBetween(Math.max(0,e-f),Math.min(a.content.size,t-f),r,i+f)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=a}return new b(r,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new b(i,o)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Tu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Eu(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Sr(0,e);if(e==this.size)return Sr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?Sr(r+1,s):Sr(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new b(t||e,r)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const bo={index:0,offset:0};function Sr(n,e){return bo.index=n,bo.offset=e,bo}function Yr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Yr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Yr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class _{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _.none;if(e instanceof _)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}_.none=[];class Xr extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Nu(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(Mu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new w(e,r,i)}}w.empty=new w(b.empty,0,0);function Mu(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Mu(o.content,e-i-1,t-i-1)))}function Nu(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Nu(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Zp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Ru(n,e,t,0)}function Ru(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Ru(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Lt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=em(t,n);return Lt(o,Iu(n,s,l,e,r))}else return Lt(o,Qr(n,e,r))}function Du(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function ds(n,e,t){let r=n.node(t);return Du(r,e.node(t)),r}function zt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Kn(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(zt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)zt(i.child(l),r);e&&e.depth==t&&e.textOffset&&zt(e.nodeBefore,r)}function Lt(n,e){return n.type.checkContent(e),n.copy(e)}function Iu(n,e,t,r,i){let o=n.depth>i&&ds(n,e,i+1),s=r.depth>i&&ds(t,r,i+1),l=[];return Kn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Du(o,s),zt(Lt(o,Iu(n,e,t,r,i+1)),l)):(o&&zt(Lt(o,Qr(n,e,i+1)),l),Kn(e,t,i,l),s&&zt(Lt(s,Qr(t,r,i+1)),l)),Kn(r,null,i,l),new b(l)}function Qr(n,e,t){let r=[];if(Kn(null,n,t,r),n.depth>t){let i=ds(n,e,t+1);zt(Lt(i,Qr(n,e,t+1)),r)}return Kn(e,null,t,r),new b(r)}function em(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class rr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Zr(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new rr(t,r,o)}static resolveCached(e,t){let r=da.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else da.set(e,r=new tm);let i=r.elts[r.i]=rr.resolve(e,t);return r.i=(r.i+1)%nm,i}}class tm{constructor(){this.elts=[],this.i=0}}const nm=12,da=new WeakMap;class Zr{constructor(e,t,r){this.$from=e,this.$to=t,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 rm=Object.create(null);class Ne{constructor(e,t,r,i=_.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||b.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Yr(this.attrs,t||e.defaultAttrs||rm)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new Ne(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ne(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new w(c,i.depth-s,o.depth-s)}replace(e,t,r){return Zp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return rr.resolveCached(this,e)}resolveNoCache(e){return rr.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Pu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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=_.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}Ne.prototype.text=void 0;class ei extends Ne{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Pu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ei(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ei(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Pu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ht{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new im(e,t);if(r.next==null)return Ht.empty;let i=$u(r);r.next&&r.err("Unexpected trailing text");let o=um(fm(i));return dm(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:f,next:u}=s.next[c];if(!(f.isText||f.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let d=o(u,l.concat(f));if(d)return d}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2
- `)}}Ht.empty=new Ht(!0);class im{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function $u(n){let e=[];do e.push(om(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function om(n){let e=[];do e.push(sm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sm(n){let e=cm(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=lm(n,e);else break;return e}function ha(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function lm(n,e){let t=ha(n),r=t;return n.eat(",")&&(n.next!="}"?r=ha(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function am(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function cm(n){if(n.eat("(")){let e=$u(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=am(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function fm(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let f=t();i(o(s.expr,a),f),a=f}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let f=t();r(a,f),i(o(s.expr,a),f),a=f}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Bu(n,e){return e-n}function pa(n,e){let t=[];return r(e),t.sort(Bu);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function um(n){let e=Object.create(null);return t(pa(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f<i.length;f++)i[f][0]==l&&(c=i[f][1]);pa(n,a).forEach(f=>{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let o=e[r.join(",")]=new Ht(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Bu);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function dm(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function zu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Lu(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Fu(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function _u(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new pm(n,r,e[r]);return t}let ma=class ju{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_u(e,r.attrs),this.defaultAttrs=zu(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==Ht.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:Lu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ne(this,this.computeAttrs(e),b.from(t),_.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new Ne(this,this.computeAttrs(e),t,_.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(b.empty,!0);return o?new Ne(this,e,t.append(o),_.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Fu(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new ju(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function hm(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class pm{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class eo{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=_u(e,i.attrs),this.excluded=null;let o=zu(this.attrs);this.instance=o?new _(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _(this,Lu(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new eo(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class mm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=oe.from(e.nodes),t.marks=oe.from(e.marks||{}),this.nodes=ma.compile(this.spec.nodes,this),this.marks=eo.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Ht.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ga(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ga(this,s.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,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ma){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(t,r,i)}text(e,t){let r=this.nodes.text;return new ei(r,r.defaultAttrs,e,_.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Ne.fromJSON(this,e)}markFromJSON(e){return _.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ga(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function gm(n){return n.tag!=null}function ym(n){return n.style!=null}class vn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(gm(i))this.tags.push(i);else if(ym(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new ba(this,t,!1);return r.addAll(e,_.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ba(this,t,!0);return r.addAll(e,_.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Sm(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=va(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=va(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vn(e,vn.schemaRules(e)))}}const Vu={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},bm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wu={ol:!0,ul:!0},ti=1,ni=2,Jn=4;function ya(n,e,t){return e!=null?(e?ti:0)|(e==="full"?ni:0):n&&n.whitespace=="pre"?ti|ni:t&~Jn}class wr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_.none,this.match=o||(s&Jn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ti)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ba{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=ya(null,t.preserveWhitespace,0)|(r?Jn:0);i?o=new wr(i.type,i.attrs,_.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new wr(null,null,_.none,!0,null,s):o=new wr(e.schema.topNodeType,null,_.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&ni||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&ti)i.options&ni?r=r.replace(/\r\n?/g,`
3
- `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;Wu.hasOwnProperty(i)&&this.parser.normalizeLists&&vm(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:bm.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(Vu.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let f=s&&s.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):Sa(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=ya(e,o,s.options);s.options&Jn&&s.content.length==0&&(l|=Jn);let a=_.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Sa(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new wr(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!f||f.name!=c&&f.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function vm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Sm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function va(n){let e={};for(let t in n)e[t]=n[t];return e}function Sa(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:f}=l.edge(a);if(c==e||o.indexOf(f)<0&&s(f))return!0}};if(s(i.contentMatch))return!0}}class Gt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=vo(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],f=this.serializeMark(c,s.isInline,t);f&&(o.push([c,i]),i.appendChild(f.dom),i=f.contentDOM||f.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=$r(vo(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&$r(vo(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return $r(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Gt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=wa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return wa(e.marks)}}function wa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function vo(n){return n.document||window.document}const xa=new WeakMap;function wm(n){let e=xa.get(n);return e===void 0&&xa.set(n,e=xm(n)),e}function xm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function $r(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=wm(r))&&o.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 s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let u in c)if(c[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),c[u]):a.setAttribute(u,c[u])}}for(let u=f;u<e.length;u++){let d=e[u];if(d===0){if(u<e.length-1||u>f)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}=$r(n,d,t,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}const Hu=65535,Uu=Math.pow(2,16);function Cm(n,e){return n+e*Uu}function Ca(n){return n&Hu}function Om(n){return(n-(n&Hu))/Uu}const Ku=1,Ju=2,Br=4,qu=8;class hs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&qu)>0}get deletedBefore(){return(this.delInfo&(Ku|Br))>0}get deletedAfter(){return(this.delInfo&(Ju|Br))>0}get deletedAcross(){return(this.delInfo&Br)>0}}class ve{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ve.empty)return ve.empty}recover(e){let t=0,r=Ca(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Om(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],f=this.ranges[l+s],u=a+c;if(e<=u){let d=c?e==a?-1:e==u?1:t:t,p=a+i+(d<0?0:f);if(r)return p;let h=e==(t<0?a:u)?null:Cm(l/3,e-a),m=e==a?Ju:e==u?Ku:Br;return(t<0?e!=a:e!=u)&&(m|=qu),new hs(p,m,h)}i+=f-c}return r?e+i:new hs(e+i,0,null)}touches(e,t){let r=0,i=Ca(t),o=this.inverted?2:1,s=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+o],f=a+c;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],f=this.ranges[i+r];e(l,l+c,a,a+f),o+=f-c}}invert(){return new ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ve.empty:new ve(e<0?[0,-e,0]:[0,0,e])}}ve.empty=new ve([]);class hn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new hn(this.maps,this.mirror,e,t)}copy(){return new hn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new hn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new hs(e,i,null)}}const So=Object.create(null);class de{getMap(){return ve.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=So[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in So)throw new RangeError("Duplicate use of step JSON ID "+e);return So[e]=t,t.prototype.jsonID=e,t}}class Q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Q(e,null)}static fail(e){return new Q(null,e)}static fromReplace(e,t,r,i){try{return Q.ok(e.replace(t,r,i))}catch(o){if(o instanceof Xr)return Q.fail(o.message);throw o}}}function ml(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(ml(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return b.fromArray(r)}class St extends de{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new w(ml(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,o)}invert(){return new _e(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new St(t.pos,r.pos,this.mark)}merge(e){return e instanceof St&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new St(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new St(t.from,t.to,e.markFromJSON(t.mark))}}de.jsonID("addMark",St);class _e extends de{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(ml(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,r)}invert(){return new St(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _e(t.pos,r.pos,this.mark)}merge(e){return e instanceof _e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _e(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _e(t.from,t.to,e.markFromJSON(t.mark))}}de.jsonID("removeMark",_e);class wt extends de{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new wt(this.pos,t.marks[i]);return new wt(this.pos,this.mark)}}return new Sn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wt(t.pos,e.markFromJSON(t.mark))}}de.jsonID("addNodeMark",wt);class Sn extends de{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sn(t.pos,e.markFromJSON(t.mark))}}de.jsonID("removeNodeMark",Sn);class te extends de{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ps(e,this.from,this.to)?Q.fail("Structure replace would overwrite content"):Q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new te(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof te)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new te(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new te(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new te(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}de.jsonID("replace",te);class ne extends de{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ps(e,this.from,this.gapFrom)||ps(e,this.gapTo,this.to)))return Q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Q.fromReplace(e,this.from,this.to,r):Q.fail("Content does not fit in gap")}getMap(){return new ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ne(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ne(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ne(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}de.jsonID("replaceAround",ne);function ps(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function km(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&f.type.allowsMarkType(r.type)){let d=Math.max(c,e),p=Math.min(c+a.nodeSize,t),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(s&&s.to==d&&s.mark.eq(u[m])?s.to=p:i.push(s=new _e(d,p,u[m])));l&&l.to==d?l.to=p:o.push(l=new St(d,p,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Am(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof eo){let c=s.marks,f;for(;f=r.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let f=0;f<a.length;f++){let u=a[f],d;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&u.eq(i[p].style)&&(d=h)}d?(d.to=c,d.step=o):i.push({style:u,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new _e(s.from,s.to,s.style)))}function Gu(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),f=l+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new te(l,f,w.empty));else{r=u;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||n.step(new _e(l,f,c.marks[d]));if(i&&c.isText&&t.whitespace!="pre"){let d,p=/\r?\n|\r/g,h;for(;d=p.exec(c.text);)h||(h=new w(b.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new te(l+d.index,l+d.index+d[0].length,h))}}l=f}if(!r.validEnd){let a=r.fillBefore(b.empty,!0);n.replace(l,l,new w(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Tm(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function En(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Tm(i,o,s))break}return null}function Em(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,f=b.empty,u=0;for(let h=o,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,f=b.from(r.node(h).copy(f)),u++):a--;let d=b.empty,p=0;for(let h=o,m=!1;h>t;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=b.from(i.node(h).copy(d)),p++):c++;n.step(new ne(a,c,s,l,new w(f.append(d),u,p),f.size-u,!0))}function gl(n,e,t=null,r=n){let i=Mm(n,e),o=i&&Nm(r,e);return o?i.map(Oa).concat({type:e,attrs:t}).concat(o.map(Oa)):null}function Oa(n){return{type:n,attrs:null}}function Mm(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Nm(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Rm(n,e,t){let r=b.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].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=b.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ne(i,o,i,o,new w(r,0,0),t.length,!0))}function Dm(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&$m(n.doc,n.mapping.slice(o).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&&Pm(n,s,l,o),Gu(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let f=n.mapping.slice(o),u=f.map(l,1),d=f.map(l+s.nodeSize,1);return n.step(new ne(u,d,u+1,d-1,new w(b.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Im(n,s,l,o),!1}})}function Im(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Pm(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
5
- `))}})}function $m(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Bm(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ne(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new w(b.from(s),0,0),1,!0))}function yl(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=t-2;c>o;c--,f--){let u=i.node(c),d=i.index(c);if(u.type.spec.isolating)return!1;let p=u.content.cutByIndex(d,u.childCount),h=r&&r[f+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[f]||u;if(!u.canReplace(d+1,u.childCount)||!m.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function zm(n,e,t=1,r){let i=n.doc.resolve(e),o=b.empty,s=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=b.from(i.node(l).copy(o));let f=r&&r[c];s=b.from(f?f.type.create(f.attrs,s):i.node(l).copy(s))}n.step(new te(e,e,new w(o.append(s),t,t),!0))}function Mn(n,e){let t=n.resolve(e),r=t.index();return Yu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Yu(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function bl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Yu(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Lm(n,e,t){let r=new te(e-t,e+t,w.empty,!0);n.step(r)}function Fm(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Xu(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),f=!1;if(o==1)f=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);f=u&&c.canReplaceWith(a,a,u[0])}if(f)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function to(n,e,t=e,r=w.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Qu(i,o,r)?new te(e,t,r):new _m(i,o,r).fit()}function Qu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class _m{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).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(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new w(o,s,l);return e>-1?new ne(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new te(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=wo(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(b.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:u};if(t==2&&s&&(f=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:f};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=wo(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new w(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=wo(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new w(Wn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new w(Wn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,f=[],{match:u,type:d}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)f.push(i.child(m));u=u.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,f.push(Zu(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=Hn(this.placed,t,b.from(f)),this.frontier[t].match=u,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<p;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=h?e==0?w.empty:new w(Wn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new w(Wn(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!xo(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=xo(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],f=xo(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hn(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=Hn(this.placed,this.frontier.length,t))}}function Wn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Wn(n.firstChild.content,e-1,t)))}function Hn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hn(n.lastChild.content,e-1,t)))}function wo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Zu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Zu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function xo(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!jm(t,o.content,s)?l:null}function jm(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Vm(n){return n.spec.defining||n.spec.definingForContent}function Wm(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Qu(i,o,r))return n.step(new te(e,t,r));let s=td(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(d)>-1?l=d:i.before(d)==p&&s.splice(1,0,-d)}let a=s.indexOf(l),c=[],f=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==r.openStart)break;d=h.content}for(let d=f-1;d>=0;d--){let p=c[d],h=Vm(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(l)-1)))f=d;else if(h||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+f+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let C=i.node(g-1),k=i.index(g-1);if(C.canReplaceWith(k,k,h.type,h.marks))return n.replace(i.before(g),y?o.after(g):t,new w(ed(r.content,0,r.openStart,p),p,r.openEnd))}}let u=n.steps.length;for(let d=s.length-1;d>=0&&(n.replace(e,t,r),!(n.steps.length>u));d--){let p=s[d];p<0||(e=i.before(p),t=o.after(p))}}function ed(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ed(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(b.empty,!0))}return n}function Hm(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Fm(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new w(b.from(r),0,0))}function Um(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=td(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function td(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class pn extends de{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(i),0,t.isLeaf?0:1))}getMap(){return ve.empty}invert(e){return new pn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pn(t.pos,t.attr,t.value)}}de.jsonID("attr",pn);class ir extends de{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Q.ok(r)}getMap(){return ve.empty}invert(e){return new ir(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ir(t.attr,t.value)}}de.jsonID("docAttr",ir);let wn=class extends Error{};wn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};wn.prototype=Object.create(Error.prototype);wn.prototype.constructor=wn;wn.prototype.name="TransformError";class vl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new hn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new wn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=w.empty){let i=to(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new w(b.from(r),0,0))}delete(e,t){return this.replace(e,t,w.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Wm(this,e,t,r),this}replaceRangeWith(e,t,r){return Hm(this,e,t,r),this}deleteRange(e,t){return Um(this,e,t),this}lift(e,t){return Em(this,e,t),this}join(e,t=1){return Lm(this,e,t),this}wrap(e,t){return Rm(this,e,t),this}setBlockType(e,t=e,r,i=null){return Dm(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Bm(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new pn(e,t,r)),this}setDocAttribute(e,t){return this.step(new ir(e,t)),this}addNodeMark(e,t){return this.step(new wt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Sn(e,t)),this}split(e,t=1,r){return zm(this,e,t,r),this}addMark(e,t,r){return km(this,e,t,r),this}removeMark(e,t,r){return Am(this,e,t,r),this}clearIncompatible(e,t,r){return Gu(this,e,t,r),this}}const Co=Object.create(null);class R{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new nd(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=w.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],f=e.mapping.slice(o);e.replaceRange(f.map(a.pos),f.map(c.pos),l?w.empty:t),l==0&&Ta(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),f=a.map(l.pos);o?e.deleteRange(c,f):(e.replaceRangeWith(c,f,t),Ta(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new z(e):ln(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?ln(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):ln(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return ln(e,e,0,0,1)||new Oe(e)}static atEnd(e){return ln(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Co[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Co)throw new RangeError("Duplicate use of selection JSON ID "+e);return Co[e]=t,t.prototype.jsonID=e,t}getBookmark(){return z.between(this.$anchor,this.$head).getBookmark()}}R.prototype.visible=!0;class nd{constructor(e,t){this.$from=e,this.$to=t}}let ka=!1;function Aa(n){!ka&&!n.parent.inlineContent&&(ka=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class z extends R{constructor(e,t=e){Aa(e),Aa(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return R.near(r);let i=e.resolve(t.map(this.anchor));return new z(i.parent.inlineContent?i:r,r)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof z&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new no(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new z(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=R.findFrom(t,r,!0)||R.findFrom(t,-r,!0);if(o)t=o.$head;else return R.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new z(e,t)}}R.jsonID("text",z);class no{constructor(e,t){this.anchor=e,this.head=t}map(e){return new no(e.map(this.anchor),e.map(this.head))}resolve(e){return z.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends R{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?R.near(o):new E(o)}content(){return new w(b.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Sl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(t.anchor))}static create(e,t){return new E(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;R.jsonID("node",E);class Sl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new no(r,r):new Sl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):R.near(t)}}class Oe extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=w.empty){if(t==w.empty){e.delete(0,e.doc.content.size);let r=R.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return Km}}R.jsonID("all",Oe);const Km={map(){return this},resolve(n){return new Oe(n)}};function ln(n,e,t,r,i,o=!1){if(e.inlineContent)return z.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&E.isSelectable(l))return E.create(n,t-(i<0?l.nodeSize:0))}else{let a=ln(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Ta(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof te||i instanceof ne))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,f)=>{s==null&&(s=f)}),n.setSelection(R.near(n.doc.resolve(s),t))}const Ea=1,xr=2,Ma=4;class Jm extends vl{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|Ea)&~xr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ea)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xr,this}ensureMarks(e){return _.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&xr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~xr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||_.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(R.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=Ma,this}get scrolledIntoView(){return(this.updated&Ma)>0}}function Na(n,e){return!e||!n?n:n.bind(e)}class Un{constructor(e,t,r){this.name=e,this.init=Na(t.init,r),this.apply=Na(t.apply,r)}}const qm=[new Un("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Un("selection",{init(n,e){return n.selection||R.atStart(e.doc)},apply(n){return n.selection}}),new Un("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Un("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Oo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qm.slice(),t&&t.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 Un(r.key,r.spec.state,r))})}}class un{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,f=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(f&&r.filterTransaction(f,s)){if(f.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:t.length}:{state:this,n:0})}t.push(f),r=r.applyInner(f),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new un(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Jm(this)}static create(e){let t=new Oo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new un(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Oo(this.schema,e.plugins),r=t.fields,i=new un(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Oo(e.schema,e.plugins),o=new un(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Ne.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=R.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function rd(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=rd(i,e,{})),t[r]=i}return t}class Yt{constructor(e){this.spec=e,this.props={},e.props&&rd(e.props,this,this.props),this.key=e.key?e.key.key:id("plugin")}getState(e){return e[this.key]}}const ko=Object.create(null);function id(n){return n in ko?n+"$"+ ++ko[n]:(ko[n]=0,n+"$")}class Nn{constructor(e="key"){this.key=id(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const se=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},or=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ms=null;const tt=function(n,e,t){let r=ms||(ms=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Gm=function(){ms=null},Ut=function(n,e,t,r){return t&&(Ra(n,e,t,r,-1)||Ra(n,e,t,r,1))},Ym=/^(img|br|input|textarea|hr)$/i;function Ra(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Fe(n))){let o=n.parentNode;if(!o||o.nodeType!=1||gr(n)||Ym.test(n.nodeName)||n.contentEditable=="false")return!1;e=se(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Fe(n):0}else return!1}}function Fe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Xm(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Fe(n)}else if(n.parentNode&&!gr(n))e=se(n),n=n.parentNode;else return null}}function Qm(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!gr(n))e=se(n)+1,n=n.parentNode;else return null}}function Zm(n,e,t){for(let r=e==0,i=e==Fe(n);r||i;){if(n==t)return!0;let o=se(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Fe(n)}}function gr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ro=function(n){return n.focusNode&&Ut(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function It(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function eg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const je=typeof navigator<"u"?navigator:null,Da=typeof document<"u"?document:null,Mt=je&&je.userAgent||"",gs=/Edge\/(\d+)/.exec(Mt),od=/MSIE \d/.exec(Mt),ys=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt),be=!!(od||ys||gs),Ot=od?document.documentMode:ys?+ys[1]:gs?+gs[1]:0,De=!be&&/gecko\/(\d+)/i.test(Mt);De&&+(/Firefox\/(\d+)/.exec(Mt)||[0,0])[1];const bs=!be&&/Chrome\/(\d+)/.exec(Mt),ce=!!bs,sd=bs?+bs[1]:0,pe=!be&&!!je&&/Apple Computer/.test(je.vendor),xn=pe&&(/Mobile\/\w+/.test(Mt)||!!je&&je.maxTouchPoints>2),xe=xn||(je?/Mac/.test(je.platform):!1),ng=je?/Win/.test(je.platform):!1,Ee=/Android \d/.test(Mt),yr=!!Da&&"webkitFontSmoothing"in Da.documentElement.style,rg=yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ig(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ye(n,e){return typeof n=="number"?n:n[e]}function og(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ia(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=or(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?ig(o):og(l),f=0,u=0;if(e.top<c.top+Ye(r,"top")?u=-(c.top-e.top+Ye(i,"top")):e.bottom>c.bottom-Ye(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Ye(i,"top")-c.top:e.bottom-c.bottom+Ye(i,"bottom")),e.left<c.left+Ye(r,"left")?f=-(c.left-e.left+Ye(i,"left")):e.right>c.right-Ye(r,"right")&&(f=e.right-c.right+Ye(i,"right")),f||u)if(a)o.defaultView.scrollBy(f,u);else{let d=l.scrollLeft,p=l.scrollTop;u&&(l.scrollTop+=u),f&&(l.scrollLeft+=f);let h=l.scrollLeft-d,m=l.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function sg(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:ld(n.dom)}}function ld(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=or(r));return e}function lg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ad(t,r==0?0:r-e)}function ad(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tn=null;function ag(n){if(n.setActive)return n.setActive();if(tn)return n.focus(tn);let e=ld(n);n.focus(tn==null?{get preventScroll(){return tn={preventScroll:!0},!0}}:void 0),tn||(tn=!1,ad(e,0))}function cd(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let f=n.firstChild,u=0;f;f=f.nextSibling,u++){let d;if(f.nodeType==1)d=f.getClientRects();else if(f.nodeType==3)d=tt(f).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),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){t=f,r=m,i=m&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,f.nodeType==1&&m&&(o=u+(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=f,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=u+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?cg(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:cd(t,i)}function cg(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=ut(r,1);if(o.top!=o.bottom&&wl(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function wl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function fg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function ug(n,e,t){let{node:r,offset:i}=cd(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function dg(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<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}o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function fd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(wl(e,c))return fd(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function hg(n,e){let t=n.dom.ownerDocument,r,i=0,o=tg(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!wl(e,c)||(s=fd(n.dom,e,c),!s))return null}if(pe)for(let c=s;r&&c;c=or(c))c.draggable&&(r=void 0);if(s=fg(s,e),r){if(De&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let f=r.childNodes[i],u;f.nodeName=="IMG"&&(u=f.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;yr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=dg(n,r,i,e))}l==null&&(l=ug(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Pa(n){return n.top<n.bottom||n.left<n.right}function ut(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Pa(r))return r}return Array.prototype.find.call(t,Pa)||n.getBoundingClientRect()}const pg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ud(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=yr||De;if(r.nodeType==3)if(s&&(pg.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=ut(tt(r,i,i),t);if(De&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=ut(tt(r,i-1,i-1),-1);if(c.top==a.top){let f=ut(tt(r,i,i+1),-1);if(f.top!=a.top)return Bn(f,f.left<c.left)}}return a}else{let a=i,c=i,f=t<0?1:-1;return t<0&&!i?(c++,f=-1):t>=0&&i==r.nodeValue.length?(a--,f=1):t<0?a--:c++,Bn(ut(tt(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Fe(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ao(a.getBoundingClientRect(),!1)}if(o==null&&i<Fe(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ao(a.getBoundingClientRect(),!0)}return Ao(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Fe(r))){let a=r.childNodes[i-1],c=a.nodeType==3?tt(a,Fe(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Bn(ut(c,1),!1)}if(o==null&&i<Fe(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?tt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Bn(ut(c,-1),!0)}return Bn(ut(r.nodeType==3?tt(r):r,-t),t>=0)}function Bn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ao(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function dd(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function mg(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return dd(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=ud(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=tt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let f=a[c];if(f.bottom>f.top+1&&(t=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}const gg=/[\u0590-\u08ac]/;function yg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!gg.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:dd(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:u}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:m}=n.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==m;try{l.collapse(f,u),a&&(a!=f||c!=u)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let $a=null,Ba=null,za=!1;function bg(n,e,t){return $a==e&&Ba==t?za:($a=e,Ba=t,za=t=="up"||t=="down"?mg(n,e,t):yg(n,e,t))}const ke=0,La=1,Pt=2,Ve=3;class br{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ke,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>se(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof pd){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof hd&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?se(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?se(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let f=s+a.border;if(e>=f&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,f);e=s;for(let u=l;u>0;u--){let d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=se(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let f=l+1;f<this.children.length;f++){let u=this.children[f];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=se(u.dom);break}t+=u.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let d=0,p=0;d<this.children.length;d++){let h=this.children[d],m=p+h.size;if(o>p&&s<m)return h.setSelection(e-p-h.border,t-p-h.border,r,i);p=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),f=!1;if((De||pe)&&e==t){let{node:d,offset:p}=l;if(d.nodeType==3){if(f=!!(p&&d.nodeValue[p-1]==`
6
- `),f&&p==d.nodeValue.length)for(let h=d,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:se(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=d.childNodes[p-1];f=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}if(De&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let d=c.focusNode.childNodes[c.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||f&&pe)&&Ut(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Ut(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((c.extend||e==t)&&!f){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Pt:La,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ve:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Pt:Ve}r=s}this.dirty=Pt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Pt:La;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class hd extends br{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==ke&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 side(){return this.widget.type.side}}class vg extends br{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Kt extends br{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Gt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Kt(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Ve||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ve&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ke){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ke}}slice(e,t,r){let i=Kt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=ws(o,t,s,r)),e>0&&(o=ws(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}}class kt extends br{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),f=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!f)f=document.createTextNode(t.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:u}=Gt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),t.type.spec.draggable&&(f.draggable=!0));let d=f;return f=yd(f,r,t),c?a=new Sg(e,t,r,i,f,u||null,d,c,o,s+1):t.isText?new io(e,t,r,i,f,d,o):new kt(e,t,r,i,f,u||null,d,o,s+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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ke&&e.eq(this.node)&&Ss(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new xg(this,s&&s.node,e);kg(this.node,this.innerDeco,(c,f,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(f==this.node.childCount?_.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,u,d)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,f,u,d)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,f,u,p,e)||a.updateNextNode(c,f,u,e,d,i)||a.addNode(c,f,u,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Pt)&&(s&&this.protectLocalComposition(e,s),md(this.contentDOM,this.children,e),xn&&Ag(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof z)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Tg(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new vg(this,o,t,i);e.input.compositionNodes.push(s),this.children=ws(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==Ve||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ke}updateOuterDeco(e){if(Ss(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=gd(this.dom,this.nodeDOM,vs(this.outerDeco,this.node,t),vs(e,this.node,t)),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 Fa(n,e,t,r,i){yd(r,e,n);let o=new kt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class io extends kt{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ve||this.dirty!=ke&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ke||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ke,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new io(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ve)}get domAtom(){return!1}isText(e){return this.node.text==e}}class pd extends br{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ke&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Sg extends kt{constructor(e,t,r,i,o,s,l,a,c,f){super(e,t,r,i,o,s,l,c,f),this.spec=a}update(e,t,r,i){if(this.dirty==Ve)return!1;if(this.spec.update){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}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 md(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=_a(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof Kt){let a=r?r.previousSibling:n.lastChild;md(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=_a(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const qn=function(n){n&&(this.nodeName=n)};qn.prototype=Object.create(null);const $t=[new qn];function vs(n,e,t){if(n.length==0)return $t;let r=t?$t[0]:new qn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new qn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new qn(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 i}function gd(n,e,t,r){if(t==$t&&r==$t)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=$t[0]),i=a}wg(i,l||$t[0],s)}return i}function wg(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function yd(n,e,t){return gd(n,n,$t,vs(e,t,n.nodeType!=1))}function Ss(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function _a(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class xg{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Cg(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ke,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<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[o])&&!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=Kt.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,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,t,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==Ve&&s.dom==s.contentDOM&&(s.dirty=Pt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof kt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let f=a.dom,u,d=this.isLocked(f)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ve&&Ss(t,a.outerDeco));if(!d&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=f&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(a,e,t,r,i,s)))return this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Pt,u.updateChildren(i,s+1),u.dirty=ke),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let l=kt.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=kt.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new hd(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof io)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pe||ce)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new pd(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Cg(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Kt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Og(n,e){return n.type.side-e.type.side}function kg(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let f=n.child(c);r(f,i,e.forChild(o,f),c),o+=f.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let f,u;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(f?(u||(u=[f])).push(g):f=g)}if(f)if(u){u.sort(Og);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(f,c,!!a);let d,p;if(a)p=-1,d=a,a=null;else if(c<n.childCount)p=c,d=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let h=o+d.nodeSize;if(d.isText){let g=h;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<h&&(a=d.cut(g-o),d=d.cut(0,g-o),h=g,p=-1)}else for(;s<i.length&&i[s].to<h;)s++;let m=d.isInline&&!d.isLeaf?l.filter(g=>!g.inline):l.slice();r(d,m,e.forChild(o,d),p),o=h}}function Ag(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Tg(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=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>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function ws(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,f=l+=a.size;c>=t||f<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),f>t&&o.push(a.slice(t-c,a.size,r)))}return o}function xl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(ro(t)){for(a=l;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&E.isSelectable(f)&&i.parent&&!(f.isInline&&Zm(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new E(s==u?l:r.resolve(u))}}else{let f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null;a=r.resolve(f)}if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=Cl(n,a,l,f)}return c}function bd(n){return n.editable?n.hasFocus():Sd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function nt(n,e=!1){let t=n.state.selection;if(vd(n,t),!!bd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ce){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ut(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Mg(n);else{let{anchor:r,head:i}=t,o,s;ja&&!(t instanceof z)&&(t.$from.parent.inlineContent||(o=Va(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Va(n,t.to))),n.docView.setSelection(r,i,n.root,e),ja&&(o&&Wa(o),s&&Wa(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Eg(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ja=pe||ce&&sd<63;function Va(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(pe&&i&&i.contentEditable=="false")return To(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return To(i);if(o)return To(o)}}function To(n){return n.contentEditable="true",pe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Wa(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Eg(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!bd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Mg(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,se(r)+1):t.setStart(r,0);let o=n.state.selection;if(o.empty)t.collapse(!0);else{let s=n.domAtPos(o.to);t.setEnd(s.node,s.offset)}e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&be&&Ot<=11&&(r.disabled=!0,r.disabled=!1)}function vd(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ha(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ha(n)}function Ha(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Cl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||z.between(e,t,r)}function Ua(n){return n.editable&&!n.hasFocus()?!1:Sd(n)}function Sd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ng(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Ut(e.node,e.offset,t.anchorNode,t.anchorOffset)}function xs(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&R.findFrom(o,e)}function dt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ka(n,e,t){let r=n.state.selection;if(r instanceof z)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return dt(n,new z(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=xs(n.state,e);return i&&i instanceof E?dt(n,i):!1}else if(!(xe&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?E.isSelectable(o)?dt(n,new E(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):yr?dt(n,new z(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return dt(n,new z(e>0?r.$to:r.$from));{let i=xs(n.state,e);return i?dt(n,i):!1}}}function ri(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function nn(n,e){return e<0?Rg(n):Dg(n)}function Rg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(De&&t.nodeType==1&&r<ri(t)&&Gn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(wd(t))break;{let l=t.previousSibling;for(;l&&Gn(l,-1);)i=t.parentNode,o=se(l),l=l.previousSibling;if(l)t=l,r=ri(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Cs(n,t,r):i&&Cs(n,i,o)}function Dg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=ri(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Gn(l,1))o=t,s=++r;else break}else{if(wd(t))break;{let l=t.nextSibling;for(;l&&Gn(l,1);)o=l.parentNode,s=se(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=ri(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Cs(n,o,s)}function wd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ig(n,e){for(;n&&e==n.childNodes.length&&!gr(n);)e=se(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Pg(n,e){for(;n&&!e&&!gr(n);)e=se(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Cs(n,e,t){if(e.nodeType!=3){let o,s;(s=Ig(e,t))?(e=s,t=0):(o=Pg(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ro(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&nt(n)},50)}function Ja(n,e){let t=n.state.doc.resolve(e);if(!(ce||ng)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function qa(n,e,t){let r=n.state.selection;if(r instanceof z&&!r.empty||t.indexOf("s")>-1||xe&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=xs(n.state,e);if(s&&s instanceof E)return dt(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Oe?R.near(s,e):R.findFrom(s,e);return l?dt(n,l):!1}return!1}function Ga(n,e){if(!(n.state.selection instanceof z))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function Ya(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function $g(n){if(!pe||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ya(n,r,"true"),setTimeout(()=>Ya(n,r,"false"),20)}return!1}function Bg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function zg(n,e){let t=e.keyCode,r=Bg(e);if(t==8||xe&&t==72&&r=="c")return Ga(n,-1)||nn(n,-1);if(t==46&&!e.shiftKey||xe&&t==68&&r=="c")return Ga(n,1)||nn(n,1);if(t==13||t==27)return!0;if(t==37||xe&&t==66&&r=="c"){let i=t==37?Ja(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ka(n,i,r)||nn(n,i)}else if(t==39||xe&&t==70&&r=="c"){let i=t==39?Ja(n,n.state.selection.from)=="ltr"?1:-1:1;return Ka(n,i,r)||nn(n,i)}else{if(t==38||xe&&t==80&&r=="c")return qa(n,-1,r)||nn(n,-1);if(t==40||xe&&t==78&&r=="c")return $g(n)||qa(n,1,r)||nn(n,1);if(r==(xe?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function xd(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Gt.fromSchema(n.state.schema),l=Ed(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,f,u=0;for(;c&&c.nodeType==1&&(f=Td[c.nodeName.toLowerCase()]);){for(let p=f.length-1;p>=0;p--){let h=l.createElement(f[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
1
+ "use strict";const Yp=require("react"),Xp=require("react-dom");function oe(n){this.content=n}oe.prototype={constructor:oe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new oe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new oe(t)},addToStart:function(n,e){return new oe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new oe(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new oe(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=oe.from(n),n.size?new oe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=oe.from(n),n.size?new oe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=oe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};oe.from=function(n){if(n instanceof oe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new oe(e)};function Au(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Au(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Tu(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,f=Math.min(s.text.length,l.text.length);for(;c<f&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Tu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let f=l+1;a.nodesBetween(Math.max(0,e-f),Math.min(a.content.size,t-f),r,i+f)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=a}return new b(r,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new b(i,o)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Au(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Tu(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Sr(0,e);if(e==this.size)return Sr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?Sr(r+1,s):Sr(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new b(t||e,r)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const vo={index:0,offset:0};function Sr(n,e){return vo.index=n,vo.offset=e,vo}function Xr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Xr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Xr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class _{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Xr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _.none;if(e instanceof _)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}_.none=[];class Qr extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Mu(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(Eu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new w(e,r,i)}}w.empty=new w(b.empty,0,0);function Eu(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Eu(o.content,e-i-1,t-i-1)))}function Mu(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Mu(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Qp(n,e,t){if(t.openStart>n.depth)throw new Qr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Qr("Inconsistent open depths");return Nu(n,e,t,0)}function Nu(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Nu(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Lt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Zp(t,n);return Lt(o,Iu(n,s,l,e,r))}else return Lt(o,Zr(n,e,r))}function Ru(n,e){if(!e.type.compatibleContent(n.type))throw new Qr("Cannot join "+e.type.name+" onto "+n.type.name)}function ds(n,e,t){let r=n.node(t);return Ru(r,e.node(t)),r}function zt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Kn(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(zt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)zt(i.child(l),r);e&&e.depth==t&&e.textOffset&&zt(e.nodeBefore,r)}function Lt(n,e){return n.type.checkContent(e),n.copy(e)}function Iu(n,e,t,r,i){let o=n.depth>i&&ds(n,e,i+1),s=r.depth>i&&ds(t,r,i+1),l=[];return Kn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Ru(o,s),zt(Lt(o,Iu(n,e,t,r,i+1)),l)):(o&&zt(Lt(o,Zr(n,e,i+1)),l),Kn(e,t,i,l),s&&zt(Lt(s,Zr(t,r,i+1)),l)),Kn(r,null,i,l),new b(l)}function Zr(n,e,t){let r=[];if(Kn(null,n,t,r),n.depth>t){let i=ds(n,e,t+1);zt(Lt(i,Zr(n,e,t+1)),r)}return Kn(e,null,t,r),new b(r)}function Zp(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class rr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ei(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new rr(t,r,o)}static resolveCached(e,t){let r=da.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else da.set(e,r=new em);let i=r.elts[r.i]=rr.resolve(e,t);return r.i=(r.i+1)%tm,i}}class em{constructor(){this.elts=[],this.i=0}}const tm=12,da=new WeakMap;class ei{constructor(e,t,r){this.$from=e,this.$to=t,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 nm=Object.create(null);class Ne{constructor(e,t,r,i=_.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||b.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Xr(this.attrs,t||e.defaultAttrs||nm)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new Ne(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ne(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new w(c,i.depth-s,o.depth-s)}replace(e,t,r){return Qp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return rr.resolveCached(this,e)}resolveNoCache(e){return rr.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Du(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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=_.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}Ne.prototype.text=void 0;class ti extends Ne{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Du(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ti(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ti(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Du(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ht{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new rm(e,t);if(r.next==null)return Ht.empty;let i=Pu(r);r.next&&r.err("Unexpected trailing text");let o=fm(cm(i));return um(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:f,next:u}=s.next[c];if(!(f.isText||f.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let d=o(u,l.concat(f));if(d)return d}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2
+ `)}}Ht.empty=new Ht(!0);class rm{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pu(n){let e=[];do e.push(im(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function im(n){let e=[];do e.push(om(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function om(n){let e=am(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=sm(n,e);else break;return e}function ha(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function sm(n,e){let t=ha(n),r=t;return n.eat(",")&&(n.next!="}"?r=ha(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function lm(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function am(n){if(n.eat("(")){let e=Pu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=lm(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function cm(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let f=t();i(o(s.expr,a),f),a=f}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let f=t();r(a,f),i(o(s.expr,a),f),a=f}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function $u(n,e){return e-n}function pa(n,e){let t=[];return r(e),t.sort($u);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function fm(n){let e=Object.create(null);return t(pa(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f<i.length;f++)i[f][0]==l&&(c=i[f][1]);pa(n,a).forEach(f=>{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let o=e[r.join(",")]=new Ht(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort($u);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function um(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Bu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function zu(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Lu(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Fu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new hm(n,r,e[r]);return t}let ma=class _u{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fu(e,r.attrs),this.defaultAttrs=Bu(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==Ht.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:zu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ne(this,this.computeAttrs(e),b.from(t),_.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new Ne(this,this.computeAttrs(e),t,_.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(b.empty,!0);return o?new Ne(this,e,t.append(o),_.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Lu(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new _u(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function dm(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class hm{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?dm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class to{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Fu(e,i.attrs),this.excluded=null;let o=Bu(this.attrs);this.instance=o?new _(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _(this,zu(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new to(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Lu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class pm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=oe.from(e.nodes),t.marks=oe.from(e.marks||{}),this.nodes=ma.compile(this.spec.nodes,this),this.marks=to.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Ht.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ga(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ga(this,s.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,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ma){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(t,r,i)}text(e,t){let r=this.nodes.text;return new ti(r,r.defaultAttrs,e,_.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Ne.fromJSON(this,e)}markFromJSON(e){return _.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ga(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function mm(n){return n.tag!=null}function gm(n){return n.style!=null}class vn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(mm(i))this.tags.push(i);else if(gm(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new ba(this,t,!1);return r.addAll(e,_.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ba(this,t,!0);return r.addAll(e,_.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(vm(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=va(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=va(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vn(e,vn.schemaRules(e)))}}const ju={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},ym={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vu={ol:!0,ul:!0},ni=1,ri=2,Jn=4;function ya(n,e,t){return e!=null?(e?ni:0)|(e==="full"?ri:0):n&&n.whitespace=="pre"?ni|ri:t&~Jn}class wr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_.none,this.match=o||(s&Jn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ni)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ju.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ba{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=ya(null,t.preserveWhitespace,0)|(r?Jn:0);i?o=new wr(i.type,i.attrs,_.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new wr(null,null,_.none,!0,null,s):o=new wr(e.schema.topNodeType,null,_.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&ri||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&ni)i.options&ri?r=r.replace(/\r\n?/g,`
3
+ `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;Vu.hasOwnProperty(i)&&this.parser.normalizeLists&&bm(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:ym.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(ju.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let f=s&&s.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):Sa(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=ya(e,o,s.options);s.options&Jn&&s.content.length==0&&(l|=Jn);let a=_.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Sa(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new wr(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!f||f.name!=c&&f.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function bm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Vu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function vm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function va(n){let e={};for(let t in n)e[t]=n[t];return e}function Sa(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:f}=l.edge(a);if(c==e||o.indexOf(f)<0&&s(f))return!0}};if(s(i.contentMatch))return!0}}class Gt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=So(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],f=this.serializeMark(c,s.isInline,t);f&&(o.push([c,i]),i.appendChild(f.dom),i=f.contentDOM||f.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=$r(So(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&$r(So(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return $r(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Gt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=wa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return wa(e.marks)}}function wa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function So(n){return n.document||window.document}const xa=new WeakMap;function Sm(n){let e=xa.get(n);return e===void 0&&xa.set(n,e=wm(n)),e}function wm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function $r(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Sm(r))&&o.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 s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let u in c)if(c[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),c[u]):a.setAttribute(u,c[u])}}for(let u=f;u<e.length;u++){let d=e[u];if(d===0){if(u<e.length-1||u>f)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}=$r(n,d,t,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}const Wu=65535,Hu=Math.pow(2,16);function xm(n,e){return n+e*Hu}function Ca(n){return n&Wu}function Cm(n){return(n-(n&Wu))/Hu}const Uu=1,Ku=2,Br=4,Ju=8;class hs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ju)>0}get deletedBefore(){return(this.delInfo&(Uu|Br))>0}get deletedAfter(){return(this.delInfo&(Ku|Br))>0}get deletedAcross(){return(this.delInfo&Br)>0}}class ve{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ve.empty)return ve.empty}recover(e){let t=0,r=Ca(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Cm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],f=this.ranges[l+s],u=a+c;if(e<=u){let d=c?e==a?-1:e==u?1:t:t,p=a+i+(d<0?0:f);if(r)return p;let h=e==(t<0?a:u)?null:xm(l/3,e-a),m=e==a?Ku:e==u?Uu:Br;return(t<0?e!=a:e!=u)&&(m|=Ju),new hs(p,m,h)}i+=f-c}return r?e+i:new hs(e+i,0,null)}touches(e,t){let r=0,i=Ca(t),o=this.inverted?2:1,s=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+o],f=a+c;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],f=this.ranges[i+r];e(l,l+c,a,a+f),o+=f-c}}invert(){return new ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ve.empty:new ve(e<0?[0,-e,0]:[0,0,e])}}ve.empty=new ve([]);class hn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new hn(this.maps,this.mirror,e,t)}copy(){return new hn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new hn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new hs(e,i,null)}}const wo=Object.create(null);class de{getMap(){return ve.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in wo)throw new RangeError("Duplicate use of step JSON ID "+e);return wo[e]=t,t.prototype.jsonID=e,t}}class Q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Q(e,null)}static fail(e){return new Q(null,e)}static fromReplace(e,t,r,i){try{return Q.ok(e.replace(t,r,i))}catch(o){if(o instanceof Qr)return Q.fail(o.message);throw o}}}function ml(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(ml(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return b.fromArray(r)}class St extends de{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new w(ml(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,o)}invert(){return new _e(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new St(t.pos,r.pos,this.mark)}merge(e){return e instanceof St&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new St(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new St(t.from,t.to,e.markFromJSON(t.mark))}}de.jsonID("addMark",St);class _e extends de{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(ml(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Q.fromReplace(e,this.from,this.to,r)}invert(){return new St(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _e(t.pos,r.pos,this.mark)}merge(e){return e instanceof _e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _e(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _e(t.from,t.to,e.markFromJSON(t.mark))}}de.jsonID("removeMark",_e);class wt extends de{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new wt(this.pos,t.marks[i]);return new wt(this.pos,this.mark)}}return new Sn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wt(t.pos,e.markFromJSON(t.mark))}}de.jsonID("addNodeMark",wt);class Sn extends de{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sn(t.pos,e.markFromJSON(t.mark))}}de.jsonID("removeNodeMark",Sn);class te extends de{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ps(e,this.from,this.to)?Q.fail("Structure replace would overwrite content"):Q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new te(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof te)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new te(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new te(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new te(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}de.jsonID("replace",te);class ne extends de{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ps(e,this.from,this.gapFrom)||ps(e,this.gapTo,this.to)))return Q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Q.fromReplace(e,this.from,this.to,r):Q.fail("Content does not fit in gap")}getMap(){return new ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ne(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ne(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ne(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}de.jsonID("replaceAround",ne);function ps(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Om(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&f.type.allowsMarkType(r.type)){let d=Math.max(c,e),p=Math.min(c+a.nodeSize,t),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(s&&s.to==d&&s.mark.eq(u[m])?s.to=p:i.push(s=new _e(d,p,u[m])));l&&l.to==d?l.to=p:o.push(l=new St(d,p,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function km(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof to){let c=s.marks,f;for(;f=r.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let f=0;f<a.length;f++){let u=a[f],d;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&u.eq(i[p].style)&&(d=h)}d?(d.to=c,d.step=o):i.push({style:u,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new _e(s.from,s.to,s.style)))}function qu(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),f=l+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new te(l,f,w.empty));else{r=u;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||n.step(new _e(l,f,c.marks[d]));if(i&&c.isText&&t.whitespace!="pre"){let d,p=/\r?\n|\r/g,h;for(;d=p.exec(c.text);)h||(h=new w(b.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new te(l+d.index,l+d.index+d[0].length,h))}}l=f}if(!r.validEnd){let a=r.fillBefore(b.empty,!0);n.replace(l,l,new w(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Am(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function En(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Am(i,o,s))break}return null}function Tm(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,f=b.empty,u=0;for(let h=o,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,f=b.from(r.node(h).copy(f)),u++):a--;let d=b.empty,p=0;for(let h=o,m=!1;h>t;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=b.from(i.node(h).copy(d)),p++):c++;n.step(new ne(a,c,s,l,new w(f.append(d),u,p),f.size-u,!0))}function gl(n,e,t=null,r=n){let i=Em(n,e),o=i&&Mm(r,e);return o?i.map(Oa).concat({type:e,attrs:t}).concat(o.map(Oa)):null}function Oa(n){return{type:n,attrs:null}}function Em(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Mm(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Nm(n,e,t){let r=b.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].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=b.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ne(i,o,i,o,new w(r,0,0),t.length,!0))}function Rm(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&Pm(n.doc,n.mapping.slice(o).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&&Dm(n,s,l,o),qu(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let f=n.mapping.slice(o),u=f.map(l,1),d=f.map(l+s.nodeSize,1);return n.step(new ne(u,d,u+1,d-1,new w(b.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Im(n,s,l,o),!1}})}function Im(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Dm(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
5
+ `))}})}function Pm(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function $m(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ne(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new w(b.from(s),0,0),1,!0))}function yl(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=t-2;c>o;c--,f--){let u=i.node(c),d=i.index(c);if(u.type.spec.isolating)return!1;let p=u.content.cutByIndex(d,u.childCount),h=r&&r[f+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[f]||u;if(!u.canReplace(d+1,u.childCount)||!m.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function Bm(n,e,t=1,r){let i=n.doc.resolve(e),o=b.empty,s=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=b.from(i.node(l).copy(o));let f=r&&r[c];s=b.from(f?f.type.create(f.attrs,s):i.node(l).copy(s))}n.step(new te(e,e,new w(o.append(s),t,t),!0))}function Mn(n,e){let t=n.resolve(e),r=t.index();return Gu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Gu(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function bl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Gu(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function zm(n,e,t){let r=new te(e-t,e+t,w.empty,!0);n.step(r)}function Lm(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Yu(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),f=!1;if(o==1)f=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);f=u&&c.canReplaceWith(a,a,u[0])}if(f)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function no(n,e,t=e,r=w.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Xu(i,o,r)?new te(e,t,r):new Fm(i,o,r).fit()}function Xu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Fm{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).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(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new w(o,s,l);return e>-1?new ne(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new te(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=xo(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(b.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:u};if(t==2&&s&&(f=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:f};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=xo(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new w(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=xo(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new w(Wn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new w(Wn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,f=[],{match:u,type:d}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)f.push(i.child(m));u=u.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,f.push(Qu(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=Hn(this.placed,t,b.from(f)),this.frontier[t].match=u,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<p;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=h?e==0?w.empty:new w(Wn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new w(Wn(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Co(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Co(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],f=Co(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hn(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=Hn(this.placed,this.frontier.length,t))}}function Wn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Wn(n.firstChild.content,e-1,t)))}function Hn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hn(n.lastChild.content,e-1,t)))}function xo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Qu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Qu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function Co(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!_m(t,o.content,s)?l:null}function _m(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function jm(n){return n.spec.defining||n.spec.definingForContent}function Vm(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Xu(i,o,r))return n.step(new te(e,t,r));let s=ed(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(d)>-1?l=d:i.before(d)==p&&s.splice(1,0,-d)}let a=s.indexOf(l),c=[],f=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==r.openStart)break;d=h.content}for(let d=f-1;d>=0;d--){let p=c[d],h=jm(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(l)-1)))f=d;else if(h||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+f+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let C=i.node(g-1),k=i.index(g-1);if(C.canReplaceWith(k,k,h.type,h.marks))return n.replace(i.before(g),y?o.after(g):t,new w(Zu(r.content,0,r.openStart,p),p,r.openEnd))}}let u=n.steps.length;for(let d=s.length-1;d>=0&&(n.replace(e,t,r),!(n.steps.length>u));d--){let p=s[d];p<0||(e=i.before(p),t=o.after(p))}}function Zu(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Zu(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(b.empty,!0))}return n}function Wm(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Lm(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new w(b.from(r),0,0))}function Hm(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ed(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function ed(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class pn extends de{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Q.fromReplace(e,this.pos,this.pos+1,new w(b.from(i),0,t.isLeaf?0:1))}getMap(){return ve.empty}invert(e){return new pn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pn(t.pos,t.attr,t.value)}}de.jsonID("attr",pn);class ir extends de{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Q.ok(r)}getMap(){return ve.empty}invert(e){return new ir(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ir(t.attr,t.value)}}de.jsonID("docAttr",ir);let wn=class extends Error{};wn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};wn.prototype=Object.create(Error.prototype);wn.prototype.constructor=wn;wn.prototype.name="TransformError";class vl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new hn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new wn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=w.empty){let i=no(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new w(b.from(r),0,0))}delete(e,t){return this.replace(e,t,w.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Vm(this,e,t,r),this}replaceRangeWith(e,t,r){return Wm(this,e,t,r),this}deleteRange(e,t){return Hm(this,e,t),this}lift(e,t){return Tm(this,e,t),this}join(e,t=1){return zm(this,e,t),this}wrap(e,t){return Nm(this,e,t),this}setBlockType(e,t=e,r,i=null){return Rm(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return $m(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new pn(e,t,r)),this}setDocAttribute(e,t){return this.step(new ir(e,t)),this}addNodeMark(e,t){return this.step(new wt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Sn(e,t)),this}split(e,t=1,r){return Bm(this,e,t,r),this}addMark(e,t,r){return Om(this,e,t,r),this}removeMark(e,t,r){return km(this,e,t,r),this}clearIncompatible(e,t,r){return qu(this,e,t,r),this}}const Oo=Object.create(null);class R{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new td(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=w.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],f=e.mapping.slice(o);e.replaceRange(f.map(a.pos),f.map(c.pos),l?w.empty:t),l==0&&Ta(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),f=a.map(l.pos);o?e.deleteRange(c,f):(e.replaceRangeWith(c,f,t),Ta(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new z(e):ln(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?ln(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):ln(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return ln(e,e,0,0,1)||new Oe(e)}static atEnd(e){return ln(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Oo[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Oo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Oo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return z.between(this.$anchor,this.$head).getBookmark()}}R.prototype.visible=!0;class td{constructor(e,t){this.$from=e,this.$to=t}}let ka=!1;function Aa(n){!ka&&!n.parent.inlineContent&&(ka=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class z extends R{constructor(e,t=e){Aa(e),Aa(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return R.near(r);let i=e.resolve(t.map(this.anchor));return new z(i.parent.inlineContent?i:r,r)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof z&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ro(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new z(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=R.findFrom(t,r,!0)||R.findFrom(t,-r,!0);if(o)t=o.$head;else return R.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new z(e,t)}}R.jsonID("text",z);class ro{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ro(e.map(this.anchor),e.map(this.head))}resolve(e){return z.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends R{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?R.near(o):new E(o)}content(){return new w(b.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Sl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(t.anchor))}static create(e,t){return new E(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;R.jsonID("node",E);class Sl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new ro(r,r):new Sl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):R.near(t)}}class Oe extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=w.empty){if(t==w.empty){e.delete(0,e.doc.content.size);let r=R.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return Um}}R.jsonID("all",Oe);const Um={map(){return this},resolve(n){return new Oe(n)}};function ln(n,e,t,r,i,o=!1){if(e.inlineContent)return z.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&E.isSelectable(l))return E.create(n,t-(i<0?l.nodeSize:0))}else{let a=ln(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Ta(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof te||i instanceof ne))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,f)=>{s==null&&(s=f)}),n.setSelection(R.near(n.doc.resolve(s),t))}const Ea=1,xr=2,Ma=4;class Km extends vl{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|Ea)&~xr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ea)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xr,this}ensureMarks(e){return _.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&xr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~xr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||_.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(R.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=Ma,this}get scrolledIntoView(){return(this.updated&Ma)>0}}function Na(n,e){return!e||!n?n:n.bind(e)}class Un{constructor(e,t,r){this.name=e,this.init=Na(t.init,r),this.apply=Na(t.apply,r)}}const Jm=[new Un("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Un("selection",{init(n,e){return n.selection||R.atStart(e.doc)},apply(n){return n.selection}}),new Un("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Un("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ko{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jm.slice(),t&&t.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 Un(r.key,r.spec.state,r))})}}class un{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,f=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(f&&r.filterTransaction(f,s)){if(f.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:t.length}:{state:this,n:0})}t.push(f),r=r.applyInner(f),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new un(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Km(this)}static create(e){let t=new ko(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new un(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new ko(this.schema,e.plugins),r=t.fields,i=new un(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ko(e.schema,e.plugins),o=new un(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Ne.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=R.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function nd(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=nd(i,e,{})),t[r]=i}return t}class Yt{constructor(e){this.spec=e,this.props={},e.props&&nd(e.props,this,this.props),this.key=e.key?e.key.key:rd("plugin")}getState(e){return e[this.key]}}const Ao=Object.create(null);function rd(n){return n in Ao?n+"$"+ ++Ao[n]:(Ao[n]=0,n+"$")}class Nn{constructor(e="key"){this.key=rd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const se=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},or=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ms=null;const tt=function(n,e,t){let r=ms||(ms=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},qm=function(){ms=null},Ut=function(n,e,t,r){return t&&(Ra(n,e,t,r,-1)||Ra(n,e,t,r,1))},Gm=/^(img|br|input|textarea|hr)$/i;function Ra(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Fe(n))){let o=n.parentNode;if(!o||o.nodeType!=1||gr(n)||Gm.test(n.nodeName)||n.contentEditable=="false")return!1;e=se(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Fe(n):0}else return!1}}function Fe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ym(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Fe(n)}else if(n.parentNode&&!gr(n))e=se(n),n=n.parentNode;else return null}}function Xm(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!gr(n))e=se(n)+1,n=n.parentNode;else return null}}function Qm(n,e,t){for(let r=e==0,i=e==Fe(n);r||i;){if(n==t)return!0;let o=se(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Fe(n)}}function gr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const io=function(n){return n.focusNode&&Ut(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Dt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Zm(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function eg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const je=typeof navigator<"u"?navigator:null,Ia=typeof document<"u"?document:null,Mt=je&&je.userAgent||"",gs=/Edge\/(\d+)/.exec(Mt),id=/MSIE \d/.exec(Mt),ys=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt),be=!!(id||ys||gs),Ot=id?document.documentMode:ys?+ys[1]:gs?+gs[1]:0,Ie=!be&&/gecko\/(\d+)/i.test(Mt);Ie&&+(/Firefox\/(\d+)/.exec(Mt)||[0,0])[1];const bs=!be&&/Chrome\/(\d+)/.exec(Mt),ce=!!bs,od=bs?+bs[1]:0,pe=!be&&!!je&&/Apple Computer/.test(je.vendor),xn=pe&&(/Mobile\/\w+/.test(Mt)||!!je&&je.maxTouchPoints>2),xe=xn||(je?/Mac/.test(je.platform):!1),tg=je?/Win/.test(je.platform):!1,Ee=/Android \d/.test(Mt),yr=!!Ia&&"webkitFontSmoothing"in Ia.documentElement.style,ng=yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rg(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ye(n,e){return typeof n=="number"?n:n[e]}function ig(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Da(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=or(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?rg(o):ig(l),f=0,u=0;if(e.top<c.top+Ye(r,"top")?u=-(c.top-e.top+Ye(i,"top")):e.bottom>c.bottom-Ye(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Ye(i,"top")-c.top:e.bottom-c.bottom+Ye(i,"bottom")),e.left<c.left+Ye(r,"left")?f=-(c.left-e.left+Ye(i,"left")):e.right>c.right-Ye(r,"right")&&(f=e.right-c.right+Ye(i,"right")),f||u)if(a)o.defaultView.scrollBy(f,u);else{let d=l.scrollLeft,p=l.scrollTop;u&&(l.scrollTop+=u),f&&(l.scrollLeft+=f);let h=l.scrollLeft-d,m=l.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function og(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:sd(n.dom)}}function sd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=or(r));return e}function sg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ld(t,r==0?0:r-e)}function ld(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tn=null;function lg(n){if(n.setActive)return n.setActive();if(tn)return n.focus(tn);let e=sd(n);n.focus(tn==null?{get preventScroll(){return tn={preventScroll:!0},!0}}:void 0),tn||(tn=!1,ld(e,0))}function ad(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let f=n.firstChild,u=0;f;f=f.nextSibling,u++){let d;if(f.nodeType==1)d=f.getClientRects();else if(f.nodeType==3)d=tt(f).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),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){t=f,r=m,i=m&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,f.nodeType==1&&m&&(o=u+(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=f,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=u+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?ag(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:ad(t,i)}function ag(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=ut(r,1);if(o.top!=o.bottom&&wl(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function wl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function cg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function fg(n,e,t){let{node:r,offset:i}=ad(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function ug(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<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}o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function cd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(wl(e,c))return cd(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function dg(n,e){let t=n.dom.ownerDocument,r,i=0,o=eg(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!wl(e,c)||(s=cd(n.dom,e,c),!s))return null}if(pe)for(let c=s;r&&c;c=or(c))c.draggable&&(r=void 0);if(s=cg(s,e),r){if(Ie&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let f=r.childNodes[i],u;f.nodeName=="IMG"&&(u=f.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;yr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=ug(n,r,i,e))}l==null&&(l=fg(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Pa(n){return n.top<n.bottom||n.left<n.right}function ut(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Pa(r))return r}return Array.prototype.find.call(t,Pa)||n.getBoundingClientRect()}const hg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function fd(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=yr||Ie;if(r.nodeType==3)if(s&&(hg.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=ut(tt(r,i,i),t);if(Ie&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=ut(tt(r,i-1,i-1),-1);if(c.top==a.top){let f=ut(tt(r,i,i+1),-1);if(f.top!=a.top)return Bn(f,f.left<c.left)}}return a}else{let a=i,c=i,f=t<0?1:-1;return t<0&&!i?(c++,f=-1):t>=0&&i==r.nodeValue.length?(a--,f=1):t<0?a--:c++,Bn(ut(tt(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Fe(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return To(a.getBoundingClientRect(),!1)}if(o==null&&i<Fe(r)){let a=r.childNodes[i];if(a.nodeType==1)return To(a.getBoundingClientRect(),!0)}return To(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Fe(r))){let a=r.childNodes[i-1],c=a.nodeType==3?tt(a,Fe(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Bn(ut(c,1),!1)}if(o==null&&i<Fe(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?tt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Bn(ut(c,-1),!0)}return Bn(ut(r.nodeType==3?tt(r):r,-t),t>=0)}function Bn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function To(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function ud(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function pg(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return ud(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=fd(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=tt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let f=a[c];if(f.bottom>f.top+1&&(t=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}const mg=/[\u0590-\u08ac]/;function gg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!mg.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:ud(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:u}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:m}=n.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==m;try{l.collapse(f,u),a&&(a!=f||c!=u)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let $a=null,Ba=null,za=!1;function yg(n,e,t){return $a==e&&Ba==t?za:($a=e,Ba=t,za=t=="up"||t=="down"?pg(n,e,t):gg(n,e,t))}const ke=0,La=1,Pt=2,Ve=3;class br{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ke,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>se(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof hd){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof dd&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?se(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?se(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let f=s+a.border;if(e>=f&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,f);e=s;for(let u=l;u>0;u--){let d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=se(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let f=l+1;f<this.children.length;f++){let u=this.children[f];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=se(u.dom);break}t+=u.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let d=0,p=0;d<this.children.length;d++){let h=this.children[d],m=p+h.size;if(o>p&&s<m)return h.setSelection(e-p-h.border,t-p-h.border,r,i);p=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),f=!1;if((Ie||pe)&&e==t){let{node:d,offset:p}=l;if(d.nodeType==3){if(f=!!(p&&d.nodeValue[p-1]==`
6
+ `),f&&p==d.nodeValue.length)for(let h=d,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:se(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=d.childNodes[p-1];f=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}if(Ie&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let d=c.focusNode.childNodes[c.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||f&&pe)&&Ut(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Ut(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((c.extend||e==t)&&!f){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Pt:La,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ve:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Pt:Ve}r=s}this.dirty=Pt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Pt:La;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class dd extends br{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==ke&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 side(){return this.widget.type.side}}class bg extends br{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Kt extends br{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Gt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Kt(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Ve||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ve&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ke){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ke}}slice(e,t,r){let i=Kt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=ws(o,t,s,r)),e>0&&(o=ws(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}}class kt extends br{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),f=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!f)f=document.createTextNode(t.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:u}=Gt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),t.type.spec.draggable&&(f.draggable=!0));let d=f;return f=gd(f,r,t),c?a=new vg(e,t,r,i,f,u||null,d,c,o,s+1):t.isText?new oo(e,t,r,i,f,d,o):new kt(e,t,r,i,f,u||null,d,o,s+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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ke&&e.eq(this.node)&&Ss(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new wg(this,s&&s.node,e);Og(this.node,this.innerDeco,(c,f,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(f==this.node.childCount?_.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,u,d)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,f,u,d)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,f,u,p,e)||a.updateNextNode(c,f,u,e,d,i)||a.addNode(c,f,u,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Pt)&&(s&&this.protectLocalComposition(e,s),pd(this.contentDOM,this.children,e),xn&&kg(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof z)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Ag(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new bg(this,o,t,i);e.input.compositionNodes.push(s),this.children=ws(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==Ve||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ke}updateOuterDeco(e){if(Ss(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=md(this.dom,this.nodeDOM,vs(this.outerDeco,this.node,t),vs(e,this.node,t)),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 Fa(n,e,t,r,i){gd(r,e,n);let o=new kt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class oo extends kt{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ve||this.dirty!=ke&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ke||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ke,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new oo(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ve)}get domAtom(){return!1}isText(e){return this.node.text==e}}class hd extends br{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ke&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class vg extends kt{constructor(e,t,r,i,o,s,l,a,c,f){super(e,t,r,i,o,s,l,c,f),this.spec=a}update(e,t,r,i){if(this.dirty==Ve)return!1;if(this.spec.update){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}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 pd(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=_a(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof Kt){let a=r?r.previousSibling:n.lastChild;pd(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=_a(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const qn=function(n){n&&(this.nodeName=n)};qn.prototype=Object.create(null);const $t=[new qn];function vs(n,e,t){if(n.length==0)return $t;let r=t?$t[0]:new qn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new qn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new qn(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 i}function md(n,e,t,r){if(t==$t&&r==$t)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=$t[0]),i=a}Sg(i,l||$t[0],s)}return i}function Sg(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function gd(n,e,t){return md(n,n,$t,vs(e,t,n.nodeType!=1))}function Ss(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function _a(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class wg{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=xg(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ke,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<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[o])&&!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=Kt.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,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,t,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==Ve&&s.dom==s.contentDOM&&(s.dirty=Pt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof kt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let f=a.dom,u,d=this.isLocked(f)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ve&&Ss(t,a.outerDeco));if(!d&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=f&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(a,e,t,r,i,s)))return this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Pt,u.updateChildren(i,s+1),u.dirty=ke),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let l=kt.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=kt.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new dd(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof oo)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pe||ce)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new hd(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function xg(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Kt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Cg(n,e){return n.type.side-e.type.side}function Og(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let f=n.child(c);r(f,i,e.forChild(o,f),c),o+=f.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let f,u;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(f?(u||(u=[f])).push(g):f=g)}if(f)if(u){u.sort(Cg);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(f,c,!!a);let d,p;if(a)p=-1,d=a,a=null;else if(c<n.childCount)p=c,d=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let h=o+d.nodeSize;if(d.isText){let g=h;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<h&&(a=d.cut(g-o),d=d.cut(0,g-o),h=g,p=-1)}else for(;s<i.length&&i[s].to<h;)s++;let m=d.isInline&&!d.isLeaf?l.filter(g=>!g.inline):l.slice();r(d,m,e.forChild(o,d),p),o=h}}function kg(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Ag(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=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>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function ws(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,f=l+=a.size;c>=t||f<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),f>t&&o.push(a.slice(t-c,a.size,r)))}return o}function xl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(io(t)){for(a=l;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&E.isSelectable(f)&&i.parent&&!(f.isInline&&Qm(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new E(s==u?l:r.resolve(u))}}else{let f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null;a=r.resolve(f)}if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=Cl(n,a,l,f)}return c}function yd(n){return n.editable?n.hasFocus():vd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function nt(n,e=!1){let t=n.state.selection;if(bd(n,t),!!yd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ce){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ut(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Eg(n);else{let{anchor:r,head:i}=t,o,s;ja&&!(t instanceof z)&&(t.$from.parent.inlineContent||(o=Va(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Va(n,t.to))),n.docView.setSelection(r,i,n.root,e),ja&&(o&&Wa(o),s&&Wa(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Tg(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ja=pe||ce&&od<63;function Va(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(pe&&i&&i.contentEditable=="false")return Eo(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Eo(i);if(o)return Eo(o)}}function Eo(n){return n.contentEditable="true",pe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Wa(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Tg(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!yd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Eg(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,se(r)+1):t.setStart(r,0);let o=n.state.selection;if(o.empty)t.collapse(!0);else{let s=n.domAtPos(o.to);t.setEnd(s.node,s.offset)}e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&be&&Ot<=11&&(r.disabled=!0,r.disabled=!1)}function bd(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ha(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ha(n)}function Ha(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Cl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||z.between(e,t,r)}function Ua(n){return n.editable&&!n.hasFocus()?!1:vd(n)}function vd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Mg(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Ut(e.node,e.offset,t.anchorNode,t.anchorOffset)}function xs(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&R.findFrom(o,e)}function dt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ka(n,e,t){let r=n.state.selection;if(r instanceof z)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return dt(n,new z(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=xs(n.state,e);return i&&i instanceof E?dt(n,i):!1}else if(!(xe&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?E.isSelectable(o)?dt(n,new E(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):yr?dt(n,new z(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return dt(n,new z(e>0?r.$to:r.$from));{let i=xs(n.state,e);return i?dt(n,i):!1}}}function ii(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function nn(n,e){return e<0?Ng(n):Rg(n)}function Ng(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(Ie&&t.nodeType==1&&r<ii(t)&&Gn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Sd(t))break;{let l=t.previousSibling;for(;l&&Gn(l,-1);)i=t.parentNode,o=se(l),l=l.previousSibling;if(l)t=l,r=ii(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Cs(n,t,r):i&&Cs(n,i,o)}function Rg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=ii(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Gn(l,1))o=t,s=++r;else break}else{if(Sd(t))break;{let l=t.nextSibling;for(;l&&Gn(l,1);)o=l.parentNode,s=se(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=ii(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Cs(n,o,s)}function Sd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ig(n,e){for(;n&&e==n.childNodes.length&&!gr(n);)e=se(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Dg(n,e){for(;n&&!e&&!gr(n);)e=se(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Cs(n,e,t){if(e.nodeType!=3){let o,s;(s=Ig(e,t))?(e=s,t=0):(o=Dg(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(io(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&nt(n)},50)}function Ja(n,e){let t=n.state.doc.resolve(e);if(!(ce||tg)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function qa(n,e,t){let r=n.state.selection;if(r instanceof z&&!r.empty||t.indexOf("s")>-1||xe&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=xs(n.state,e);if(s&&s instanceof E)return dt(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Oe?R.near(s,e):R.findFrom(s,e);return l?dt(n,l):!1}return!1}function Ga(n,e){if(!(n.state.selection instanceof z))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function Ya(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Pg(n){if(!pe||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ya(n,r,"true"),setTimeout(()=>Ya(n,r,"false"),20)}return!1}function $g(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Bg(n,e){let t=e.keyCode,r=$g(e);if(t==8||xe&&t==72&&r=="c")return Ga(n,-1)||nn(n,-1);if(t==46&&!e.shiftKey||xe&&t==68&&r=="c")return Ga(n,1)||nn(n,1);if(t==13||t==27)return!0;if(t==37||xe&&t==66&&r=="c"){let i=t==37?Ja(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ka(n,i,r)||nn(n,i)}else if(t==39||xe&&t==70&&r=="c"){let i=t==39?Ja(n,n.state.selection.from)=="ltr"?1:-1:1;return Ka(n,i,r)||nn(n,i)}else{if(t==38||xe&&t==80&&r=="c")return qa(n,-1,r)||nn(n,-1);if(t==40||xe&&t==78&&r=="c")return Pg(n)||qa(n,1,r)||nn(n,1);if(r==(xe?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function wd(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Gt.fromSchema(n.state.schema),l=Td(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,f,u=0;for(;c&&c.nodeType==1&&(f=Ad[c.nodeName.toLowerCase()]);){for(let p=f.length-1;p>=0;p--){let h=l.createElement(f[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
7
7
 
8
- `);return{dom:a,text:d,slice:e}}function Cd(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",d=>{e=d(e,o||r,n)}),o)return e?new w(b.from(n.state.schema.text(e.replace(/\r\n?/g,`
9
- `))),0,0):w.empty;let u=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(u)l=u;else{let d=i.marks(),{schema:p}=n.state,h=Gt.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=_g(t),yr&&jg(s);let c=s&&s.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let u=+f[3];u>0;u--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||vn.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Lg.test(d.parentNode.nodeName)?{ignore:!0}:null}})),f)l=Vg(Xa(l,+f[1],+f[2]),f[4]);else if(l=w.maxOpen(Fg(l.content,i),!0),l.openStart||l.openEnd){let u=0,d=0;for(let p=l.content.firstChild;u<l.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=l.content.lastChild;d<l.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);l=Xa(l,u,d)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const Lg=/^(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 Fg(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&kd(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ad(s[s.length-1],o.length));let f=Od(l,a);s.push(f),i=i.matchType(f.type),o=a}}),s)return b.from(s)}return n}function Od(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function kd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=kd(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(b.from(Od(t,n,i+1))))}}function Ad(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ad(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(b.empty,!0);return n.copy(t.append(r))}function Os(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=Os(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Xa(n,e,t){return e<n.openStart&&(n=new w(Os(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new w(Os(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Td={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 Qa=null;function Ed(){return Qa||(Qa=document.implementation.createHTMLDocument("title"))}function _g(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ed().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Td[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=n,i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function jg(n){let e=n.querySelectorAll(ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Vg(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),o++,s++}return new w(i,o,s)}const me={},ge={},Wg={touchstart:!0,touchmove:!0};class Hg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 Ug(n){for(let e in me){let t=me[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Jg(n,r)&&!Ol(n,r)&&(n.editable||!(r.type in ge))&&t(n,r)},Wg[e]?{passive:!0}:void 0)}pe&&n.dom.addEventListener("input",()=>null),ks(n)}function xt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Kg(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function ks(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ol(n,r))})}function Ol(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Jg(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function qg(n,e){!Ol(n,e)&&me[e.type]&&(n.editable||!(e.type in ge))&&me[e.type](n,e)}ge.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Nd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ee&&ce&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,It(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||zg(n,t)?t.preventDefault():xt(n,"key")};ge.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ge.keypress=(n,e)=>{let t=e;if(Nd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||xe&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof z)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function oo(n){return{left:n.clientX,top:n.clientY}}function Gg(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function kl(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function mn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Yg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(mn(n,new E(t)),!0):!1}function Xg(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof E&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(E.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(mn(n,E.create(n.state.doc,i)),!0):!1}function Qg(n,e,t,r,i){return kl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?Xg(n,t):Yg(n,t))}function Zg(n,e,t,r){return kl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function ey(n,e,t,r){return kl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||ty(n,t,r)}function ty(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(mn(n,z.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)mn(n,z.create(r,l+1,l+1+s.content.size));else if(E.isSelectable(s))mn(n,E.create(r,l));else continue;return!0}}function Al(n){return ii(n)}const Md=xe?"metaKey":"ctrlKey";me.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Al(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&Gg(t,n.input.lastClick)&&!t[Md]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(oo(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ny(n,s,t,!!r)):(o=="doubleClick"?Zg:ey)(n,s.pos,s.inside,t)?t.preventDefault():xt(n,"pointer"))};class ny{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Md],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let f=e.state.doc.resolve(t.pos);o=f.parent,s=f.depth?f.before():0}const l=i?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&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof E&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&De&&!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)),xt(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(()=>nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(oo(e))),this.updateAllowDefault(e),this.allowDefault||!t?xt(this.view,"pointer"):Qg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pe&&this.mightDrag&&!this.mightDrag.node.isAtom||ce&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(mn(this.view,R.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):xt(this.view,"pointer")}move(e){this.updateAllowDefault(e),xt(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)}}me.touchstart=n=>{n.input.lastTouch=Date.now(),Al(n),xt(n,"pointer")};me.touchmove=n=>{n.input.lastTouch=Date.now(),xt(n,"pointer")};me.contextmenu=n=>Al(n);function Nd(n,e){return n.composing?!0:pe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ry=Ee?5e3:-1;ge.compositionstart=ge.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof z&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ii(n,!0),n.markCursor=null;else if(ii(n),De&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Rd(n,ry)};ge.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Rd(n,20))};function Rd(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ii(n),e))}function Dd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=oy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function iy(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Xm(e.focusNode,e.focusOffset),r=Qm(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function oy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ii(n,e=!1){if(!(Ee&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Dd(n),e||n.docView&&n.docView.dirty){let t=xl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function sy(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const sr=be&&Ot<15||xn&&rg<604;me.copy=ge.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=sr?null:t.clipboardData,s=r.content(),{dom:l,text:a}=xd(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):sy(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ly(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ay(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?lr(n,r.value,null,i,e):lr(n,r.textContent,r.innerHTML,i,e)},50)}function lr(n,e,t,r,i){let o=Cd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||w.empty)))return!0;if(!o)return!1;let s=ly(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Id(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ge.paste=(n,e)=>{let t=e;if(n.composing&&!Ee)return;let r=sr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&lr(n,Id(r),r.getData("text/html"),i,t)?t.preventDefault():ay(n,t)};class Pd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const $d=xe?"altKey":"ctrlKey";me.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(oo(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)s=E.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=E.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:f}=xd(n,l);(!t.dataTransfer.files.length||!ce||sd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(sr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",sr||t.dataTransfer.setData("text/plain",c),n.dragging=new Pd(f,!t[$d],s)};me.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ge.dragover=ge.dragenter=(n,e)=>e.preventDefault();ge.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(oo(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",h=>{s=h(s,n)}):s=Cd(n,Id(t.dataTransfer),sr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[$d]);if(n.someProp("handleDrop",h=>h(n,t,s||w.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Xu(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let c=n.state.tr;if(l){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let f=c.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(f,f,s.content.firstChild):c.replaceRange(f,f,s),c.doc.eq(d))return;let p=c.doc.resolve(f);if(u&&E.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new E(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,C)=>h=C),c.setSelection(Cl(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};me.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&nt(n)},20))};me.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};me.beforeinput=(n,e)=>{if(ce&&Ee&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,It(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in ge)me[n]=ge[n];function ar(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class oi{constructor(e,t){this.toDOM=e,this.spec=t||Ft,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new he(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof oi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ar(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class At{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new he(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof At&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}static is(e){return e.type instanceof At}destroy(){}}class Tl{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new he(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Tl&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}destroy(){}}class he{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new he(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new he(e,e,new oi(t,r))}static inline(e,t,r,i){return new he(e,t,new At(r,i))}static node(e,t,r,i){return new he(e,t,new Tl(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof At}get widget(){return this.type instanceof oi}}const an=[],Ft={};class J{constructor(e,t){this.local=e.length?e:an,this.children=t.length?t:an}static create(e,t){return t.length?si(t,e,0,Ft):ae}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==ae||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ft)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?cy(this.children,s||[],e,t,r,i,o):s?new J(s.sort(_t),an):ae}add(e,t){return t.length?this==ae?J.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,f;if(f=zd(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,f,c+1):i.splice(o,0,a,a+l.nodeSize,si(f,l,c+1,Ft)),o+=3}});let s=Bd(o?Ld(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new J(s.length?this.local.concat(s).sort(_t):this.local,i||this.children)}remove(e){return e.length==0||this==ae?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+1]+t;for(let f=0,u;f<e.length;f++)(u=e[f])&&u.from>l&&u.to<a&&(e[f]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=ae?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new J(i,r):ae}forChild(e,t){if(this==ae)return this;if(t.isLeaf)return J.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof At){let c=Math.max(o,a.from)-o,f=Math.min(s,a.to)-o;c<f&&(i||(i=[])).push(a.copy(c,f))}}if(i){let l=new J(i.sort(_t),an);return r?new yt([l,r]):l}return r||ae}eq(e){if(this==e)return!0;if(!(e instanceof J)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return El(this.localsInner(e))}localsInner(e){if(this==ae)return an;if(e.inlineContent||!this.local.some(At.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof At||t.push(this.local[r]);return t}}J.empty=new J([],[]);J.removeOverlap=El;const ae=J.empty;class yt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Ft));return yt.from(r)}forChild(e,t){if(t.isLeaf)return J.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ae&&(o instanceof yt?r=r.concat(o.members):r.push(o))}return yt.from(r)}eq(e){if(!(e instanceof yt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?El(r?t:t.sort(_t)):an}static from(e){switch(e.length){case 0:return ae;case 1:return e[0];default:return new yt(e.every(t=>t instanceof J)?e:e.reduce((t,r)=>t.concat(r instanceof J?r:r.members),[]))}}}function cy(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,f=o;c<t.maps.length;c++){let u=0;t.maps[c].forEach((d,p,h,m)=>{let g=m-h-(p-d);for(let y=0;y<l.length;y+=3){let C=l[y+1];if(C<0||d>C+f-u)continue;let k=l[y]+f-u;p>=k?l[y+1]=d<=k?-2:-1:d>=f&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),f=t.maps[c].map(f,-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 f=t.map(n[c]+o),u=f-i;if(u<0||u>=r.content.size){a=!0;continue}let d=t.map(n[c+1]+o,-1),p=d-i,{index:h,offset:m}=r.content.findIndex(u),g=r.maybeChild(h);if(g&&m==u&&m+g.nodeSize==p){let y=l[c+2].mapInner(t,g,f+1,n[c]+o+1,s);y!=ae?(l[c]=u,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=fy(l,n,e,t,i,o,s),f=si(c,r,0,s);e=f.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,d=0;u<f.children.length;u+=3){let p=f.children[u];for(;d<l.length&&l[d]<p;)d+=3;l.splice(d,0,f.children[u],f.children[u+1],f.children[u+2])}}return new J(e.sort(_t),l)}function Bd(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new he(i.from+e,i.to+e,i.type))}return t}function fy(n,e,t,r,i,o,s){function l(a,c){for(let f=0;f<a.local.length;f++){let u=a.local[f].map(r,i,c);u?t.push(u):s.onRemove&&s.onRemove(a.local[f].spec)}for(let f=0;f<a.children.length;f+=3)l(a.children[f+2],a.children[f]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+o+1);return t}function zd(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Ld(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function si(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=zd(n,l,a+t);if(c){o=!0;let f=si(c,l,t+a+1,r);f!=ae&&i.push(a,a+l.nodeSize,f)}});let s=Bd(o?Ld(n):n,-t).sort(_t);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new J(s,i):ae}function _t(n,e){return n.from-e.from||n.to-e.to}function El(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Za(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Za(e,i,r.copy(o.from,r.to)));break}}}return e}function Za(n,e,t){for(;e<n.length&&_t(t,n[e])>0;)e++;n.splice(e,0,t)}function Eo(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ae&&e.push(r)}),n.cursorWrapper&&e.push(J.create(n.state.doc,[n.cursorWrapper.deco])),yt.from(e)}const uy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dy=be&&Ot<=11;class hy{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 py{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new hy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);be&&Ot<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),dy&&(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,uy)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ua(this.view)){if(this.suppressingSelectionUpdates)return nt(this.view);if(be&&Ot<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ut(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=or(o))t.add(o);for(let o=e.anchorNode;o;o=or(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ua(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let f=0;f<t.length;f++){let u=this.registerMutation(t[f],a);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(l=!0))}if(De&&a.length){let f=a.filter(u=>u.nodeName=="BR");if(f.length==2){let[u,d]=f;u.parentNode&&u.parentNode.parentNode==d.parentNode?d.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let d of f){let p=d.parentNode;p&&p.nodeName=="LI"&&(!u||yy(e,u)!=p)&&d.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ro(r)&&(c=xl(e))&&c.eq(R.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,nt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),my(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||nt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 f=0;f<e.addedNodes.length;f++){let u=e.addedNodes[f];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(be&&Ot<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:u,nextSibling:d}=e.addedNodes[f];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==e.target?se(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?se(o):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 ec=new WeakMap,tc=!1;function my(n){if(!ec.has(n)&&(ec.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=De,tc)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."),tc=!0}}function nc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Ut(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function gy(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return nc(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?nc(n,t):null}function yy(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function by(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,f=a.anchorNode;if(f&&n.dom.contains(f.nodeType==1?f:f.parentNode)&&(c=[{node:f,offset:a.anchorOffset}],ro(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ce&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],C=y.pmViewDesc;if(y.nodeName=="BR"&&!C){o=g;break}if(!C||C.size)break}let u=n.state.doc,d=n.someProp("domParser")||vn.fromSchema(n.state.schema),p=u.resolve(s),h=null,m=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:vy,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),h={anchor:g+s,head:y+s}}return{doc:m,sel:h,from:s,to:l}}function vy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(pe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||pe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Sy=/^(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 wy(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Y=xl(n,T);if(Y&&!n.state.selection.eq(Y)){if(ce&&Ee&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",O=>O(n,It(13,"Enter"))))return;let A=n.state.tr.setSelection(Y);T=="pointer"?A.setMeta("pointer",!0):T=="key"&&A.scrollIntoView(),o&&A.setMeta("composition",o),n.dispatch(A)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=by(n,e,t),f=n.state.doc,u=f.slice(c.from,c.to),d,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(d=n.state.selection.to,p="end"):(d=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let h=Oy(u.content,c.doc.content,c.from,d,p);if((xn&&n.input.lastIOSEnter>Date.now()-225||Ee)&&i.some(T=>T.nodeType==1&&!Sy.test(T.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",T=>T(n,It(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof z&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=rc(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let Y=n.state.tr.setSelection(T);o&&Y.setMeta("composition",o),n.dispatch(Y)}}return}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&h.start==h.endB&&n.state.selection instanceof z&&(h.start>n.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA<n.state.selection.to&&h.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),be&&Ot<=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),g=c.doc.resolveNoCache(h.endB-c.from),y=f.resolve(h.start),C=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA,k;if((xn&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(k=R.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head==g.pos)&&n.someProp("handleKeyDown",T=>T(n,It(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&Cy(f,h.start,h.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,It(8,"Backspace")))){Ee&&ce&&n.domObserver.suppressSelectionUpdates();return}ce&&Ee&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),Ee&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,It(13,"Enter"))})},20));let N=h.start,M=h.endA,x,D,I;if(C){if(m.pos==g.pos)be&&Ot<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>nt(n),20)),x=n.state.tr.delete(N,M),D=f.resolve(h.start).marksAcross(f.resolve(h.endA));else if(h.endA==h.endB&&(I=xy(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start()))))x=n.state.tr,I.type=="add"?x.addMark(N,M,I.mark):x.removeMark(N,M,I.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",Y=>Y(n,N,M,T)))return;x=n.state.tr.insertText(T,N,M)}}if(x||(x=n.state.tr.replace(N,M,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let T=rc(n,x.doc,c.sel);T&&!(ce&&Ee&&n.composing&&T.empty&&(h.start!=h.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==N||T.head==x.mapping.map(M)-1)||be&&T.empty&&T.head==N)&&x.setSelection(T)}D&&x.ensureMarks(D),o&&x.setMeta("composition",o),n.dispatch(x.scrollIntoView())}function rc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Cl(n,e.resolve(t.anchor),e.resolve(t.head))}function xy(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let f=0;f<r.length;f++)i=r[f].removeFromSet(i);for(let f=0;f<t.length;f++)o=t[f].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=f=>f.mark(l.addToSet(f.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(a(e.child(f)));if(b.from(c).eq(n))return{mark:l,type:s}}function Cy(n,e,t,r,i){if(t-e<=i.pos-r.pos||Mo(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Mo(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Mo(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Mo(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Oy(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&ic(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&ic(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function ic(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class ky{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Hg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(cc),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=lc(this),sc(this),this.nodeViews=ac(this),this.docView=Fa(this.state.doc,oc(this),Eo(this),this.dom,this),this.domObserver=new py(this,(r,i,o,s)=>wy(this,r,i,o,s)),this.domObserver.start(),Ug(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ks(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Dd(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=ac(this);Ty(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ks(this),this.editable=lc(this),sc(this);let a=Eo(this),c=oc(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(i.selection))&&(s=!0);let d=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&sg(this);if(s){this.domObserver.stop();let p=u&&(be||ce)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Ay(i.selection,e.selection);if(u){let h=ce?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=iy(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fa(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ng(this))?nt(this,p):(vd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():d&&lg(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof E){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ia(this,t.getBoundingClientRect(),e)}else Ia(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 t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Pd(e.slice,e.move,i<0?void 0:E.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(be){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&&ag(this.dom),nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return hg(this,e)}coordsAtPos(e,t=1){return ud(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return bg(this,t||this.state,e)}pasteHTML(e,t){return lr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return lr(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Kg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Eo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Gm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return qg(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?pe&&this.root.nodeType===11&&eg(this.dom.ownerDocument)==this.dom&&gy(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function oc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[he.node(0,n.state.doc.content.size,e)]}function sc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:he.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function lc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ay(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function ac(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Ty(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function cc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Tt={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:"'"},li={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ey=typeof navigator<"u"&&/Mac/.test(navigator.platform),My=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var le=0;le<10;le++)Tt[48+le]=Tt[96+le]=String(le);for(var le=1;le<=24;le++)Tt[le+111]="F"+le;for(var le=65;le<=90;le++)Tt[le]=String.fromCharCode(le+32),li[le]=String.fromCharCode(le);for(var No in Tt)li.hasOwnProperty(No)||(li[No]=Tt[No]);function Ny(n){var e=Ey&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||My&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?li:Tt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Ry=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Dy(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Ry?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Iy(n){let e=Object.create(null);for(let t in n)e[Dy(t)]=n[t];return e}function Ro(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Py(n){return new Yt({props:{handleKeyDown:Ml(n)}})}function Ml(n){let e=Iy(n);return function(t,r){let i=Ny(r),o,s=e[Ro(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ro(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Tt[r.keyCode])&&o!=i){let l=e[Ro(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const $y=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Fd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const By=(n,e,t)=>{let r=Fd(n,t);if(!r)return!1;let i=Nl(r);if(!i){let s=r.blockRange(),l=s&&En(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(Wd(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Cn(o,"end")||E.isSelectable(o)))for(let s=r.depth;;s--){let l=to(n.doc,r.before(s),r.after(s),w.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Cn(o,"end")?R.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):E.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},zy=(n,e,t)=>{let r=Fd(n,t);if(!r)return!1;let i=Nl(r);return i?_d(n,i,e):!1},Ly=(n,e,t)=>{let r=jd(n,t);if(!r)return!1;let i=Rl(r);return i?_d(n,i,e):!1};function _d(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=to(n.doc,o,a,w.empty);if(!c||c.from!=o||c instanceof te&&c.slice.size>=a-o)return!1;if(t){let f=n.tr.step(c);f.setSelection(z.create(f.doc,o)),t(f.scrollIntoView())}return!0}function Cn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Fy=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Nl(r)}let s=o&&o.nodeBefore;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Nl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function jd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _y=(n,e,t)=>{let r=jd(n,t);if(!r)return!1;let i=Rl(r);if(!i)return!1;let o=i.nodeAfter;if(Wd(n,i,e,1))return!0;if(r.parent.content.size==0&&(Cn(o,"start")||E.isSelectable(o))){let s=to(n.doc,r.before(),r.after(),w.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Cn(o,"start")?R.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):E.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},jy=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Rl(r)}let s=o&&o.nodeAfter;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos)).scrollIntoView()),!0)};function Rl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Vy=(n,e)=>{let t=n.selection,r=t instanceof E,i;if(r){if(t.node.isTextblock||!Mn(n.doc,t.from))return!1;i=t.from}else if(i=bl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(E.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Wy=(n,e)=>{let t=n.selection,r;if(t instanceof E){if(t.node.isTextblock||!Mn(n.doc,t.to))return!1;r=t.to}else if(r=bl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Hy=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&En(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Uy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
- `).scrollIntoView()),!0)};function Vd(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Ky=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=Vd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(R.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Jy=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Oe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Vd(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(z.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},qy=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(yl(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&En(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Gy=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(E.create(n.doc,i))),!0)};function Yy(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Mn(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Wd(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&Yy(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,h=b.empty;for(let y=s.length-1;y>=0;y--)h=b.from(s[y].create(null,h));h=b.from(i.copy(h));let m=n.tr.step(new ne(e.pos-1,p,e.pos,p,new w(h,1,0),s.length,!0)),g=p+2*s.length;Mn(m.doc,g)&&m.join(g),t(m.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&a?null:R.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),d=u&&En(u);if(d!=null&&d>=e.depth)return t&&t(n.tr.lift(u,d).scrollIntoView()),!0;if(c&&Cn(o,"start",!0)&&Cn(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let y=b.empty;for(let k=h.length-1;k>=0;k--)y=b.from(h[k].copy(y));let C=n.tr.step(new ne(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new w(y,h.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function Hd(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(z.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const Xy=Hd(-1),Qy=Hd(1);function Zy(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&gl(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function eb(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let f=t.doc.resolve(c),u=f.index();i=f.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function tb(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let f=t.doc.resolve(s.start-2);a=new Zr(f,f,s.depth),s.endIndex<s.parent.childCount&&(s=new Zr(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=gl(a,n,e,s);return c?(r&&r(nb(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function nb(n,e,t,r,i){let o=b.empty;for(let f=t.length-1;f>=0;f--)o=b.from(t[f].type.create(t[f].attrs,o));n.step(new ne(e.start-(r?2:0),e.end,e.start,e.end,new w(o,0,0),t.length,!0));let s=0;for(let f=0;f<t.length;f++)t[f].type==i&&(s=f+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let f=e.startIndex,u=e.endIndex,d=!0;f<u;f++,d=!1)!d&&yl(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(f).nodeSize;return n}function rb(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?ib(e,t,n,o):ob(e,t,o):!0:!1}}function ib(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ne(o-1,s,o,s,new w(b.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Zr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=En(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Mn(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function ob(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),f=o.index(-1);if(!c.canReplace(f+(l?0:1),f+1,s.content.append(a?b.empty:b.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new ne(u-(l?1:0),d+(a?1:0),u+1,d-1,new w((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function sb(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=b.from(c?n.create():null),u=new w(b.from(n.create(null,b.from(l.type.create(null,f)))),c?3:1,0),d=o.start,p=o.end;t(e.tr.step(new ne(d-(c?3:1),p,d,p,u,1,!0)).scrollIntoView())}return!0}}function Ud(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Ud(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function lb(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Ud(n))&&(r&&(r+=" "),r+=e);return r}const Dl="-",ab=n=>{const e=fb(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(Dl);return l[0]===""&&l.length!==1&&l.shift(),Kd(l,e)||cb(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},Kd=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?Kd(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=n.join(Dl);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},fc=/^\[(.+)\]$/,cb=n=>{if(fc.test(n)){const e=fc.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},fb=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return db(Object.entries(n.classGroups),t).forEach(([o,s])=>{As(s,r,o,e)}),r},As=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const o=i===""?e:uc(e,i);o.classGroupId=t;return}if(typeof i=="function"){if(ub(i)){As(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([o,s])=>{As(s,uc(e,o),t,r)})})},uc=(n,e)=>{let t=n;return e.split(Dl).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},ub=n=>n.isThemeGetter,db=(n,e)=>e?n.map(([t,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[t,i]}):n,hb=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(o,s)=>{t.set(o,s),e++,e>n&&(e=0,r=t,t=new Map)};return{get(o){let s=t.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){t.has(o)?t.set(o,s):i(o,s)}}},Jd="!",pb=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],o=e.length,s=l=>{const a=[];let c=0,f=0,u;for(let g=0;g<l.length;g++){let y=l[g];if(c===0){if(y===i&&(r||l.slice(g,g+o)===e)){a.push(l.slice(f,g)),f=g+o;continue}if(y==="/"){u=g;continue}}y==="["?c++:y==="]"&&c--}const d=a.length===0?l:l.substring(f),p=d.startsWith(Jd),h=p?d.substring(1):d,m=u&&u>f?u-f:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}};return t?l=>t({className:l,parseClassName:s}):s},mb=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},gb=n=>({cache:hb(n.cacheSize),parseClassName:pb(n),...ab(n)}),yb=/\s+/,bb=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=n.trim().split(yb);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:f,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:p}=t(c);let h=!!p,m=r(h?d.substring(0,p):d);if(!m){if(!h){l=c+(l.length>0?" "+l:l);continue}if(m=r(d),!m){l=c+(l.length>0?" "+l:l);continue}h=!1}const g=mb(f).join(":"),y=u?g+Jd:g,C=y+m;if(o.includes(C))continue;o.push(C);const k=i(m,h);for(let N=0;N<k.length;++N){const M=k[N];o.push(y+M)}l=c+(l.length>0?" "+l:l)}return l};function vb(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=qd(e))&&(r&&(r+=" "),r+=t);return r}const qd=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=qd(n[r]))&&(t&&(t+=" "),t+=e);return t};function Sb(n,...e){let t,r,i,o=s;function s(a){const c=e.reduce((f,u)=>u(f),n());return t=gb(c),r=t.cache.get,i=t.cache.set,o=l,l(a)}function l(a){const c=r(a);if(c)return c;const f=bb(a,t);return i(a,f),f}return function(){return o(vb.apply(null,arguments))}}const V=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Gd=/^\[(?:([a-z-]+):)?(.+)\]$/i,wb=/^\d+\/\d+$/,xb=new Set(["px","full","screen"]),Cb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ob=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Ab=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=n=>gn(n)||xb.has(n)||wb.test(n),at=n=>Rn(n,"length",$b),gn=n=>!!n&&!Number.isNaN(Number(n)),Do=n=>Rn(n,"number",gn),zn=n=>!!n&&Number.isInteger(Number(n)),Eb=n=>n.endsWith("%")&&gn(n.slice(0,-1)),P=n=>Gd.test(n),ct=n=>Cb.test(n),Mb=new Set(["length","size","percentage"]),Nb=n=>Rn(n,Mb,Yd),Rb=n=>Rn(n,"position",Yd),Db=new Set(["image","url"]),Ib=n=>Rn(n,Db,zb),Pb=n=>Rn(n,"",Bb),Ln=()=>!0,Rn=(n,e,t)=>{const r=Gd.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},$b=n=>Ob.test(n)&&!kb.test(n),Yd=()=>!1,Bb=n=>Ab.test(n),zb=n=>Tb.test(n),Lb=()=>{const n=V("colors"),e=V("spacing"),t=V("blur"),r=V("brightness"),i=V("borderColor"),o=V("borderRadius"),s=V("borderSpacing"),l=V("borderWidth"),a=V("contrast"),c=V("grayscale"),f=V("hueRotate"),u=V("invert"),d=V("gap"),p=V("gradientColorStops"),h=V("gradientColorStopPositions"),m=V("inset"),g=V("margin"),y=V("opacity"),C=V("padding"),k=V("saturate"),N=V("scale"),M=V("sepia"),x=V("skew"),D=V("space"),I=V("translate"),T=()=>["auto","contain","none"],Y=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",P,e],O=()=>[P,e],B=()=>["",Xe,at],v=()=>["auto",gn,P],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],j=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",P],lt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[gn,P];return{cacheSize:500,separator:":",theme:{colors:[Ln],spacing:[Xe,at],blur:["none","",ct,P],brightness:Z(),borderColor:[n],borderRadius:["none","","full",ct,P],borderSpacing:O(),borderWidth:B(),contrast:Z(),grayscale:U(),hueRotate:Z(),invert:U(),gap:O(),gradientColorStops:[n],gradientColorStopPositions:[Eb,at],inset:A(),margin:A(),opacity:Z(),padding:O(),saturate:Z(),scale:Z(),sepia:U(),skew:Z(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",P]}],container:["container"],columns:[{columns:[ct]}],"break-after":[{"break-after":lt()}],"break-before":[{"break-before":lt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),P]}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zn,P]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",P]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",zn,P]}],"grid-cols":[{"grid-cols":[Ln]}],"col-start-end":[{col:["auto",{span:["full",zn,P]},P]}],"col-start":[{"col-start":v()}],"col-end":[{"col-end":v()}],"grid-rows":[{"grid-rows":[Ln]}],"row-start-end":[{row:["auto",{span:[zn,P]},P]}],"row-start":[{"row-start":v()}],"row-end":[{"row-end":v()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",P]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",P]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",P,e]}],"min-w":[{"min-w":[P,e,"min","max","fit"]}],"max-w":[{"max-w":[P,e,"none","full","min","max","fit","prose",{screen:[ct]},ct]}],h:[{h:[P,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[P,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[P,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[P,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ct,at]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Do]}],"font-family":[{font:[Ln]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",P]}],"line-clamp":[{"line-clamp":["none",gn,Do]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Xe,P]}],"list-image":[{"list-image":["none",P]}],"list-style-type":[{list:["none","disc","decimal",P]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Xe,at]}],"underline-offset":[{"underline-offset":["auto",Xe,P]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),Rb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Nb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ib]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:F()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Xe,P]}],"outline-w":[{outline:[Xe,at]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Xe,at]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",ct,Pb]}],"shadow-color":[{shadow:[Ln]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...j(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",ct,P]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",P]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",P]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",P]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[zn,P]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",P]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",P]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",P]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Xe,at,Do]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Fb=Sb(Lb);var cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function _b(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var dc=Object.prototype.toString,Qd=function(e){var t=dc.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&dc.call(e.callee)==="[object Function]"),r},Io,hc;function jb(){if(hc)return Io;hc=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Qd,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(d){var p=d.constructor;return p&&p.prototype===d},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!c["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{a(window[d])}catch{return!0}}catch{return!0}return!1}(),u=function(d){if(typeof window>"u"||!f)return a(d);try{return a(d)}catch{return!1}};n=function(p){var h=p!==null&&typeof p=="object",m=t.call(p)==="[object Function]",g=r(p),y=h&&t.call(p)==="[object String]",C=[];if(!h&&!m&&!g)throw new TypeError("Object.keys called on a non-object");var k=s&&m;if(y&&p.length>0&&!e.call(p,0))for(var N=0;N<p.length;++N)C.push(String(N));if(g&&p.length>0)for(var M=0;M<p.length;++M)C.push(String(M));else for(var x in p)!(k&&x==="prototype")&&e.call(p,x)&&C.push(String(x));if(o)for(var D=u(p),I=0;I<l.length;++I)!(D&&l[I]==="constructor")&&e.call(p,l[I])&&C.push(l[I]);return C}}return Io=n,Io}var Vb=Array.prototype.slice,Wb=Qd,pc=Object.keys,zr=pc?function(e){return pc(e)}:jb(),mc=Object.keys;zr.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Wb(r)?mc(Vb.call(r)):mc(r)})}else Object.keys=zr;return Object.keys||zr};var Il=zr,Hb=Error,Ub=EvalError,Kb=RangeError,Jb=ReferenceError,Zd=SyntaxError,Nt=TypeError,qb=URIError,so=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==i||s.enumerable!==!0)return!1}return!0},gc=typeof Symbol<"u"&&Symbol,Gb=so,Pl=function(){return typeof gc!="function"||typeof Symbol!="function"||typeof gc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Gb()},Po={__proto__:null,foo:{}},Yb=Object,Xb=function(){return{__proto__:Po}.foo===Po.foo&&!(Po instanceof Yb)},Qb="Function.prototype.bind called on incompatible ",Zb=Object.prototype.toString,e0=Math.max,t0="[object Function]",yc=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},n0=function(e,t){for(var r=[],i=t,o=0;i<e.length;i+=1,o+=1)r[o]=e[i];return r},r0=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},i0=function(e){var t=this;if(typeof t!="function"||Zb.apply(t)!==t0)throw new TypeError(Qb+t);for(var r=n0(arguments,1),i,o=function(){if(this instanceof i){var f=t.apply(this,yc(r,arguments));return Object(f)===f?f:this}return t.apply(e,yc(r,arguments))},s=e0(0,t.length-r.length),l=[],a=0;a<s;a++)l[a]="$"+a;if(i=Function("binder","return function ("+r0(l,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i},o0=i0,$l=Function.prototype.bind||o0,s0=Function.prototype.call,l0=Object.prototype.hasOwnProperty,a0=$l,eh=a0.call(s0,l0),L,c0=Hb,f0=Ub,u0=Kb,d0=Jb,On=Zd,yn=Nt,h0=qb,th=Function,$o=function(n){try{return th('"use strict"; return ('+n+").constructor;")()}catch{}},jt=Object.getOwnPropertyDescriptor;if(jt)try{jt({},"")}catch{jt=null}var Bo=function(){throw new yn},p0=jt?function(){try{return arguments.callee,Bo}catch{try{return jt(arguments,"callee").get}catch{return Bo}}}():Bo,rn=Pl(),m0=Xb(),ee=Object.getPrototypeOf||(m0?function(n){return n.__proto__}:null),cn={},g0=typeof Uint8Array>"u"||!ee?L:ee(Uint8Array),Vt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?L:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?L:ArrayBuffer,"%ArrayIteratorPrototype%":rn&&ee?ee([][Symbol.iterator]()):L,"%AsyncFromSyncIteratorPrototype%":L,"%AsyncFunction%":cn,"%AsyncGenerator%":cn,"%AsyncGeneratorFunction%":cn,"%AsyncIteratorPrototype%":cn,"%Atomics%":typeof Atomics>"u"?L:Atomics,"%BigInt%":typeof BigInt>"u"?L:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?L:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?L:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?L:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":c0,"%eval%":eval,"%EvalError%":f0,"%Float32Array%":typeof Float32Array>"u"?L:Float32Array,"%Float64Array%":typeof Float64Array>"u"?L:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?L:FinalizationRegistry,"%Function%":th,"%GeneratorFunction%":cn,"%Int8Array%":typeof Int8Array>"u"?L:Int8Array,"%Int16Array%":typeof Int16Array>"u"?L:Int16Array,"%Int32Array%":typeof Int32Array>"u"?L:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":rn&&ee?ee(ee([][Symbol.iterator]())):L,"%JSON%":typeof JSON=="object"?JSON:L,"%Map%":typeof Map>"u"?L:Map,"%MapIteratorPrototype%":typeof Map>"u"||!rn||!ee?L:ee(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?L:Promise,"%Proxy%":typeof Proxy>"u"?L:Proxy,"%RangeError%":u0,"%ReferenceError%":d0,"%Reflect%":typeof Reflect>"u"?L:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?L:Set,"%SetIteratorPrototype%":typeof Set>"u"||!rn||!ee?L:ee(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?L:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":rn&&ee?ee(""[Symbol.iterator]()):L,"%Symbol%":rn?Symbol:L,"%SyntaxError%":On,"%ThrowTypeError%":p0,"%TypedArray%":g0,"%TypeError%":yn,"%Uint8Array%":typeof Uint8Array>"u"?L:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?L:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?L:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?L:Uint32Array,"%URIError%":h0,"%WeakMap%":typeof WeakMap>"u"?L:WeakMap,"%WeakRef%":typeof WeakRef>"u"?L:WeakRef,"%WeakSet%":typeof WeakSet>"u"?L:WeakSet};if(ee)try{null.error}catch(n){var y0=ee(ee(n));Vt["%Error.prototype%"]=y0}var b0=function n(e){var t;if(e==="%AsyncFunction%")t=$o("async function () {}");else if(e==="%GeneratorFunction%")t=$o("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=$o("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&ee&&(t=ee(i.prototype))}return Vt[e]=t,t},bc={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vr=$l,ai=eh,v0=vr.call(Function.call,Array.prototype.concat),S0=vr.call(Function.apply,Array.prototype.splice),vc=vr.call(Function.call,String.prototype.replace),ci=vr.call(Function.call,String.prototype.slice),w0=vr.call(Function.call,RegExp.prototype.exec),x0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C0=/\\(\\)?/g,O0=function(e){var t=ci(e,0,1),r=ci(e,-1);if(t==="%"&&r!=="%")throw new On("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new On("invalid intrinsic syntax, expected opening `%`");var i=[];return vc(e,x0,function(o,s,l,a){i[i.length]=l?vc(a,C0,"$1"):s||o}),i},k0=function(e,t){var r=e,i;if(ai(bc,r)&&(i=bc[r],r="%"+i[0]+"%"),ai(Vt,r)){var o=Vt[r];if(o===cn&&(o=b0(r)),typeof o>"u"&&!t)throw new yn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new On("intrinsic "+e+" does not exist!")},Ue=function(e,t){if(typeof e!="string"||e.length===0)throw new yn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new yn('"allowMissing" argument must be a boolean');if(w0(/^%?[^%]*%?$/,e)===null)throw new On("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=O0(e),i=r.length>0?r[0]:"",o=k0("%"+i+"%",t),s=o.name,l=o.value,a=!1,c=o.alias;c&&(i=c[0],S0(r,v0([0,1],c)));for(var f=1,u=!0;f<r.length;f+=1){var d=r[f],p=ci(d,0,1),h=ci(d,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new On("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(a=!0),i+="."+d,s="%"+i+"%",ai(Vt,s))l=Vt[s];else if(l!=null){if(!(d in l)){if(!t)throw new yn("base intrinsic for "+e+" exists, but the property is not available.");return}if(jt&&f+1>=r.length){var m=jt(l,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?l=m.get:l=l[d]}else u=ai(l,d),l=l[d];u&&!a&&(Vt[s]=l)}}return l},zo,Sc;function Bl(){if(Sc)return zo;Sc=1;var n=Ue,e=n("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return zo=e,zo}var A0=Ue,Lr=A0("%Object.getOwnPropertyDescriptor%",!0);if(Lr)try{Lr([],"length")}catch{Lr=null}var zl=Lr,wc=Bl(),T0=Zd,on=Nt,xc=zl,Ll=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new on("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new on("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new on("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new on("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new on("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new on("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,a=!!xc&&xc(e,t);if(wc)wc(e,t,{configurable:s===null&&a?a.configurable:!s,enumerable:i===null&&a?a.enumerable:!i,value:r,writable:o===null&&a?a.writable:!o});else if(l||!i&&!o&&!s)e[t]=r;else throw new T0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ts=Bl(),nh=function(){return!!Ts};nh.hasArrayLengthDefineBug=function(){if(!Ts)return null;try{return Ts([],"length",{value:1}).length!==1}catch{return!0}};var Fl=nh,E0=Il,M0=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",N0=Object.prototype.toString,R0=Array.prototype.concat,Cc=Ll,D0=function(n){return typeof n=="function"&&N0.call(n)==="[object Function]"},rh=Fl(),I0=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!D0(r)||!r())return}rh?Cc(n,e,t,!0):Cc(n,e,t)},ih=function(n,e){var t=arguments.length>2?arguments[2]:{},r=E0(e);M0&&(r=R0.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)I0(n,r[i],e[r[i]],t[r[i]])};ih.supportsDescriptors=!!rh;var Xt=ih,oh={exports:{}},P0=Ue,Oc=Ll,$0=Fl(),kc=zl,Ac=Nt,B0=P0("%Math.floor%"),z0=function(e,t){if(typeof e!="function")throw new Ac("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||B0(t)!==t)throw new Ac("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&kc){var s=kc(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&($0?Oc(e,"length",t,!0,!0):Oc(e,"length",t)),e};(function(n){var e=$l,t=Ue,r=z0,i=Nt,o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(s,o),a=Bl(),c=t("%Math.max%");n.exports=function(d){if(typeof d!="function")throw new i("a function is required");var p=l(e,s,arguments);return r(p,1+c(0,d.length-(arguments.length-1)),!0)};var f=function(){return l(e,o,arguments)};a?a(n.exports,"apply",{value:f}):n.exports.apply=f})(oh);var Dn=oh.exports,sh=Ue,lh=Dn,L0=lh(sh("String.prototype.indexOf")),Ae=function(e,t){var r=sh(e,!!t);return typeof r=="function"&&L0(e,".prototype.")>-1?lh(r):r},F0=Il,ah=so(),ch=Ae,Tc=Object,_0=ch("Array.prototype.push"),Ec=ch("Object.prototype.propertyIsEnumerable"),j0=ah?Object.getOwnPropertySymbols:null,fh=function(e,t){if(e==null)throw new TypeError("target must be an object");var r=Tc(e);if(arguments.length===1)return r;for(var i=1;i<arguments.length;++i){var o=Tc(arguments[i]),s=F0(o),l=ah&&(Object.getOwnPropertySymbols||j0);if(l)for(var a=l(o),c=0;c<a.length;++c){var f=a[c];Ec(o,f)&&_0(s,f)}for(var u=0;u<s.length;++u){var d=s[u];if(Ec(o,d)){var p=o[d];r[d]=p}}}return r},Lo=fh,V0=function(){if(!Object.assign)return!1;for(var n="abcdefghijklmnopqrst",e=n.split(""),t={},r=0;r<e.length;++r)t[e[r]]=e[r];var i=Object.assign({},t),o="";for(var s in i)o+=s;return n!==o},W0=function(){if(!Object.assign||!Object.preventExtensions)return!1;var n=Object.preventExtensions({1:2});try{Object.assign(n,"xy")}catch{return n[1]==="y"}return!1},uh=function(){return!Object.assign||V0()||W0()?Lo:Object.assign},H0=Xt,U0=uh,K0=function(){var e=U0();return H0(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e},J0=Xt,q0=Dn,G0=fh,dh=uh,Y0=K0,X0=q0.apply(dh()),hh=function(e,t){return X0(Object,arguments)};J0(hh,{getPolyfill:dh,implementation:G0,shim:Y0});var Q0=hh,fr=function(){return typeof(function(){}).name=="string"},Yn=Object.getOwnPropertyDescriptor;if(Yn)try{Yn([],"length")}catch{Yn=null}fr.functionsHaveConfigurableNames=function(){if(!fr()||!Yn)return!1;var e=Yn(function(){},"name");return!!e&&!!e.configurable};var Z0=Function.prototype.bind;fr.boundFunctionsHaveNames=function(){return fr()&&typeof Z0=="function"&&(function(){}).bind().name!==""};var e1=fr,Mc=Ll,t1=Fl(),n1=e1.functionsHaveConfigurableNames(),r1=Nt,i1=function(e,t){if(typeof e!="function")throw new r1("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||n1)&&(t1?Mc(e,"name",t,!0,!0):Mc(e,"name",t)),e},o1=i1,s1=Nt,l1=Object,ph=o1(function(){if(this==null||this!==l1(this))throw new s1("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),a1=ph,c1=Xt.supportsDescriptors,f1=Object.getOwnPropertyDescriptor,mh=function(){if(c1&&/a/mig.flags==="gim"){var e=f1(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(r,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return a1},u1=Xt.supportsDescriptors,d1=mh,h1=Object.getOwnPropertyDescriptor,p1=Object.defineProperty,m1=TypeError,Nc=Object.getPrototypeOf,g1=/a/,y1=function(){if(!u1||!Nc)throw new m1("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=d1(),t=Nc(g1),r=h1(t,"flags");return(!r||r.get!==e)&&p1(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},b1=Xt,v1=Dn,S1=ph,gh=mh,w1=y1,yh=v1(gh());b1(yh,{getPolyfill:gh,implementation:S1,shim:w1});var x1=yh,Fr={exports:{}},C1=so,Qt=function(){return C1()&&!!Symbol.toStringTag},O1=Qt(),k1=Ae,Es=k1("Object.prototype.toString"),lo=function(e){return O1&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Es(e)==="[object Arguments]"},bh=function(e){return lo(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Es(e)!=="[object Array]"&&Es(e.callee)==="[object Function]"},A1=function(){return lo(arguments)}();lo.isLegacyArguments=bh;var vh=A1?lo:bh;const T1={},E1=Object.freeze(Object.defineProperty({__proto__:null,default:T1},Symbol.toStringTag,{value:"Module"})),M1=_b(E1);var _l=typeof Map=="function"&&Map.prototype,Fo=Object.getOwnPropertyDescriptor&&_l?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,fi=_l&&Fo&&typeof Fo.get=="function"?Fo.get:null,Rc=_l&&Map.prototype.forEach,jl=typeof Set=="function"&&Set.prototype,_o=Object.getOwnPropertyDescriptor&&jl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ui=jl&&_o&&typeof _o.get=="function"?_o.get:null,Dc=jl&&Set.prototype.forEach,N1=typeof WeakMap=="function"&&WeakMap.prototype,Xn=N1?WeakMap.prototype.has:null,R1=typeof WeakSet=="function"&&WeakSet.prototype,Qn=R1?WeakSet.prototype.has:null,D1=typeof WeakRef=="function"&&WeakRef.prototype,Ic=D1?WeakRef.prototype.deref:null,I1=Boolean.prototype.valueOf,P1=Object.prototype.toString,$1=Function.prototype.toString,B1=String.prototype.match,Vl=String.prototype.slice,Ct=String.prototype.replace,z1=String.prototype.toUpperCase,Pc=String.prototype.toLowerCase,Sh=RegExp.prototype.test,$c=Array.prototype.concat,Le=Array.prototype.join,L1=Array.prototype.slice,Bc=Math.floor,Ms=typeof BigInt=="function"?BigInt.prototype.valueOf:null,jo=Object.getOwnPropertySymbols,Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,kn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",fe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===kn||!0)?Symbol.toStringTag:null,wh=Object.prototype.propertyIsEnumerable,zc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Lc(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Sh.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Bc(-n):Bc(n);if(r!==n){var i=String(r),o=Vl.call(e,i.length+1);return Ct.call(i,t,"$&_")+"."+Ct.call(Ct.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ct.call(e,t,"$&_")}var Rs=M1,Fc=Rs.custom,_c=Ch(Fc)?Fc:null,F1=function n(e,t,r,i){var o=t||{};if(ht(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=ht(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ht(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return kh(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return l?Lc(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return l?Lc(e,c):c}var f=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=f&&f>0&&typeof e=="object")return Ds(e)?"[Array]":"[Object]";var u=rv(o,r);if(typeof i>"u")i=[];else if(Oh(i,e)>=0)return"[Circular]";function d(B,v,X){if(v&&(i=L1.call(i),i.push(v)),X){var F={depth:o.depth};return ht(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),n(B,F,r+1,i)}return n(B,o,r+1,i)}if(typeof e=="function"&&!jc(e)){var p=q1(e),h=Cr(e,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+Le.call(h,", ")+" }":"")}if(Ch(e)){var m=kn?Ct.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ns.call(e);return typeof e=="object"&&!kn?Fn(m):m}if(ev(e)){for(var g="<"+Pc.call(String(e.nodeName)),y=e.attributes||[],C=0;C<y.length;C++)g+=" "+y[C].name+"="+xh(_1(y[C].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Pc.call(String(e.nodeName))+">",g}if(Ds(e)){if(e.length===0)return"[]";var k=Cr(e,d);return u&&!nv(k)?"["+Is(k,u)+"]":"[ "+Le.call(k,", ")+" ]"}if(V1(e)){var N=Cr(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!wh.call(e,"cause")?"{ ["+String(e)+"] "+Le.call($c.call("[cause]: "+d(e.cause),N),", ")+" }":N.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Le.call(N,", ")+" }"}if(typeof e=="object"&&s){if(_c&&typeof e[_c]=="function"&&Rs)return Rs(e,{depth:f-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(G1(e)){var M=[];return Rc&&Rc.call(e,function(B,v){M.push(d(v,e,!0)+" => "+d(B,e))}),Vc("Map",fi.call(e),M,u)}if(Q1(e)){var x=[];return Dc&&Dc.call(e,function(B){x.push(d(B,e))}),Vc("Set",ui.call(e),x,u)}if(Y1(e))return Vo("WeakMap");if(Z1(e))return Vo("WeakSet");if(X1(e))return Vo("WeakRef");if(H1(e))return Fn(d(Number(e)));if(K1(e))return Fn(d(Ms.call(e)));if(U1(e))return Fn(I1.call(e));if(W1(e))return Fn(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof cr<"u"&&e===cr)return"{ [object globalThis] }";if(!j1(e)&&!jc(e)){var D=Cr(e,d),I=zc?zc(e)===Object.prototype:e instanceof Object||e.constructor===Object,T=e instanceof Object?"":"null prototype",Y=!I&&fe&&Object(e)===e&&fe in e?Vl.call(Rt(e),8,-1):T?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",O=A+(Y||T?"["+Le.call($c.call([],Y||[],T||[]),": ")+"] ":"");return D.length===0?O+"{}":u?O+"{"+Is(D,u)+"}":O+"{ "+Le.call(D,", ")+" }"}return String(e)};function xh(n,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+n+r}function _1(n){return Ct.call(String(n),/"/g,"&quot;")}function Ds(n){return Rt(n)==="[object Array]"&&(!fe||!(typeof n=="object"&&fe in n))}function j1(n){return Rt(n)==="[object Date]"&&(!fe||!(typeof n=="object"&&fe in n))}function jc(n){return Rt(n)==="[object RegExp]"&&(!fe||!(typeof n=="object"&&fe in n))}function V1(n){return Rt(n)==="[object Error]"&&(!fe||!(typeof n=="object"&&fe in n))}function W1(n){return Rt(n)==="[object String]"&&(!fe||!(typeof n=="object"&&fe in n))}function H1(n){return Rt(n)==="[object Number]"&&(!fe||!(typeof n=="object"&&fe in n))}function U1(n){return Rt(n)==="[object Boolean]"&&(!fe||!(typeof n=="object"&&fe in n))}function Ch(n){if(kn)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Ns)return!1;try{return Ns.call(n),!0}catch{}return!1}function K1(n){if(!n||typeof n!="object"||!Ms)return!1;try{return Ms.call(n),!0}catch{}return!1}var J1=Object.prototype.hasOwnProperty||function(n){return n in this};function ht(n,e){return J1.call(n,e)}function Rt(n){return P1.call(n)}function q1(n){if(n.name)return n.name;var e=B1.call($1.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function Oh(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function G1(n){if(!fi||!n||typeof n!="object")return!1;try{fi.call(n);try{ui.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function Y1(n){if(!Xn||!n||typeof n!="object")return!1;try{Xn.call(n,Xn);try{Qn.call(n,Qn)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function X1(n){if(!Ic||!n||typeof n!="object")return!1;try{return Ic.call(n),!0}catch{}return!1}function Q1(n){if(!ui||!n||typeof n!="object")return!1;try{ui.call(n);try{fi.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Z1(n){if(!Qn||!n||typeof n!="object")return!1;try{Qn.call(n,Qn);try{Xn.call(n,Xn)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function ev(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function kh(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return kh(Vl.call(n,0,e.maxStringLength),e)+r}var i=Ct.call(Ct.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,tv);return xh(i,"single",e)}function tv(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+z1.call(e.toString(16))}function Fn(n){return"Object("+n+")"}function Vo(n){return n+" { ? }"}function Vc(n,e,t,r){var i=r?Is(t,r):Le.call(t,", ");return n+" ("+e+") {"+i+"}"}function nv(n){for(var e=0;e<n.length;e++)if(Oh(n[e],`
11
- `)>=0)return!1;return!0}function rv(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Le.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Le.call(Array(e+1),t)}}function Is(n,e){if(n.length===0)return"";var t=`
8
+ `);return{dom:a,text:d,slice:e}}function xd(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",d=>{e=d(e,o||r,n)}),o)return e?new w(b.from(n.state.schema.text(e.replace(/\r\n?/g,`
9
+ `))),0,0):w.empty;let u=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(u)l=u;else{let d=i.marks(),{schema:p}=n.state,h=Gt.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=Fg(t),yr&&_g(s);let c=s&&s.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let u=+f[3];u>0;u--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||vn.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!zg.test(d.parentNode.nodeName)?{ignore:!0}:null}})),f)l=jg(Xa(l,+f[1],+f[2]),f[4]);else if(l=w.maxOpen(Lg(l.content,i),!0),l.openStart||l.openEnd){let u=0,d=0;for(let p=l.content.firstChild;u<l.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=l.content.lastChild;d<l.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);l=Xa(l,u,d)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const zg=/^(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 Lg(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Od(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=kd(s[s.length-1],o.length));let f=Cd(l,a);s.push(f),i=i.matchType(f.type),o=a}}),s)return b.from(s)}return n}function Cd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function Od(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Od(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(b.from(Cd(t,n,i+1))))}}function kd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,kd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(b.empty,!0);return n.copy(t.append(r))}function Os(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=Os(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Xa(n,e,t){return e<n.openStart&&(n=new w(Os(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new w(Os(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ad={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 Qa=null;function Td(){return Qa||(Qa=document.implementation.createHTMLDocument("title"))}function Fg(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Td().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Ad[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=n,i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function _g(n){let e=n.querySelectorAll(ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function jg(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),o++,s++}return new w(i,o,s)}const me={},ge={},Vg={touchstart:!0,touchmove:!0};class Wg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 Hg(n){for(let e in me){let t=me[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Kg(n,r)&&!Ol(n,r)&&(n.editable||!(r.type in ge))&&t(n,r)},Vg[e]?{passive:!0}:void 0)}pe&&n.dom.addEventListener("input",()=>null),ks(n)}function xt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ug(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function ks(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ol(n,r))})}function Ol(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Kg(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Jg(n,e){!Ol(n,e)&&me[e.type]&&(n.editable||!(e.type in ge))&&me[e.type](n,e)}ge.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Md(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ee&&ce&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Dt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Bg(n,t)?t.preventDefault():xt(n,"key")};ge.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ge.keypress=(n,e)=>{let t=e;if(Md(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||xe&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof z)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function so(n){return{left:n.clientX,top:n.clientY}}function qg(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function kl(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function mn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Gg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(mn(n,new E(t)),!0):!1}function Yg(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof E&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(E.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(mn(n,E.create(n.state.doc,i)),!0):!1}function Xg(n,e,t,r,i){return kl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?Yg(n,t):Gg(n,t))}function Qg(n,e,t,r){return kl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Zg(n,e,t,r){return kl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||ey(n,t,r)}function ey(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(mn(n,z.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)mn(n,z.create(r,l+1,l+1+s.content.size));else if(E.isSelectable(s))mn(n,E.create(r,l));else continue;return!0}}function Al(n){return oi(n)}const Ed=xe?"metaKey":"ctrlKey";me.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Al(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&qg(t,n.input.lastClick)&&!t[Ed]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(so(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ty(n,s,t,!!r)):(o=="doubleClick"?Qg:Zg)(n,s.pos,s.inside,t)?t.preventDefault():xt(n,"pointer"))};class ty{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ed],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let f=e.state.doc.resolve(t.pos);o=f.parent,s=f.depth?f.before():0}const l=i?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&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof E&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ie&&!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)),xt(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(()=>nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(so(e))),this.updateAllowDefault(e),this.allowDefault||!t?xt(this.view,"pointer"):Xg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pe&&this.mightDrag&&!this.mightDrag.node.isAtom||ce&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(mn(this.view,R.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):xt(this.view,"pointer")}move(e){this.updateAllowDefault(e),xt(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)}}me.touchstart=n=>{n.input.lastTouch=Date.now(),Al(n),xt(n,"pointer")};me.touchmove=n=>{n.input.lastTouch=Date.now(),xt(n,"pointer")};me.contextmenu=n=>Al(n);function Md(n,e){return n.composing?!0:pe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ny=Ee?5e3:-1;ge.compositionstart=ge.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof z&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),oi(n,!0),n.markCursor=null;else if(oi(n),Ie&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Nd(n,ny)};ge.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Nd(n,20))};function Nd(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>oi(n),e))}function Rd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=iy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ry(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Ym(e.focusNode,e.focusOffset),r=Xm(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function iy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function oi(n,e=!1){if(!(Ee&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Rd(n),e||n.docView&&n.docView.dirty){let t=xl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function oy(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const sr=be&&Ot<15||xn&&ng<604;me.copy=ge.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=sr?null:t.clipboardData,s=r.content(),{dom:l,text:a}=wd(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):oy(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function sy(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ly(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?lr(n,r.value,null,i,e):lr(n,r.textContent,r.innerHTML,i,e)},50)}function lr(n,e,t,r,i){let o=xd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||w.empty)))return!0;if(!o)return!1;let s=sy(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Id(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ge.paste=(n,e)=>{let t=e;if(n.composing&&!Ee)return;let r=sr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&lr(n,Id(r),r.getData("text/html"),i,t)?t.preventDefault():ly(n,t)};class Dd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Pd=xe?"altKey":"ctrlKey";me.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(so(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)s=E.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=E.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:f}=wd(n,l);(!t.dataTransfer.files.length||!ce||od>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(sr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",sr||t.dataTransfer.setData("text/plain",c),n.dragging=new Dd(f,!t[Pd],s)};me.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ge.dragover=ge.dragenter=(n,e)=>e.preventDefault();ge.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(so(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",h=>{s=h(s,n)}):s=xd(n,Id(t.dataTransfer),sr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[Pd]);if(n.someProp("handleDrop",h=>h(n,t,s||w.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Yu(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let c=n.state.tr;if(l){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let f=c.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(f,f,s.content.firstChild):c.replaceRange(f,f,s),c.doc.eq(d))return;let p=c.doc.resolve(f);if(u&&E.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new E(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,C)=>h=C),c.setSelection(Cl(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};me.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&nt(n)},20))};me.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};me.beforeinput=(n,e)=>{if(ce&&Ee&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Dt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in ge)me[n]=ge[n];function ar(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class si{constructor(e,t){this.toDOM=e,this.spec=t||Ft,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new he(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof si&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ar(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class At{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new he(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof At&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}static is(e){return e.type instanceof At}destroy(){}}class Tl{constructor(e,t){this.attrs=e,this.spec=t||Ft}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new he(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Tl&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}destroy(){}}class he{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new he(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new he(e,e,new si(t,r))}static inline(e,t,r,i){return new he(e,t,new At(r,i))}static node(e,t,r,i){return new he(e,t,new Tl(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof At}get widget(){return this.type instanceof si}}const an=[],Ft={};class J{constructor(e,t){this.local=e.length?e:an,this.children=t.length?t:an}static create(e,t){return t.length?li(t,e,0,Ft):ae}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==ae||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ft)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?ay(this.children,s||[],e,t,r,i,o):s?new J(s.sort(_t),an):ae}add(e,t){return t.length?this==ae?J.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,f;if(f=Bd(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,f,c+1):i.splice(o,0,a,a+l.nodeSize,li(f,l,c+1,Ft)),o+=3}});let s=$d(o?zd(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new J(s.length?this.local.concat(s).sort(_t):this.local,i||this.children)}remove(e){return e.length==0||this==ae?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+1]+t;for(let f=0,u;f<e.length;f++)(u=e[f])&&u.from>l&&u.to<a&&(e[f]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=ae?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new J(i,r):ae}forChild(e,t){if(this==ae)return this;if(t.isLeaf)return J.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof At){let c=Math.max(o,a.from)-o,f=Math.min(s,a.to)-o;c<f&&(i||(i=[])).push(a.copy(c,f))}}if(i){let l=new J(i.sort(_t),an);return r?new yt([l,r]):l}return r||ae}eq(e){if(this==e)return!0;if(!(e instanceof J)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return El(this.localsInner(e))}localsInner(e){if(this==ae)return an;if(e.inlineContent||!this.local.some(At.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof At||t.push(this.local[r]);return t}}J.empty=new J([],[]);J.removeOverlap=El;const ae=J.empty;class yt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Ft));return yt.from(r)}forChild(e,t){if(t.isLeaf)return J.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ae&&(o instanceof yt?r=r.concat(o.members):r.push(o))}return yt.from(r)}eq(e){if(!(e instanceof yt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?El(r?t:t.sort(_t)):an}static from(e){switch(e.length){case 0:return ae;case 1:return e[0];default:return new yt(e.every(t=>t instanceof J)?e:e.reduce((t,r)=>t.concat(r instanceof J?r:r.members),[]))}}}function ay(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,f=o;c<t.maps.length;c++){let u=0;t.maps[c].forEach((d,p,h,m)=>{let g=m-h-(p-d);for(let y=0;y<l.length;y+=3){let C=l[y+1];if(C<0||d>C+f-u)continue;let k=l[y]+f-u;p>=k?l[y+1]=d<=k?-2:-1:d>=f&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),f=t.maps[c].map(f,-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 f=t.map(n[c]+o),u=f-i;if(u<0||u>=r.content.size){a=!0;continue}let d=t.map(n[c+1]+o,-1),p=d-i,{index:h,offset:m}=r.content.findIndex(u),g=r.maybeChild(h);if(g&&m==u&&m+g.nodeSize==p){let y=l[c+2].mapInner(t,g,f+1,n[c]+o+1,s);y!=ae?(l[c]=u,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=cy(l,n,e,t,i,o,s),f=li(c,r,0,s);e=f.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,d=0;u<f.children.length;u+=3){let p=f.children[u];for(;d<l.length&&l[d]<p;)d+=3;l.splice(d,0,f.children[u],f.children[u+1],f.children[u+2])}}return new J(e.sort(_t),l)}function $d(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new he(i.from+e,i.to+e,i.type))}return t}function cy(n,e,t,r,i,o,s){function l(a,c){for(let f=0;f<a.local.length;f++){let u=a.local[f].map(r,i,c);u?t.push(u):s.onRemove&&s.onRemove(a.local[f].spec)}for(let f=0;f<a.children.length;f+=3)l(a.children[f+2],a.children[f]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+o+1);return t}function Bd(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function zd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function li(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Bd(n,l,a+t);if(c){o=!0;let f=li(c,l,t+a+1,r);f!=ae&&i.push(a,a+l.nodeSize,f)}});let s=$d(o?zd(n):n,-t).sort(_t);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new J(s,i):ae}function _t(n,e){return n.from-e.from||n.to-e.to}function El(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Za(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Za(e,i,r.copy(o.from,r.to)));break}}}return e}function Za(n,e,t){for(;e<n.length&&_t(t,n[e])>0;)e++;n.splice(e,0,t)}function Mo(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ae&&e.push(r)}),n.cursorWrapper&&e.push(J.create(n.state.doc,[n.cursorWrapper.deco])),yt.from(e)}const fy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},uy=be&&Ot<=11;class dy{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 hy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new dy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);be&&Ot<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),uy&&(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,fy)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ua(this.view)){if(this.suppressingSelectionUpdates)return nt(this.view);if(be&&Ot<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ut(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=or(o))t.add(o);for(let o=e.anchorNode;o;o=or(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ua(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let f=0;f<t.length;f++){let u=this.registerMutation(t[f],a);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(l=!0))}if(Ie&&a.length){let f=a.filter(u=>u.nodeName=="BR");if(f.length==2){let[u,d]=f;u.parentNode&&u.parentNode.parentNode==d.parentNode?d.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let d of f){let p=d.parentNode;p&&p.nodeName=="LI"&&(!u||gy(e,u)!=p)&&d.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&io(r)&&(c=xl(e))&&c.eq(R.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,nt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),py(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||nt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 f=0;f<e.addedNodes.length;f++){let u=e.addedNodes[f];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(be&&Ot<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:u,nextSibling:d}=e.addedNodes[f];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==e.target?se(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?se(o):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 ec=new WeakMap,tc=!1;function py(n){if(!ec.has(n)&&(ec.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ie,tc)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."),tc=!0}}function nc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Ut(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function my(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return nc(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?nc(n,t):null}function gy(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function yy(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,f=a.anchorNode;if(f&&n.dom.contains(f.nodeType==1?f:f.parentNode)&&(c=[{node:f,offset:a.anchorOffset}],io(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ce&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],C=y.pmViewDesc;if(y.nodeName=="BR"&&!C){o=g;break}if(!C||C.size)break}let u=n.state.doc,d=n.someProp("domParser")||vn.fromSchema(n.state.schema),p=u.resolve(s),h=null,m=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:by,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),h={anchor:g+s,head:y+s}}return{doc:m,sel:h,from:s,to:l}}function by(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(pe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||pe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const vy=/^(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 Sy(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Y=xl(n,T);if(Y&&!n.state.selection.eq(Y)){if(ce&&Ee&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",O=>O(n,Dt(13,"Enter"))))return;let A=n.state.tr.setSelection(Y);T=="pointer"?A.setMeta("pointer",!0):T=="key"&&A.scrollIntoView(),o&&A.setMeta("composition",o),n.dispatch(A)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=yy(n,e,t),f=n.state.doc,u=f.slice(c.from,c.to),d,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(d=n.state.selection.to,p="end"):(d=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let h=Cy(u.content,c.doc.content,c.from,d,p);if((xn&&n.input.lastIOSEnter>Date.now()-225||Ee)&&i.some(T=>T.nodeType==1&&!vy.test(T.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",T=>T(n,Dt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof z&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=rc(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let Y=n.state.tr.setSelection(T);o&&Y.setMeta("composition",o),n.dispatch(Y)}}return}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&h.start==h.endB&&n.state.selection instanceof z&&(h.start>n.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA<n.state.selection.to&&h.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),be&&Ot<=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),g=c.doc.resolveNoCache(h.endB-c.from),y=f.resolve(h.start),C=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA,k;if((xn&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(k=R.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head==g.pos)&&n.someProp("handleKeyDown",T=>T(n,Dt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&xy(f,h.start,h.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,Dt(8,"Backspace")))){Ee&&ce&&n.domObserver.suppressSelectionUpdates();return}ce&&Ee&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),Ee&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,Dt(13,"Enter"))})},20));let N=h.start,M=h.endA,x,I,D;if(C){if(m.pos==g.pos)be&&Ot<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>nt(n),20)),x=n.state.tr.delete(N,M),I=f.resolve(h.start).marksAcross(f.resolve(h.endA));else if(h.endA==h.endB&&(D=wy(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start()))))x=n.state.tr,D.type=="add"?x.addMark(N,M,D.mark):x.removeMark(N,M,D.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",Y=>Y(n,N,M,T)))return;x=n.state.tr.insertText(T,N,M)}}if(x||(x=n.state.tr.replace(N,M,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let T=rc(n,x.doc,c.sel);T&&!(ce&&Ee&&n.composing&&T.empty&&(h.start!=h.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==N||T.head==x.mapping.map(M)-1)||be&&T.empty&&T.head==N)&&x.setSelection(T)}I&&x.ensureMarks(I),o&&x.setMeta("composition",o),n.dispatch(x.scrollIntoView())}function rc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Cl(n,e.resolve(t.anchor),e.resolve(t.head))}function wy(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let f=0;f<r.length;f++)i=r[f].removeFromSet(i);for(let f=0;f<t.length;f++)o=t[f].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=f=>f.mark(l.addToSet(f.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(a(e.child(f)));if(b.from(c).eq(n))return{mark:l,type:s}}function xy(n,e,t,r,i){if(t-e<=i.pos-r.pos||No(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(No(o,!0,!0));return!s.parent.isTextblock||s.pos>t||No(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function No(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Cy(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&ic(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&ic(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function ic(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Oy{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Wg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(cc),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=lc(this),sc(this),this.nodeViews=ac(this),this.docView=Fa(this.state.doc,oc(this),Mo(this),this.dom,this),this.domObserver=new hy(this,(r,i,o,s)=>Sy(this,r,i,o,s)),this.domObserver.start(),Hg(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ks(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Rd(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=ac(this);Ay(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ks(this),this.editable=lc(this),sc(this);let a=Mo(this),c=oc(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(i.selection))&&(s=!0);let d=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&og(this);if(s){this.domObserver.stop();let p=u&&(be||ce)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ky(i.selection,e.selection);if(u){let h=ce?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ry(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fa(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Mg(this))?nt(this,p):(bd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():d&&sg(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof E){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Da(this,t.getBoundingClientRect(),e)}else Da(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 t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Dd(e.slice,e.move,i<0?void 0:E.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(be){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&&lg(this.dom),nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return dg(this,e)}coordsAtPos(e,t=1){return fd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return yg(this,t||this.state,e)}pasteHTML(e,t){return lr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return lr(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Ug(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,qm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Jg(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?pe&&this.root.nodeType===11&&Zm(this.dom.ownerDocument)==this.dom&&my(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function oc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[he.node(0,n.state.doc.content.size,e)]}function sc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:he.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function lc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function ky(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function ac(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Ay(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function cc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Tt={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:"'"},ai={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ty=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ey=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var le=0;le<10;le++)Tt[48+le]=Tt[96+le]=String(le);for(var le=1;le<=24;le++)Tt[le+111]="F"+le;for(var le=65;le<=90;le++)Tt[le]=String.fromCharCode(le+32),ai[le]=String.fromCharCode(le);for(var Ro in Tt)ai.hasOwnProperty(Ro)||(ai[Ro]=Tt[Ro]);function My(n){var e=Ty&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ey&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ai:Tt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Ny=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Ry(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Ny?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Iy(n){let e=Object.create(null);for(let t in n)e[Ry(t)]=n[t];return e}function Io(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Dy(n){return new Yt({props:{handleKeyDown:Ml(n)}})}function Ml(n){let e=Iy(n);return function(t,r){let i=My(r),o,s=e[Io(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Io(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Tt[r.keyCode])&&o!=i){let l=e[Io(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Py=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ld(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const $y=(n,e,t)=>{let r=Ld(n,t);if(!r)return!1;let i=Nl(r);if(!i){let s=r.blockRange(),l=s&&En(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(Vd(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Cn(o,"end")||E.isSelectable(o)))for(let s=r.depth;;s--){let l=no(n.doc,r.before(s),r.after(s),w.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Cn(o,"end")?R.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):E.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},By=(n,e,t)=>{let r=Ld(n,t);if(!r)return!1;let i=Nl(r);return i?Fd(n,i,e):!1},zy=(n,e,t)=>{let r=_d(n,t);if(!r)return!1;let i=Rl(r);return i?Fd(n,i,e):!1};function Fd(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=no(n.doc,o,a,w.empty);if(!c||c.from!=o||c instanceof te&&c.slice.size>=a-o)return!1;if(t){let f=n.tr.step(c);f.setSelection(z.create(f.doc,o)),t(f.scrollIntoView())}return!0}function Cn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Ly=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Nl(r)}let s=o&&o.nodeBefore;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Nl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function _d(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Fy=(n,e,t)=>{let r=_d(n,t);if(!r)return!1;let i=Rl(r);if(!i)return!1;let o=i.nodeAfter;if(Vd(n,i,e,1))return!0;if(r.parent.content.size==0&&(Cn(o,"start")||E.isSelectable(o))){let s=no(n.doc,r.before(),r.after(),w.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Cn(o,"start")?R.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):E.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},_y=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Rl(r)}let s=o&&o.nodeAfter;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos)).scrollIntoView()),!0)};function Rl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const jy=(n,e)=>{let t=n.selection,r=t instanceof E,i;if(r){if(t.node.isTextblock||!Mn(n.doc,t.from))return!1;i=t.from}else if(i=bl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(E.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Vy=(n,e)=>{let t=n.selection,r;if(t instanceof E){if(t.node.isTextblock||!Mn(n.doc,t.to))return!1;r=t.to}else if(r=bl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Wy=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&En(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Hy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
+ `).scrollIntoView()),!0)};function jd(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Uy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=jd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(R.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ky=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Oe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=jd(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(z.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Jy=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(yl(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&En(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},qy=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(E.create(n.doc,i))),!0)};function Gy(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Mn(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Vd(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&Gy(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,h=b.empty;for(let y=s.length-1;y>=0;y--)h=b.from(s[y].create(null,h));h=b.from(i.copy(h));let m=n.tr.step(new ne(e.pos-1,p,e.pos,p,new w(h,1,0),s.length,!0)),g=p+2*s.length;Mn(m.doc,g)&&m.join(g),t(m.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&a?null:R.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),d=u&&En(u);if(d!=null&&d>=e.depth)return t&&t(n.tr.lift(u,d).scrollIntoView()),!0;if(c&&Cn(o,"start",!0)&&Cn(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let y=b.empty;for(let k=h.length-1;k>=0;k--)y=b.from(h[k].copy(y));let C=n.tr.step(new ne(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new w(y,h.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function Wd(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(z.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const Yy=Wd(-1),Xy=Wd(1);function Qy(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&gl(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Zy(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let f=t.doc.resolve(c),u=f.index();i=f.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function eb(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let f=t.doc.resolve(s.start-2);a=new ei(f,f,s.depth),s.endIndex<s.parent.childCount&&(s=new ei(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=gl(a,n,e,s);return c?(r&&r(tb(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function tb(n,e,t,r,i){let o=b.empty;for(let f=t.length-1;f>=0;f--)o=b.from(t[f].type.create(t[f].attrs,o));n.step(new ne(e.start-(r?2:0),e.end,e.start,e.end,new w(o,0,0),t.length,!0));let s=0;for(let f=0;f<t.length;f++)t[f].type==i&&(s=f+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let f=e.startIndex,u=e.endIndex,d=!0;f<u;f++,d=!1)!d&&yl(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(f).nodeSize;return n}function nb(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?rb(e,t,n,o):ib(e,t,o):!0:!1}}function rb(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ne(o-1,s,o,s,new w(b.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new ei(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=En(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Mn(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function ib(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),f=o.index(-1);if(!c.canReplace(f+(l?0:1),f+1,s.content.append(a?b.empty:b.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new ne(u-(l?1:0),d+(a?1:0),u+1,d-1,new w((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function ob(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=b.from(c?n.create():null),u=new w(b.from(n.create(null,b.from(l.type.create(null,f)))),c?3:1,0),d=o.start,p=o.end;t(e.tr.step(new ne(d-(c?3:1),p,d,p,u,1,!0)).scrollIntoView())}return!0}}function Hd(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Hd(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function sb(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Hd(n))&&(r&&(r+=" "),r+=e);return r}const Il="-",lb=n=>{const e=cb(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(Il);return l[0]===""&&l.length!==1&&l.shift(),Ud(l,e)||ab(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},Ud=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?Ud(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=n.join(Il);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},fc=/^\[(.+)\]$/,ab=n=>{if(fc.test(n)){const e=fc.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},cb=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return ub(Object.entries(n.classGroups),t).forEach(([o,s])=>{As(s,r,o,e)}),r},As=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const o=i===""?e:uc(e,i);o.classGroupId=t;return}if(typeof i=="function"){if(fb(i)){As(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([o,s])=>{As(s,uc(e,o),t,r)})})},uc=(n,e)=>{let t=n;return e.split(Il).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},fb=n=>n.isThemeGetter,ub=(n,e)=>e?n.map(([t,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[t,i]}):n,db=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(o,s)=>{t.set(o,s),e++,e>n&&(e=0,r=t,t=new Map)};return{get(o){let s=t.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){t.has(o)?t.set(o,s):i(o,s)}}},Kd="!",hb=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],o=e.length,s=l=>{const a=[];let c=0,f=0,u;for(let g=0;g<l.length;g++){let y=l[g];if(c===0){if(y===i&&(r||l.slice(g,g+o)===e)){a.push(l.slice(f,g)),f=g+o;continue}if(y==="/"){u=g;continue}}y==="["?c++:y==="]"&&c--}const d=a.length===0?l:l.substring(f),p=d.startsWith(Kd),h=p?d.substring(1):d,m=u&&u>f?u-f:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}};return t?l=>t({className:l,parseClassName:s}):s},pb=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},mb=n=>({cache:db(n.cacheSize),parseClassName:hb(n),...lb(n)}),gb=/\s+/,yb=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=n.trim().split(gb);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:f,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:p}=t(c);let h=!!p,m=r(h?d.substring(0,p):d);if(!m){if(!h){l=c+(l.length>0?" "+l:l);continue}if(m=r(d),!m){l=c+(l.length>0?" "+l:l);continue}h=!1}const g=pb(f).join(":"),y=u?g+Kd:g,C=y+m;if(o.includes(C))continue;o.push(C);const k=i(m,h);for(let N=0;N<k.length;++N){const M=k[N];o.push(y+M)}l=c+(l.length>0?" "+l:l)}return l};function bb(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=Jd(e))&&(r&&(r+=" "),r+=t);return r}const Jd=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=Jd(n[r]))&&(t&&(t+=" "),t+=e);return t};function vb(n,...e){let t,r,i,o=s;function s(a){const c=e.reduce((f,u)=>u(f),n());return t=mb(c),r=t.cache.get,i=t.cache.set,o=l,l(a)}function l(a){const c=r(a);if(c)return c;const f=yb(a,t);return i(a,f),f}return function(){return o(bb.apply(null,arguments))}}const V=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},qd=/^\[(?:([a-z-]+):)?(.+)\]$/i,Sb=/^\d+\/\d+$/,wb=new Set(["px","full","screen"]),xb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ob=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,kb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ab=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=n=>gn(n)||wb.has(n)||Sb.test(n),at=n=>Rn(n,"length",Pb),gn=n=>!!n&&!Number.isNaN(Number(n)),Do=n=>Rn(n,"number",gn),zn=n=>!!n&&Number.isInteger(Number(n)),Tb=n=>n.endsWith("%")&&gn(n.slice(0,-1)),P=n=>qd.test(n),ct=n=>xb.test(n),Eb=new Set(["length","size","percentage"]),Mb=n=>Rn(n,Eb,Gd),Nb=n=>Rn(n,"position",Gd),Rb=new Set(["image","url"]),Ib=n=>Rn(n,Rb,Bb),Db=n=>Rn(n,"",$b),Ln=()=>!0,Rn=(n,e,t)=>{const r=qd.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},Pb=n=>Cb.test(n)&&!Ob.test(n),Gd=()=>!1,$b=n=>kb.test(n),Bb=n=>Ab.test(n),zb=()=>{const n=V("colors"),e=V("spacing"),t=V("blur"),r=V("brightness"),i=V("borderColor"),o=V("borderRadius"),s=V("borderSpacing"),l=V("borderWidth"),a=V("contrast"),c=V("grayscale"),f=V("hueRotate"),u=V("invert"),d=V("gap"),p=V("gradientColorStops"),h=V("gradientColorStopPositions"),m=V("inset"),g=V("margin"),y=V("opacity"),C=V("padding"),k=V("saturate"),N=V("scale"),M=V("sepia"),x=V("skew"),I=V("space"),D=V("translate"),T=()=>["auto","contain","none"],Y=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",P,e],O=()=>[P,e],B=()=>["",Xe,at],v=()=>["auto",gn,P],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],j=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",P],lt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[gn,P];return{cacheSize:500,separator:":",theme:{colors:[Ln],spacing:[Xe,at],blur:["none","",ct,P],brightness:Z(),borderColor:[n],borderRadius:["none","","full",ct,P],borderSpacing:O(),borderWidth:B(),contrast:Z(),grayscale:U(),hueRotate:Z(),invert:U(),gap:O(),gradientColorStops:[n],gradientColorStopPositions:[Tb,at],inset:A(),margin:A(),opacity:Z(),padding:O(),saturate:Z(),scale:Z(),sepia:U(),skew:Z(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",P]}],container:["container"],columns:[{columns:[ct]}],"break-after":[{"break-after":lt()}],"break-before":[{"break-before":lt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),P]}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zn,P]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",P]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",zn,P]}],"grid-cols":[{"grid-cols":[Ln]}],"col-start-end":[{col:["auto",{span:["full",zn,P]},P]}],"col-start":[{"col-start":v()}],"col-end":[{"col-end":v()}],"grid-rows":[{"grid-rows":[Ln]}],"row-start-end":[{row:["auto",{span:[zn,P]},P]}],"row-start":[{"row-start":v()}],"row-end":[{"row-end":v()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",P]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",P]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",P,e]}],"min-w":[{"min-w":[P,e,"min","max","fit"]}],"max-w":[{"max-w":[P,e,"none","full","min","max","fit","prose",{screen:[ct]},ct]}],h:[{h:[P,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[P,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[P,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[P,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ct,at]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Do]}],"font-family":[{font:[Ln]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",P]}],"line-clamp":[{"line-clamp":["none",gn,Do]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Xe,P]}],"list-image":[{"list-image":["none",P]}],"list-style-type":[{list:["none","disc","decimal",P]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Xe,at]}],"underline-offset":[{"underline-offset":["auto",Xe,P]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),Nb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Mb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ib]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:F()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Xe,P]}],"outline-w":[{outline:[Xe,at]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Xe,at]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",ct,Db]}],"shadow-color":[{shadow:[Ln]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...j(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",ct,P]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",P]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",P]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",P]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[zn,P]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",P]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",P]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",P]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Xe,at,Do]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Lb=vb(zb);var cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Fb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var dc=Object.prototype.toString,Xd=function(e){var t=dc.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&dc.call(e.callee)==="[object Function]"),r},Po,hc;function _b(){if(hc)return Po;hc=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Xd,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(d){var p=d.constructor;return p&&p.prototype===d},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!c["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{a(window[d])}catch{return!0}}catch{return!0}return!1}(),u=function(d){if(typeof window>"u"||!f)return a(d);try{return a(d)}catch{return!1}};n=function(p){var h=p!==null&&typeof p=="object",m=t.call(p)==="[object Function]",g=r(p),y=h&&t.call(p)==="[object String]",C=[];if(!h&&!m&&!g)throw new TypeError("Object.keys called on a non-object");var k=s&&m;if(y&&p.length>0&&!e.call(p,0))for(var N=0;N<p.length;++N)C.push(String(N));if(g&&p.length>0)for(var M=0;M<p.length;++M)C.push(String(M));else for(var x in p)!(k&&x==="prototype")&&e.call(p,x)&&C.push(String(x));if(o)for(var I=u(p),D=0;D<l.length;++D)!(I&&l[D]==="constructor")&&e.call(p,l[D])&&C.push(l[D]);return C}}return Po=n,Po}var jb=Array.prototype.slice,Vb=Xd,pc=Object.keys,zr=pc?function(e){return pc(e)}:_b(),mc=Object.keys;zr.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Vb(r)?mc(jb.call(r)):mc(r)})}else Object.keys=zr;return Object.keys||zr};var Dl=zr,Wb=Error,Hb=EvalError,Ub=RangeError,Kb=ReferenceError,Qd=SyntaxError,Nt=TypeError,Jb=URIError,lo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==i||s.enumerable!==!0)return!1}return!0},gc=typeof Symbol<"u"&&Symbol,qb=lo,Pl=function(){return typeof gc!="function"||typeof Symbol!="function"||typeof gc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:qb()},$o={__proto__:null,foo:{}},Gb=Object,Yb=function(){return{__proto__:$o}.foo===$o.foo&&!($o instanceof Gb)},Xb="Function.prototype.bind called on incompatible ",Qb=Object.prototype.toString,Zb=Math.max,e0="[object Function]",yc=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},t0=function(e,t){for(var r=[],i=t,o=0;i<e.length;i+=1,o+=1)r[o]=e[i];return r},n0=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},r0=function(e){var t=this;if(typeof t!="function"||Qb.apply(t)!==e0)throw new TypeError(Xb+t);for(var r=t0(arguments,1),i,o=function(){if(this instanceof i){var f=t.apply(this,yc(r,arguments));return Object(f)===f?f:this}return t.apply(e,yc(r,arguments))},s=Zb(0,t.length-r.length),l=[],a=0;a<s;a++)l[a]="$"+a;if(i=Function("binder","return function ("+n0(l,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i},i0=r0,$l=Function.prototype.bind||i0,o0=Function.prototype.call,s0=Object.prototype.hasOwnProperty,l0=$l,Zd=l0.call(o0,s0),L,a0=Wb,c0=Hb,f0=Ub,u0=Kb,On=Qd,yn=Nt,d0=Jb,eh=Function,Bo=function(n){try{return eh('"use strict"; return ('+n+").constructor;")()}catch{}},jt=Object.getOwnPropertyDescriptor;if(jt)try{jt({},"")}catch{jt=null}var zo=function(){throw new yn},h0=jt?function(){try{return arguments.callee,zo}catch{try{return jt(arguments,"callee").get}catch{return zo}}}():zo,rn=Pl(),p0=Yb(),ee=Object.getPrototypeOf||(p0?function(n){return n.__proto__}:null),cn={},m0=typeof Uint8Array>"u"||!ee?L:ee(Uint8Array),Vt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?L:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?L:ArrayBuffer,"%ArrayIteratorPrototype%":rn&&ee?ee([][Symbol.iterator]()):L,"%AsyncFromSyncIteratorPrototype%":L,"%AsyncFunction%":cn,"%AsyncGenerator%":cn,"%AsyncGeneratorFunction%":cn,"%AsyncIteratorPrototype%":cn,"%Atomics%":typeof Atomics>"u"?L:Atomics,"%BigInt%":typeof BigInt>"u"?L:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?L:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?L:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?L:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":a0,"%eval%":eval,"%EvalError%":c0,"%Float32Array%":typeof Float32Array>"u"?L:Float32Array,"%Float64Array%":typeof Float64Array>"u"?L:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?L:FinalizationRegistry,"%Function%":eh,"%GeneratorFunction%":cn,"%Int8Array%":typeof Int8Array>"u"?L:Int8Array,"%Int16Array%":typeof Int16Array>"u"?L:Int16Array,"%Int32Array%":typeof Int32Array>"u"?L:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":rn&&ee?ee(ee([][Symbol.iterator]())):L,"%JSON%":typeof JSON=="object"?JSON:L,"%Map%":typeof Map>"u"?L:Map,"%MapIteratorPrototype%":typeof Map>"u"||!rn||!ee?L:ee(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?L:Promise,"%Proxy%":typeof Proxy>"u"?L:Proxy,"%RangeError%":f0,"%ReferenceError%":u0,"%Reflect%":typeof Reflect>"u"?L:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?L:Set,"%SetIteratorPrototype%":typeof Set>"u"||!rn||!ee?L:ee(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?L:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":rn&&ee?ee(""[Symbol.iterator]()):L,"%Symbol%":rn?Symbol:L,"%SyntaxError%":On,"%ThrowTypeError%":h0,"%TypedArray%":m0,"%TypeError%":yn,"%Uint8Array%":typeof Uint8Array>"u"?L:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?L:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?L:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?L:Uint32Array,"%URIError%":d0,"%WeakMap%":typeof WeakMap>"u"?L:WeakMap,"%WeakRef%":typeof WeakRef>"u"?L:WeakRef,"%WeakSet%":typeof WeakSet>"u"?L:WeakSet};if(ee)try{null.error}catch(n){var g0=ee(ee(n));Vt["%Error.prototype%"]=g0}var y0=function n(e){var t;if(e==="%AsyncFunction%")t=Bo("async function () {}");else if(e==="%GeneratorFunction%")t=Bo("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Bo("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&ee&&(t=ee(i.prototype))}return Vt[e]=t,t},bc={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vr=$l,ci=Zd,b0=vr.call(Function.call,Array.prototype.concat),v0=vr.call(Function.apply,Array.prototype.splice),vc=vr.call(Function.call,String.prototype.replace),fi=vr.call(Function.call,String.prototype.slice),S0=vr.call(Function.call,RegExp.prototype.exec),w0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,x0=/\\(\\)?/g,C0=function(e){var t=fi(e,0,1),r=fi(e,-1);if(t==="%"&&r!=="%")throw new On("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new On("invalid intrinsic syntax, expected opening `%`");var i=[];return vc(e,w0,function(o,s,l,a){i[i.length]=l?vc(a,x0,"$1"):s||o}),i},O0=function(e,t){var r=e,i;if(ci(bc,r)&&(i=bc[r],r="%"+i[0]+"%"),ci(Vt,r)){var o=Vt[r];if(o===cn&&(o=y0(r)),typeof o>"u"&&!t)throw new yn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new On("intrinsic "+e+" does not exist!")},Ue=function(e,t){if(typeof e!="string"||e.length===0)throw new yn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new yn('"allowMissing" argument must be a boolean');if(S0(/^%?[^%]*%?$/,e)===null)throw new On("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=C0(e),i=r.length>0?r[0]:"",o=O0("%"+i+"%",t),s=o.name,l=o.value,a=!1,c=o.alias;c&&(i=c[0],v0(r,b0([0,1],c)));for(var f=1,u=!0;f<r.length;f+=1){var d=r[f],p=fi(d,0,1),h=fi(d,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new On("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(a=!0),i+="."+d,s="%"+i+"%",ci(Vt,s))l=Vt[s];else if(l!=null){if(!(d in l)){if(!t)throw new yn("base intrinsic for "+e+" exists, but the property is not available.");return}if(jt&&f+1>=r.length){var m=jt(l,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?l=m.get:l=l[d]}else u=ci(l,d),l=l[d];u&&!a&&(Vt[s]=l)}}return l},k0=Ue,Lr=k0("%Object.defineProperty%",!0)||!1;if(Lr)try{Lr({},"a",{value:1})}catch{Lr=!1}var Bl=Lr,A0=Ue,Fr=A0("%Object.getOwnPropertyDescriptor%",!0);if(Fr)try{Fr([],"length")}catch{Fr=null}var zl=Fr,Sc=Bl,T0=Qd,on=Nt,wc=zl,Ll=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new on("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new on("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new on("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new on("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new on("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new on("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,a=!!wc&&wc(e,t);if(Sc)Sc(e,t,{configurable:s===null&&a?a.configurable:!s,enumerable:i===null&&a?a.enumerable:!i,value:r,writable:o===null&&a?a.writable:!o});else if(l||!i&&!o&&!s)e[t]=r;else throw new T0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ts=Bl,th=function(){return!!Ts};th.hasArrayLengthDefineBug=function(){if(!Ts)return null;try{return Ts([],"length",{value:1}).length!==1}catch{return!0}};var Fl=th,E0=Dl,M0=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",N0=Object.prototype.toString,R0=Array.prototype.concat,xc=Ll,I0=function(n){return typeof n=="function"&&N0.call(n)==="[object Function]"},nh=Fl(),D0=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!I0(r)||!r())return}nh?xc(n,e,t,!0):xc(n,e,t)},rh=function(n,e){var t=arguments.length>2?arguments[2]:{},r=E0(e);M0&&(r=R0.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)D0(n,r[i],e[r[i]],t[r[i]])};rh.supportsDescriptors=!!nh;var Xt=rh,ih={exports:{}},P0=Ue,Cc=Ll,$0=Fl(),Oc=zl,kc=Nt,B0=P0("%Math.floor%"),z0=function(e,t){if(typeof e!="function")throw new kc("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||B0(t)!==t)throw new kc("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&Oc){var s=Oc(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&($0?Cc(e,"length",t,!0,!0):Cc(e,"length",t)),e};(function(n){var e=$l,t=Ue,r=z0,i=Nt,o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(s,o),a=Bl,c=t("%Math.max%");n.exports=function(d){if(typeof d!="function")throw new i("a function is required");var p=l(e,s,arguments);return r(p,1+c(0,d.length-(arguments.length-1)),!0)};var f=function(){return l(e,o,arguments)};a?a(n.exports,"apply",{value:f}):n.exports.apply=f})(ih);var In=ih.exports,oh=Ue,sh=In,L0=sh(oh("String.prototype.indexOf")),Ae=function(e,t){var r=oh(e,!!t);return typeof r=="function"&&L0(e,".prototype.")>-1?sh(r):r},F0=Dl,lh=lo(),ah=Ae,Ac=Object,_0=ah("Array.prototype.push"),Tc=ah("Object.prototype.propertyIsEnumerable"),j0=lh?Object.getOwnPropertySymbols:null,ch=function(e,t){if(e==null)throw new TypeError("target must be an object");var r=Ac(e);if(arguments.length===1)return r;for(var i=1;i<arguments.length;++i){var o=Ac(arguments[i]),s=F0(o),l=lh&&(Object.getOwnPropertySymbols||j0);if(l)for(var a=l(o),c=0;c<a.length;++c){var f=a[c];Tc(o,f)&&_0(s,f)}for(var u=0;u<s.length;++u){var d=s[u];if(Tc(o,d)){var p=o[d];r[d]=p}}}return r},Lo=ch,V0=function(){if(!Object.assign)return!1;for(var n="abcdefghijklmnopqrst",e=n.split(""),t={},r=0;r<e.length;++r)t[e[r]]=e[r];var i=Object.assign({},t),o="";for(var s in i)o+=s;return n!==o},W0=function(){if(!Object.assign||!Object.preventExtensions)return!1;var n=Object.preventExtensions({1:2});try{Object.assign(n,"xy")}catch{return n[1]==="y"}return!1},fh=function(){return!Object.assign||V0()||W0()?Lo:Object.assign},H0=Xt,U0=fh,K0=function(){var e=U0();return H0(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e},J0=Xt,q0=In,G0=ch,uh=fh,Y0=K0,X0=q0.apply(uh()),dh=function(e,t){return X0(Object,arguments)};J0(dh,{getPolyfill:uh,implementation:G0,shim:Y0});var Q0=dh,fr=function(){return typeof(function(){}).name=="string"},Yn=Object.getOwnPropertyDescriptor;if(Yn)try{Yn([],"length")}catch{Yn=null}fr.functionsHaveConfigurableNames=function(){if(!fr()||!Yn)return!1;var e=Yn(function(){},"name");return!!e&&!!e.configurable};var Z0=Function.prototype.bind;fr.boundFunctionsHaveNames=function(){return fr()&&typeof Z0=="function"&&(function(){}).bind().name!==""};var e1=fr,Ec=Ll,t1=Fl(),n1=e1.functionsHaveConfigurableNames(),r1=Nt,i1=function(e,t){if(typeof e!="function")throw new r1("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||n1)&&(t1?Ec(e,"name",t,!0,!0):Ec(e,"name",t)),e},o1=i1,s1=Nt,l1=Object,hh=o1(function(){if(this==null||this!==l1(this))throw new s1("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),a1=hh,c1=Xt.supportsDescriptors,f1=Object.getOwnPropertyDescriptor,ph=function(){if(c1&&/a/mig.flags==="gim"){var e=f1(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(r,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return a1},u1=Xt.supportsDescriptors,d1=ph,h1=Object.getOwnPropertyDescriptor,p1=Object.defineProperty,m1=TypeError,Mc=Object.getPrototypeOf,g1=/a/,y1=function(){if(!u1||!Mc)throw new m1("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=d1(),t=Mc(g1),r=h1(t,"flags");return(!r||r.get!==e)&&p1(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},b1=Xt,v1=In,S1=hh,mh=ph,w1=y1,gh=v1(mh());b1(gh,{getPolyfill:mh,implementation:S1,shim:w1});var x1=gh,_r={exports:{}},C1=lo,Qt=function(){return C1()&&!!Symbol.toStringTag},O1=Qt(),k1=Ae,Es=k1("Object.prototype.toString"),ao=function(e){return O1&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Es(e)==="[object Arguments]"},yh=function(e){return ao(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Es(e)!=="[object Array]"&&Es(e.callee)==="[object Function]"},A1=function(){return ao(arguments)}();ao.isLegacyArguments=yh;var bh=A1?ao:yh;const T1={},E1=Object.freeze(Object.defineProperty({__proto__:null,default:T1},Symbol.toStringTag,{value:"Module"})),M1=Fb(E1);var _l=typeof Map=="function"&&Map.prototype,Fo=Object.getOwnPropertyDescriptor&&_l?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ui=_l&&Fo&&typeof Fo.get=="function"?Fo.get:null,Nc=_l&&Map.prototype.forEach,jl=typeof Set=="function"&&Set.prototype,_o=Object.getOwnPropertyDescriptor&&jl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,di=jl&&_o&&typeof _o.get=="function"?_o.get:null,Rc=jl&&Set.prototype.forEach,N1=typeof WeakMap=="function"&&WeakMap.prototype,Xn=N1?WeakMap.prototype.has:null,R1=typeof WeakSet=="function"&&WeakSet.prototype,Qn=R1?WeakSet.prototype.has:null,I1=typeof WeakRef=="function"&&WeakRef.prototype,Ic=I1?WeakRef.prototype.deref:null,D1=Boolean.prototype.valueOf,P1=Object.prototype.toString,$1=Function.prototype.toString,B1=String.prototype.match,Vl=String.prototype.slice,Ct=String.prototype.replace,z1=String.prototype.toUpperCase,Dc=String.prototype.toLowerCase,vh=RegExp.prototype.test,Pc=Array.prototype.concat,Le=Array.prototype.join,L1=Array.prototype.slice,$c=Math.floor,Ms=typeof BigInt=="function"?BigInt.prototype.valueOf:null,jo=Object.getOwnPropertySymbols,Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,kn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",fe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===kn||!0)?Symbol.toStringTag:null,Sh=Object.prototype.propertyIsEnumerable,Bc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function zc(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||vh.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-$c(-n):$c(n);if(r!==n){var i=String(r),o=Vl.call(e,i.length+1);return Ct.call(i,t,"$&_")+"."+Ct.call(Ct.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ct.call(e,t,"$&_")}var Rs=M1,Lc=Rs.custom,Fc=xh(Lc)?Lc:null,F1=function n(e,t,r,i){var o=t||{};if(ht(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=ht(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ht(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Oh(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return l?zc(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return l?zc(e,c):c}var f=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=f&&f>0&&typeof e=="object")return Is(e)?"[Array]":"[Object]";var u=rv(o,r);if(typeof i>"u")i=[];else if(Ch(i,e)>=0)return"[Circular]";function d(B,v,X){if(v&&(i=L1.call(i),i.push(v)),X){var F={depth:o.depth};return ht(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),n(B,F,r+1,i)}return n(B,o,r+1,i)}if(typeof e=="function"&&!_c(e)){var p=q1(e),h=Cr(e,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+Le.call(h,", ")+" }":"")}if(xh(e)){var m=kn?Ct.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ns.call(e);return typeof e=="object"&&!kn?Fn(m):m}if(ev(e)){for(var g="<"+Dc.call(String(e.nodeName)),y=e.attributes||[],C=0;C<y.length;C++)g+=" "+y[C].name+"="+wh(_1(y[C].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Dc.call(String(e.nodeName))+">",g}if(Is(e)){if(e.length===0)return"[]";var k=Cr(e,d);return u&&!nv(k)?"["+Ds(k,u)+"]":"[ "+Le.call(k,", ")+" ]"}if(V1(e)){var N=Cr(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Sh.call(e,"cause")?"{ ["+String(e)+"] "+Le.call(Pc.call("[cause]: "+d(e.cause),N),", ")+" }":N.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Le.call(N,", ")+" }"}if(typeof e=="object"&&s){if(Fc&&typeof e[Fc]=="function"&&Rs)return Rs(e,{depth:f-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(G1(e)){var M=[];return Nc&&Nc.call(e,function(B,v){M.push(d(v,e,!0)+" => "+d(B,e))}),jc("Map",ui.call(e),M,u)}if(Q1(e)){var x=[];return Rc&&Rc.call(e,function(B){x.push(d(B,e))}),jc("Set",di.call(e),x,u)}if(Y1(e))return Vo("WeakMap");if(Z1(e))return Vo("WeakSet");if(X1(e))return Vo("WeakRef");if(H1(e))return Fn(d(Number(e)));if(K1(e))return Fn(d(Ms.call(e)));if(U1(e))return Fn(D1.call(e));if(W1(e))return Fn(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof cr<"u"&&e===cr)return"{ [object globalThis] }";if(!j1(e)&&!_c(e)){var I=Cr(e,d),D=Bc?Bc(e)===Object.prototype:e instanceof Object||e.constructor===Object,T=e instanceof Object?"":"null prototype",Y=!D&&fe&&Object(e)===e&&fe in e?Vl.call(Rt(e),8,-1):T?"Object":"",A=D||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",O=A+(Y||T?"["+Le.call(Pc.call([],Y||[],T||[]),": ")+"] ":"");return I.length===0?O+"{}":u?O+"{"+Ds(I,u)+"}":O+"{ "+Le.call(I,", ")+" }"}return String(e)};function wh(n,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+n+r}function _1(n){return Ct.call(String(n),/"/g,"&quot;")}function Is(n){return Rt(n)==="[object Array]"&&(!fe||!(typeof n=="object"&&fe in n))}function j1(n){return Rt(n)==="[object Date]"&&(!fe||!(typeof n=="object"&&fe in n))}function _c(n){return Rt(n)==="[object RegExp]"&&(!fe||!(typeof n=="object"&&fe in n))}function V1(n){return Rt(n)==="[object Error]"&&(!fe||!(typeof n=="object"&&fe in n))}function W1(n){return Rt(n)==="[object String]"&&(!fe||!(typeof n=="object"&&fe in n))}function H1(n){return Rt(n)==="[object Number]"&&(!fe||!(typeof n=="object"&&fe in n))}function U1(n){return Rt(n)==="[object Boolean]"&&(!fe||!(typeof n=="object"&&fe in n))}function xh(n){if(kn)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Ns)return!1;try{return Ns.call(n),!0}catch{}return!1}function K1(n){if(!n||typeof n!="object"||!Ms)return!1;try{return Ms.call(n),!0}catch{}return!1}var J1=Object.prototype.hasOwnProperty||function(n){return n in this};function ht(n,e){return J1.call(n,e)}function Rt(n){return P1.call(n)}function q1(n){if(n.name)return n.name;var e=B1.call($1.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function Ch(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function G1(n){if(!ui||!n||typeof n!="object")return!1;try{ui.call(n);try{di.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function Y1(n){if(!Xn||!n||typeof n!="object")return!1;try{Xn.call(n,Xn);try{Qn.call(n,Qn)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function X1(n){if(!Ic||!n||typeof n!="object")return!1;try{return Ic.call(n),!0}catch{}return!1}function Q1(n){if(!di||!n||typeof n!="object")return!1;try{di.call(n);try{ui.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Z1(n){if(!Qn||!n||typeof n!="object")return!1;try{Qn.call(n,Qn);try{Xn.call(n,Xn)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function ev(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Oh(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Oh(Vl.call(n,0,e.maxStringLength),e)+r}var i=Ct.call(Ct.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,tv);return wh(i,"single",e)}function tv(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+z1.call(e.toString(16))}function Fn(n){return"Object("+n+")"}function Vo(n){return n+" { ? }"}function jc(n,e,t,r){var i=r?Ds(t,r):Le.call(t,", ");return n+" ("+e+") {"+i+"}"}function nv(n){for(var e=0;e<n.length;e++)if(Ch(n[e],`
11
+ `)>=0)return!1;return!0}function rv(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Le.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Le.call(Array(e+1),t)}}function Ds(n,e){if(n.length===0)return"";var t=`
12
12
  `+e.prev+e.base;return t+Le.call(n,","+t)+`
13
- `+e.prev}function Cr(n,e){var t=Ds(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=ht(n,i)?e(n[i],n):""}var o=typeof jo=="function"?jo(n):[],s;if(kn){s={};for(var l=0;l<o.length;l++)s["$"+o[l]]=o[l]}for(var a in n)ht(n,a)&&(t&&String(Number(a))===a&&a<n.length||kn&&s["$"+a]instanceof Symbol||(Sh.call(/[^\w$]/,a)?r.push(e(a,n)+": "+e(n[a],n)):r.push(a+": "+e(n[a],n))));if(typeof jo=="function")for(var c=0;c<o.length;c++)wh.call(n,o[c])&&r.push("["+e(o[c])+"]: "+e(n[o[c]],n));return r}var Ah=Ue,In=Ae,iv=F1,ov=Nt,Or=Ah("%WeakMap%",!0),kr=Ah("%Map%",!0),sv=In("WeakMap.prototype.get",!0),lv=In("WeakMap.prototype.set",!0),av=In("WeakMap.prototype.has",!0),cv=In("Map.prototype.get",!0),fv=In("Map.prototype.set",!0),uv=In("Map.prototype.has",!0),Wl=function(n,e){for(var t=n,r;(r=t.next)!==null;t=r)if(r.key===e)return t.next=r.next,r.next=n.next,n.next=r,r},dv=function(n,e){var t=Wl(n,e);return t&&t.value},hv=function(n,e,t){var r=Wl(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},pv=function(n,e){return!!Wl(n,e)},Th=function(){var e,t,r,i={assert:function(o){if(!i.has(o))throw new ov("Side channel does not contain "+iv(o))},get:function(o){if(Or&&o&&(typeof o=="object"||typeof o=="function")){if(e)return sv(e,o)}else if(kr){if(t)return cv(t,o)}else if(r)return dv(r,o)},has:function(o){if(Or&&o&&(typeof o=="object"||typeof o=="function")){if(e)return av(e,o)}else if(kr){if(t)return uv(t,o)}else if(r)return pv(r,o);return!1},set:function(o,s){Or&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new Or),lv(e,o,s)):kr?(t||(t=new kr),fv(t,o,s)):(r||(r={key:{},next:null}),hv(r,o,s))}};return i},mv=eh,_n=Th(),Qe=Nt,Hl={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");if(_n.assert(n),!Hl.has(n,e))throw new Qe("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var t=_n.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var t=_n.get(n);return!!t&&mv(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var r=_n.get(n);r||(r={},_n.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Hl);var gv=Hl,jn=gv,yv=SyntaxError,Wc=typeof StopIteration=="object"?StopIteration:null,bv=function(e){if(!Wc)throw new yv("this environment lacks StopIteration");jn.set(e,"[[Done]]",!1);var t={next:function(){var i=jn.get(this,"[[Iterator]]"),o=jn.get(i,"[[Done]]");try{return{done:o,value:o?void 0:i.next()}}catch(s){if(jn.set(i,"[[Done]]",!0),s!==Wc)throw s;return{done:!0,value:void 0}}}};return jn.set(t,"[[Iterator]]",e),t},vv={}.toString,Eh=Array.isArray||function(n){return vv.call(n)=="[object Array]"},Sv=String.prototype.valueOf,wv=function(e){try{return Sv.call(e),!0}catch{return!1}},xv=Object.prototype.toString,Cv="[object String]",Ov=Qt(),Mh=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:Ov?wv(e):xv.call(e)===Cv},Ul=typeof Map=="function"&&Map.prototype?Map:null,kv=typeof Set=="function"&&Set.prototype?Set:null,di;Ul||(di=function(e){return!1});var Nh=Ul?Map.prototype.has:null,Hc=kv?Set.prototype.has:null;!di&&!Nh&&(di=function(e){return!1});var Rh=di||function(e){if(!e||typeof e!="object")return!1;try{if(Nh.call(e),Hc)try{Hc.call(e)}catch{return!0}return e instanceof Ul}catch{}return!1},Av=typeof Map=="function"&&Map.prototype?Map:null,Kl=typeof Set=="function"&&Set.prototype?Set:null,hi;Kl||(hi=function(e){return!1});var Uc=Av?Map.prototype.has:null,Dh=Kl?Set.prototype.has:null;!hi&&!Dh&&(hi=function(e){return!1});var Ih=hi||function(e){if(!e||typeof e!="object")return!1;try{if(Dh.call(e),Uc)try{Uc.call(e)}catch{return!0}return e instanceof Kl}catch{}return!1},Kc=vh,Jc=bv;if(Pl()||so()){var Wo=Symbol.iterator;Fr.exports=function(e){if(e!=null&&typeof e[Wo]<"u")return e[Wo]();if(Kc(e))return Array.prototype[Wo].call(e)}}else{var Tv=Eh,Ev=Mh,qc=Ue,Mv=qc("%Map%",!0),Nv=qc("%Set%",!0),Te=Ae,Gc=Te("Array.prototype.push"),Yc=Te("String.prototype.charCodeAt"),Rv=Te("String.prototype.slice"),Dv=function(e,t){var r=e.length;if(t+1>=r)return t+1;var i=Yc(e,t);if(i<55296||i>56319)return t+1;var o=Yc(e,t+1);return o<56320||o>57343?t+1:t+2},Ho=function(e){var t=0;return{next:function(){var i=t>=e.length,o;return i||(o=e[t],t+=1),{done:i,value:o}}}},Xc=function(e,t){if(Tv(e)||Kc(e))return Ho(e);if(Ev(e)){var r=0;return{next:function(){var o=Dv(e,r),s=Rv(e,r,o);return r=o,{done:o>e.length,value:s}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!Mv&&!Nv)Fr.exports=function(e){if(e!=null)return Xc(e,!0)};else{var Iv=Rh,Pv=Ih,Qc=Te("Map.prototype.forEach",!0),Zc=Te("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var ef=Te("Map.prototype.iterator",!0),tf=Te("Set.prototype.iterator",!0);var nf=Te("Map.prototype.@@iterator",!0)||Te("Map.prototype._es6-shim iterator_",!0),rf=Te("Set.prototype.@@iterator",!0)||Te("Set.prototype._es6-shim iterator_",!0),$v=function(e){if(Iv(e)){if(ef)return Jc(ef(e));if(nf)return nf(e);if(Qc){var t=[];return Qc(e,function(i,o){Gc(t,[o,i])}),Ho(t)}}if(Pv(e)){if(tf)return Jc(tf(e));if(rf)return rf(e);if(Zc){var r=[];return Zc(e,function(i){Gc(r,i)}),Ho(r)}}};Fr.exports=function(e){return $v(e)||Xc(e)}}}var Bv=Fr.exports,of=function(n){return n!==n},Ph=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||of(e)&&of(t))},zv=Ph,$h=function(){return typeof Object.is=="function"?Object.is:zv},Lv=$h,Fv=Xt,_v=function(){var e=Lv();return Fv(Object,{is:e},{is:function(){return Object.is!==e}}),e},jv=Xt,Vv=Dn,Wv=Ph,Bh=$h,Hv=_v,zh=Vv(Bh(),Object);jv(zh,{getPolyfill:Bh,implementation:Wv,shim:Hv});var Uv=zh,Kv=Dn,Lh=Ae,Jv=Ue,Ps=Jv("%ArrayBuffer%",!0),_r=Lh("ArrayBuffer.prototype.byteLength",!0),qv=Lh("Object.prototype.toString"),sf=!!Ps&&!_r&&new Ps(0).slice,lf=!!sf&&Kv(sf),Fh=_r||lf?function(e){if(!e||typeof e!="object")return!1;try{return _r?_r(e):lf(e,0),!0}catch{return!1}}:Ps?function(e){return qv(e)==="[object ArrayBuffer]"}:function(e){return!1},Gv=Date.prototype.getDay,Yv=function(e){try{return Gv.call(e),!0}catch{return!1}},Xv=Object.prototype.toString,Qv="[object Date]",Zv=Qt(),eS=function(e){return typeof e!="object"||e===null?!1:Zv?Yv(e):Xv.call(e)===Qv},$s=Ae,_h=Qt(),jh,Vh,Bs,zs;if(_h){jh=$s("Object.prototype.hasOwnProperty"),Vh=$s("RegExp.prototype.exec"),Bs={};var Uo=function(){throw Bs};zs={toString:Uo,valueOf:Uo},typeof Symbol.toPrimitive=="symbol"&&(zs[Symbol.toPrimitive]=Uo)}var tS=$s("Object.prototype.toString"),nS=Object.getOwnPropertyDescriptor,rS="[object RegExp]",iS=_h?function(e){if(!e||typeof e!="object")return!1;var t=nS(e,"lastIndex"),r=t&&jh(t,"value");if(!r)return!1;try{Vh(e,zs)}catch(i){return i===Bs}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:tS(e)===rS},oS=Ae,af=oS("SharedArrayBuffer.prototype.byteLength",!0),sS=af?function(e){if(!e||typeof e!="object")return!1;try{return af(e),!0}catch{return!1}}:function(e){return!1},lS=Number.prototype.toString,aS=function(e){try{return lS.call(e),!0}catch{return!1}},cS=Object.prototype.toString,fS="[object Number]",uS=Qt(),dS=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:uS?aS(e):cS.call(e)===fS},Wh=Ae,hS=Wh("Boolean.prototype.toString"),pS=Wh("Object.prototype.toString"),mS=function(e){try{return hS(e),!0}catch{return!1}},gS="[object Boolean]",yS=Qt(),bS=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:yS&&Symbol.toStringTag in e?mS(e):pS(e)===gS},Ls={exports:{}},vS=Object.prototype.toString,SS=Pl();if(SS){var wS=Symbol.prototype.toString,xS=/^Symbol\(.*\)$/,CS=function(e){return typeof e.valueOf()!="symbol"?!1:xS.test(wS.call(e))};Ls.exports=function(e){if(typeof e=="symbol")return!0;if(vS.call(e)!=="[object Symbol]")return!1;try{return CS(e)}catch{return!1}}}else Ls.exports=function(e){return!1};var OS=Ls.exports,Fs={exports:{}},cf=typeof BigInt<"u"&&BigInt,kS=function(){return typeof cf=="function"&&typeof BigInt=="function"&&typeof cf(42)=="bigint"&&typeof BigInt(42)=="bigint"},AS=kS();if(AS){var TS=BigInt.prototype.valueOf,ES=function(e){try{return TS.call(e),!0}catch{}return!1};Fs.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:ES(e)}}else Fs.exports=function(e){return!1};var MS=Fs.exports,NS=Mh,RS=dS,DS=bS,IS=OS,PS=MS,$S=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(NS(e))return"String";if(RS(e))return"Number";if(DS(e))return"Boolean";if(IS(e))return"Symbol";if(PS(e))return"BigInt"},pi=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,ff=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,mi;pi||(mi=function(e){return!1});var _s=pi?pi.prototype.has:null,Ko=ff?ff.prototype.has:null;!mi&&!_s&&(mi=function(e){return!1});var BS=mi||function(e){if(!e||typeof e!="object")return!1;try{if(_s.call(e,_s),Ko)try{Ko.call(e,Ko)}catch{return!0}return e instanceof pi}catch{}return!1},js={exports:{}},zS=Ue,Hh=Ae,LS=zS("%WeakSet%",!0),Jo=Hh("WeakSet.prototype.has",!0);if(Jo){var qo=Hh("WeakMap.prototype.has",!0);js.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Jo(e,Jo),qo)try{qo(e,qo)}catch{return!0}return e instanceof LS}catch{}return!1}}else js.exports=function(e){return!1};var FS=js.exports,_S=Rh,jS=Ih,VS=BS,WS=FS,HS=function(e){if(e&&typeof e=="object"){if(_S(e))return"Map";if(jS(e))return"Set";if(VS(e))return"WeakMap";if(WS(e))return"WeakSet"}return!1},Uh=Function.prototype.toString,dn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Vs,jr;if(typeof dn=="function"&&typeof Object.defineProperty=="function")try{Vs=Object.defineProperty({},"length",{get:function(){throw jr}}),jr={},dn(function(){throw 42},null,Vs)}catch(n){n!==jr&&(dn=null)}else dn=null;var US=/^\s*class\b/,Ws=function(e){try{var t=Uh.call(e);return US.test(t)}catch{return!1}},Go=function(e){try{return Ws(e)?!1:(Uh.call(e),!0)}catch{return!1}},Vr=Object.prototype.toString,KS="[object Object]",JS="[object Function]",qS="[object GeneratorFunction]",GS="[object HTMLAllCollection]",YS="[object HTML document.all class]",XS="[object HTMLCollection]",QS=typeof Symbol=="function"&&!!Symbol.toStringTag,ZS=!(0 in[,]),Hs=function(){return!1};if(typeof document=="object"){var ew=document.all;Vr.call(ew)===Vr.call(document.all)&&(Hs=function(e){if((ZS||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Vr.call(e);return(t===GS||t===YS||t===XS||t===KS)&&e("")==null}catch{}return!1})}var tw=dn?function(e){if(Hs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{dn(e,null,Vs)}catch(t){if(t!==jr)return!1}return!Ws(e)&&Go(e)}:function(e){if(Hs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(QS)return Go(e);if(Ws(e))return!1;var t=Vr.call(e);return t!==JS&&t!==qS&&!/^\[object HTML/.test(t)?!1:Go(e)},nw=tw,rw=Object.prototype.toString,Kh=Object.prototype.hasOwnProperty,iw=function(e,t,r){for(var i=0,o=e.length;i<o;i++)Kh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},ow=function(e,t,r){for(var i=0,o=e.length;i<o;i++)r==null?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},sw=function(e,t,r){for(var i in e)Kh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},lw=function(e,t,r){if(!nw(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=r),rw.call(e)==="[object Array]"?iw(e,t,i):typeof e=="string"?ow(e,t,i):sw(e,t,i)},aw=lw,cw=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Yo=cw,fw=typeof globalThis>"u"?cr:globalThis,uw=function(){for(var e=[],t=0;t<Yo.length;t++)typeof fw[Yo[t]]=="function"&&(e[e.length]=Yo[t]);return e},gi=aw,dw=uw,uf=Dn,Jl=Ae,Wr=zl,hw=Jl("Object.prototype.toString"),Jh=Qt(),df=typeof globalThis>"u"?cr:globalThis,Us=dw(),ql=Jl("String.prototype.slice"),Xo=Object.getPrototypeOf,pw=Jl("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},yi={__proto__:null};Jh&&Wr&&Xo?gi(Us,function(n){var e=new df[n];if(Symbol.toStringTag in e){var t=Xo(e),r=Wr(t,Symbol.toStringTag);if(!r){var i=Xo(t);r=Wr(i,Symbol.toStringTag)}yi["$"+n]=uf(r.get)}}):gi(Us,function(n){var e=new df[n],t=e.slice||e.set;t&&(yi["$"+n]=uf(t))});var mw=function(e){var t=!1;return gi(yi,function(r,i){if(!t)try{"$"+r(e)===i&&(t=ql(i,1))}catch{}}),t},gw=function(e){var t=!1;return gi(yi,function(r,i){if(!t)try{r(e),t=ql(i,1)}catch{}}),t},yw=function(e){if(!e||typeof e!="object")return!1;if(!Jh){var t=ql(hw(e),8,-1);return pw(Us,t)>-1?t:t!=="Object"?!1:gw(e)}return Wr?mw(e):null},bw=Ae,hf=bw("ArrayBuffer.prototype.byteLength",!0),vw=Fh,Sw=function(e){return vw(e)?hf?hf(e):e.byteLength:NaN},qh=Q0,Ke=Ae,pf=x1,ww=Ue,An=Bv,xw=Th,mf=Uv,gf=vh,yf=Eh,bf=Fh,vf=eS,Sf=iS,wf=sS,xf=Il,Cf=$S,Of=HS,kf=yw,Af=Sw,Tf=Ke("SharedArrayBuffer.prototype.byteLength",!0),Ef=Ke("Date.prototype.getTime"),Qo=Object.getPrototypeOf,Mf=Ke("Object.prototype.toString"),bi=ww("%Set%",!0),Ks=Ke("Map.prototype.has",!0),vi=Ke("Map.prototype.get",!0),Nf=Ke("Map.prototype.size",!0),Si=Ke("Set.prototype.add",!0),Gh=Ke("Set.prototype.delete",!0),wi=Ke("Set.prototype.has",!0),Hr=Ke("Set.prototype.size",!0);function Rf(n,e,t,r){for(var i=An(n),o;(o=i.next())&&!o.done;)if(Re(e,o.value,t,r))return Gh(n,o.value),!0;return!1}function Yh(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function Cw(n,e,t,r,i,o){var s=Yh(t);if(s!=null)return s;var l=vi(e,s),a=qh({},i,{strict:!1});return typeof l>"u"&&!Ks(e,s)||!Re(r,l,a,o)?!1:!Ks(n,s)&&Re(r,l,a,o)}function Ow(n,e,t){var r=Yh(t);return r??(wi(e,r)&&!wi(n,r))}function Df(n,e,t,r,i,o){for(var s=An(n),l,a;(l=s.next())&&!l.done;)if(a=l.value,Re(t,a,i,o)&&Re(r,vi(e,a),i,o))return Gh(n,a),!0;return!1}function Re(n,e,t,r){var i=t||{};if(i.strict?mf(n,e):n===e)return!0;var o=Cf(n),s=Cf(e);if(o!==s)return!1;if(!n||!e||typeof n!="object"&&typeof e!="object")return i.strict?mf(n,e):n==e;var l=r.has(n),a=r.has(e),c;if(l&&a){if(r.get(n)===r.get(e))return!0}else c={};return l||r.set(n,c),a||r.set(e,c),Tw(n,e,i,r)}function If(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function kw(n,e,t,r){if(Hr(n)!==Hr(e))return!1;for(var i=An(n),o=An(e),s,l,a;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")a||(a=new bi),Si(a,s.value);else if(!wi(e,s.value)){if(t.strict||!Ow(n,e,s.value))return!1;a||(a=new bi),Si(a,s.value)}if(a){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Rf(a,l.value,t.strict,r))return!1}else if(!t.strict&&!wi(n,l.value)&&!Rf(a,l.value,t.strict,r))return!1;return Hr(a)===0}return!0}function Aw(n,e,t,r){if(Nf(n)!==Nf(e))return!1;for(var i=An(n),o=An(e),s,l,a,c,f,u;(s=i.next())&&!s.done;)if(c=s.value[0],f=s.value[1],c&&typeof c=="object")a||(a=new bi),Si(a,c);else if(u=vi(e,c),typeof u>"u"&&!Ks(e,c)||!Re(f,u,t,r)){if(t.strict||!Cw(n,e,c,f,t,r))return!1;a||(a=new bi),Si(a,c)}if(a){for(;(l=o.next())&&!l.done;)if(c=l.value[0],u=l.value[1],c&&typeof c=="object"){if(!Df(a,n,c,u,t,r))return!1}else if(!t.strict&&(!n.has(c)||!Re(vi(n,c),u,t,r))&&!Df(a,n,c,u,qh({},t,{strict:!1}),r))return!1;return Hr(a)===0}return!0}function Tw(n,e,t,r){var i,o;if(typeof n!=typeof e||n==null||e==null||Mf(n)!==Mf(e)||gf(n)!==gf(e))return!1;var s=yf(n),l=yf(e);if(s!==l)return!1;var a=n instanceof Error,c=e instanceof Error;if(a!==c||(a||c)&&(n.name!==e.name||n.message!==e.message))return!1;var f=Sf(n),u=Sf(e);if(f!==u||(f||u)&&(n.source!==e.source||pf(n)!==pf(e)))return!1;var d=vf(n),p=vf(e);if(d!==p||(d||p)&&Ef(n)!==Ef(e)||t.strict&&Qo&&Qo(n)!==Qo(e))return!1;var h=kf(n),m=kf(e);if(h!==m)return!1;if(h||m){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var g=If(n),y=If(e);if(g!==y)return!1;if(g||y){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var C=bf(n),k=bf(e);if(C!==k)return!1;if(C||k)return Af(n)!==Af(e)?!1:typeof Uint8Array=="function"&&Re(new Uint8Array(n),new Uint8Array(e),t,r);var N=wf(n),M=wf(e);if(N!==M)return!1;if(N||M)return Tf(n)!==Tf(e)?!1:typeof Uint8Array=="function"&&Re(new Uint8Array(n),new Uint8Array(e),t,r);if(typeof n!=typeof e)return!1;var x=xf(n),D=xf(e);if(x.length!==D.length)return!1;for(x.sort(),D.sort(),i=x.length-1;i>=0;i--)if(x[i]!=D[i])return!1;for(i=x.length-1;i>=0;i--)if(o=x[i],!Re(n[o],e[o],t,r))return!1;var I=Of(n),T=Of(e);return I!==T?!1:I==="Set"||T==="Set"?kw(n,e,t,r):I==="Map"?Aw(n,e,t,r):!0}var Ew=function(e,t,r){return Re(e,t,r,xw())};const Mw=Xd(Ew);function Xh(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=Xh(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function Nw(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=Xh(n))&&(r&&(r+=" "),r+=e);return r}const Pf=n=>typeof n=="boolean"?"".concat(n):n===0?"0":n,$f=Nw,Rw=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return $f(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(c=>{const f=t==null?void 0:t[c],u=o==null?void 0:o[c];if(f===null)return null;const d=Pf(f)||Pf(u);return i[c][d]}),l=t&&Object.entries(t).reduce((c,f)=>{let[u,d]=f;return d===void 0||(c[u]=d),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:u,className:d,...p}=f;return Object.entries(p).every(h=>{let[m,g]=h;return Array.isArray(g)?g.includes({...o,...l}[m]):{...o,...l}[m]===g})?[...c,u,d]:c},[]);return $f(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)};var Qh={exports:{}};(function(n,e){(function(r,i){n.exports=i(Xp,Qp)})(cr,function(t,r){return function(i){var o={};function s(l){if(o[l])return o[l].exports;var a=o[l]={i:l,l:!1,exports:{}};return i[l].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=i,s.c=o,s.d=function(l,a,c){s.o(l,a)||Object.defineProperty(l,a,{enumerable:!0,get:c})},s.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},s.t=function(l,a){if(a&1&&(l=s(l)),a&8||a&4&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),a&2&&typeof l!="string")for(var f in l)s.d(c,f,(function(u){return l[u]}).bind(null,f));return c},s.n=function(l){var a=l&&l.__esModule?function(){return l.default}:function(){return l};return s.d(a,"a",a),a},s.o=function(l,a){return Object.prototype.hasOwnProperty.call(l,a)},s.p="",s(s.s=4)}([function(i,o,s){i.exports=s(5)()},function(i,o){i.exports=t},function(i,o){i.exports=r},function(i,o){i.exports=function(s,l,a){var c=s.direction,f=s.value;switch(c){case"top":return a.top+f<l.top&&a.bottom>l.bottom&&a.left<l.left&&a.right>l.right;case"left":return a.left+f<l.left&&a.bottom>l.bottom&&a.top<l.top&&a.right>l.right;case"bottom":return a.bottom-f>l.bottom&&a.left<l.left&&a.right>l.right&&a.top<l.top;case"right":return a.right-f>l.right&&a.left<l.left&&a.top<l.top&&a.bottom>l.bottom}}},function(i,o,s){s.r(o),s.d(o,"default",function(){return Y});var l=s(1),a=s.n(l),c=s(2),f=s.n(c),u=s(0),d=s.n(u),p=s(3),h=s.n(p);function m(A){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?m=function(B){return typeof B}:m=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},m(A)}function g(A,O){if(!(A instanceof O))throw new TypeError("Cannot call a class as a function")}function y(A,O){for(var B=0;B<O.length;B++){var v=O[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(A,v.key,v)}}function C(A,O,B){return O&&y(A.prototype,O),A}function k(A,O){return O&&(m(O)==="object"||typeof O=="function")?O:M(A)}function N(A){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},N(A)}function M(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function x(A,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(O&&O.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),O&&D(A,O)}function D(A,O){return D=Object.setPrototypeOf||function(v,X){return v.__proto__=X,v},D(A,O)}function I(A,O,B){return O in A?Object.defineProperty(A,O,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[O]=B,A}function T(A){return A.width===void 0&&(A.width=A.right-A.left),A.height===void 0&&(A.height=A.bottom-A.top),A}var Y=function(A){x(O,A);function O(B){var v;return g(this,O),v=k(this,N(O).call(this,B)),I(M(v),"getContainer",function(){return v.props.containment||window}),I(M(v),"addEventListener",function(X,F,j,ie){v.debounceCheck||(v.debounceCheck={});var U,lt,Z=function(){U=null,v.check()};ie>-1?lt=function(){U||(U=setTimeout(Z,ie||0))}:lt=function(){clearTimeout(U),U=setTimeout(Z,j||0)};var $n={target:X,fn:lt,getLastTimeout:function(){return U}};X.addEventListener(F,$n.fn),v.debounceCheck[F]=$n}),I(M(v),"startWatching",function(){v.debounceCheck||v.interval||(v.props.intervalCheck&&(v.interval=setInterval(v.check,v.props.intervalDelay)),v.props.scrollCheck&&v.addEventListener(v.getContainer(),"scroll",v.props.scrollDelay,v.props.scrollThrottle),v.props.resizeCheck&&v.addEventListener(window,"resize",v.props.resizeDelay,v.props.resizeThrottle),!v.props.delayedCall&&v.check())}),I(M(v),"stopWatching",function(){if(v.debounceCheck){for(var X in v.debounceCheck)if(v.debounceCheck.hasOwnProperty(X)){var F=v.debounceCheck[X];clearTimeout(F.getLastTimeout()),F.target.removeEventListener(X,F.fn),v.debounceCheck[X]=null}}v.debounceCheck=null,v.interval&&(v.interval=clearInterval(v.interval))}),I(M(v),"check",function(){var X=v.node,F,j;if(!X)return v.state;if(F=T(v.roundRectDown(X.getBoundingClientRect())),v.props.containment){var ie=v.props.containment.getBoundingClientRect();j={top:ie.top,left:ie.left,bottom:ie.bottom,right:ie.right}}else j={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var U=v.props.offset||{},lt=m(U)==="object";lt&&(j.top+=U.top||0,j.left+=U.left||0,j.bottom-=U.bottom||0,j.right-=U.right||0);var Z={top:F.top>=j.top,left:F.left>=j.left,bottom:F.bottom<=j.bottom,right:F.right<=j.right},$n=F.height>0&&F.width>0,Ge=$n&&Z.top&&Z.left&&Z.bottom&&Z.right;if($n&&v.props.partialVisibility){var go=F.top<=j.bottom&&F.bottom>=j.top&&F.left<=j.right&&F.right>=j.left;typeof v.props.partialVisibility=="string"&&(go=Z[v.props.partialVisibility]),Ge=v.props.minTopValue?go&&F.top<=j.bottom-v.props.minTopValue:go}typeof U.direction=="string"&&typeof U.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",U.direction,U.value),Ge=h()(U,F,j));var yo=v.state;return v.state.isVisible!==Ge&&(yo={isVisible:Ge,visibilityRect:Z},v.setState(yo),v.props.onChange&&v.props.onChange(Ge)),yo}),v.state={isVisible:null,visibilityRect:{}},v}return C(O,[{key:"componentDidMount",value:function(){this.node=f.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(v){this.node=f.a.findDOMNode(this),this.props.active&&!v.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(v){return{top:Math.floor(v.top),left:Math.floor(v.left),bottom:Math.floor(v.bottom),right:Math.floor(v.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):a.a.Children.only(this.props.children)}}]),O}(a.a.Component);I(Y,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:a.a.createElement("span",null)}),I(Y,"propTypes",{onChange:d.a.func,active:d.a.bool,partialVisibility:d.a.oneOfType([d.a.bool,d.a.oneOf(["top","right","bottom","left"])]),delayedCall:d.a.bool,offset:d.a.oneOfType([d.a.shape({top:d.a.number,left:d.a.number,bottom:d.a.number,right:d.a.number}),d.a.shape({direction:d.a.oneOf(["top","right","bottom","left"]),value:d.a.number})]),scrollCheck:d.a.bool,scrollDelay:d.a.number,scrollThrottle:d.a.number,resizeCheck:d.a.bool,resizeDelay:d.a.number,resizeThrottle:d.a.number,intervalCheck:d.a.bool,intervalDelay:d.a.number,containment:typeof window<"u"?d.a.instanceOf(window.Element):d.a.any,children:d.a.oneOfType([d.a.element,d.a.func]),minTopValue:d.a.number})},function(i,o,s){var l=s(6);function a(){}function c(){}c.resetWarningCache=a,i.exports=function(){function f(p,h,m,g,y,C){if(C!==l){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}}f.isRequired=f;function u(){return f}var d={array:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:u,element:f,elementType:f,instanceOf:u,node:f,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:c,resetWarningCache:a};return d.PropTypes=d,d}},function(i,o,s){var l="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";i.exports=l}])})})(Qh);var Dw=Qh.exports;const Iw=Xd(Dw);var Zh=typeof global=="object"&&global&&global.Object===Object&&global,Pw=typeof self=="object"&&self&&self.Object===Object&&self,Je=Zh||Pw||Function("return this")(),We=Je.Symbol,ep=Object.prototype,$w=ep.hasOwnProperty,Bw=ep.toString,Vn=We?We.toStringTag:void 0;function zw(n){var e=$w.call(n,Vn),t=n[Vn];try{n[Vn]=void 0;var r=!0}catch{}var i=Bw.call(n);return r&&(e?n[Vn]=t:delete n[Vn]),i}var Lw=Object.prototype,Fw=Lw.toString;function _w(n){return Fw.call(n)}var jw="[object Null]",Vw="[object Undefined]",Bf=We?We.toStringTag:void 0;function Dt(n){return n==null?n===void 0?Vw:jw:Bf&&Bf in Object(n)?zw(n):_w(n)}function it(n){return n!=null&&typeof n=="object"}var Ww="[object Symbol]";function ao(n){return typeof n=="symbol"||it(n)&&Dt(n)==Ww}function tp(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t<r;)i[t]=e(n[t],t,n);return i}var He=Array.isArray,Hw=1/0,zf=We?We.prototype:void 0,Lf=zf?zf.toString:void 0;function xi(n){if(typeof n=="string")return n;if(He(n))return tp(n,xi)+"";if(ao(n))return Lf?Lf.call(n):"";var e=n+"";return e=="0"&&1/n==-Hw?"-0":e}var Uw=/\s/;function Kw(n){for(var e=n.length;e--&&Uw.test(n.charAt(e)););return e}var Jw=/^\s+/;function qw(n){return n&&n.slice(0,Kw(n)+1).replace(Jw,"")}function Et(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Ff=NaN,Gw=/^[-+]0x[0-9a-f]+$/i,Yw=/^0b[01]+$/i,Xw=/^0o[0-7]+$/i,Qw=parseInt;function bn(n){if(typeof n=="number")return n;if(ao(n))return Ff;if(Et(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Et(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=qw(n);var t=Yw.test(n);return t||Xw.test(n)?Qw(n.slice(2),t?2:8):Gw.test(n)?Ff:+n}var _f=1/0,Zw=17976931348623157e292;function ex(n){if(!n)return n===0?n:0;if(n=bn(n),n===_f||n===-_f){var e=n<0?-1:1;return e*Zw}return n===n?n:0}function tx(n){var e=ex(n),t=e%1;return e===e?t?e-t:e:0}function Gl(n){return n}var nx="[object AsyncFunction]",rx="[object Function]",ix="[object GeneratorFunction]",ox="[object Proxy]";function np(n){if(!Et(n))return!1;var e=Dt(n);return e==rx||e==ix||e==nx||e==ox}var Zo=Je["__core-js_shared__"],jf=function(){var n=/[^.]+$/.exec(Zo&&Zo.keys&&Zo.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function sx(n){return!!jf&&jf in n}var lx=Function.prototype,ax=lx.toString;function Zt(n){if(n!=null){try{return ax.call(n)}catch{}try{return n+""}catch{}}return""}var cx=/[\\^$.*+?()[\]{}|]/g,fx=/^\[object .+?Constructor\]$/,ux=Function.prototype,dx=Object.prototype,hx=ux.toString,px=dx.hasOwnProperty,mx=RegExp("^"+hx.call(px).replace(cx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gx(n){if(!Et(n)||sx(n))return!1;var e=np(n)?mx:fx;return e.test(Zt(n))}function yx(n,e){return n==null?void 0:n[e]}function en(n,e){var t=yx(n,e);return gx(t)?t:void 0}var Js=en(Je,"WeakMap");function bx(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}var vx=800,Sx=16,wx=Date.now;function xx(n){var e=0,t=0;return function(){var r=wx(),i=Sx-(r-t);if(t=r,i>0){if(++e>=vx)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Cx(n){return function(){return n}}var Vf=function(){try{var n=en(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Ox=Vf?function(n,e){return Vf(n,"toString",{configurable:!0,enumerable:!1,value:Cx(e),writable:!0})}:Gl,kx=xx(Ox);function Ax(n,e,t,r){for(var i=n.length,o=t+-1;++o<i;)if(e(n[o],o,n))return o;return-1}function Tx(n){return n!==n}function Ex(n,e,t){for(var r=t-1,i=n.length;++r<i;)if(n[r]===e)return r;return-1}function Mx(n,e,t){return e===e?Ex(n,e,t):Ax(n,Tx,t)}function Nx(n,e){var t=n==null?0:n.length;return!!t&&Mx(n,e,0)>-1}var Rx=9007199254740991,Dx=/^(?:0|[1-9]\d*)$/;function rp(n,e){var t=typeof n;return e=e??Rx,!!e&&(t=="number"||t!="symbol"&&Dx.test(n))&&n>-1&&n%1==0&&n<e}function ip(n,e){return n===e||n!==n&&e!==e}var Wf=Math.max;function Ix(n,e,t){return e=Wf(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,o=Wf(r.length-e,0),s=Array(o);++i<o;)s[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=t(s),bx(n,this,l)}}function Px(n,e){return kx(Ix(n,e,Gl),n+"")}var $x=9007199254740991;function Yl(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=$x}function op(n){return n!=null&&Yl(n.length)&&!np(n)}var Bx=Object.prototype;function zx(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Bx;return n===t}function Lx(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var Fx="[object Arguments]";function Hf(n){return it(n)&&Dt(n)==Fx}var sp=Object.prototype,_x=sp.hasOwnProperty,jx=sp.propertyIsEnumerable,Xl=Hf(function(){return arguments}())?Hf:function(n){return it(n)&&_x.call(n,"callee")&&!jx.call(n,"callee")};function Vx(){return!1}var lp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uf=lp&&typeof module=="object"&&module&&!module.nodeType&&module,Wx=Uf&&Uf.exports===lp,Kf=Wx?Je.Buffer:void 0,Hx=Kf?Kf.isBuffer:void 0,qs=Hx||Vx,Ux="[object Arguments]",Kx="[object Array]",Jx="[object Boolean]",qx="[object Date]",Gx="[object Error]",Yx="[object Function]",Xx="[object Map]",Qx="[object Number]",Zx="[object Object]",eC="[object RegExp]",tC="[object Set]",nC="[object String]",rC="[object WeakMap]",iC="[object ArrayBuffer]",oC="[object DataView]",sC="[object Float32Array]",lC="[object Float64Array]",aC="[object Int8Array]",cC="[object Int16Array]",fC="[object Int32Array]",uC="[object Uint8Array]",dC="[object Uint8ClampedArray]",hC="[object Uint16Array]",pC="[object Uint32Array]",W={};W[sC]=W[lC]=W[aC]=W[cC]=W[fC]=W[uC]=W[dC]=W[hC]=W[pC]=!0;W[Ux]=W[Kx]=W[iC]=W[Jx]=W[oC]=W[qx]=W[Gx]=W[Yx]=W[Xx]=W[Qx]=W[Zx]=W[eC]=W[tC]=W[nC]=W[rC]=!1;function mC(n){return it(n)&&Yl(n.length)&&!!W[Dt(n)]}function Ql(n){return function(e){return n(e)}}var ap=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zn=ap&&typeof module=="object"&&module&&!module.nodeType&&module,gC=Zn&&Zn.exports===ap,es=gC&&Zh.process,Ci=function(){try{var n=Zn&&Zn.require&&Zn.require("util").types;return n||es&&es.binding&&es.binding("util")}catch{}}(),Jf=Ci&&Ci.isTypedArray,cp=Jf?Ql(Jf):mC,yC=Object.prototype,bC=yC.hasOwnProperty;function vC(n,e){var t=He(n),r=!t&&Xl(n),i=!t&&!r&&qs(n),o=!t&&!r&&!i&&cp(n),s=t||r||i||o,l=s?Lx(n.length,String):[],a=l.length;for(var c in n)bC.call(n,c)&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||rp(c,a)))&&l.push(c);return l}function SC(n,e){return function(t){return n(e(t))}}var wC=SC(Object.keys,Object),xC=Object.prototype,CC=xC.hasOwnProperty;function OC(n){if(!zx(n))return wC(n);var e=[];for(var t in Object(n))CC.call(n,t)&&t!="constructor"&&e.push(t);return e}function fp(n){return op(n)?vC(n):OC(n)}var kC=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,AC=/^\w*$/;function Zl(n,e){if(He(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||ao(n)?!0:AC.test(n)||!kC.test(n)||e!=null&&n in Object(e)}var ur=en(Object,"create");function TC(){this.__data__=ur?ur(null):{},this.size=0}function EC(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var MC="__lodash_hash_undefined__",NC=Object.prototype,RC=NC.hasOwnProperty;function DC(n){var e=this.__data__;if(ur){var t=e[n];return t===MC?void 0:t}return RC.call(e,n)?e[n]:void 0}var IC=Object.prototype,PC=IC.hasOwnProperty;function $C(n){var e=this.__data__;return ur?e[n]!==void 0:PC.call(e,n)}var BC="__lodash_hash_undefined__";function zC(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=ur&&e===void 0?BC:e,this}function Jt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Jt.prototype.clear=TC;Jt.prototype.delete=EC;Jt.prototype.get=DC;Jt.prototype.has=$C;Jt.prototype.set=zC;function LC(){this.__data__=[],this.size=0}function co(n,e){for(var t=n.length;t--;)if(ip(n[t][0],e))return t;return-1}var FC=Array.prototype,_C=FC.splice;function jC(n){var e=this.__data__,t=co(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():_C.call(e,t,1),--this.size,!0}function VC(n){var e=this.__data__,t=co(e,n);return t<0?void 0:e[t][1]}function WC(n){return co(this.__data__,n)>-1}function HC(n,e){var t=this.__data__,r=co(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function ot(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}ot.prototype.clear=LC;ot.prototype.delete=jC;ot.prototype.get=VC;ot.prototype.has=WC;ot.prototype.set=HC;var dr=en(Je,"Map");function UC(){this.size=0,this.__data__={hash:new Jt,map:new(dr||ot),string:new Jt}}function KC(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function fo(n,e){var t=n.__data__;return KC(e)?t[typeof e=="string"?"string":"hash"]:t.map}function JC(n){var e=fo(this,n).delete(n);return this.size-=e?1:0,e}function qC(n){return fo(this,n).get(n)}function GC(n){return fo(this,n).has(n)}function YC(n,e){var t=fo(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function st(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}st.prototype.clear=UC;st.prototype.delete=JC;st.prototype.get=qC;st.prototype.has=GC;st.prototype.set=YC;var XC="Expected a function";function ea(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(XC);var t=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=t.cache;if(o.has(i))return o.get(i);var s=n.apply(this,r);return t.cache=o.set(i,s)||o,s};return t.cache=new(ea.Cache||st),t}ea.Cache=st;var QC=500;function ZC(n){var e=ea(n,function(r){return t.size===QC&&t.clear(),r}),t=e.cache;return e}var eO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tO=/\\(\\)?/g,nO=ZC(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(eO,function(t,r,i,o){e.push(i?o.replace(tO,"$1"):r||t)}),e});function Gs(n){return n==null?"":xi(n)}function up(n,e){return He(n)?n:Zl(n,e)?[n]:nO(Gs(n))}var rO=1/0;function uo(n){if(typeof n=="string"||ao(n))return n;var e=n+"";return e=="0"&&1/n==-rO?"-0":e}function dp(n,e){e=up(e,n);for(var t=0,r=e.length;n!=null&&t<r;)n=n[uo(e[t++])];return t&&t==r?n:void 0}function iO(n,e,t){var r=n==null?void 0:dp(n,e);return r===void 0?t:r}function hp(n,e){for(var t=-1,r=e.length,i=n.length;++t<r;)n[i+t]=e[t];return n}var qf=We?We.isConcatSpreadable:void 0;function oO(n){return He(n)||Xl(n)||!!(qf&&n&&n[qf])}function sO(n,e,t,r,i){var o=-1,s=n.length;for(t||(t=oO),i||(i=[]);++o<s;){var l=n[o];t(l)&&hp(i,l)}return i}function lO(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+e];return o}function aO(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:lO(n,e,t)}var cO="\\ud800-\\udfff",fO="\\u0300-\\u036f",uO="\\ufe20-\\ufe2f",dO="\\u20d0-\\u20ff",hO=fO+uO+dO,pO="\\ufe0e\\ufe0f",mO="\\u200d",gO=RegExp("["+mO+cO+hO+pO+"]");function ta(n){return gO.test(n)}function yO(n){return n.split("")}var pp="\\ud800-\\udfff",bO="\\u0300-\\u036f",vO="\\ufe20-\\ufe2f",SO="\\u20d0-\\u20ff",wO=bO+vO+SO,xO="\\ufe0e\\ufe0f",CO="["+pp+"]",Ys="["+wO+"]",Xs="\\ud83c[\\udffb-\\udfff]",OO="(?:"+Ys+"|"+Xs+")",mp="[^"+pp+"]",gp="(?:\\ud83c[\\udde6-\\uddff]){2}",yp="[\\ud800-\\udbff][\\udc00-\\udfff]",kO="\\u200d",bp=OO+"?",vp="["+xO+"]?",AO="(?:"+kO+"(?:"+[mp,gp,yp].join("|")+")"+vp+bp+")*",TO=vp+bp+AO,EO="(?:"+[mp+Ys+"?",Ys,gp,yp,CO].join("|")+")",MO=RegExp(Xs+"(?="+Xs+")|"+EO+TO,"g");function NO(n){return n.match(MO)||[]}function RO(n){return ta(n)?NO(n):yO(n)}function DO(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function IO(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=bn(t),t=t===t?t:0),e!==void 0&&(e=bn(e),e=e===e?e:0),DO(bn(n),e,t)}function PO(){this.__data__=new ot,this.size=0}function $O(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function BO(n){return this.__data__.get(n)}function zO(n){return this.__data__.has(n)}var LO=200;function FO(n,e){var t=this.__data__;if(t instanceof ot){var r=t.__data__;if(!dr||r.length<LO-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new st(r)}return t.set(n,e),this.size=t.size,this}function rt(n){var e=this.__data__=new ot(n);this.size=e.size}rt.prototype.clear=PO;rt.prototype.delete=$O;rt.prototype.get=BO;rt.prototype.has=zO;rt.prototype.set=FO;function _O(n,e){for(var t=-1,r=n==null?0:n.length,i=0,o=[];++t<r;){var s=n[t];e(s,t,n)&&(o[i++]=s)}return o}function jO(){return[]}var VO=Object.prototype,WO=VO.propertyIsEnumerable,Gf=Object.getOwnPropertySymbols,HO=Gf?function(n){return n==null?[]:(n=Object(n),_O(Gf(n),function(e){return WO.call(n,e)}))}:jO;function UO(n,e,t){var r=e(n);return He(n)?r:hp(r,t(n))}function Yf(n){return UO(n,fp,HO)}var Qs=en(Je,"DataView"),Zs=en(Je,"Promise"),el=en(Je,"Set"),Xf="[object Map]",KO="[object Object]",Qf="[object Promise]",Zf="[object Set]",eu="[object WeakMap]",tu="[object DataView]",JO=Zt(Qs),qO=Zt(dr),GO=Zt(Zs),YO=Zt(el),XO=Zt(Js),pt=Dt;(Qs&&pt(new Qs(new ArrayBuffer(1)))!=tu||dr&&pt(new dr)!=Xf||Zs&&pt(Zs.resolve())!=Qf||el&&pt(new el)!=Zf||Js&&pt(new Js)!=eu)&&(pt=function(n){var e=Dt(n),t=e==KO?n.constructor:void 0,r=t?Zt(t):"";if(r)switch(r){case JO:return tu;case qO:return Xf;case GO:return Qf;case YO:return Zf;case XO:return eu}return e});var nu=Je.Uint8Array,QO="__lodash_hash_undefined__";function ZO(n){return this.__data__.set(n,QO),this}function ek(n){return this.__data__.has(n)}function hr(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new st;++e<t;)this.add(n[e])}hr.prototype.add=hr.prototype.push=ZO;hr.prototype.has=ek;function tk(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(e(n[t],t,n))return!0;return!1}function Sp(n,e){return n.has(e)}var nk=1,rk=2;function wp(n,e,t,r,i,o){var s=t&nk,l=n.length,a=e.length;if(l!=a&&!(s&&a>l))return!1;var c=o.get(n),f=o.get(e);if(c&&f)return c==e&&f==n;var u=-1,d=!0,p=t&rk?new hr:void 0;for(o.set(n,e),o.set(e,n);++u<l;){var h=n[u],m=e[u];if(r)var g=s?r(m,h,u,e,n,o):r(h,m,u,n,e,o);if(g!==void 0){if(g)continue;d=!1;break}if(p){if(!tk(e,function(y,C){if(!Sp(p,C)&&(h===y||i(h,y,t,r,o)))return p.push(C)})){d=!1;break}}else if(!(h===m||i(h,m,t,r,o))){d=!1;break}}return o.delete(n),o.delete(e),d}function ik(n){var e=-1,t=Array(n.size);return n.forEach(function(r,i){t[++e]=[i,r]}),t}function ok(n){var e=-1,t=Array(n.size);return n.forEach(function(r){t[++e]=r}),t}var sk=1,lk=2,ak="[object Boolean]",ck="[object Date]",fk="[object Error]",uk="[object Map]",dk="[object Number]",hk="[object RegExp]",pk="[object Set]",mk="[object String]",gk="[object Symbol]",yk="[object ArrayBuffer]",bk="[object DataView]",ru=We?We.prototype:void 0,ts=ru?ru.valueOf:void 0;function vk(n,e,t,r,i,o,s){switch(t){case bk:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case yk:return!(n.byteLength!=e.byteLength||!o(new nu(n),new nu(e)));case ak:case ck:case dk:return ip(+n,+e);case fk:return n.name==e.name&&n.message==e.message;case hk:case mk:return n==e+"";case uk:var l=ik;case pk:var a=r&sk;if(l||(l=ok),n.size!=e.size&&!a)return!1;var c=s.get(n);if(c)return c==e;r|=lk,s.set(n,e);var f=wp(l(n),l(e),r,i,o,s);return s.delete(n),f;case gk:if(ts)return ts.call(n)==ts.call(e)}return!1}var Sk=1,wk=Object.prototype,xk=wk.hasOwnProperty;function Ck(n,e,t,r,i,o){var s=t&Sk,l=Yf(n),a=l.length,c=Yf(e),f=c.length;if(a!=f&&!s)return!1;for(var u=a;u--;){var d=l[u];if(!(s?d in e:xk.call(e,d)))return!1}var p=o.get(n),h=o.get(e);if(p&&h)return p==e&&h==n;var m=!0;o.set(n,e),o.set(e,n);for(var g=s;++u<a;){d=l[u];var y=n[d],C=e[d];if(r)var k=s?r(C,y,d,e,n,o):r(y,C,d,n,e,o);if(!(k===void 0?y===C||i(y,C,t,r,o):k)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var N=n.constructor,M=e.constructor;N!=M&&"constructor"in n&&"constructor"in e&&!(typeof N=="function"&&N instanceof N&&typeof M=="function"&&M instanceof M)&&(m=!1)}return o.delete(n),o.delete(e),m}var Ok=1,iu="[object Arguments]",ou="[object Array]",Ar="[object Object]",kk=Object.prototype,su=kk.hasOwnProperty;function Ak(n,e,t,r,i,o){var s=He(n),l=He(e),a=s?ou:pt(n),c=l?ou:pt(e);a=a==iu?Ar:a,c=c==iu?Ar:c;var f=a==Ar,u=c==Ar,d=a==c;if(d&&qs(n)){if(!qs(e))return!1;s=!0,f=!1}if(d&&!f)return o||(o=new rt),s||cp(n)?wp(n,e,t,r,i,o):vk(n,e,a,t,r,i,o);if(!(t&Ok)){var p=f&&su.call(n,"__wrapped__"),h=u&&su.call(e,"__wrapped__");if(p||h){var m=p?n.value():n,g=h?e.value():e;return o||(o=new rt),i(m,g,t,r,o)}}return d?(o||(o=new rt),Ck(n,e,t,r,i,o)):!1}function na(n,e,t,r,i){return n===e?!0:n==null||e==null||!it(n)&&!it(e)?n!==n&&e!==e:Ak(n,e,t,r,na,i)}var Tk=1,Ek=2;function Mk(n,e,t,r){var i=t.length,o=i;if(n==null)return!o;for(n=Object(n);i--;){var s=t[i];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++i<o;){s=t[i];var l=s[0],a=n[l],c=s[1];if(s[2]){if(a===void 0&&!(l in n))return!1}else{var f=new rt,u;if(!(u===void 0?na(c,a,Tk|Ek,r,f):u))return!1}}return!0}function xp(n){return n===n&&!Et(n)}function Nk(n){for(var e=fp(n),t=e.length;t--;){var r=e[t],i=n[r];e[t]=[r,i,xp(i)]}return e}function Cp(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Rk(n){var e=Nk(n);return e.length==1&&e[0][2]?Cp(e[0][0],e[0][1]):function(t){return t===n||Mk(t,n,e)}}function Dk(n,e){return n!=null&&e in Object(n)}function Ik(n,e,t){e=up(e,n);for(var r=-1,i=e.length,o=!1;++r<i;){var s=uo(e[r]);if(!(o=n!=null&&t(n,s)))break;n=n[s]}return o||++r!=i?o:(i=n==null?0:n.length,!!i&&Yl(i)&&rp(s,i)&&(He(n)||Xl(n)))}function Pk(n,e){return n!=null&&Ik(n,e,Dk)}var $k=1,Bk=2;function zk(n,e){return Zl(n)&&xp(e)?Cp(uo(n),e):function(t){var r=iO(t,n);return r===void 0&&r===e?Pk(t,n):na(e,r,$k|Bk)}}function Op(n){return function(e){return e==null?void 0:e[n]}}function Lk(n){return function(e){return dp(e,n)}}function Fk(n){return Zl(n)?Op(uo(n)):Lk(n)}function _k(n){return typeof n=="function"?n:n==null?Gl:typeof n=="object"?He(n)?zk(n[0],n[1]):Rk(n):Fk(n)}var ns=function(){return Je.Date.now()},jk="Expected a function",Vk=Math.max,Wk=Math.min;function kp(n,e,t){var r,i,o,s,l,a,c=0,f=!1,u=!1,d=!0;if(typeof n!="function")throw new TypeError(jk);e=bn(e)||0,Et(t)&&(f=!!t.leading,u="maxWait"in t,o=u?Vk(bn(t.maxWait)||0,e):o,d="trailing"in t?!!t.trailing:d);function p(x){var D=r,I=i;return r=i=void 0,c=x,s=n.apply(I,D),s}function h(x){return c=x,l=setTimeout(y,e),f?p(x):s}function m(x){var D=x-a,I=x-c,T=e-D;return u?Wk(T,o-I):T}function g(x){var D=x-a,I=x-c;return a===void 0||D>=e||D<0||u&&I>=o}function y(){var x=ns();if(g(x))return C(x);l=setTimeout(y,m(x))}function C(x){return l=void 0,d&&r?p(x):(r=i=void 0,s)}function k(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function N(){return l===void 0?s:C(ns())}function M(){var x=ns(),D=g(x);if(r=arguments,i=this,a=x,D){if(l===void 0)return h(a);if(u)return clearTimeout(l),l=setTimeout(y,e),p(a)}return l===void 0&&(l=setTimeout(y,e)),s}return M.cancel=k,M.flush=N,M}function rs(n){return it(n)&&op(n)}var Hk=200;function Uk(n,e,t,r){var i=-1,o=Nx,s=!0,l=n.length,a=[],c=e.length;if(!l)return a;t&&(e=tp(e,Ql(t))),e.length>=Hk&&(o=Sp,s=!1,e=new hr(e));e:for(;++i<l;){var f=n[i],u=t==null?f:t(f);if(f=f!==0?f:0,s&&u===u){for(var d=c;d--;)if(e[d]===u)continue e;a.push(f)}else o(e,u,r)||a.push(f)}return a}function Kk(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var Jk=Px(function(n,e){var t=Kk(e);return rs(t)&&(t=void 0),rs(n)?Uk(n,sO(e,1,rs),_k(t)):[]}),qk="[object Number]";function Gk(n){return typeof n=="number"||it(n)&&Dt(n)==qk}var Yk="[object RegExp]";function Xk(n){return it(n)&&Dt(n)==Yk}var lu=Ci&&Ci.isRegExp,Qk=lu?Ql(lu):Xk,Zk=Op("length"),Ap="\\ud800-\\udfff",eA="\\u0300-\\u036f",tA="\\ufe20-\\ufe2f",nA="\\u20d0-\\u20ff",rA=eA+tA+nA,iA="\\ufe0e\\ufe0f",oA="["+Ap+"]",tl="["+rA+"]",nl="\\ud83c[\\udffb-\\udfff]",sA="(?:"+tl+"|"+nl+")",Tp="[^"+Ap+"]",Ep="(?:\\ud83c[\\udde6-\\uddff]){2}",Mp="[\\ud800-\\udbff][\\udc00-\\udfff]",lA="\\u200d",Np=sA+"?",Rp="["+iA+"]?",aA="(?:"+lA+"(?:"+[Tp,Ep,Mp].join("|")+")"+Rp+Np+")*",cA=Rp+Np+aA,fA="(?:"+[Tp+tl+"?",tl,Ep,Mp,oA].join("|")+")",au=RegExp(nl+"(?="+nl+")|"+fA+cA,"g");function uA(n){for(var e=au.lastIndex=0;au.test(n);)++e;return e}function dA(n){return ta(n)?uA(n):Zk(n)}var hA="Expected a function";function pA(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(hA);return Et(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),kp(n,e,{leading:r,maxWait:e,trailing:i})}var mA=30,gA="...",yA=/\w*$/;function bA(n,e){var t=mA,r=gA;if(Et(e)){var i="separator"in e?e.separator:i;t="length"in e?tx(e.length):t,r="omission"in e?xi(e.omission):r}n=Gs(n);var o=n.length;if(ta(n)){var s=RO(n);o=s.length}if(t>=o)return n;var l=t-dA(r);if(l<1)return r;var a=s?aO(s,0,l).join(""):n.slice(0,l);if(i===void 0)return a+r;if(s&&(l+=a.length-l),Qk(i)){if(n.slice(l).search(i)){var c,f=a;for(i.global||(i=RegExp(i.source,Gs(yA.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var u=c.index;a=a.slice(0,u===void 0?l:u)}}else if(n.indexOf(xi(i),l)!=l){var d=a.lastIndexOf(i);d>-1&&(a=a.slice(0,d))}return a+r}const vA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",SA="ελ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",Tn=(n,e)=>{for(const t in e)n[t]=e[t];return n},rl="numeric",il="ascii",ol="alpha",Ur="asciinumeric",Tr="alphanumeric",sl="domain",Dp="emoji",wA="scheme",xA="slashscheme",cu="whitespace";function CA(n,e){return n in e||(e[n]=[]),e[n]}function Bt(n,e,t){e[rl]&&(e[Ur]=!0,e[Tr]=!0),e[il]&&(e[Ur]=!0,e[ol]=!0),e[Ur]&&(e[Tr]=!0),e[ol]&&(e[Tr]=!0),e[Tr]&&(e[sl]=!0),e[Dp]&&(e[sl]=!0);for(const r in e){const i=CA(r,t);i.indexOf(n)<0&&i.push(n)}}function OA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ye(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}ye.groups={};ye.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e){return e===void 0&&(e=!1),e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||ye.groups;let i;return e&&e.j?i=e:(i=new ye(e),t&&r&&Bt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||ye.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let s,l=i.go(n);if(l?(s=new ye,Tn(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new ye,o){if(r)if(s.t&&typeof s.t=="string"){const a=Tn(OA(s.t,r),t);Bt(o,a,r)}else t&&Bt(o,t,r);s.t=o}return i.j[n]=s,s}};const $=(n,e,t,r,i)=>n.ta(e,t,r,i),Se=(n,e,t,r,i)=>n.tr(e,t,r,i),fu=(n,e,t,r,i)=>n.ts(e,t,r,i),S=(n,e,t,r,i)=>n.tt(e,t,r,i),Ze="WORD",ll="UWORD",pr="LOCALHOST",al="TLD",cl="UTLD",Kr="SCHEME",fn="SLASH_SCHEME",ra="NUM",Ip="WS",ia="NL",er="OPENBRACE",tr="CLOSEBRACE",Oi="OPENBRACKET",ki="CLOSEBRACKET",Ai="OPENPAREN",Ti="CLOSEPAREN",Ei="OPENANGLEBRACKET",Mi="CLOSEANGLEBRACKET",Ni="FULLWIDTHLEFTPAREN",Ri="FULLWIDTHRIGHTPAREN",Di="LEFTCORNERBRACKET",Ii="RIGHTCORNERBRACKET",Pi="LEFTWHITECORNERBRACKET",$i="RIGHTWHITECORNERBRACKET",Bi="FULLWIDTHLESSTHAN",zi="FULLWIDTHGREATERTHAN",Li="AMPERSAND",Fi="APOSTROPHE",_i="ASTERISK",mt="AT",ji="BACKSLASH",Vi="BACKTICK",Wi="CARET",bt="COLON",oa="COMMA",Hi="DOLLAR",Pe="DOT",Ui="EQUALS",sa="EXCLAMATION",$e="HYPHEN",Ki="PERCENT",Ji="PIPE",qi="PLUS",Gi="POUND",Yi="QUERY",la="QUOTE",aa="SEMI",Be="SLASH",nr="TILDE",Xi="UNDERSCORE",Pp="EMOJI",Qi="SYM";var $p=Object.freeze({__proto__:null,WORD:Ze,UWORD:ll,LOCALHOST:pr,TLD:al,UTLD:cl,SCHEME:Kr,SLASH_SCHEME:fn,NUM:ra,WS:Ip,NL:ia,OPENBRACE:er,CLOSEBRACE:tr,OPENBRACKET:Oi,CLOSEBRACKET:ki,OPENPAREN:Ai,CLOSEPAREN:Ti,OPENANGLEBRACKET:Ei,CLOSEANGLEBRACKET:Mi,FULLWIDTHLEFTPAREN:Ni,FULLWIDTHRIGHTPAREN:Ri,LEFTCORNERBRACKET:Di,RIGHTCORNERBRACKET:Ii,LEFTWHITECORNERBRACKET:Pi,RIGHTWHITECORNERBRACKET:$i,FULLWIDTHLESSTHAN:Bi,FULLWIDTHGREATERTHAN:zi,AMPERSAND:Li,APOSTROPHE:Fi,ASTERISK:_i,AT:mt,BACKSLASH:ji,BACKTICK:Vi,CARET:Wi,COLON:bt,COMMA:oa,DOLLAR:Hi,DOT:Pe,EQUALS:Ui,EXCLAMATION:sa,HYPHEN:$e,PERCENT:Ki,PIPE:Ji,PLUS:qi,POUND:Gi,QUERY:Yi,QUOTE:la,SEMI:aa,SLASH:Be,TILDE:nr,UNDERSCORE:Xi,EMOJI:Pp,SYM:Qi});const sn=/[a-z]/,is=new RegExp("\\p{L}","u"),ss=new RegExp("\\p{Emoji}","u"),ls=/\d/,uu=/\s/,du=`
14
- `,kA="️",AA="‍";let Er=null,Mr=null;function TA(n){n===void 0&&(n=[]);const e={};ye.groups=e;const t=new ye;Er==null&&(Er=hu(vA)),Mr==null&&(Mr=hu(SA)),S(t,"'",Fi),S(t,"{",er),S(t,"}",tr),S(t,"[",Oi),S(t,"]",ki),S(t,"(",Ai),S(t,")",Ti),S(t,"<",Ei),S(t,">",Mi),S(t,"(",Ni),S(t,")",Ri),S(t,"「",Di),S(t,"」",Ii),S(t,"『",Pi),S(t,"』",$i),S(t,"<",Bi),S(t,">",zi),S(t,"&",Li),S(t,"*",_i),S(t,"@",mt),S(t,"`",Vi),S(t,"^",Wi),S(t,":",bt),S(t,",",oa),S(t,"$",Hi),S(t,".",Pe),S(t,"=",Ui),S(t,"!",sa),S(t,"-",$e),S(t,"%",Ki),S(t,"|",Ji),S(t,"+",qi),S(t,"#",Gi),S(t,"?",Yi),S(t,'"',la),S(t,"/",Be),S(t,";",aa),S(t,"~",nr),S(t,"_",Xi),S(t,"\\",ji);const r=Se(t,ls,ra,{[rl]:!0});Se(r,ls,r);const i=Se(t,sn,Ze,{[il]:!0});Se(i,sn,i);const o=Se(t,is,ll,{[ol]:!0});Se(o,sn),Se(o,is,o);const s=Se(t,uu,Ip,{[cu]:!0});S(t,du,ia,{[cu]:!0}),S(s,du),Se(s,uu,s);const l=Se(t,ss,Pp,{[Dp]:!0});Se(l,ss,l),S(l,kA,l);const a=S(l,AA);Se(a,ss,l);const c=[[sn,i]],f=[[sn,null],[is,o]];for(let u=0;u<Er.length;u++)ft(t,Er[u],al,Ze,c);for(let u=0;u<Mr.length;u++)ft(t,Mr[u],cl,ll,f);Bt(al,{tld:!0,ascii:!0},e),Bt(cl,{utld:!0,alpha:!0},e),ft(t,"file",Kr,Ze,c),ft(t,"mailto",Kr,Ze,c),ft(t,"http",fn,Ze,c),ft(t,"https",fn,Ze,c),ft(t,"ftp",fn,Ze,c),ft(t,"ftps",fn,Ze,c),Bt(Kr,{scheme:!0,ascii:!0},e),Bt(fn,{slashscheme:!0,ascii:!0},e),n=n.sort((u,d)=>u[0]>d[0]?1:-1);for(let u=0;u<n.length;u++){const d=n[u][0],h=n[u][1]?{[wA]:!0}:{[xA]:!0};d.indexOf("-")>=0?h[sl]=!0:sn.test(d)?ls.test(d)?h[Ur]=!0:h[il]=!0:h[rl]=!0,fu(t,d,d,h)}return fu(t,"localhost",pr,{ascii:!0}),t.jd=new ye(Qi),{start:t,tokens:Tn({groups:e},$p)}}function EA(n,e){const t=MA(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,a=null,c=0,f=null,u=-1,d=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(u=0,d=0,f=l):u>=0&&(u+=t[s].length,d++),c+=t[s].length,o+=t[s].length,s++;o-=u,s-=d,c-=u,i.push({t:f.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function MA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function ft(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?o=n.j[a]:(o=new ye(r),o.jr=i.slice(),n.j[a]=o),n=o}return o=new ye(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function hu(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const mr={defaultProtocol:"http",events:null,format:pu,formatHref:pu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ca(n,e){e===void 0&&(e=null);let t=Tn({},mr);n&&(t=Tn(t,n instanceof ca?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}ca.prototype={o:mr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:mr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function pu(n){return n}function Bp(n,e){this.t="token",this.v=n,this.tk=e}Bp.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=mr.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),f=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),f&&Tn(s,f),{tagName:i,attributes:s,content:o,eventListeners:u}}};function ho(n,e){class t extends Bp{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const mu=ho("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gu=ho("text"),NA=ho("nl"),Nr=ho("url",{isLink:!0,toHref(n){return n===void 0&&(n=mr.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==pr&&n[1].t===bt}}),we=n=>new ye(n);function RA(n){let{groups:e}=n;const t=e.domain.concat([Li,_i,mt,ji,Vi,Wi,Hi,Ui,$e,ra,Ki,Ji,qi,Gi,Be,Qi,nr,Xi]),r=[Fi,bt,oa,Pe,sa,Yi,la,aa,Ei,Mi,er,tr,ki,Oi,Ai,Ti,Ni,Ri,Di,Ii,Pi,$i,Bi,zi],i=[Li,Fi,_i,ji,Vi,Wi,Hi,Ui,$e,er,tr,Ki,Ji,qi,Gi,Yi,Be,Qi,nr,Xi],o=we(),s=S(o,nr);$(s,i,s),$(s,e.domain,s);const l=we(),a=we(),c=we();$(o,e.domain,l),$(o,e.scheme,a),$(o,e.slashscheme,c),$(l,i,s),$(l,e.domain,l);const f=S(l,mt);S(s,mt,f),S(a,mt,f),S(c,mt,f);const u=S(s,Pe);$(u,i,s),$(u,e.domain,s);const d=we();$(f,e.domain,d),$(d,e.domain,d);const p=S(d,Pe);$(p,e.domain,d);const h=we(mu);$(p,e.tld,h),$(p,e.utld,h),S(f,pr,h);const m=S(d,$e);$(m,e.domain,d),$(h,e.domain,d),S(h,Pe,p),S(h,$e,m);const g=S(h,bt);$(g,e.numeric,mu);const y=S(l,$e),C=S(l,Pe);$(y,e.domain,l),$(C,i,s),$(C,e.domain,l);const k=we(Nr);$(C,e.tld,k),$(C,e.utld,k),$(k,e.domain,l),$(k,i,s),S(k,Pe,C),S(k,$e,y),S(k,mt,f);const N=S(k,bt),M=we(Nr);$(N,e.numeric,M);const x=we(Nr),D=we();$(x,t,x),$(x,r,D),$(D,t,x),$(D,r,D),S(k,Be,x),S(M,Be,x);const I=S(a,bt),T=S(c,bt),Y=S(T,Be),A=S(Y,Be);$(a,e.domain,l),S(a,Pe,C),S(a,$e,y),$(c,e.domain,l),S(c,Pe,C),S(c,$e,y),$(I,e.domain,x),S(I,Be,x),$(A,e.domain,x),$(A,t,x),S(A,Be,x);const O=[[er,tr],[Oi,ki],[Ai,Ti],[Ei,Mi],[Ni,Ri],[Di,Ii],[Pi,$i],[Bi,zi]];for(let B=0;B<O.length;B++){const[v,X]=O[B],F=S(x,v);S(D,v,F),S(F,X,x);const j=we(Nr);$(F,t,j);const ie=we();$(F,r),$(j,t,j),$(j,r,ie),$(ie,t,j),$(ie,r,ie),S(j,X,x),S(ie,X,x)}return S(o,pr,k),S(o,ia,NA),{start:o,tokens:$p}}function DA(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,a=null,c=null,f=0,u=null,d=-1;for(;i<r&&!(a=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(d=0,u=l):d>=0&&d++,i++,f++;if(d<0)i-=f,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(as(gu,e,s)),s=[]),i-=d,f-=d;const p=u.t,h=t.slice(i-f,i);o.push(as(p,e,h))}}return s.length>0&&o.push(as(gu,e,s)),o}function as(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const IA=typeof console<"u"&&console&&console.warn||(()=>{}),PA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",K={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $A(){ye.groups={},K.scanner=null,K.parser=null,K.tokenQueue=[],K.pluginQueue=[],K.customSchemes=[],K.initialized=!1}function BA(n,e){if(e===void 0&&(e=!1),K.initialized&&IA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${PA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
13
+ `+e.prev}function Cr(n,e){var t=Is(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=ht(n,i)?e(n[i],n):""}var o=typeof jo=="function"?jo(n):[],s;if(kn){s={};for(var l=0;l<o.length;l++)s["$"+o[l]]=o[l]}for(var a in n)ht(n,a)&&(t&&String(Number(a))===a&&a<n.length||kn&&s["$"+a]instanceof Symbol||(vh.call(/[^\w$]/,a)?r.push(e(a,n)+": "+e(n[a],n)):r.push(a+": "+e(n[a],n))));if(typeof jo=="function")for(var c=0;c<o.length;c++)Sh.call(n,o[c])&&r.push("["+e(o[c])+"]: "+e(n[o[c]],n));return r}var kh=Ue,Dn=Ae,iv=F1,ov=Nt,Or=kh("%WeakMap%",!0),kr=kh("%Map%",!0),sv=Dn("WeakMap.prototype.get",!0),lv=Dn("WeakMap.prototype.set",!0),av=Dn("WeakMap.prototype.has",!0),cv=Dn("Map.prototype.get",!0),fv=Dn("Map.prototype.set",!0),uv=Dn("Map.prototype.has",!0),Wl=function(n,e){for(var t=n,r;(r=t.next)!==null;t=r)if(r.key===e)return t.next=r.next,r.next=n.next,n.next=r,r},dv=function(n,e){var t=Wl(n,e);return t&&t.value},hv=function(n,e,t){var r=Wl(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},pv=function(n,e){return!!Wl(n,e)},Ah=function(){var e,t,r,i={assert:function(o){if(!i.has(o))throw new ov("Side channel does not contain "+iv(o))},get:function(o){if(Or&&o&&(typeof o=="object"||typeof o=="function")){if(e)return sv(e,o)}else if(kr){if(t)return cv(t,o)}else if(r)return dv(r,o)},has:function(o){if(Or&&o&&(typeof o=="object"||typeof o=="function")){if(e)return av(e,o)}else if(kr){if(t)return uv(t,o)}else if(r)return pv(r,o);return!1},set:function(o,s){Or&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new Or),lv(e,o,s)):kr?(t||(t=new kr),fv(t,o,s)):(r||(r={key:{},next:null}),hv(r,o,s))}};return i},mv=Zd,_n=Ah(),Qe=Nt,Hl={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");if(_n.assert(n),!Hl.has(n,e))throw new Qe("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var t=_n.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var t=_n.get(n);return!!t&&mv(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Qe("`O` is not an object");if(typeof e!="string")throw new Qe("`slot` must be a string");var r=_n.get(n);r||(r={},_n.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Hl);var gv=Hl,jn=gv,yv=SyntaxError,Vc=typeof StopIteration=="object"?StopIteration:null,bv=function(e){if(!Vc)throw new yv("this environment lacks StopIteration");jn.set(e,"[[Done]]",!1);var t={next:function(){var i=jn.get(this,"[[Iterator]]"),o=jn.get(i,"[[Done]]");try{return{done:o,value:o?void 0:i.next()}}catch(s){if(jn.set(i,"[[Done]]",!0),s!==Vc)throw s;return{done:!0,value:void 0}}}};return jn.set(t,"[[Iterator]]",e),t},vv={}.toString,Th=Array.isArray||function(n){return vv.call(n)=="[object Array]"},Sv=String.prototype.valueOf,wv=function(e){try{return Sv.call(e),!0}catch{return!1}},xv=Object.prototype.toString,Cv="[object String]",Ov=Qt(),Eh=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:Ov?wv(e):xv.call(e)===Cv},Ul=typeof Map=="function"&&Map.prototype?Map:null,kv=typeof Set=="function"&&Set.prototype?Set:null,hi;Ul||(hi=function(e){return!1});var Mh=Ul?Map.prototype.has:null,Wc=kv?Set.prototype.has:null;!hi&&!Mh&&(hi=function(e){return!1});var Nh=hi||function(e){if(!e||typeof e!="object")return!1;try{if(Mh.call(e),Wc)try{Wc.call(e)}catch{return!0}return e instanceof Ul}catch{}return!1},Av=typeof Map=="function"&&Map.prototype?Map:null,Kl=typeof Set=="function"&&Set.prototype?Set:null,pi;Kl||(pi=function(e){return!1});var Hc=Av?Map.prototype.has:null,Rh=Kl?Set.prototype.has:null;!pi&&!Rh&&(pi=function(e){return!1});var Ih=pi||function(e){if(!e||typeof e!="object")return!1;try{if(Rh.call(e),Hc)try{Hc.call(e)}catch{return!0}return e instanceof Kl}catch{}return!1},Uc=bh,Kc=bv;if(Pl()||lo()){var Wo=Symbol.iterator;_r.exports=function(e){if(e!=null&&typeof e[Wo]<"u")return e[Wo]();if(Uc(e))return Array.prototype[Wo].call(e)}}else{var Tv=Th,Ev=Eh,Jc=Ue,Mv=Jc("%Map%",!0),Nv=Jc("%Set%",!0),Te=Ae,qc=Te("Array.prototype.push"),Gc=Te("String.prototype.charCodeAt"),Rv=Te("String.prototype.slice"),Iv=function(e,t){var r=e.length;if(t+1>=r)return t+1;var i=Gc(e,t);if(i<55296||i>56319)return t+1;var o=Gc(e,t+1);return o<56320||o>57343?t+1:t+2},Ho=function(e){var t=0;return{next:function(){var i=t>=e.length,o;return i||(o=e[t],t+=1),{done:i,value:o}}}},Yc=function(e,t){if(Tv(e)||Uc(e))return Ho(e);if(Ev(e)){var r=0;return{next:function(){var o=Iv(e,r),s=Rv(e,r,o);return r=o,{done:o>e.length,value:s}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!Mv&&!Nv)_r.exports=function(e){if(e!=null)return Yc(e,!0)};else{var Dv=Nh,Pv=Ih,Xc=Te("Map.prototype.forEach",!0),Qc=Te("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Zc=Te("Map.prototype.iterator",!0),ef=Te("Set.prototype.iterator",!0);var tf=Te("Map.prototype.@@iterator",!0)||Te("Map.prototype._es6-shim iterator_",!0),nf=Te("Set.prototype.@@iterator",!0)||Te("Set.prototype._es6-shim iterator_",!0),$v=function(e){if(Dv(e)){if(Zc)return Kc(Zc(e));if(tf)return tf(e);if(Xc){var t=[];return Xc(e,function(i,o){qc(t,[o,i])}),Ho(t)}}if(Pv(e)){if(ef)return Kc(ef(e));if(nf)return nf(e);if(Qc){var r=[];return Qc(e,function(i){qc(r,i)}),Ho(r)}}};_r.exports=function(e){return $v(e)||Yc(e)}}}var Bv=_r.exports,rf=function(n){return n!==n},Dh=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||rf(e)&&rf(t))},zv=Dh,Ph=function(){return typeof Object.is=="function"?Object.is:zv},Lv=Ph,Fv=Xt,_v=function(){var e=Lv();return Fv(Object,{is:e},{is:function(){return Object.is!==e}}),e},jv=Xt,Vv=In,Wv=Dh,$h=Ph,Hv=_v,Bh=Vv($h(),Object);jv(Bh,{getPolyfill:$h,implementation:Wv,shim:Hv});var Uv=Bh,Kv=In,zh=Ae,Jv=Ue,Ps=Jv("%ArrayBuffer%",!0),jr=zh("ArrayBuffer.prototype.byteLength",!0),qv=zh("Object.prototype.toString"),of=!!Ps&&!jr&&new Ps(0).slice,sf=!!of&&Kv(of),Lh=jr||sf?function(e){if(!e||typeof e!="object")return!1;try{return jr?jr(e):sf(e,0),!0}catch{return!1}}:Ps?function(e){return qv(e)==="[object ArrayBuffer]"}:function(e){return!1},Gv=Date.prototype.getDay,Yv=function(e){try{return Gv.call(e),!0}catch{return!1}},Xv=Object.prototype.toString,Qv="[object Date]",Zv=Qt(),eS=function(e){return typeof e!="object"||e===null?!1:Zv?Yv(e):Xv.call(e)===Qv},$s=Ae,Fh=Qt(),_h,jh,Bs,zs;if(Fh){_h=$s("Object.prototype.hasOwnProperty"),jh=$s("RegExp.prototype.exec"),Bs={};var Uo=function(){throw Bs};zs={toString:Uo,valueOf:Uo},typeof Symbol.toPrimitive=="symbol"&&(zs[Symbol.toPrimitive]=Uo)}var tS=$s("Object.prototype.toString"),nS=Object.getOwnPropertyDescriptor,rS="[object RegExp]",iS=Fh?function(e){if(!e||typeof e!="object")return!1;var t=nS(e,"lastIndex"),r=t&&_h(t,"value");if(!r)return!1;try{jh(e,zs)}catch(i){return i===Bs}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:tS(e)===rS},oS=Ae,lf=oS("SharedArrayBuffer.prototype.byteLength",!0),sS=lf?function(e){if(!e||typeof e!="object")return!1;try{return lf(e),!0}catch{return!1}}:function(e){return!1},lS=Number.prototype.toString,aS=function(e){try{return lS.call(e),!0}catch{return!1}},cS=Object.prototype.toString,fS="[object Number]",uS=Qt(),dS=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:uS?aS(e):cS.call(e)===fS},Vh=Ae,hS=Vh("Boolean.prototype.toString"),pS=Vh("Object.prototype.toString"),mS=function(e){try{return hS(e),!0}catch{return!1}},gS="[object Boolean]",yS=Qt(),bS=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:yS&&Symbol.toStringTag in e?mS(e):pS(e)===gS},Ls={exports:{}},vS=Object.prototype.toString,SS=Pl();if(SS){var wS=Symbol.prototype.toString,xS=/^Symbol\(.*\)$/,CS=function(e){return typeof e.valueOf()!="symbol"?!1:xS.test(wS.call(e))};Ls.exports=function(e){if(typeof e=="symbol")return!0;if(vS.call(e)!=="[object Symbol]")return!1;try{return CS(e)}catch{return!1}}}else Ls.exports=function(e){return!1};var OS=Ls.exports,Fs={exports:{}},af=typeof BigInt<"u"&&BigInt,kS=function(){return typeof af=="function"&&typeof BigInt=="function"&&typeof af(42)=="bigint"&&typeof BigInt(42)=="bigint"},AS=kS();if(AS){var TS=BigInt.prototype.valueOf,ES=function(e){try{return TS.call(e),!0}catch{}return!1};Fs.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:ES(e)}}else Fs.exports=function(e){return!1};var MS=Fs.exports,NS=Eh,RS=dS,IS=bS,DS=OS,PS=MS,$S=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(NS(e))return"String";if(RS(e))return"Number";if(IS(e))return"Boolean";if(DS(e))return"Symbol";if(PS(e))return"BigInt"},mi=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,cf=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,gi;mi||(gi=function(e){return!1});var _s=mi?mi.prototype.has:null,Ko=cf?cf.prototype.has:null;!gi&&!_s&&(gi=function(e){return!1});var BS=gi||function(e){if(!e||typeof e!="object")return!1;try{if(_s.call(e,_s),Ko)try{Ko.call(e,Ko)}catch{return!0}return e instanceof mi}catch{}return!1},js={exports:{}},zS=Ue,Wh=Ae,LS=zS("%WeakSet%",!0),Jo=Wh("WeakSet.prototype.has",!0);if(Jo){var qo=Wh("WeakMap.prototype.has",!0);js.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Jo(e,Jo),qo)try{qo(e,qo)}catch{return!0}return e instanceof LS}catch{}return!1}}else js.exports=function(e){return!1};var FS=js.exports,_S=Nh,jS=Ih,VS=BS,WS=FS,HS=function(e){if(e&&typeof e=="object"){if(_S(e))return"Map";if(jS(e))return"Set";if(VS(e))return"WeakMap";if(WS(e))return"WeakSet"}return!1},Hh=Function.prototype.toString,dn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Vs,Vr;if(typeof dn=="function"&&typeof Object.defineProperty=="function")try{Vs=Object.defineProperty({},"length",{get:function(){throw Vr}}),Vr={},dn(function(){throw 42},null,Vs)}catch(n){n!==Vr&&(dn=null)}else dn=null;var US=/^\s*class\b/,Ws=function(e){try{var t=Hh.call(e);return US.test(t)}catch{return!1}},Go=function(e){try{return Ws(e)?!1:(Hh.call(e),!0)}catch{return!1}},Wr=Object.prototype.toString,KS="[object Object]",JS="[object Function]",qS="[object GeneratorFunction]",GS="[object HTMLAllCollection]",YS="[object HTML document.all class]",XS="[object HTMLCollection]",QS=typeof Symbol=="function"&&!!Symbol.toStringTag,ZS=!(0 in[,]),Hs=function(){return!1};if(typeof document=="object"){var ew=document.all;Wr.call(ew)===Wr.call(document.all)&&(Hs=function(e){if((ZS||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Wr.call(e);return(t===GS||t===YS||t===XS||t===KS)&&e("")==null}catch{}return!1})}var tw=dn?function(e){if(Hs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{dn(e,null,Vs)}catch(t){if(t!==Vr)return!1}return!Ws(e)&&Go(e)}:function(e){if(Hs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(QS)return Go(e);if(Ws(e))return!1;var t=Wr.call(e);return t!==JS&&t!==qS&&!/^\[object HTML/.test(t)?!1:Go(e)},nw=tw,rw=Object.prototype.toString,Uh=Object.prototype.hasOwnProperty,iw=function(e,t,r){for(var i=0,o=e.length;i<o;i++)Uh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},ow=function(e,t,r){for(var i=0,o=e.length;i<o;i++)r==null?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},sw=function(e,t,r){for(var i in e)Uh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},lw=function(e,t,r){if(!nw(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=r),rw.call(e)==="[object Array]"?iw(e,t,i):typeof e=="string"?ow(e,t,i):sw(e,t,i)},aw=lw,cw=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Yo=cw,fw=typeof globalThis>"u"?cr:globalThis,uw=function(){for(var e=[],t=0;t<Yo.length;t++)typeof fw[Yo[t]]=="function"&&(e[e.length]=Yo[t]);return e},yi=aw,dw=uw,ff=In,Jl=Ae,Hr=zl,hw=Jl("Object.prototype.toString"),Kh=Qt(),uf=typeof globalThis>"u"?cr:globalThis,Us=dw(),ql=Jl("String.prototype.slice"),Xo=Object.getPrototypeOf,pw=Jl("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},bi={__proto__:null};Kh&&Hr&&Xo?yi(Us,function(n){var e=new uf[n];if(Symbol.toStringTag in e){var t=Xo(e),r=Hr(t,Symbol.toStringTag);if(!r){var i=Xo(t);r=Hr(i,Symbol.toStringTag)}bi["$"+n]=ff(r.get)}}):yi(Us,function(n){var e=new uf[n],t=e.slice||e.set;t&&(bi["$"+n]=ff(t))});var mw=function(e){var t=!1;return yi(bi,function(r,i){if(!t)try{"$"+r(e)===i&&(t=ql(i,1))}catch{}}),t},gw=function(e){var t=!1;return yi(bi,function(r,i){if(!t)try{r(e),t=ql(i,1)}catch{}}),t},yw=function(e){if(!e||typeof e!="object")return!1;if(!Kh){var t=ql(hw(e),8,-1);return pw(Us,t)>-1?t:t!=="Object"?!1:gw(e)}return Hr?mw(e):null},bw=Ae,df=bw("ArrayBuffer.prototype.byteLength",!0),vw=Lh,Sw=function(e){return vw(e)?df?df(e):e.byteLength:NaN},Jh=Q0,Ke=Ae,hf=x1,ww=Ue,An=Bv,xw=Ah,pf=Uv,mf=bh,gf=Th,yf=Lh,bf=eS,vf=iS,Sf=sS,wf=Dl,xf=$S,Cf=HS,Of=yw,kf=Sw,Af=Ke("SharedArrayBuffer.prototype.byteLength",!0),Tf=Ke("Date.prototype.getTime"),Qo=Object.getPrototypeOf,Ef=Ke("Object.prototype.toString"),vi=ww("%Set%",!0),Ks=Ke("Map.prototype.has",!0),Si=Ke("Map.prototype.get",!0),Mf=Ke("Map.prototype.size",!0),wi=Ke("Set.prototype.add",!0),qh=Ke("Set.prototype.delete",!0),xi=Ke("Set.prototype.has",!0),Ur=Ke("Set.prototype.size",!0);function Nf(n,e,t,r){for(var i=An(n),o;(o=i.next())&&!o.done;)if(Re(e,o.value,t,r))return qh(n,o.value),!0;return!1}function Gh(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function Cw(n,e,t,r,i,o){var s=Gh(t);if(s!=null)return s;var l=Si(e,s),a=Jh({},i,{strict:!1});return typeof l>"u"&&!Ks(e,s)||!Re(r,l,a,o)?!1:!Ks(n,s)&&Re(r,l,a,o)}function Ow(n,e,t){var r=Gh(t);return r??(xi(e,r)&&!xi(n,r))}function Rf(n,e,t,r,i,o){for(var s=An(n),l,a;(l=s.next())&&!l.done;)if(a=l.value,Re(t,a,i,o)&&Re(r,Si(e,a),i,o))return qh(n,a),!0;return!1}function Re(n,e,t,r){var i=t||{};if(i.strict?pf(n,e):n===e)return!0;var o=xf(n),s=xf(e);if(o!==s)return!1;if(!n||!e||typeof n!="object"&&typeof e!="object")return i.strict?pf(n,e):n==e;var l=r.has(n),a=r.has(e),c;if(l&&a){if(r.get(n)===r.get(e))return!0}else c={};return l||r.set(n,c),a||r.set(e,c),Tw(n,e,i,r)}function If(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function kw(n,e,t,r){if(Ur(n)!==Ur(e))return!1;for(var i=An(n),o=An(e),s,l,a;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")a||(a=new vi),wi(a,s.value);else if(!xi(e,s.value)){if(t.strict||!Ow(n,e,s.value))return!1;a||(a=new vi),wi(a,s.value)}if(a){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Nf(a,l.value,t.strict,r))return!1}else if(!t.strict&&!xi(n,l.value)&&!Nf(a,l.value,t.strict,r))return!1;return Ur(a)===0}return!0}function Aw(n,e,t,r){if(Mf(n)!==Mf(e))return!1;for(var i=An(n),o=An(e),s,l,a,c,f,u;(s=i.next())&&!s.done;)if(c=s.value[0],f=s.value[1],c&&typeof c=="object")a||(a=new vi),wi(a,c);else if(u=Si(e,c),typeof u>"u"&&!Ks(e,c)||!Re(f,u,t,r)){if(t.strict||!Cw(n,e,c,f,t,r))return!1;a||(a=new vi),wi(a,c)}if(a){for(;(l=o.next())&&!l.done;)if(c=l.value[0],u=l.value[1],c&&typeof c=="object"){if(!Rf(a,n,c,u,t,r))return!1}else if(!t.strict&&(!n.has(c)||!Re(Si(n,c),u,t,r))&&!Rf(a,n,c,u,Jh({},t,{strict:!1}),r))return!1;return Ur(a)===0}return!0}function Tw(n,e,t,r){var i,o;if(typeof n!=typeof e||n==null||e==null||Ef(n)!==Ef(e)||mf(n)!==mf(e))return!1;var s=gf(n),l=gf(e);if(s!==l)return!1;var a=n instanceof Error,c=e instanceof Error;if(a!==c||(a||c)&&(n.name!==e.name||n.message!==e.message))return!1;var f=vf(n),u=vf(e);if(f!==u||(f||u)&&(n.source!==e.source||hf(n)!==hf(e)))return!1;var d=bf(n),p=bf(e);if(d!==p||(d||p)&&Tf(n)!==Tf(e)||t.strict&&Qo&&Qo(n)!==Qo(e))return!1;var h=Of(n),m=Of(e);if(h!==m)return!1;if(h||m){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var g=If(n),y=If(e);if(g!==y)return!1;if(g||y){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var C=yf(n),k=yf(e);if(C!==k)return!1;if(C||k)return kf(n)!==kf(e)?!1:typeof Uint8Array=="function"&&Re(new Uint8Array(n),new Uint8Array(e),t,r);var N=Sf(n),M=Sf(e);if(N!==M)return!1;if(N||M)return Af(n)!==Af(e)?!1:typeof Uint8Array=="function"&&Re(new Uint8Array(n),new Uint8Array(e),t,r);if(typeof n!=typeof e)return!1;var x=wf(n),I=wf(e);if(x.length!==I.length)return!1;for(x.sort(),I.sort(),i=x.length-1;i>=0;i--)if(x[i]!=I[i])return!1;for(i=x.length-1;i>=0;i--)if(o=x[i],!Re(n[o],e[o],t,r))return!1;var D=Cf(n),T=Cf(e);return D!==T?!1:D==="Set"||T==="Set"?kw(n,e,t,r):D==="Map"?Aw(n,e,t,r):!0}var Ew=function(e,t,r){return Re(e,t,r,xw())};const Mw=Yd(Ew);function Yh(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=Yh(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function Nw(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=Yh(n))&&(r&&(r+=" "),r+=e);return r}const Df=n=>typeof n=="boolean"?"".concat(n):n===0?"0":n,Pf=Nw,Rw=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return Pf(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(c=>{const f=t==null?void 0:t[c],u=o==null?void 0:o[c];if(f===null)return null;const d=Df(f)||Df(u);return i[c][d]}),l=t&&Object.entries(t).reduce((c,f)=>{let[u,d]=f;return d===void 0||(c[u]=d),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:u,className:d,...p}=f;return Object.entries(p).every(h=>{let[m,g]=h;return Array.isArray(g)?g.includes({...o,...l}[m]):{...o,...l}[m]===g})?[...c,u,d]:c},[]);return Pf(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)};var Xh={exports:{}};(function(n,e){(function(r,i){n.exports=i(Yp,Xp)})(cr,function(t,r){return function(i){var o={};function s(l){if(o[l])return o[l].exports;var a=o[l]={i:l,l:!1,exports:{}};return i[l].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=i,s.c=o,s.d=function(l,a,c){s.o(l,a)||Object.defineProperty(l,a,{enumerable:!0,get:c})},s.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},s.t=function(l,a){if(a&1&&(l=s(l)),a&8||a&4&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),a&2&&typeof l!="string")for(var f in l)s.d(c,f,(function(u){return l[u]}).bind(null,f));return c},s.n=function(l){var a=l&&l.__esModule?function(){return l.default}:function(){return l};return s.d(a,"a",a),a},s.o=function(l,a){return Object.prototype.hasOwnProperty.call(l,a)},s.p="",s(s.s=4)}([function(i,o,s){i.exports=s(5)()},function(i,o){i.exports=t},function(i,o){i.exports=r},function(i,o){i.exports=function(s,l,a){var c=s.direction,f=s.value;switch(c){case"top":return a.top+f<l.top&&a.bottom>l.bottom&&a.left<l.left&&a.right>l.right;case"left":return a.left+f<l.left&&a.bottom>l.bottom&&a.top<l.top&&a.right>l.right;case"bottom":return a.bottom-f>l.bottom&&a.left<l.left&&a.right>l.right&&a.top<l.top;case"right":return a.right-f>l.right&&a.left<l.left&&a.top<l.top&&a.bottom>l.bottom}}},function(i,o,s){s.r(o),s.d(o,"default",function(){return Y});var l=s(1),a=s.n(l),c=s(2),f=s.n(c),u=s(0),d=s.n(u),p=s(3),h=s.n(p);function m(A){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?m=function(B){return typeof B}:m=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},m(A)}function g(A,O){if(!(A instanceof O))throw new TypeError("Cannot call a class as a function")}function y(A,O){for(var B=0;B<O.length;B++){var v=O[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(A,v.key,v)}}function C(A,O,B){return O&&y(A.prototype,O),A}function k(A,O){return O&&(m(O)==="object"||typeof O=="function")?O:M(A)}function N(A){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},N(A)}function M(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function x(A,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(O&&O.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),O&&I(A,O)}function I(A,O){return I=Object.setPrototypeOf||function(v,X){return v.__proto__=X,v},I(A,O)}function D(A,O,B){return O in A?Object.defineProperty(A,O,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[O]=B,A}function T(A){return A.width===void 0&&(A.width=A.right-A.left),A.height===void 0&&(A.height=A.bottom-A.top),A}var Y=function(A){x(O,A);function O(B){var v;return g(this,O),v=k(this,N(O).call(this,B)),D(M(v),"getContainer",function(){return v.props.containment||window}),D(M(v),"addEventListener",function(X,F,j,ie){v.debounceCheck||(v.debounceCheck={});var U,lt,Z=function(){U=null,v.check()};ie>-1?lt=function(){U||(U=setTimeout(Z,ie||0))}:lt=function(){clearTimeout(U),U=setTimeout(Z,j||0)};var $n={target:X,fn:lt,getLastTimeout:function(){return U}};X.addEventListener(F,$n.fn),v.debounceCheck[F]=$n}),D(M(v),"startWatching",function(){v.debounceCheck||v.interval||(v.props.intervalCheck&&(v.interval=setInterval(v.check,v.props.intervalDelay)),v.props.scrollCheck&&v.addEventListener(v.getContainer(),"scroll",v.props.scrollDelay,v.props.scrollThrottle),v.props.resizeCheck&&v.addEventListener(window,"resize",v.props.resizeDelay,v.props.resizeThrottle),!v.props.delayedCall&&v.check())}),D(M(v),"stopWatching",function(){if(v.debounceCheck){for(var X in v.debounceCheck)if(v.debounceCheck.hasOwnProperty(X)){var F=v.debounceCheck[X];clearTimeout(F.getLastTimeout()),F.target.removeEventListener(X,F.fn),v.debounceCheck[X]=null}}v.debounceCheck=null,v.interval&&(v.interval=clearInterval(v.interval))}),D(M(v),"check",function(){var X=v.node,F,j;if(!X)return v.state;if(F=T(v.roundRectDown(X.getBoundingClientRect())),v.props.containment){var ie=v.props.containment.getBoundingClientRect();j={top:ie.top,left:ie.left,bottom:ie.bottom,right:ie.right}}else j={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var U=v.props.offset||{},lt=m(U)==="object";lt&&(j.top+=U.top||0,j.left+=U.left||0,j.bottom-=U.bottom||0,j.right-=U.right||0);var Z={top:F.top>=j.top,left:F.left>=j.left,bottom:F.bottom<=j.bottom,right:F.right<=j.right},$n=F.height>0&&F.width>0,Ge=$n&&Z.top&&Z.left&&Z.bottom&&Z.right;if($n&&v.props.partialVisibility){var yo=F.top<=j.bottom&&F.bottom>=j.top&&F.left<=j.right&&F.right>=j.left;typeof v.props.partialVisibility=="string"&&(yo=Z[v.props.partialVisibility]),Ge=v.props.minTopValue?yo&&F.top<=j.bottom-v.props.minTopValue:yo}typeof U.direction=="string"&&typeof U.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",U.direction,U.value),Ge=h()(U,F,j));var bo=v.state;return v.state.isVisible!==Ge&&(bo={isVisible:Ge,visibilityRect:Z},v.setState(bo),v.props.onChange&&v.props.onChange(Ge)),bo}),v.state={isVisible:null,visibilityRect:{}},v}return C(O,[{key:"componentDidMount",value:function(){this.node=f.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(v){this.node=f.a.findDOMNode(this),this.props.active&&!v.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(v){return{top:Math.floor(v.top),left:Math.floor(v.left),bottom:Math.floor(v.bottom),right:Math.floor(v.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):a.a.Children.only(this.props.children)}}]),O}(a.a.Component);D(Y,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:a.a.createElement("span",null)}),D(Y,"propTypes",{onChange:d.a.func,active:d.a.bool,partialVisibility:d.a.oneOfType([d.a.bool,d.a.oneOf(["top","right","bottom","left"])]),delayedCall:d.a.bool,offset:d.a.oneOfType([d.a.shape({top:d.a.number,left:d.a.number,bottom:d.a.number,right:d.a.number}),d.a.shape({direction:d.a.oneOf(["top","right","bottom","left"]),value:d.a.number})]),scrollCheck:d.a.bool,scrollDelay:d.a.number,scrollThrottle:d.a.number,resizeCheck:d.a.bool,resizeDelay:d.a.number,resizeThrottle:d.a.number,intervalCheck:d.a.bool,intervalDelay:d.a.number,containment:typeof window<"u"?d.a.instanceOf(window.Element):d.a.any,children:d.a.oneOfType([d.a.element,d.a.func]),minTopValue:d.a.number})},function(i,o,s){var l=s(6);function a(){}function c(){}c.resetWarningCache=a,i.exports=function(){function f(p,h,m,g,y,C){if(C!==l){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}}f.isRequired=f;function u(){return f}var d={array:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:u,element:f,elementType:f,instanceOf:u,node:f,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:c,resetWarningCache:a};return d.PropTypes=d,d}},function(i,o,s){var l="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";i.exports=l}])})})(Xh);var Iw=Xh.exports;const Dw=Yd(Iw);var Qh=typeof global=="object"&&global&&global.Object===Object&&global,Pw=typeof self=="object"&&self&&self.Object===Object&&self,Je=Qh||Pw||Function("return this")(),We=Je.Symbol,Zh=Object.prototype,$w=Zh.hasOwnProperty,Bw=Zh.toString,Vn=We?We.toStringTag:void 0;function zw(n){var e=$w.call(n,Vn),t=n[Vn];try{n[Vn]=void 0;var r=!0}catch{}var i=Bw.call(n);return r&&(e?n[Vn]=t:delete n[Vn]),i}var Lw=Object.prototype,Fw=Lw.toString;function _w(n){return Fw.call(n)}var jw="[object Null]",Vw="[object Undefined]",$f=We?We.toStringTag:void 0;function It(n){return n==null?n===void 0?Vw:jw:$f&&$f in Object(n)?zw(n):_w(n)}function it(n){return n!=null&&typeof n=="object"}var Ww="[object Symbol]";function co(n){return typeof n=="symbol"||it(n)&&It(n)==Ww}function ep(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t<r;)i[t]=e(n[t],t,n);return i}var He=Array.isArray,Hw=1/0,Bf=We?We.prototype:void 0,zf=Bf?Bf.toString:void 0;function Ci(n){if(typeof n=="string")return n;if(He(n))return ep(n,Ci)+"";if(co(n))return zf?zf.call(n):"";var e=n+"";return e=="0"&&1/n==-Hw?"-0":e}var Uw=/\s/;function Kw(n){for(var e=n.length;e--&&Uw.test(n.charAt(e)););return e}var Jw=/^\s+/;function qw(n){return n&&n.slice(0,Kw(n)+1).replace(Jw,"")}function Et(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Lf=NaN,Gw=/^[-+]0x[0-9a-f]+$/i,Yw=/^0b[01]+$/i,Xw=/^0o[0-7]+$/i,Qw=parseInt;function bn(n){if(typeof n=="number")return n;if(co(n))return Lf;if(Et(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Et(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=qw(n);var t=Yw.test(n);return t||Xw.test(n)?Qw(n.slice(2),t?2:8):Gw.test(n)?Lf:+n}var Ff=1/0,Zw=17976931348623157e292;function ex(n){if(!n)return n===0?n:0;if(n=bn(n),n===Ff||n===-Ff){var e=n<0?-1:1;return e*Zw}return n===n?n:0}function tx(n){var e=ex(n),t=e%1;return e===e?t?e-t:e:0}function Gl(n){return n}var nx="[object AsyncFunction]",rx="[object Function]",ix="[object GeneratorFunction]",ox="[object Proxy]";function tp(n){if(!Et(n))return!1;var e=It(n);return e==rx||e==ix||e==nx||e==ox}var Zo=Je["__core-js_shared__"],_f=function(){var n=/[^.]+$/.exec(Zo&&Zo.keys&&Zo.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function sx(n){return!!_f&&_f in n}var lx=Function.prototype,ax=lx.toString;function Zt(n){if(n!=null){try{return ax.call(n)}catch{}try{return n+""}catch{}}return""}var cx=/[\\^$.*+?()[\]{}|]/g,fx=/^\[object .+?Constructor\]$/,ux=Function.prototype,dx=Object.prototype,hx=ux.toString,px=dx.hasOwnProperty,mx=RegExp("^"+hx.call(px).replace(cx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gx(n){if(!Et(n)||sx(n))return!1;var e=tp(n)?mx:fx;return e.test(Zt(n))}function yx(n,e){return n==null?void 0:n[e]}function en(n,e){var t=yx(n,e);return gx(t)?t:void 0}var Js=en(Je,"WeakMap");function bx(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}var vx=800,Sx=16,wx=Date.now;function xx(n){var e=0,t=0;return function(){var r=wx(),i=Sx-(r-t);if(t=r,i>0){if(++e>=vx)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Cx(n){return function(){return n}}var jf=function(){try{var n=en(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Ox=jf?function(n,e){return jf(n,"toString",{configurable:!0,enumerable:!1,value:Cx(e),writable:!0})}:Gl,kx=xx(Ox);function Ax(n,e,t,r){for(var i=n.length,o=t+-1;++o<i;)if(e(n[o],o,n))return o;return-1}function Tx(n){return n!==n}function Ex(n,e,t){for(var r=t-1,i=n.length;++r<i;)if(n[r]===e)return r;return-1}function Mx(n,e,t){return e===e?Ex(n,e,t):Ax(n,Tx,t)}function Nx(n,e){var t=n==null?0:n.length;return!!t&&Mx(n,e,0)>-1}var Rx=9007199254740991,Ix=/^(?:0|[1-9]\d*)$/;function np(n,e){var t=typeof n;return e=e??Rx,!!e&&(t=="number"||t!="symbol"&&Ix.test(n))&&n>-1&&n%1==0&&n<e}function rp(n,e){return n===e||n!==n&&e!==e}var Vf=Math.max;function Dx(n,e,t){return e=Vf(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,o=Vf(r.length-e,0),s=Array(o);++i<o;)s[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=t(s),bx(n,this,l)}}function Px(n,e){return kx(Dx(n,e,Gl),n+"")}var $x=9007199254740991;function Yl(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=$x}function ip(n){return n!=null&&Yl(n.length)&&!tp(n)}var Bx=Object.prototype;function zx(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Bx;return n===t}function Lx(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var Fx="[object Arguments]";function Wf(n){return it(n)&&It(n)==Fx}var op=Object.prototype,_x=op.hasOwnProperty,jx=op.propertyIsEnumerable,Xl=Wf(function(){return arguments}())?Wf:function(n){return it(n)&&_x.call(n,"callee")&&!jx.call(n,"callee")};function Vx(){return!1}var sp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hf=sp&&typeof module=="object"&&module&&!module.nodeType&&module,Wx=Hf&&Hf.exports===sp,Uf=Wx?Je.Buffer:void 0,Hx=Uf?Uf.isBuffer:void 0,qs=Hx||Vx,Ux="[object Arguments]",Kx="[object Array]",Jx="[object Boolean]",qx="[object Date]",Gx="[object Error]",Yx="[object Function]",Xx="[object Map]",Qx="[object Number]",Zx="[object Object]",eC="[object RegExp]",tC="[object Set]",nC="[object String]",rC="[object WeakMap]",iC="[object ArrayBuffer]",oC="[object DataView]",sC="[object Float32Array]",lC="[object Float64Array]",aC="[object Int8Array]",cC="[object Int16Array]",fC="[object Int32Array]",uC="[object Uint8Array]",dC="[object Uint8ClampedArray]",hC="[object Uint16Array]",pC="[object Uint32Array]",W={};W[sC]=W[lC]=W[aC]=W[cC]=W[fC]=W[uC]=W[dC]=W[hC]=W[pC]=!0;W[Ux]=W[Kx]=W[iC]=W[Jx]=W[oC]=W[qx]=W[Gx]=W[Yx]=W[Xx]=W[Qx]=W[Zx]=W[eC]=W[tC]=W[nC]=W[rC]=!1;function mC(n){return it(n)&&Yl(n.length)&&!!W[It(n)]}function Ql(n){return function(e){return n(e)}}var lp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zn=lp&&typeof module=="object"&&module&&!module.nodeType&&module,gC=Zn&&Zn.exports===lp,es=gC&&Qh.process,Oi=function(){try{var n=Zn&&Zn.require&&Zn.require("util").types;return n||es&&es.binding&&es.binding("util")}catch{}}(),Kf=Oi&&Oi.isTypedArray,ap=Kf?Ql(Kf):mC,yC=Object.prototype,bC=yC.hasOwnProperty;function vC(n,e){var t=He(n),r=!t&&Xl(n),i=!t&&!r&&qs(n),o=!t&&!r&&!i&&ap(n),s=t||r||i||o,l=s?Lx(n.length,String):[],a=l.length;for(var c in n)bC.call(n,c)&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||np(c,a)))&&l.push(c);return l}function SC(n,e){return function(t){return n(e(t))}}var wC=SC(Object.keys,Object),xC=Object.prototype,CC=xC.hasOwnProperty;function OC(n){if(!zx(n))return wC(n);var e=[];for(var t in Object(n))CC.call(n,t)&&t!="constructor"&&e.push(t);return e}function cp(n){return ip(n)?vC(n):OC(n)}var kC=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,AC=/^\w*$/;function Zl(n,e){if(He(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||co(n)?!0:AC.test(n)||!kC.test(n)||e!=null&&n in Object(e)}var ur=en(Object,"create");function TC(){this.__data__=ur?ur(null):{},this.size=0}function EC(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var MC="__lodash_hash_undefined__",NC=Object.prototype,RC=NC.hasOwnProperty;function IC(n){var e=this.__data__;if(ur){var t=e[n];return t===MC?void 0:t}return RC.call(e,n)?e[n]:void 0}var DC=Object.prototype,PC=DC.hasOwnProperty;function $C(n){var e=this.__data__;return ur?e[n]!==void 0:PC.call(e,n)}var BC="__lodash_hash_undefined__";function zC(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=ur&&e===void 0?BC:e,this}function Jt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Jt.prototype.clear=TC;Jt.prototype.delete=EC;Jt.prototype.get=IC;Jt.prototype.has=$C;Jt.prototype.set=zC;function LC(){this.__data__=[],this.size=0}function fo(n,e){for(var t=n.length;t--;)if(rp(n[t][0],e))return t;return-1}var FC=Array.prototype,_C=FC.splice;function jC(n){var e=this.__data__,t=fo(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():_C.call(e,t,1),--this.size,!0}function VC(n){var e=this.__data__,t=fo(e,n);return t<0?void 0:e[t][1]}function WC(n){return fo(this.__data__,n)>-1}function HC(n,e){var t=this.__data__,r=fo(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function ot(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}ot.prototype.clear=LC;ot.prototype.delete=jC;ot.prototype.get=VC;ot.prototype.has=WC;ot.prototype.set=HC;var dr=en(Je,"Map");function UC(){this.size=0,this.__data__={hash:new Jt,map:new(dr||ot),string:new Jt}}function KC(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function uo(n,e){var t=n.__data__;return KC(e)?t[typeof e=="string"?"string":"hash"]:t.map}function JC(n){var e=uo(this,n).delete(n);return this.size-=e?1:0,e}function qC(n){return uo(this,n).get(n)}function GC(n){return uo(this,n).has(n)}function YC(n,e){var t=uo(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function st(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}st.prototype.clear=UC;st.prototype.delete=JC;st.prototype.get=qC;st.prototype.has=GC;st.prototype.set=YC;var XC="Expected a function";function ea(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(XC);var t=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=t.cache;if(o.has(i))return o.get(i);var s=n.apply(this,r);return t.cache=o.set(i,s)||o,s};return t.cache=new(ea.Cache||st),t}ea.Cache=st;var QC=500;function ZC(n){var e=ea(n,function(r){return t.size===QC&&t.clear(),r}),t=e.cache;return e}var eO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tO=/\\(\\)?/g,nO=ZC(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(eO,function(t,r,i,o){e.push(i?o.replace(tO,"$1"):r||t)}),e});function Gs(n){return n==null?"":Ci(n)}function fp(n,e){return He(n)?n:Zl(n,e)?[n]:nO(Gs(n))}var rO=1/0;function ho(n){if(typeof n=="string"||co(n))return n;var e=n+"";return e=="0"&&1/n==-rO?"-0":e}function up(n,e){e=fp(e,n);for(var t=0,r=e.length;n!=null&&t<r;)n=n[ho(e[t++])];return t&&t==r?n:void 0}function iO(n,e,t){var r=n==null?void 0:up(n,e);return r===void 0?t:r}function dp(n,e){for(var t=-1,r=e.length,i=n.length;++t<r;)n[i+t]=e[t];return n}var Jf=We?We.isConcatSpreadable:void 0;function oO(n){return He(n)||Xl(n)||!!(Jf&&n&&n[Jf])}function sO(n,e,t,r,i){var o=-1,s=n.length;for(t||(t=oO),i||(i=[]);++o<s;){var l=n[o];t(l)&&dp(i,l)}return i}function lO(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+e];return o}function aO(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:lO(n,e,t)}var cO="\\ud800-\\udfff",fO="\\u0300-\\u036f",uO="\\ufe20-\\ufe2f",dO="\\u20d0-\\u20ff",hO=fO+uO+dO,pO="\\ufe0e\\ufe0f",mO="\\u200d",gO=RegExp("["+mO+cO+hO+pO+"]");function ta(n){return gO.test(n)}function yO(n){return n.split("")}var hp="\\ud800-\\udfff",bO="\\u0300-\\u036f",vO="\\ufe20-\\ufe2f",SO="\\u20d0-\\u20ff",wO=bO+vO+SO,xO="\\ufe0e\\ufe0f",CO="["+hp+"]",Ys="["+wO+"]",Xs="\\ud83c[\\udffb-\\udfff]",OO="(?:"+Ys+"|"+Xs+")",pp="[^"+hp+"]",mp="(?:\\ud83c[\\udde6-\\uddff]){2}",gp="[\\ud800-\\udbff][\\udc00-\\udfff]",kO="\\u200d",yp=OO+"?",bp="["+xO+"]?",AO="(?:"+kO+"(?:"+[pp,mp,gp].join("|")+")"+bp+yp+")*",TO=bp+yp+AO,EO="(?:"+[pp+Ys+"?",Ys,mp,gp,CO].join("|")+")",MO=RegExp(Xs+"(?="+Xs+")|"+EO+TO,"g");function NO(n){return n.match(MO)||[]}function RO(n){return ta(n)?NO(n):yO(n)}function IO(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function DO(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=bn(t),t=t===t?t:0),e!==void 0&&(e=bn(e),e=e===e?e:0),IO(bn(n),e,t)}function PO(){this.__data__=new ot,this.size=0}function $O(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function BO(n){return this.__data__.get(n)}function zO(n){return this.__data__.has(n)}var LO=200;function FO(n,e){var t=this.__data__;if(t instanceof ot){var r=t.__data__;if(!dr||r.length<LO-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new st(r)}return t.set(n,e),this.size=t.size,this}function rt(n){var e=this.__data__=new ot(n);this.size=e.size}rt.prototype.clear=PO;rt.prototype.delete=$O;rt.prototype.get=BO;rt.prototype.has=zO;rt.prototype.set=FO;function _O(n,e){for(var t=-1,r=n==null?0:n.length,i=0,o=[];++t<r;){var s=n[t];e(s,t,n)&&(o[i++]=s)}return o}function jO(){return[]}var VO=Object.prototype,WO=VO.propertyIsEnumerable,qf=Object.getOwnPropertySymbols,HO=qf?function(n){return n==null?[]:(n=Object(n),_O(qf(n),function(e){return WO.call(n,e)}))}:jO;function UO(n,e,t){var r=e(n);return He(n)?r:dp(r,t(n))}function Gf(n){return UO(n,cp,HO)}var Qs=en(Je,"DataView"),Zs=en(Je,"Promise"),el=en(Je,"Set"),Yf="[object Map]",KO="[object Object]",Xf="[object Promise]",Qf="[object Set]",Zf="[object WeakMap]",eu="[object DataView]",JO=Zt(Qs),qO=Zt(dr),GO=Zt(Zs),YO=Zt(el),XO=Zt(Js),pt=It;(Qs&&pt(new Qs(new ArrayBuffer(1)))!=eu||dr&&pt(new dr)!=Yf||Zs&&pt(Zs.resolve())!=Xf||el&&pt(new el)!=Qf||Js&&pt(new Js)!=Zf)&&(pt=function(n){var e=It(n),t=e==KO?n.constructor:void 0,r=t?Zt(t):"";if(r)switch(r){case JO:return eu;case qO:return Yf;case GO:return Xf;case YO:return Qf;case XO:return Zf}return e});var tu=Je.Uint8Array,QO="__lodash_hash_undefined__";function ZO(n){return this.__data__.set(n,QO),this}function ek(n){return this.__data__.has(n)}function hr(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new st;++e<t;)this.add(n[e])}hr.prototype.add=hr.prototype.push=ZO;hr.prototype.has=ek;function tk(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(e(n[t],t,n))return!0;return!1}function vp(n,e){return n.has(e)}var nk=1,rk=2;function Sp(n,e,t,r,i,o){var s=t&nk,l=n.length,a=e.length;if(l!=a&&!(s&&a>l))return!1;var c=o.get(n),f=o.get(e);if(c&&f)return c==e&&f==n;var u=-1,d=!0,p=t&rk?new hr:void 0;for(o.set(n,e),o.set(e,n);++u<l;){var h=n[u],m=e[u];if(r)var g=s?r(m,h,u,e,n,o):r(h,m,u,n,e,o);if(g!==void 0){if(g)continue;d=!1;break}if(p){if(!tk(e,function(y,C){if(!vp(p,C)&&(h===y||i(h,y,t,r,o)))return p.push(C)})){d=!1;break}}else if(!(h===m||i(h,m,t,r,o))){d=!1;break}}return o.delete(n),o.delete(e),d}function ik(n){var e=-1,t=Array(n.size);return n.forEach(function(r,i){t[++e]=[i,r]}),t}function ok(n){var e=-1,t=Array(n.size);return n.forEach(function(r){t[++e]=r}),t}var sk=1,lk=2,ak="[object Boolean]",ck="[object Date]",fk="[object Error]",uk="[object Map]",dk="[object Number]",hk="[object RegExp]",pk="[object Set]",mk="[object String]",gk="[object Symbol]",yk="[object ArrayBuffer]",bk="[object DataView]",nu=We?We.prototype:void 0,ts=nu?nu.valueOf:void 0;function vk(n,e,t,r,i,o,s){switch(t){case bk:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case yk:return!(n.byteLength!=e.byteLength||!o(new tu(n),new tu(e)));case ak:case ck:case dk:return rp(+n,+e);case fk:return n.name==e.name&&n.message==e.message;case hk:case mk:return n==e+"";case uk:var l=ik;case pk:var a=r&sk;if(l||(l=ok),n.size!=e.size&&!a)return!1;var c=s.get(n);if(c)return c==e;r|=lk,s.set(n,e);var f=Sp(l(n),l(e),r,i,o,s);return s.delete(n),f;case gk:if(ts)return ts.call(n)==ts.call(e)}return!1}var Sk=1,wk=Object.prototype,xk=wk.hasOwnProperty;function Ck(n,e,t,r,i,o){var s=t&Sk,l=Gf(n),a=l.length,c=Gf(e),f=c.length;if(a!=f&&!s)return!1;for(var u=a;u--;){var d=l[u];if(!(s?d in e:xk.call(e,d)))return!1}var p=o.get(n),h=o.get(e);if(p&&h)return p==e&&h==n;var m=!0;o.set(n,e),o.set(e,n);for(var g=s;++u<a;){d=l[u];var y=n[d],C=e[d];if(r)var k=s?r(C,y,d,e,n,o):r(y,C,d,n,e,o);if(!(k===void 0?y===C||i(y,C,t,r,o):k)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var N=n.constructor,M=e.constructor;N!=M&&"constructor"in n&&"constructor"in e&&!(typeof N=="function"&&N instanceof N&&typeof M=="function"&&M instanceof M)&&(m=!1)}return o.delete(n),o.delete(e),m}var Ok=1,ru="[object Arguments]",iu="[object Array]",Ar="[object Object]",kk=Object.prototype,ou=kk.hasOwnProperty;function Ak(n,e,t,r,i,o){var s=He(n),l=He(e),a=s?iu:pt(n),c=l?iu:pt(e);a=a==ru?Ar:a,c=c==ru?Ar:c;var f=a==Ar,u=c==Ar,d=a==c;if(d&&qs(n)){if(!qs(e))return!1;s=!0,f=!1}if(d&&!f)return o||(o=new rt),s||ap(n)?Sp(n,e,t,r,i,o):vk(n,e,a,t,r,i,o);if(!(t&Ok)){var p=f&&ou.call(n,"__wrapped__"),h=u&&ou.call(e,"__wrapped__");if(p||h){var m=p?n.value():n,g=h?e.value():e;return o||(o=new rt),i(m,g,t,r,o)}}return d?(o||(o=new rt),Ck(n,e,t,r,i,o)):!1}function na(n,e,t,r,i){return n===e?!0:n==null||e==null||!it(n)&&!it(e)?n!==n&&e!==e:Ak(n,e,t,r,na,i)}var Tk=1,Ek=2;function Mk(n,e,t,r){var i=t.length,o=i;if(n==null)return!o;for(n=Object(n);i--;){var s=t[i];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++i<o;){s=t[i];var l=s[0],a=n[l],c=s[1];if(s[2]){if(a===void 0&&!(l in n))return!1}else{var f=new rt,u;if(!(u===void 0?na(c,a,Tk|Ek,r,f):u))return!1}}return!0}function wp(n){return n===n&&!Et(n)}function Nk(n){for(var e=cp(n),t=e.length;t--;){var r=e[t],i=n[r];e[t]=[r,i,wp(i)]}return e}function xp(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Rk(n){var e=Nk(n);return e.length==1&&e[0][2]?xp(e[0][0],e[0][1]):function(t){return t===n||Mk(t,n,e)}}function Ik(n,e){return n!=null&&e in Object(n)}function Dk(n,e,t){e=fp(e,n);for(var r=-1,i=e.length,o=!1;++r<i;){var s=ho(e[r]);if(!(o=n!=null&&t(n,s)))break;n=n[s]}return o||++r!=i?o:(i=n==null?0:n.length,!!i&&Yl(i)&&np(s,i)&&(He(n)||Xl(n)))}function Pk(n,e){return n!=null&&Dk(n,e,Ik)}var $k=1,Bk=2;function zk(n,e){return Zl(n)&&wp(e)?xp(ho(n),e):function(t){var r=iO(t,n);return r===void 0&&r===e?Pk(t,n):na(e,r,$k|Bk)}}function Cp(n){return function(e){return e==null?void 0:e[n]}}function Lk(n){return function(e){return up(e,n)}}function Fk(n){return Zl(n)?Cp(ho(n)):Lk(n)}function _k(n){return typeof n=="function"?n:n==null?Gl:typeof n=="object"?He(n)?zk(n[0],n[1]):Rk(n):Fk(n)}var ns=function(){return Je.Date.now()},jk="Expected a function",Vk=Math.max,Wk=Math.min;function Op(n,e,t){var r,i,o,s,l,a,c=0,f=!1,u=!1,d=!0;if(typeof n!="function")throw new TypeError(jk);e=bn(e)||0,Et(t)&&(f=!!t.leading,u="maxWait"in t,o=u?Vk(bn(t.maxWait)||0,e):o,d="trailing"in t?!!t.trailing:d);function p(x){var I=r,D=i;return r=i=void 0,c=x,s=n.apply(D,I),s}function h(x){return c=x,l=setTimeout(y,e),f?p(x):s}function m(x){var I=x-a,D=x-c,T=e-I;return u?Wk(T,o-D):T}function g(x){var I=x-a,D=x-c;return a===void 0||I>=e||I<0||u&&D>=o}function y(){var x=ns();if(g(x))return C(x);l=setTimeout(y,m(x))}function C(x){return l=void 0,d&&r?p(x):(r=i=void 0,s)}function k(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function N(){return l===void 0?s:C(ns())}function M(){var x=ns(),I=g(x);if(r=arguments,i=this,a=x,I){if(l===void 0)return h(a);if(u)return clearTimeout(l),l=setTimeout(y,e),p(a)}return l===void 0&&(l=setTimeout(y,e)),s}return M.cancel=k,M.flush=N,M}function rs(n){return it(n)&&ip(n)}var Hk=200;function Uk(n,e,t,r){var i=-1,o=Nx,s=!0,l=n.length,a=[],c=e.length;if(!l)return a;t&&(e=ep(e,Ql(t))),e.length>=Hk&&(o=vp,s=!1,e=new hr(e));e:for(;++i<l;){var f=n[i],u=t==null?f:t(f);if(f=f!==0?f:0,s&&u===u){for(var d=c;d--;)if(e[d]===u)continue e;a.push(f)}else o(e,u,r)||a.push(f)}return a}function Kk(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var Jk=Px(function(n,e){var t=Kk(e);return rs(t)&&(t=void 0),rs(n)?Uk(n,sO(e,1,rs),_k(t)):[]}),qk="[object Number]";function Gk(n){return typeof n=="number"||it(n)&&It(n)==qk}var Yk="[object RegExp]";function Xk(n){return it(n)&&It(n)==Yk}var su=Oi&&Oi.isRegExp,Qk=su?Ql(su):Xk,Zk=Cp("length"),kp="\\ud800-\\udfff",eA="\\u0300-\\u036f",tA="\\ufe20-\\ufe2f",nA="\\u20d0-\\u20ff",rA=eA+tA+nA,iA="\\ufe0e\\ufe0f",oA="["+kp+"]",tl="["+rA+"]",nl="\\ud83c[\\udffb-\\udfff]",sA="(?:"+tl+"|"+nl+")",Ap="[^"+kp+"]",Tp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ep="[\\ud800-\\udbff][\\udc00-\\udfff]",lA="\\u200d",Mp=sA+"?",Np="["+iA+"]?",aA="(?:"+lA+"(?:"+[Ap,Tp,Ep].join("|")+")"+Np+Mp+")*",cA=Np+Mp+aA,fA="(?:"+[Ap+tl+"?",tl,Tp,Ep,oA].join("|")+")",lu=RegExp(nl+"(?="+nl+")|"+fA+cA,"g");function uA(n){for(var e=lu.lastIndex=0;lu.test(n);)++e;return e}function dA(n){return ta(n)?uA(n):Zk(n)}var hA="Expected a function";function pA(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(hA);return Et(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),Op(n,e,{leading:r,maxWait:e,trailing:i})}var mA=30,gA="...",yA=/\w*$/;function bA(n,e){var t=mA,r=gA;if(Et(e)){var i="separator"in e?e.separator:i;t="length"in e?tx(e.length):t,r="omission"in e?Ci(e.omission):r}n=Gs(n);var o=n.length;if(ta(n)){var s=RO(n);o=s.length}if(t>=o)return n;var l=t-dA(r);if(l<1)return r;var a=s?aO(s,0,l).join(""):n.slice(0,l);if(i===void 0)return a+r;if(s&&(l+=a.length-l),Qk(i)){if(n.slice(l).search(i)){var c,f=a;for(i.global||(i=RegExp(i.source,Gs(yA.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var u=c.index;a=a.slice(0,u===void 0?l:u)}}else if(n.indexOf(Ci(i),l)!=l){var d=a.lastIndexOf(i);d>-1&&(a=a.slice(0,d))}return a+r}const vA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",SA="ελ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",Tn=(n,e)=>{for(const t in e)n[t]=e[t];return n},rl="numeric",il="ascii",ol="alpha",Kr="asciinumeric",Tr="alphanumeric",sl="domain",Rp="emoji",wA="scheme",xA="slashscheme",au="whitespace";function CA(n,e){return n in e||(e[n]=[]),e[n]}function Bt(n,e,t){e[rl]&&(e[Kr]=!0,e[Tr]=!0),e[il]&&(e[Kr]=!0,e[ol]=!0),e[Kr]&&(e[Tr]=!0),e[ol]&&(e[Tr]=!0),e[Tr]&&(e[sl]=!0),e[Rp]&&(e[sl]=!0);for(const r in e){const i=CA(r,t);i.indexOf(n)<0&&i.push(n)}}function OA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ye(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}ye.groups={};ye.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e){return e===void 0&&(e=!1),e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||ye.groups;let i;return e&&e.j?i=e:(i=new ye(e),t&&r&&Bt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||ye.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let s,l=i.go(n);if(l?(s=new ye,Tn(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new ye,o){if(r)if(s.t&&typeof s.t=="string"){const a=Tn(OA(s.t,r),t);Bt(o,a,r)}else t&&Bt(o,t,r);s.t=o}return i.j[n]=s,s}};const $=(n,e,t,r,i)=>n.ta(e,t,r,i),Se=(n,e,t,r,i)=>n.tr(e,t,r,i),cu=(n,e,t,r,i)=>n.ts(e,t,r,i),S=(n,e,t,r,i)=>n.tt(e,t,r,i),Ze="WORD",ll="UWORD",pr="LOCALHOST",al="TLD",cl="UTLD",Jr="SCHEME",fn="SLASH_SCHEME",ra="NUM",Ip="WS",ia="NL",er="OPENBRACE",tr="CLOSEBRACE",ki="OPENBRACKET",Ai="CLOSEBRACKET",Ti="OPENPAREN",Ei="CLOSEPAREN",Mi="OPENANGLEBRACKET",Ni="CLOSEANGLEBRACKET",Ri="FULLWIDTHLEFTPAREN",Ii="FULLWIDTHRIGHTPAREN",Di="LEFTCORNERBRACKET",Pi="RIGHTCORNERBRACKET",$i="LEFTWHITECORNERBRACKET",Bi="RIGHTWHITECORNERBRACKET",zi="FULLWIDTHLESSTHAN",Li="FULLWIDTHGREATERTHAN",Fi="AMPERSAND",_i="APOSTROPHE",ji="ASTERISK",mt="AT",Vi="BACKSLASH",Wi="BACKTICK",Hi="CARET",bt="COLON",oa="COMMA",Ui="DOLLAR",Pe="DOT",Ki="EQUALS",sa="EXCLAMATION",$e="HYPHEN",Ji="PERCENT",qi="PIPE",Gi="PLUS",Yi="POUND",Xi="QUERY",la="QUOTE",aa="SEMI",Be="SLASH",nr="TILDE",Qi="UNDERSCORE",Dp="EMOJI",Zi="SYM";var Pp=Object.freeze({__proto__:null,WORD:Ze,UWORD:ll,LOCALHOST:pr,TLD:al,UTLD:cl,SCHEME:Jr,SLASH_SCHEME:fn,NUM:ra,WS:Ip,NL:ia,OPENBRACE:er,CLOSEBRACE:tr,OPENBRACKET:ki,CLOSEBRACKET:Ai,OPENPAREN:Ti,CLOSEPAREN:Ei,OPENANGLEBRACKET:Mi,CLOSEANGLEBRACKET:Ni,FULLWIDTHLEFTPAREN:Ri,FULLWIDTHRIGHTPAREN:Ii,LEFTCORNERBRACKET:Di,RIGHTCORNERBRACKET:Pi,LEFTWHITECORNERBRACKET:$i,RIGHTWHITECORNERBRACKET:Bi,FULLWIDTHLESSTHAN:zi,FULLWIDTHGREATERTHAN:Li,AMPERSAND:Fi,APOSTROPHE:_i,ASTERISK:ji,AT:mt,BACKSLASH:Vi,BACKTICK:Wi,CARET:Hi,COLON:bt,COMMA:oa,DOLLAR:Ui,DOT:Pe,EQUALS:Ki,EXCLAMATION:sa,HYPHEN:$e,PERCENT:Ji,PIPE:qi,PLUS:Gi,POUND:Yi,QUERY:Xi,QUOTE:la,SEMI:aa,SLASH:Be,TILDE:nr,UNDERSCORE:Qi,EMOJI:Dp,SYM:Zi});const sn=/[a-z]/,is=new RegExp("\\p{L}","u"),ss=new RegExp("\\p{Emoji}","u"),ls=/\d/,fu=/\s/,uu=`
14
+ `,kA="️",AA="‍";let Er=null,Mr=null;function TA(n){n===void 0&&(n=[]);const e={};ye.groups=e;const t=new ye;Er==null&&(Er=du(vA)),Mr==null&&(Mr=du(SA)),S(t,"'",_i),S(t,"{",er),S(t,"}",tr),S(t,"[",ki),S(t,"]",Ai),S(t,"(",Ti),S(t,")",Ei),S(t,"<",Mi),S(t,">",Ni),S(t,"(",Ri),S(t,")",Ii),S(t,"「",Di),S(t,"」",Pi),S(t,"『",$i),S(t,"』",Bi),S(t,"<",zi),S(t,">",Li),S(t,"&",Fi),S(t,"*",ji),S(t,"@",mt),S(t,"`",Wi),S(t,"^",Hi),S(t,":",bt),S(t,",",oa),S(t,"$",Ui),S(t,".",Pe),S(t,"=",Ki),S(t,"!",sa),S(t,"-",$e),S(t,"%",Ji),S(t,"|",qi),S(t,"+",Gi),S(t,"#",Yi),S(t,"?",Xi),S(t,'"',la),S(t,"/",Be),S(t,";",aa),S(t,"~",nr),S(t,"_",Qi),S(t,"\\",Vi);const r=Se(t,ls,ra,{[rl]:!0});Se(r,ls,r);const i=Se(t,sn,Ze,{[il]:!0});Se(i,sn,i);const o=Se(t,is,ll,{[ol]:!0});Se(o,sn),Se(o,is,o);const s=Se(t,fu,Ip,{[au]:!0});S(t,uu,ia,{[au]:!0}),S(s,uu),Se(s,fu,s);const l=Se(t,ss,Dp,{[Rp]:!0});Se(l,ss,l),S(l,kA,l);const a=S(l,AA);Se(a,ss,l);const c=[[sn,i]],f=[[sn,null],[is,o]];for(let u=0;u<Er.length;u++)ft(t,Er[u],al,Ze,c);for(let u=0;u<Mr.length;u++)ft(t,Mr[u],cl,ll,f);Bt(al,{tld:!0,ascii:!0},e),Bt(cl,{utld:!0,alpha:!0},e),ft(t,"file",Jr,Ze,c),ft(t,"mailto",Jr,Ze,c),ft(t,"http",fn,Ze,c),ft(t,"https",fn,Ze,c),ft(t,"ftp",fn,Ze,c),ft(t,"ftps",fn,Ze,c),Bt(Jr,{scheme:!0,ascii:!0},e),Bt(fn,{slashscheme:!0,ascii:!0},e),n=n.sort((u,d)=>u[0]>d[0]?1:-1);for(let u=0;u<n.length;u++){const d=n[u][0],h=n[u][1]?{[wA]:!0}:{[xA]:!0};d.indexOf("-")>=0?h[sl]=!0:sn.test(d)?ls.test(d)?h[Kr]=!0:h[il]=!0:h[rl]=!0,cu(t,d,d,h)}return cu(t,"localhost",pr,{ascii:!0}),t.jd=new ye(Zi),{start:t,tokens:Tn({groups:e},Pp)}}function EA(n,e){const t=MA(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,a=null,c=0,f=null,u=-1,d=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(u=0,d=0,f=l):u>=0&&(u+=t[s].length,d++),c+=t[s].length,o+=t[s].length,s++;o-=u,s-=d,c-=u,i.push({t:f.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function MA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function ft(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?o=n.j[a]:(o=new ye(r),o.jr=i.slice(),n.j[a]=o),n=o}return o=new ye(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function du(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const mr={defaultProtocol:"http",events:null,format:hu,formatHref:hu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ca(n,e){e===void 0&&(e=null);let t=Tn({},mr);n&&(t=Tn(t,n instanceof ca?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}ca.prototype={o:mr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:mr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function hu(n){return n}function $p(n,e){this.t="token",this.v=n,this.tk=e}$p.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=mr.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),f=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),f&&Tn(s,f),{tagName:i,attributes:s,content:o,eventListeners:u}}};function po(n,e){class t extends $p{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const pu=po("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),mu=po("text"),NA=po("nl"),Nr=po("url",{isLink:!0,toHref(n){return n===void 0&&(n=mr.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==pr&&n[1].t===bt}}),we=n=>new ye(n);function RA(n){let{groups:e}=n;const t=e.domain.concat([Fi,ji,mt,Vi,Wi,Hi,Ui,Ki,$e,ra,Ji,qi,Gi,Yi,Be,Zi,nr,Qi]),r=[_i,bt,oa,Pe,sa,Xi,la,aa,Mi,Ni,er,tr,Ai,ki,Ti,Ei,Ri,Ii,Di,Pi,$i,Bi,zi,Li],i=[Fi,_i,ji,Vi,Wi,Hi,Ui,Ki,$e,er,tr,Ji,qi,Gi,Yi,Xi,Be,Zi,nr,Qi],o=we(),s=S(o,nr);$(s,i,s),$(s,e.domain,s);const l=we(),a=we(),c=we();$(o,e.domain,l),$(o,e.scheme,a),$(o,e.slashscheme,c),$(l,i,s),$(l,e.domain,l);const f=S(l,mt);S(s,mt,f),S(a,mt,f),S(c,mt,f);const u=S(s,Pe);$(u,i,s),$(u,e.domain,s);const d=we();$(f,e.domain,d),$(d,e.domain,d);const p=S(d,Pe);$(p,e.domain,d);const h=we(pu);$(p,e.tld,h),$(p,e.utld,h),S(f,pr,h);const m=S(d,$e);$(m,e.domain,d),$(h,e.domain,d),S(h,Pe,p),S(h,$e,m);const g=S(h,bt);$(g,e.numeric,pu);const y=S(l,$e),C=S(l,Pe);$(y,e.domain,l),$(C,i,s),$(C,e.domain,l);const k=we(Nr);$(C,e.tld,k),$(C,e.utld,k),$(k,e.domain,l),$(k,i,s),S(k,Pe,C),S(k,$e,y),S(k,mt,f);const N=S(k,bt),M=we(Nr);$(N,e.numeric,M);const x=we(Nr),I=we();$(x,t,x),$(x,r,I),$(I,t,x),$(I,r,I),S(k,Be,x),S(M,Be,x);const D=S(a,bt),T=S(c,bt),Y=S(T,Be),A=S(Y,Be);$(a,e.domain,l),S(a,Pe,C),S(a,$e,y),$(c,e.domain,l),S(c,Pe,C),S(c,$e,y),$(D,e.domain,x),S(D,Be,x),$(A,e.domain,x),$(A,t,x),S(A,Be,x);const O=[[er,tr],[ki,Ai],[Ti,Ei],[Mi,Ni],[Ri,Ii],[Di,Pi],[$i,Bi],[zi,Li]];for(let B=0;B<O.length;B++){const[v,X]=O[B],F=S(x,v);S(I,v,F),S(F,X,x);const j=we(Nr);$(F,t,j);const ie=we();$(F,r),$(j,t,j),$(j,r,ie),$(ie,t,j),$(ie,r,ie),S(j,X,x),S(ie,X,x)}return S(o,pr,k),S(o,ia,NA),{start:o,tokens:Pp}}function IA(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,a=null,c=null,f=0,u=null,d=-1;for(;i<r&&!(a=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(d=0,u=l):d>=0&&d++,i++,f++;if(d<0)i-=f,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(as(mu,e,s)),s=[]),i-=d,f-=d;const p=u.t,h=t.slice(i-f,i);o.push(as(p,e,h))}}return s.length>0&&o.push(as(mu,e,s)),o}function as(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const DA=typeof console<"u"&&console&&console.warn||(()=>{}),PA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",K={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $A(){ye.groups={},K.scanner=null,K.parser=null,K.tokenQueue=[],K.pluginQueue=[],K.customSchemes=[],K.initialized=!1}function BA(n,e){if(e===void 0&&(e=!1),K.initialized&&DA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${PA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
15
15
  1. Must only contain digits, lowercase ASCII letters or "-"
16
16
  2. Cannot start or end with "-"
17
- 3. "-" cannot repeat`);K.customSchemes.push([n,e])}function zA(){K.scanner=TA(K.customSchemes);for(let n=0;n<K.tokenQueue.length;n++)K.tokenQueue[n][1]({scanner:K.scanner});K.parser=RA(K.scanner.tokens);for(let n=0;n<K.pluginQueue.length;n++)K.pluginQueue[n][1]({scanner:K.scanner,parser:K.parser});K.initialized=!0}function zp(n){return K.initialized||zA(),DA(K.parser.start,n,EA(K.scanner.start,n))}function LA(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ca(t),i=zp(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Zi=200,re=function(){};re.prototype.append=function(e){return e.length?(e=re.from(e),!this.length&&e||e.length<Zi&&this.leafAppend(e)||this.length<Zi&&e.leafPrepend(this)||this.appendInner(e)):this};re.prototype.prepend=function(e){return e.length?re.from(e).append(this):this};re.prototype.appendInner=function(e){return new FA(this,e)};re.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?re.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};re.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};re.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};re.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};re.from=function(e){return e instanceof re?e:e&&e.length?new Lp(e):re.empty};var Lp=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Zi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Zi)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(re);re.empty=new Lp([]);var FA=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(re);const _A=500;class Me{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],f=[];return this.items.forEach((u,d)=>{if(!u.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,f.push(u);return}if(i){f.push(new ze(u.map));let p=u.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new ze(h,void 0,void 0,c.length+f.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(o)):u.selection,a=new Me(this.items.slice(0,r).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let f=0;f<e.steps.length;f++){let u=e.steps[f].invert(e.docs[f]),d=new ze(e.mapping.maps[f],u,t),p;(p=a&&a.merge(d))&&(d=p,f?o.pop():l=l.slice(0,l.length-1)),o.push(d),t&&(s++,t=void 0),i||(a=d)}let c=s-r.depth;return c>VA&&(l=jA(l,c),s-=c),new Me(l.append(o),s)}remapping(e,t){let r=new hn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Me(this.items.append(e.map(t=>new ze(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=t;this.items.forEach(d=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(d.step){let m=e.steps[p].invert(e.docs[p]),g=d.selection&&d.selection.map(o.slice(a+1,p));g&&l++,r.push(new ze(h,m,g))}else r.push(new ze(h))},i);let c=[];for(let d=t;d<s;d++)c.push(new ze(o.maps[d]));let f=this.items.slice(0,i).append(c).append(r),u=new Me(f,l);return u.emptyItemCount()>_A&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let f=s.selection&&s.selection.map(t.slice(r));f&&o++;let u=new ze(c.invert(),a,f),d,p=i.length-1;(d=i.length&&i[p].merge(u))?i[p]=d:i.push(u)}}else s.map&&r--},this.items.length,0),new Me(re.from(i.reverse()),o)}}Me.empty=new Me(re.empty,0);function jA(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ze{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ze(t.getMap().invert(),t,this.selection)}}}class gt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const VA=20;function WA(n,e,t,r){let i=t.getMeta(Wt),o;if(i)return i.historyState;t.getMeta(KA)&&(n=new gt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Wt))return s.getMeta(Wt).redo?new gt(n.done.addTransform(t,void 0,r,Jr(e)),n.undone,yu(t.mapping.maps),n.prevTime,n.prevComposition):new gt(n.done,n.undone.addTransform(t,void 0,r,Jr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!HA(t,n.prevRanges)),c=s?cs(n.prevRanges,t.mapping):yu(t.mapping.maps);return new gt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Jr(e)),Me.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new gt(n.done.rebased(t,o),n.undone.rebased(t,o),cs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new gt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),cs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function HA(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function yu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function cs(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function UA(n,e,t){let r=Jr(e),i=Wt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new gt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Wt,{redo:t,historyState:a})}let fs=!1,bu=null;function Jr(n){let e=n.plugins;if(bu!=e){fs=!1,bu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){fs=!0;break}}return fs}const Wt=new Nn("history"),KA=new Nn("closeHistory");function JA(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Yt({key:Wt,state:{init(){return new gt(Me.empty,Me.empty,null,0,-1)},apply(e,t,r){return WA(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?_p:r=="historyRedo"?jp:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Fp(n,e){return(t,r)=>{let i=Wt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=UA(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const _p=Fp(!1,!0),jp=Fp(!0,!0);function qA(n={}){return new Yt({view(e){return new GA(e,n)}})}class GA{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let f=c.getBoundingClientRect(),u=l?f.bottom:f.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Xu(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}class q extends R{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return q.valid(r)?new q(r):R.near(r)}content(){return w.empty}eq(e){return e instanceof q&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new q(e.resolve(t.pos))}getBookmark(){return new fa(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!YA(e)||!XA(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&q.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(q.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!E.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(q.valid(l))return l}return null}}}q.prototype.visible=!1;q.findFrom=q.findGapCursorFrom;R.jsonID("gapcursor",q);class fa{constructor(e){this.pos=e}map(e){return new fa(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return q.valid(t)?new q(t):R.near(t)}}function YA(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function XA(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function QA(){return new Yt({props:{decorations:nT,createSelectionBetween(n,e,t){return e.pos==t.pos&&q.valid(t)?new q(t):null},handleClick:eT,handleKeyDown:ZA,handleDOMEvents:{beforeinput:tT}}})}const ZA=Ml({ArrowLeft:Rr("horiz",-1),ArrowRight:Rr("horiz",1),ArrowUp:Rr("vert",-1),ArrowDown:Rr("vert",1)});function Rr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof z){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=q.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new q(c))),!0):!1}}function eT(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!q.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&E.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new q(r))),!0)}function tT(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof q))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=b.empty;for(let s=r.length-1;s>=0;s--)i=b.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new w(i,0,0));return o.setSelection(z.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function nT(n){if(!(n.selection instanceof q))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",J.create(n.doc,[he.widget(n.selection.head,e,{key:"gapcursor"})])}var fl,ul;if(typeof WeakMap<"u"){let n=new WeakMap;fl=e=>n.get(e),ul=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;fl=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},ul=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var G=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return fl(n)||ul(n,rT(n))}};function rT(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=iT(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,f=e*t;c<f;c++)r[c]=0;for(let c=0,f=0;c<t;c++){const u=n.child(c);f++;for(let h=0;;h++){for(;i<r.length&&r[i]!=0;)i++;if(h==u.childCount)break;const m=u.child(h),{colspan:g,rowspan:y,colwidth:C}=m.attrs;for(let k=0;k<y;k++){if(k+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:y-k});break}const N=i+k*e;for(let M=0;M<g;M++){r[N+M]==0?r[N+M]=f:(o||(o=[])).push({type:"collision",row:c,pos:f,n:g-M});const x=C&&C[M];if(x){const D=(N+M)%e*2,I=s[D];I==null||I!=x&&s[D+1]==1?(s[D]=x,s[D+1]=1):I==x&&s[D+1]++}}}i+=g,f+=m.nodeSize}const d=(c+1)*e;let p=0;for(;i<d;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),f++}const l=new G(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&oT(l,s,n),l}function iT(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function oT(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const f=(i+c)%n.width,u=e[f*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=sT(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function sT(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ue(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var vt=new Nn("selectingCells");function Pn(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function lT(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ie(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function po(n){const e=n.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 t=Pn(e.$head)||aT(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function aT(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function dl(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function cT(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ua(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Vp(n,e,t){const r=n.node(-1),i=G.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function qt(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Wp(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function fT(n,e,t){const r=ue(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var H=class et extends R{constructor(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(f=>f!=t.pos-o);a.unshift(t.pos-o);const c=a.map(f=>{const u=r.nodeAt(f);if(!u)throw RangeError(`No cell with offset ${f} found`);const d=o+f+1;return new nd(l.resolve(d),l.resolve(d+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(dl(r)&&dl(i)&&ua(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?et.rowSelection(r,i):o&&this.isColSelection()?et.colSelection(r,i):new et(r,i)}return z.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=G.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let f=a*t.width+i.left,u=i.left;u<i.right;u++,f++){const d=t.map[f];if(o[d])continue;o[d]=!0;const p=t.findCell(d);let h=e.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const m=i.left-p.left,g=p.right-i.right;if(m>0||g>0){let y=h.attrs;if(m>0&&(y=qt(y,0,m)),g>0&&(y=qt(y,y.colspan-g,g)),p.left<i.left){if(h=h.type.createAndFill(y),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else h=h.type.create(y,h.content)}if(p.top<i.top||p.bottom>i.bottom){const y={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?h=h.type.createAndFill(y):h=h.type.create(y,h.content)}c.push(h)}s.push(e.child(a).copy(b.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new w(b.from(l),1,1)}replace(e,t=w.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?w.empty:t)}const o=R.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new w(b.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=G.get(t),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new et(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=G.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof et&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new et(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new et(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new et(e.resolve(t),e.resolve(r))}getBookmark(){return new uT(this.$anchorCell.pos,this.$headCell.pos)}};H.prototype.visible=!1;R.jsonID("cell",H);var uT=class Hp{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Hp(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&ua(t,r)?new H(t,r):R.near(r,1)}};function dT(n){if(!(n.selection instanceof H))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(he.node(r,r+t.nodeSize,{class:"selectedCell"}))}),J.create(n.doc,e)}function hT({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function pT({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return t!==r&&e.parentOffset===0}function mT(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof E&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=H.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=H.rowSelection(l,l)}else if(!t){const l=G.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=H.create(i,a+1,c)}}else r instanceof z&&hT(r)?o=z.create(i,r.from):r instanceof z&&pT(r)&&(o=z.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var gT=new Nn("fix-tables");function Up(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,f=Math.min(i,s+3);c<f;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?Up(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Kp(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=yT(n,i,o,t))};return e?e.doc!=n.doc&&Up(e.doc,n.doc,0,r):n.doc.descendants(r),t}function yT(n,e,t,r){const i=G.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const u=f.attrs;for(let d=0;d<u.rowspan;d++)o[c.row+d]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,qt(u,u.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const f=e.child(a),u=c+f.nodeSize,d=o[a];if(d>0){let p="cell";f.firstChild&&(p=f.firstChild.type.spec.tableRole);const h=[];for(let g=0;g<d;g++){const y=ue(n.schema)[p].createAndFill();y&&h.push(y)}const m=(a==0||s==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(m),h)}c=u}return r.setMeta(gT,{fixTables:!0})}function bT(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const f=a?0:Math.max(0,t-1),u=a<e.childCount-1?0:Math.max(0,r-1);(f||u)&&(c=hl(ue(s).row,new w(c,f,u)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?hl(ue(s).row,new w(e,t,r)).content:e);else return null;return vT(s,l)}function vT(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(b.empty),t[i]<r){const o=ue(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(b.from(s))}return{height:e.length,width:r,rows:e}}function hl(n,e){const t=n.createAndFill();return new vl(t).replace(0,t.content.size,e).doc}function ST({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let f=o[l]||0,u=0;f<r;u++){let d=a.child(u%a.childCount);f+d.attrs.colspan>r&&(d=d.type.createChecked(qt(d.attrs,d.attrs.colspan,f+d.attrs.colspan-r),d.content)),c.push(d),f+=d.attrs.colspan;for(let p=1;p<d.attrs.rowspan;p++)o[l+p]=(o[l+p]||0)+d.attrs.colspan}s.push(b.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let f=0;f<c.childCount;f++){let u=c.child(f);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),a.push(u)}o.push(b.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function wT(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=ue(l);let c,f;if(i>e.width)for(let u=0,d=0;u<e.height;u++){const p=t.child(u);d+=p.nodeSize;const h=[];let m;p.lastChild==null||p.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=f||(f=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)h.push(m);n.insert(n.mapping.slice(s).map(d-1+r),h)}if(o>e.height){const u=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,i);h++){const g=h>=e.width?!1:t.nodeAt(e.map[m+h]).type==a.header_cell;u.push(g?f||(f=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const d=a.row.create(null,b.from(u)),p=[];for(let h=e.height;h<o;h++)p.push(d);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),p)}return!!(c||f)}function vu(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const f=s*e.width+c,u=e.map[f];if(e.map[f-e.width]==u){a=!0;const d=t.nodeAt(u),{top:p,left:h}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d.attrs,rowspan:s-p}),n.insert(n.mapping.slice(l).map(e.positionAt(s,h,t)),d.type.createAndFill({...d.attrs,rowspan:p+d.attrs.rowspan-s})),c+=d.attrs.colspan-1}}return a}function Su(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const f=c*e.width+s,u=e.map[f];if(e.map[f-1]==u){a=!0;const d=t.nodeAt(u),p=e.colCount(u),h=n.mapping.slice(l).map(u+r);n.setNodeMarkup(h,null,qt(d.attrs,s-p,d.attrs.colspan-(s-p))),n.insert(h+d.nodeSize,d.type.createAndFill(qt(d.attrs,0,s-p))),c+=d.attrs.rowspan-1}}return a}function wu(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=G.get(o);const{top:l,left:a}=r,c=a+i.width,f=l+i.height,u=n.tr;let d=0;function p(){if(o=t?u.doc.nodeAt(t-1):u.doc,!o)throw new Error("No table found");s=G.get(o),d=u.mapping.maps.length}wT(u,s,o,t,c,f,d)&&p(),vu(u,s,o,t,a,c,l,d)&&p(),vu(u,s,o,t,a,c,f,d)&&p(),Su(u,s,o,t,l,f,a,d)&&p(),Su(u,s,o,t,l,f,c,d)&&p();for(let h=l;h<f;h++){const m=s.positionAt(h,a,o),g=s.positionAt(h,c,o);u.replace(u.mapping.slice(d).map(m+t),u.mapping.slice(d).map(g+t),new w(i.rows[h-l],0,0))}p(),u.setSelection(new H(u.doc.resolve(t+s.positionAt(l,a,o)),u.doc.resolve(t+s.positionAt(f-1,c-1,o)))),e(u)}var xT=Ml({ArrowLeft:Dr("horiz",-1),ArrowRight:Dr("horiz",1),ArrowUp:Dr("vert",-1),ArrowDown:Dr("vert",1),"Shift-ArrowLeft":Ir("horiz",-1),"Shift-ArrowRight":Ir("horiz",1),"Shift-ArrowUp":Ir("vert",-1),"Shift-ArrowDown":Ir("vert",1),Backspace:Pr,"Mod-Backspace":Pr,Delete:Pr,"Mod-Delete":Pr});function qr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Dr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof H)return qr(t,r,R.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Jp(i,n,e);if(s==null)return!1;if(n=="horiz")return qr(t,r,R.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Vp(l,n,e);let c;return a?c=R.near(a,1):e<0?c=R.near(t.doc.resolve(l.before(-1)),-1):c=R.near(t.doc.resolve(l.after(-1)),1),qr(t,r,c)}}}function Ir(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof H)s=o;else{const a=Jp(i,n,e);if(a==null)return!1;s=new H(t.doc.resolve(a))}const l=Vp(s.$headCell,n,e);return l?qr(t,r,new H(s.$anchorCell,l)):!1}}function Pr(n,e){const t=n.selection;if(!(t instanceof H))return!1;if(e){const r=n.tr,i=ue(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new w(i,0,0))}),r.docChanged&&e(r)}return!0}function CT(n,e){const t=n.state.doc,r=Pn(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new H(r))),!0):!1}function OT(n,e,t){if(!Ie(n.state))return!1;let r=bT(t);const i=n.state.selection;if(i instanceof H){r||(r={width:1,height:1,rows:[b.from(hl(ue(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=G.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=ST(r,l.right-l.left,l.bottom-l.top),wu(n.state,n.dispatch,s,l,r),!0}else if(r){const o=po(n.state),s=o.start(-1);return wu(n.state,n.dispatch,s,G.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function kT(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=xu(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof H)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Pn(n.state.selection.$anchor))!=null&&((t=us(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let f=us(n,c);const u=vt.getState(n.state)==null;if(!f||!ua(a,f))if(u)f=a;else return;const d=new H(a,f);if(u||!n.state.selection.eq(d)){const p=n.state.tr.setSelection(d);u&&p.setMeta(vt,a.pos),n.dispatch(p)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),vt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(vt,-1))}function l(a){const c=a,f=vt.getState(n.state);let u;if(f!=null)u=n.state.doc.resolve(f);else if(xu(n,c.target)!=r&&(u=us(n,e),!u))return s();u&&o(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Jp(n,e,t){if(!(n.state.selection instanceof z))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function xu(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function us(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Pn(n.state.doc.resolve(t.pos)):null}var AT=class{constructor(n,e){this.node=n,this.cellMinWidth=e,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")),pl(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,pl(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function pl(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const f=n.firstChild;if(f){for(let u=0,d=0;u<f.childCount;u++){const{colspan:p,colwidth:h}=f.child(u).attrs;for(let m=0;m<p;m++,d++){const g=i==d?o:h&&h[m],y=g?g+"px":"";l+=g||r,g||(a=!1),c?(c.style.width!=y&&(c.style.width=y),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;c;){const u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ce=new Nn("tableColumnResizing");function TT({handleWidth:n=5,cellMinWidth:e=25,View:t=AT,lastColumnResizable:r=!0}={}){const i=new Yt({key:Ce,state:{init(o,s){var l,a;const c=(a=(l=i.spec)==null?void 0:l.props)==null?void 0:a.nodeViews,f=ue(s.schema).table.name;return t&&c&&(c[f]=(u,d)=>new t(u,e,d)),new ET(-1,!1)},apply(o,s){return s.apply(o)}},props:{attributes:o=>{const s=Ce.getState(o);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,s)=>{MT(o,s,n,e,r)},mouseleave:o=>{NT(o)},mousedown:(o,s)=>{RT(o,s,e)}},decorations:o=>{const s=Ce.getState(o);if(s&&s.activeHandle>-1)return zT(o,s.activeHandle)},nodeViews:{}}});return i}var ET=class Gr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ce);if(r&&r.setHandle!=null)return new Gr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Gr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return dl(e.doc.resolve(i))||(i=-1),new Gr(i,t.dragging)}return t}};function MT(n,e,t,r,i){const o=Ce.getState(n.state);if(o&&!o.dragging){const s=IT(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=Cu(n,e,"left",t):c-e.clientX<=t&&(l=Cu(n,e,"right",t))}if(l!=o.activeHandle){if(!i&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),f=G.get(c),u=a.start(-1);if(f.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==f.width-1)return}qp(n,l)}}}function NT(n){const e=Ce.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&qp(n,-1)}function RT(n,e,t){var r;const i=(r=n.dom.ownerDocument.defaultView)!=null?r:window,o=Ce.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const s=n.state.doc.nodeAt(o.activeHandle),l=DT(n,o.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Ce,{setDragging:{startX:e.clientX,startWidth:l}}));function a(f){i.removeEventListener("mouseup",a),i.removeEventListener("mousemove",c);const u=Ce.getState(n.state);u!=null&&u.dragging&&(PT(n,u.activeHandle,Ou(u.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Ce,{setDragging:null})))}function c(f){if(!f.which)return a(f);const u=Ce.getState(n.state);if(u&&u.dragging){const d=Ou(u.dragging,f,t);$T(n,u.activeHandle,d,t)}}return i.addEventListener("mouseup",a),i.addEventListener("mousemove",c),e.preventDefault(),!0}function DT(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function IT(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Cu(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=Pn(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=G.get(l.node(-1)),c=l.start(-1),f=a.map.indexOf(l.pos-c);return f%a.width==0?-1:c+a.map[f-1]}function Ou(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function qp(n,e){n.dispatch(n.state.tr.setMeta(Ce,{setHandle:e}))}function PT(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=G.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const f=c*o.width+l;if(c&&o.map[f]==o.map[f-o.width])continue;const u=o.map[f],d=i.nodeAt(u).attrs,p=d.colspan==1?0:l-o.colCount(u);if(d.colwidth&&d.colwidth[p]==t)continue;const h=d.colwidth?d.colwidth.slice():BT(d.colspan);h[p]=t,a.setNodeMarkup(s+u,null,{...d,colwidth:h})}a.docChanged&&n.dispatch(a)}function $T(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=G.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&pl(o,a.firstChild,a,r,l,t)}function BT(n){return Array(n).fill(0)}function zT(n,e){const t=[],r=n.doc.resolve(e),i=r.node(-1);if(!i)return J.empty;const o=G.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let a=0;a<o.height;a++){const c=l+a*o.width;if((l==o.width-1||o.map[c]!=o.map[c+1])&&(a==0||o.map[c]!=o.map[c-o.width])){const f=o.map[c],u=s+f+i.nodeAt(f).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(he.widget(u,d))}}return J.create(n.doc,t)}function qe(n){const e=n.selection,t=po(n),r=t.node(-1),i=t.start(-1),o=G.get(r);return{...e instanceof H?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function Gp(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;fT(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Wp(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?ue(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function LT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n);e(Gp(n.tr,t,t.left))}return!0}function FT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n);e(Gp(n.tr,t,t.right))}return!0}function _T(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),f=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,qt(f,i-e.colCount(a)));else{const u=n.mapping.slice(o).map(r+a);n.delete(u,u+c.nodeSize)}s+=f.rowspan}}function jT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;_T(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=G.get(o)}e(r)}return!0}function VT(n,e,t){var r;const i=ue(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Yp(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;VT(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const u=e.map[f],d=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,{...d,rowspan:d.rowspan+1}),c+=d.colspan-1}else{const u=a==null?ue(r.type.schema).cell:(o=r.nodeAt(e.map[f+a*e.width]))==null?void 0:o.type,d=u==null?void 0:u.createAndFill();d&&l.push(d)}return n.insert(s,ue(r.type.schema).row.create(null,l)),n}function WT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n);e(Yp(n.tr,t,t.top))}return!0}function HT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n);e(Yp(n.tr,t,t.bottom))}return!0}function UT(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const u=e.map[f];if(!a.has(u)){if(a.add(u),i>0&&u==e.map[f-e.width]){const d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d,rowspan:d.rowspan-1}),c+=d.colspan-1}else if(i<e.height&&u==e.map[f+e.width]){const d=t.nodeAt(u),p=d.attrs,h=d.type.create({...p,rowspan:d.attrs.rowspan-1},d.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),h),c+=p.colspan-1}}}}function KT(n,e){if(!Ie(n))return!1;if(e){const t=qe(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;UT(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=G.get(t.table)}e(r)}return!0}function ku(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function JT({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function qT(n,e){const t=n.selection;if(!(t instanceof H)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=qe(n),{map:i}=r;if(JT(i,r))return!1;if(e){const o=n.tr,s={};let l=b.empty,a,c;for(let f=r.top;f<r.bottom;f++)for(let u=r.left;u<r.right;u++){const d=i.map[f*i.width+u],p=r.table.nodeAt(d);if(!(s[d]||!p))if(s[d]=!0,a==null)a=d,c=p;else{ku(p)||(l=l.append(p.content));const h=o.mapping.map(d+r.tableStart);o.delete(h,h+p.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Wp(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=a+1+c.content.size,u=ku(c)?a+1:f;o.replaceWith(u+r.tableStart,f+r.tableStart,l)}o.setSelection(new H(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function GT(n,e){const t=ue(n.schema);return YT(({node:r})=>t[r.type.spec.tableRole])(n,e)}function YT(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof H){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=lT(i.$from),!o)return!1;s=(r=Pn(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=qe(e),u=e.tr;for(let p=0;p<f.right-f.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let d;for(let p=f.top;p<f.bottom;p++){let h=f.map.positionAt(p,f.left,f.table);p==f.top&&(h+=o.nodeSize);for(let m=f.left,g=0;m<f.right;m++,g++)m==f.left&&p==f.top||u.insert(d=u.mapping.map(h+f.tableStart,1),n({node:o,row:p,col:m}).createAndFill(a[g]))}u.setNodeMarkup(s,n({node:o,row:f.top,col:f.left}),a[0]),i instanceof H&&u.setSelection(new H(u.doc.resolve(i.$anchorCell.pos),d?u.doc.resolve(d):void 0)),t(u)}return!0}}function XT(n,e){return function(t,r){if(!Ie(t))return!1;const i=po(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof H?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function QT(n){return function(e,t){if(!Ie(e))return!1;if(t){const r=ue(e.schema),i=qe(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function Au(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function mo(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?QT(n):function(t,r){if(!Ie(t))return!1;if(r){const i=ue(t.schema),o=qe(t),s=t.tr,l=Au("row",o,i),a=Au("column",o,i),f=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:f,right:1,bottom:o.map.height}:n=="row"?{left:f,top:0,right:o.map.width,bottom:1}:o,d=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(p=>{const h=p+o.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,d,m.attrs)}),r(s)}return!0}}mo("row",{useDeprecatedLogic:!0});mo("column",{useDeprecatedLogic:!0});var ZT=mo("cell",{useDeprecatedLogic:!0});function eE(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function tE(n){return function(e,t){if(!Ie(e))return!1;const r=eE(po(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(z.between(i,cT(i))).scrollIntoView())}return!0}}function nE(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function rE({allowTableNodeSelection:n=!1}={}){return new Yt({key:vt,state:{init(){return null},apply(e,t){const r=e.getMeta(vt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:dT,handleDOMEvents:{mousedown:kT},createSelectionBetween(e){return vt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:CT,handleKeyDown:xT,handlePaste:OT},appendTransaction(e,t,r){return mT(r,Kp(r,t),n)}})}exports.AllSelection=Oe;exports.CellSelection=H;exports.DOMParser=vn;exports.DOMSerializer=Gt;exports.Decoration=he;exports.DecorationSet=J;exports.EditorState=un;exports.EditorView=ky;exports.Fragment=b;exports.Node=Ne;exports.NodeSelection=E;exports.Plugin=Yt;exports.PluginKey=Nn;exports.ReplaceAroundStep=ne;exports.ReplaceStep=te;exports.Schema=mm;exports.Selection=R;exports.Slice=w;exports.TextSelection=z;exports.Transform=vl;exports.VisibilitySensor=Iw;exports.addColumnAfter=FT;exports.addColumnBefore=LT;exports.addRowAfter=HT;exports.addRowBefore=WT;exports.canJoin=Mn;exports.canSplit=yl;exports.clamp=IO;exports.clsx=lb;exports.columnResizing=TT;exports.createParagraphNear=Jy;exports.cva=Rw;exports.debounce=kp;exports.deepEqual=Mw;exports.deleteColumn=jT;exports.deleteRow=KT;exports.deleteSelection=$y;exports.deleteTable=nE;exports.differenceBy=Jk;exports.dropCursor=qA;exports.exitCode=Ky;exports.find=LA;exports.findWrapping=gl;exports.fixTables=Kp;exports.gapCursor=QA;exports.goToNextCell=tE;exports.history=JA;exports.isNumber=Gk;exports.joinBackward=By;exports.joinDown=Wy;exports.joinForward=_y;exports.joinPoint=bl;exports.joinTextblockBackward=zy;exports.joinTextblockForward=Ly;exports.joinUp=Vy;exports.keymap=Py;exports.lift=Hy;exports.liftEmptyBlock=qy;exports.liftListItem=rb;exports.liftTarget=En;exports.mergeCells=qT;exports.newlineInCode=Uy;exports.redo=jp;exports.registerCustomProtocol=BA;exports.reset=$A;exports.selectNodeBackward=Fy;exports.selectNodeForward=jy;exports.selectParentNode=Gy;exports.selectTextblockEnd=Qy;exports.selectTextblockStart=Xy;exports.setBlockType=eb;exports.setCellAttr=XT;exports.sinkListItem=sb;exports.splitCell=GT;exports.tableEditing=rE;exports.throttle=pA;exports.toggleHeader=mo;exports.toggleHeaderCell=ZT;exports.tokenize=zp;exports.truncate=bA;exports.twMerge=Fb;exports.undo=_p;exports.wrapIn=Zy;exports.wrapInList=tb;
17
+ 3. "-" cannot repeat`);K.customSchemes.push([n,e])}function zA(){K.scanner=TA(K.customSchemes);for(let n=0;n<K.tokenQueue.length;n++)K.tokenQueue[n][1]({scanner:K.scanner});K.parser=RA(K.scanner.tokens);for(let n=0;n<K.pluginQueue.length;n++)K.pluginQueue[n][1]({scanner:K.scanner,parser:K.parser});K.initialized=!0}function Bp(n){return K.initialized||zA(),IA(K.parser.start,n,EA(K.scanner.start,n))}function LA(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ca(t),i=Bp(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var eo=200,re=function(){};re.prototype.append=function(e){return e.length?(e=re.from(e),!this.length&&e||e.length<eo&&this.leafAppend(e)||this.length<eo&&e.leafPrepend(this)||this.appendInner(e)):this};re.prototype.prepend=function(e){return e.length?re.from(e).append(this):this};re.prototype.appendInner=function(e){return new FA(this,e)};re.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?re.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};re.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};re.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};re.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};re.from=function(e){return e instanceof re?e:e&&e.length?new zp(e):re.empty};var zp=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=eo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=eo)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(re);re.empty=new zp([]);var FA=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(re);const _A=500;class Me{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],f=[];return this.items.forEach((u,d)=>{if(!u.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,f.push(u);return}if(i){f.push(new ze(u.map));let p=u.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new ze(h,void 0,void 0,c.length+f.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(o)):u.selection,a=new Me(this.items.slice(0,r).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let f=0;f<e.steps.length;f++){let u=e.steps[f].invert(e.docs[f]),d=new ze(e.mapping.maps[f],u,t),p;(p=a&&a.merge(d))&&(d=p,f?o.pop():l=l.slice(0,l.length-1)),o.push(d),t&&(s++,t=void 0),i||(a=d)}let c=s-r.depth;return c>VA&&(l=jA(l,c),s-=c),new Me(l.append(o),s)}remapping(e,t){let r=new hn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Me(this.items.append(e.map(t=>new ze(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=t;this.items.forEach(d=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(d.step){let m=e.steps[p].invert(e.docs[p]),g=d.selection&&d.selection.map(o.slice(a+1,p));g&&l++,r.push(new ze(h,m,g))}else r.push(new ze(h))},i);let c=[];for(let d=t;d<s;d++)c.push(new ze(o.maps[d]));let f=this.items.slice(0,i).append(c).append(r),u=new Me(f,l);return u.emptyItemCount()>_A&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let f=s.selection&&s.selection.map(t.slice(r));f&&o++;let u=new ze(c.invert(),a,f),d,p=i.length-1;(d=i.length&&i[p].merge(u))?i[p]=d:i.push(u)}}else s.map&&r--},this.items.length,0),new Me(re.from(i.reverse()),o)}}Me.empty=new Me(re.empty,0);function jA(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ze{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ze(t.getMap().invert(),t,this.selection)}}}class gt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const VA=20;function WA(n,e,t,r){let i=t.getMeta(Wt),o;if(i)return i.historyState;t.getMeta(KA)&&(n=new gt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Wt))return s.getMeta(Wt).redo?new gt(n.done.addTransform(t,void 0,r,qr(e)),n.undone,gu(t.mapping.maps),n.prevTime,n.prevComposition):new gt(n.done,n.undone.addTransform(t,void 0,r,qr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!HA(t,n.prevRanges)),c=s?cs(n.prevRanges,t.mapping):gu(t.mapping.maps);return new gt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,qr(e)),Me.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new gt(n.done.rebased(t,o),n.undone.rebased(t,o),cs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new gt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),cs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function HA(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function gu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function cs(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function UA(n,e,t){let r=qr(e),i=Wt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new gt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Wt,{redo:t,historyState:a})}let fs=!1,yu=null;function qr(n){let e=n.plugins;if(yu!=e){fs=!1,yu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){fs=!0;break}}return fs}const Wt=new Nn("history"),KA=new Nn("closeHistory");function JA(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Yt({key:Wt,state:{init(){return new gt(Me.empty,Me.empty,null,0,-1)},apply(e,t,r){return WA(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Fp:r=="historyRedo"?_p:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Lp(n,e){return(t,r)=>{let i=Wt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=UA(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Fp=Lp(!1,!0),_p=Lp(!0,!0);function qA(n={}){return new Yt({view(e){return new GA(e,n)}})}class GA{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let f=c.getBoundingClientRect(),u=l?f.bottom:f.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Yu(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}class q extends R{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return q.valid(r)?new q(r):R.near(r)}content(){return w.empty}eq(e){return e instanceof q&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new q(e.resolve(t.pos))}getBookmark(){return new fa(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!YA(e)||!XA(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&q.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(q.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!E.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(q.valid(l))return l}return null}}}q.prototype.visible=!1;q.findFrom=q.findGapCursorFrom;R.jsonID("gapcursor",q);class fa{constructor(e){this.pos=e}map(e){return new fa(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return q.valid(t)?new q(t):R.near(t)}}function YA(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function XA(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function QA(){return new Yt({props:{decorations:nT,createSelectionBetween(n,e,t){return e.pos==t.pos&&q.valid(t)?new q(t):null},handleClick:eT,handleKeyDown:ZA,handleDOMEvents:{beforeinput:tT}}})}const ZA=Ml({ArrowLeft:Rr("horiz",-1),ArrowRight:Rr("horiz",1),ArrowUp:Rr("vert",-1),ArrowDown:Rr("vert",1)});function Rr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof z){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=q.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new q(c))),!0):!1}}function eT(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!q.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&E.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new q(r))),!0)}function tT(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof q))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=b.empty;for(let s=r.length-1;s>=0;s--)i=b.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new w(i,0,0));return o.setSelection(z.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function nT(n){if(!(n.selection instanceof q))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",J.create(n.doc,[he.widget(n.selection.head,e,{key:"gapcursor"})])}var fl,ul;if(typeof WeakMap<"u"){let n=new WeakMap;fl=e=>n.get(e),ul=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;fl=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},ul=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var G=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return fl(n)||ul(n,rT(n))}};function rT(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=iT(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,f=e*t;c<f;c++)r[c]=0;for(let c=0,f=0;c<t;c++){const u=n.child(c);f++;for(let h=0;;h++){for(;i<r.length&&r[i]!=0;)i++;if(h==u.childCount)break;const m=u.child(h),{colspan:g,rowspan:y,colwidth:C}=m.attrs;for(let k=0;k<y;k++){if(k+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:y-k});break}const N=i+k*e;for(let M=0;M<g;M++){r[N+M]==0?r[N+M]=f:(o||(o=[])).push({type:"collision",row:c,pos:f,n:g-M});const x=C&&C[M];if(x){const I=(N+M)%e*2,D=s[I];D==null||D!=x&&s[I+1]==1?(s[I]=x,s[I+1]=1):D==x&&s[I+1]++}}}i+=g,f+=m.nodeSize}const d=(c+1)*e;let p=0;for(;i<d;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),f++}const l=new G(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&oT(l,s,n),l}function iT(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function oT(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const f=(i+c)%n.width,u=e[f*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=sT(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function sT(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ue(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var vt=new Nn("selectingCells");function Pn(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function lT(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function De(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function mo(n){const e=n.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 t=Pn(e.$head)||aT(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function aT(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function dl(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function cT(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ua(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function jp(n,e,t){const r=n.node(-1),i=G.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function qt(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Vp(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function fT(n,e,t){const r=ue(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var H=class et extends R{constructor(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(f=>f!=t.pos-o);a.unshift(t.pos-o);const c=a.map(f=>{const u=r.nodeAt(f);if(!u)throw RangeError(`No cell with offset ${f} found`);const d=o+f+1;return new td(l.resolve(d),l.resolve(d+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(dl(r)&&dl(i)&&ua(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?et.rowSelection(r,i):o&&this.isColSelection()?et.colSelection(r,i):new et(r,i)}return z.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=G.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let f=a*t.width+i.left,u=i.left;u<i.right;u++,f++){const d=t.map[f];if(o[d])continue;o[d]=!0;const p=t.findCell(d);let h=e.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const m=i.left-p.left,g=p.right-i.right;if(m>0||g>0){let y=h.attrs;if(m>0&&(y=qt(y,0,m)),g>0&&(y=qt(y,y.colspan-g,g)),p.left<i.left){if(h=h.type.createAndFill(y),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else h=h.type.create(y,h.content)}if(p.top<i.top||p.bottom>i.bottom){const y={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?h=h.type.createAndFill(y):h=h.type.create(y,h.content)}c.push(h)}s.push(e.child(a).copy(b.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new w(b.from(l),1,1)}replace(e,t=w.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?w.empty:t)}const o=R.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new w(b.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=G.get(t),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new et(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=G.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof et&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=G.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new et(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new et(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new et(e.resolve(t),e.resolve(r))}getBookmark(){return new uT(this.$anchorCell.pos,this.$headCell.pos)}};H.prototype.visible=!1;R.jsonID("cell",H);var uT=class Wp{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Wp(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&ua(t,r)?new H(t,r):R.near(r,1)}};function dT(n){if(!(n.selection instanceof H))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(he.node(r,r+t.nodeSize,{class:"selectedCell"}))}),J.create(n.doc,e)}function hT({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function pT({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return t!==r&&e.parentOffset===0}function mT(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof E&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=H.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=H.rowSelection(l,l)}else if(!t){const l=G.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=H.create(i,a+1,c)}}else r instanceof z&&hT(r)?o=z.create(i,r.from):r instanceof z&&pT(r)&&(o=z.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var gT=new Nn("fix-tables");function Hp(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,f=Math.min(i,s+3);c<f;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?Hp(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Up(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=yT(n,i,o,t))};return e?e.doc!=n.doc&&Hp(e.doc,n.doc,0,r):n.doc.descendants(r),t}function yT(n,e,t,r){const i=G.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const u=f.attrs;for(let d=0;d<u.rowspan;d++)o[c.row+d]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,qt(u,u.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const f=e.child(a),u=c+f.nodeSize,d=o[a];if(d>0){let p="cell";f.firstChild&&(p=f.firstChild.type.spec.tableRole);const h=[];for(let g=0;g<d;g++){const y=ue(n.schema)[p].createAndFill();y&&h.push(y)}const m=(a==0||s==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(m),h)}c=u}return r.setMeta(gT,{fixTables:!0})}function bT(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const f=a?0:Math.max(0,t-1),u=a<e.childCount-1?0:Math.max(0,r-1);(f||u)&&(c=hl(ue(s).row,new w(c,f,u)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?hl(ue(s).row,new w(e,t,r)).content:e);else return null;return vT(s,l)}function vT(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(b.empty),t[i]<r){const o=ue(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(b.from(s))}return{height:e.length,width:r,rows:e}}function hl(n,e){const t=n.createAndFill();return new vl(t).replace(0,t.content.size,e).doc}function ST({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let f=o[l]||0,u=0;f<r;u++){let d=a.child(u%a.childCount);f+d.attrs.colspan>r&&(d=d.type.createChecked(qt(d.attrs,d.attrs.colspan,f+d.attrs.colspan-r),d.content)),c.push(d),f+=d.attrs.colspan;for(let p=1;p<d.attrs.rowspan;p++)o[l+p]=(o[l+p]||0)+d.attrs.colspan}s.push(b.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let f=0;f<c.childCount;f++){let u=c.child(f);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),a.push(u)}o.push(b.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function wT(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=ue(l);let c,f;if(i>e.width)for(let u=0,d=0;u<e.height;u++){const p=t.child(u);d+=p.nodeSize;const h=[];let m;p.lastChild==null||p.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=f||(f=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)h.push(m);n.insert(n.mapping.slice(s).map(d-1+r),h)}if(o>e.height){const u=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,i);h++){const g=h>=e.width?!1:t.nodeAt(e.map[m+h]).type==a.header_cell;u.push(g?f||(f=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const d=a.row.create(null,b.from(u)),p=[];for(let h=e.height;h<o;h++)p.push(d);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),p)}return!!(c||f)}function bu(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const f=s*e.width+c,u=e.map[f];if(e.map[f-e.width]==u){a=!0;const d=t.nodeAt(u),{top:p,left:h}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d.attrs,rowspan:s-p}),n.insert(n.mapping.slice(l).map(e.positionAt(s,h,t)),d.type.createAndFill({...d.attrs,rowspan:p+d.attrs.rowspan-s})),c+=d.attrs.colspan-1}}return a}function vu(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const f=c*e.width+s,u=e.map[f];if(e.map[f-1]==u){a=!0;const d=t.nodeAt(u),p=e.colCount(u),h=n.mapping.slice(l).map(u+r);n.setNodeMarkup(h,null,qt(d.attrs,s-p,d.attrs.colspan-(s-p))),n.insert(h+d.nodeSize,d.type.createAndFill(qt(d.attrs,0,s-p))),c+=d.attrs.rowspan-1}}return a}function Su(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=G.get(o);const{top:l,left:a}=r,c=a+i.width,f=l+i.height,u=n.tr;let d=0;function p(){if(o=t?u.doc.nodeAt(t-1):u.doc,!o)throw new Error("No table found");s=G.get(o),d=u.mapping.maps.length}wT(u,s,o,t,c,f,d)&&p(),bu(u,s,o,t,a,c,l,d)&&p(),bu(u,s,o,t,a,c,f,d)&&p(),vu(u,s,o,t,l,f,a,d)&&p(),vu(u,s,o,t,l,f,c,d)&&p();for(let h=l;h<f;h++){const m=s.positionAt(h,a,o),g=s.positionAt(h,c,o);u.replace(u.mapping.slice(d).map(m+t),u.mapping.slice(d).map(g+t),new w(i.rows[h-l],0,0))}p(),u.setSelection(new H(u.doc.resolve(t+s.positionAt(l,a,o)),u.doc.resolve(t+s.positionAt(f-1,c-1,o)))),e(u)}var xT=Ml({ArrowLeft:Ir("horiz",-1),ArrowRight:Ir("horiz",1),ArrowUp:Ir("vert",-1),ArrowDown:Ir("vert",1),"Shift-ArrowLeft":Dr("horiz",-1),"Shift-ArrowRight":Dr("horiz",1),"Shift-ArrowUp":Dr("vert",-1),"Shift-ArrowDown":Dr("vert",1),Backspace:Pr,"Mod-Backspace":Pr,Delete:Pr,"Mod-Delete":Pr});function Gr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Ir(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof H)return Gr(t,r,R.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Kp(i,n,e);if(s==null)return!1;if(n=="horiz")return Gr(t,r,R.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=jp(l,n,e);let c;return a?c=R.near(a,1):e<0?c=R.near(t.doc.resolve(l.before(-1)),-1):c=R.near(t.doc.resolve(l.after(-1)),1),Gr(t,r,c)}}}function Dr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof H)s=o;else{const a=Kp(i,n,e);if(a==null)return!1;s=new H(t.doc.resolve(a))}const l=jp(s.$headCell,n,e);return l?Gr(t,r,new H(s.$anchorCell,l)):!1}}function Pr(n,e){const t=n.selection;if(!(t instanceof H))return!1;if(e){const r=n.tr,i=ue(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new w(i,0,0))}),r.docChanged&&e(r)}return!0}function CT(n,e){const t=n.state.doc,r=Pn(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new H(r))),!0):!1}function OT(n,e,t){if(!De(n.state))return!1;let r=bT(t);const i=n.state.selection;if(i instanceof H){r||(r={width:1,height:1,rows:[b.from(hl(ue(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=G.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=ST(r,l.right-l.left,l.bottom-l.top),Su(n.state,n.dispatch,s,l,r),!0}else if(r){const o=mo(n.state),s=o.start(-1);return Su(n.state,n.dispatch,s,G.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function kT(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=wu(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof H)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Pn(n.state.selection.$anchor))!=null&&((t=us(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let f=us(n,c);const u=vt.getState(n.state)==null;if(!f||!ua(a,f))if(u)f=a;else return;const d=new H(a,f);if(u||!n.state.selection.eq(d)){const p=n.state.tr.setSelection(d);u&&p.setMeta(vt,a.pos),n.dispatch(p)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),vt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(vt,-1))}function l(a){const c=a,f=vt.getState(n.state);let u;if(f!=null)u=n.state.doc.resolve(f);else if(wu(n,c.target)!=r&&(u=us(n,e),!u))return s();u&&o(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Kp(n,e,t){if(!(n.state.selection instanceof z))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function wu(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function us(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Pn(n.state.doc.resolve(t.pos)):null}var AT=class{constructor(n,e){this.node=n,this.cellMinWidth=e,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")),pl(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,pl(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function pl(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const f=n.firstChild;if(f){for(let u=0,d=0;u<f.childCount;u++){const{colspan:p,colwidth:h}=f.child(u).attrs;for(let m=0;m<p;m++,d++){const g=i==d?o:h&&h[m],y=g?g+"px":"";l+=g||r,g||(a=!1),c?(c.style.width!=y&&(c.style.width=y),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;c;){const u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ce=new Nn("tableColumnResizing");function TT({handleWidth:n=5,cellMinWidth:e=25,View:t=AT,lastColumnResizable:r=!0}={}){const i=new Yt({key:Ce,state:{init(o,s){var l,a;const c=(a=(l=i.spec)==null?void 0:l.props)==null?void 0:a.nodeViews,f=ue(s.schema).table.name;return t&&c&&(c[f]=(u,d)=>new t(u,e,d)),new ET(-1,!1)},apply(o,s){return s.apply(o)}},props:{attributes:o=>{const s=Ce.getState(o);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,s)=>{MT(o,s,n,e,r)},mouseleave:o=>{NT(o)},mousedown:(o,s)=>{RT(o,s,e)}},decorations:o=>{const s=Ce.getState(o);if(s&&s.activeHandle>-1)return zT(o,s.activeHandle)},nodeViews:{}}});return i}var ET=class Yr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ce);if(r&&r.setHandle!=null)return new Yr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Yr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return dl(e.doc.resolve(i))||(i=-1),new Yr(i,t.dragging)}return t}};function MT(n,e,t,r,i){const o=Ce.getState(n.state);if(o&&!o.dragging){const s=DT(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=xu(n,e,"left",t):c-e.clientX<=t&&(l=xu(n,e,"right",t))}if(l!=o.activeHandle){if(!i&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),f=G.get(c),u=a.start(-1);if(f.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==f.width-1)return}Jp(n,l)}}}function NT(n){const e=Ce.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Jp(n,-1)}function RT(n,e,t){var r;const i=(r=n.dom.ownerDocument.defaultView)!=null?r:window,o=Ce.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const s=n.state.doc.nodeAt(o.activeHandle),l=IT(n,o.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Ce,{setDragging:{startX:e.clientX,startWidth:l}}));function a(f){i.removeEventListener("mouseup",a),i.removeEventListener("mousemove",c);const u=Ce.getState(n.state);u!=null&&u.dragging&&(PT(n,u.activeHandle,Cu(u.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Ce,{setDragging:null})))}function c(f){if(!f.which)return a(f);const u=Ce.getState(n.state);if(u&&u.dragging){const d=Cu(u.dragging,f,t);$T(n,u.activeHandle,d,t)}}return i.addEventListener("mouseup",a),i.addEventListener("mousemove",c),e.preventDefault(),!0}function IT(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function DT(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function xu(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=Pn(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=G.get(l.node(-1)),c=l.start(-1),f=a.map.indexOf(l.pos-c);return f%a.width==0?-1:c+a.map[f-1]}function Cu(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Jp(n,e){n.dispatch(n.state.tr.setMeta(Ce,{setHandle:e}))}function PT(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=G.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const f=c*o.width+l;if(c&&o.map[f]==o.map[f-o.width])continue;const u=o.map[f],d=i.nodeAt(u).attrs,p=d.colspan==1?0:l-o.colCount(u);if(d.colwidth&&d.colwidth[p]==t)continue;const h=d.colwidth?d.colwidth.slice():BT(d.colspan);h[p]=t,a.setNodeMarkup(s+u,null,{...d,colwidth:h})}a.docChanged&&n.dispatch(a)}function $T(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=G.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&pl(o,a.firstChild,a,r,l,t)}function BT(n){return Array(n).fill(0)}function zT(n,e){const t=[],r=n.doc.resolve(e),i=r.node(-1);if(!i)return J.empty;const o=G.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let a=0;a<o.height;a++){const c=l+a*o.width;if((l==o.width-1||o.map[c]!=o.map[c+1])&&(a==0||o.map[c]!=o.map[c-o.width])){const f=o.map[c],u=s+f+i.nodeAt(f).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(he.widget(u,d))}}return J.create(n.doc,t)}function qe(n){const e=n.selection,t=mo(n),r=t.node(-1),i=t.start(-1),o=G.get(r);return{...e instanceof H?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function qp(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;fT(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Vp(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?ue(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function LT(n,e){if(!De(n))return!1;if(e){const t=qe(n);e(qp(n.tr,t,t.left))}return!0}function FT(n,e){if(!De(n))return!1;if(e){const t=qe(n);e(qp(n.tr,t,t.right))}return!0}function _T(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),f=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,qt(f,i-e.colCount(a)));else{const u=n.mapping.slice(o).map(r+a);n.delete(u,u+c.nodeSize)}s+=f.rowspan}}function jT(n,e){if(!De(n))return!1;if(e){const t=qe(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;_T(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=G.get(o)}e(r)}return!0}function VT(n,e,t){var r;const i=ue(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Gp(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;VT(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const u=e.map[f],d=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,{...d,rowspan:d.rowspan+1}),c+=d.colspan-1}else{const u=a==null?ue(r.type.schema).cell:(o=r.nodeAt(e.map[f+a*e.width]))==null?void 0:o.type,d=u==null?void 0:u.createAndFill();d&&l.push(d)}return n.insert(s,ue(r.type.schema).row.create(null,l)),n}function WT(n,e){if(!De(n))return!1;if(e){const t=qe(n);e(Gp(n.tr,t,t.top))}return!0}function HT(n,e){if(!De(n))return!1;if(e){const t=qe(n);e(Gp(n.tr,t,t.bottom))}return!0}function UT(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const u=e.map[f];if(!a.has(u)){if(a.add(u),i>0&&u==e.map[f-e.width]){const d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d,rowspan:d.rowspan-1}),c+=d.colspan-1}else if(i<e.height&&u==e.map[f+e.width]){const d=t.nodeAt(u),p=d.attrs,h=d.type.create({...p,rowspan:d.attrs.rowspan-1},d.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),h),c+=p.colspan-1}}}}function KT(n,e){if(!De(n))return!1;if(e){const t=qe(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;UT(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=G.get(t.table)}e(r)}return!0}function Ou(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function JT({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function qT(n,e){const t=n.selection;if(!(t instanceof H)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=qe(n),{map:i}=r;if(JT(i,r))return!1;if(e){const o=n.tr,s={};let l=b.empty,a,c;for(let f=r.top;f<r.bottom;f++)for(let u=r.left;u<r.right;u++){const d=i.map[f*i.width+u],p=r.table.nodeAt(d);if(!(s[d]||!p))if(s[d]=!0,a==null)a=d,c=p;else{Ou(p)||(l=l.append(p.content));const h=o.mapping.map(d+r.tableStart);o.delete(h,h+p.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Vp(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=a+1+c.content.size,u=Ou(c)?a+1:f;o.replaceWith(u+r.tableStart,f+r.tableStart,l)}o.setSelection(new H(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function GT(n,e){const t=ue(n.schema);return YT(({node:r})=>t[r.type.spec.tableRole])(n,e)}function YT(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof H){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=lT(i.$from),!o)return!1;s=(r=Pn(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=qe(e),u=e.tr;for(let p=0;p<f.right-f.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let d;for(let p=f.top;p<f.bottom;p++){let h=f.map.positionAt(p,f.left,f.table);p==f.top&&(h+=o.nodeSize);for(let m=f.left,g=0;m<f.right;m++,g++)m==f.left&&p==f.top||u.insert(d=u.mapping.map(h+f.tableStart,1),n({node:o,row:p,col:m}).createAndFill(a[g]))}u.setNodeMarkup(s,n({node:o,row:f.top,col:f.left}),a[0]),i instanceof H&&u.setSelection(new H(u.doc.resolve(i.$anchorCell.pos),d?u.doc.resolve(d):void 0)),t(u)}return!0}}function XT(n,e){return function(t,r){if(!De(t))return!1;const i=mo(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof H?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function QT(n){return function(e,t){if(!De(e))return!1;if(t){const r=ue(e.schema),i=qe(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function ku(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function go(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?QT(n):function(t,r){if(!De(t))return!1;if(r){const i=ue(t.schema),o=qe(t),s=t.tr,l=ku("row",o,i),a=ku("column",o,i),f=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:f,right:1,bottom:o.map.height}:n=="row"?{left:f,top:0,right:o.map.width,bottom:1}:o,d=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(p=>{const h=p+o.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,d,m.attrs)}),r(s)}return!0}}go("row",{useDeprecatedLogic:!0});go("column",{useDeprecatedLogic:!0});var ZT=go("cell",{useDeprecatedLogic:!0});function eE(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function tE(n){return function(e,t){if(!De(e))return!1;const r=eE(mo(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(z.between(i,cT(i))).scrollIntoView())}return!0}}function nE(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function rE({allowTableNodeSelection:n=!1}={}){return new Yt({key:vt,state:{init(){return null},apply(e,t){const r=e.getMeta(vt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:dT,handleDOMEvents:{mousedown:kT},createSelectionBetween(e){return vt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:CT,handleKeyDown:xT,handlePaste:OT},appendTransaction(e,t,r){return mT(r,Up(r,t),n)}})}exports.AllSelection=Oe;exports.CellSelection=H;exports.DOMParser=vn;exports.DOMSerializer=Gt;exports.Decoration=he;exports.DecorationSet=J;exports.EditorState=un;exports.EditorView=Oy;exports.Fragment=b;exports.Node=Ne;exports.NodeSelection=E;exports.Plugin=Yt;exports.PluginKey=Nn;exports.ReplaceAroundStep=ne;exports.ReplaceStep=te;exports.Schema=pm;exports.Selection=R;exports.Slice=w;exports.TextSelection=z;exports.Transform=vl;exports.VisibilitySensor=Dw;exports.addColumnAfter=FT;exports.addColumnBefore=LT;exports.addRowAfter=HT;exports.addRowBefore=WT;exports.canJoin=Mn;exports.canSplit=yl;exports.clamp=DO;exports.clsx=sb;exports.columnResizing=TT;exports.createParagraphNear=Ky;exports.cva=Rw;exports.debounce=Op;exports.deepEqual=Mw;exports.deleteColumn=jT;exports.deleteRow=KT;exports.deleteSelection=Py;exports.deleteTable=nE;exports.differenceBy=Jk;exports.dropCursor=qA;exports.exitCode=Uy;exports.find=LA;exports.findWrapping=gl;exports.fixTables=Up;exports.gapCursor=QA;exports.goToNextCell=tE;exports.history=JA;exports.isNumber=Gk;exports.joinBackward=$y;exports.joinDown=Vy;exports.joinForward=Fy;exports.joinPoint=bl;exports.joinTextblockBackward=By;exports.joinTextblockForward=zy;exports.joinUp=jy;exports.keymap=Dy;exports.lift=Wy;exports.liftEmptyBlock=Jy;exports.liftListItem=nb;exports.liftTarget=En;exports.mergeCells=qT;exports.newlineInCode=Hy;exports.redo=_p;exports.registerCustomProtocol=BA;exports.reset=$A;exports.selectNodeBackward=Ly;exports.selectNodeForward=_y;exports.selectParentNode=qy;exports.selectTextblockEnd=Xy;exports.selectTextblockStart=Yy;exports.setBlockType=Zy;exports.setCellAttr=XT;exports.sinkListItem=ob;exports.splitCell=GT;exports.tableEditing=rE;exports.throttle=pA;exports.toggleHeader=go;exports.toggleHeaderCell=ZT;exports.tokenize=Bp;exports.truncate=bA;exports.twMerge=Lb;exports.undo=Fp;exports.wrapIn=Qy;exports.wrapInList=eb;