@paroicms/tiptap-editor-plugin 1.0.4 → 1.0.6

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,64 +1,4 @@
1
- function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"English",fr:"French",es:"Spanish",de:"German",it:"Italian",pt:"Portuguese"},fr:{en:"Anglais",fr:"Français",es:"Espagnol",de:"Allemand",it:"Italien",pt:"Portugais"},es:{en:"Inglés",fr:"Francés",es:"Español",de:"Alemán",it:"Italiano",pt:"Portugués"},de:{en:"Englisch",fr:"Französisch",es:"Spanisch",de:"Deutsch",it:"Italienisch",pt:"Portugiesisch"},it:{en:"Inglese",fr:"Francese",es:"Spagnolo",de:"Tedesco",it:"Italiano",pt:"Portoghese"},pt:{en:"Inglês",fr:"Francês",es:"Espanhol",de:"Alemão",it:"Italiano",pt:"Português"}},Ga=Object.keys(Bf);function zf(n,{pluginLanguages:e,siteLanguages:t=[]}){if(e.includes(n)||Ga.includes(n)&&e.includes(n))return n;const r=t.find(i=>Ga.includes(i)&&e.includes(i));return r||(e.includes("en")?"en":e[0]??"en")}function Ae(n){this.content=n}Ae.prototype={constructor:Ae,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Ae(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ae(t)},addToStart:function(n,e){return new Ae([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ae(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Ae(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=Ae.from(n),n.size?new Ae(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ae.from(n),n.size?new Ae(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ae.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}};Ae.from=function(n){if(n instanceof Ae)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ae(e)};function Pc(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Pc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Bc(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=Bc(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class S{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,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new S(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 s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new S(r,i)}cutByIndex(e,t){return e==t?S.empty:e==0&&t==this.content.length?this:new S(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new S(i,s)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(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 Pc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Bc(this,e,t,r)}findIndex(e){if(e==0)return Wr(0,e);if(e==this.size)return Wr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Wr(t+1,s):Wr(t,r);r=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 S.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new S(t||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const As={index:0,offset:0};function Wr(n,e){return As.index=n,As.offset=e,As}function di(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(!di(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!di(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let te=class io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&di(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 io.none;if(e instanceof io)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};te.none=[];class ui extends Error{}class O{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=Hc(this.content,e+this.openStart,t);return r&&new O(r,this.openStart,this.openEnd)}removeBetween(e,t){return new O(zc(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 O.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 O(S.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new O(e,r,i)}}O.empty=new O(S.empty,0,0);function zc(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(zc(s.content,e-i-1,t-i-1)))}function Hc(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Hc(o.content,e-s-1,t,o);return a&&n.replaceChild(i,o.copy(a))}function Hf(n,e,t){if(t.openStart>n.depth)throw new ui("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ui("Inconsistent open depths");return Fc(n,e,t,0)}function Fc(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Fc(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return bn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Ff(t,n);return bn(s,Vc(n,o,a,e,r))}else return bn(s,hi(n,e,r))}function Uc(n,e){if(!e.type.compatibleContent(n.type))throw new ui("Cannot join "+e.type.name+" onto "+n.type.name)}function so(n,e,t){let r=n.node(t);return Uc(r,e.node(t)),r}function gn(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 or(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(gn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)gn(i.child(a),r);e&&e.depth==t&&e.textOffset&&gn(e.nodeBefore,r)}function bn(n,e){return n.type.checkContent(e),n.copy(e)}function Vc(n,e,t,r,i){let s=n.depth>i&&so(n,e,i+1),o=r.depth>i&&so(t,r,i+1),a=[];return or(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(Uc(s,o),gn(bn(s,Vc(n,e,t,r,i+1)),a)):(s&&gn(bn(s,hi(n,e,i+1)),a),or(e,t,i,a),o&&gn(bn(o,hi(t,r,i+1)),a)),or(r,null,i,a),new S(a)}function hi(n,e,t){let r=[];if(or(null,n,t,r),n.depth>t){let i=so(n,e,t+1);gn(bn(i,hi(n,e,t+1)),r)}return or(e,null,t,r),new S(r)}function Ff(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(S.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class yr{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 fi(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,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new yr(t,r,s)}static resolveCached(e,t){let r=Ja.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Ja.set(e,r=new Uf);let i=r.elts[r.i]=yr.resolve(e,t);return r.i=(r.i+1)%Vf,i}}class Uf{constructor(){this.elts=[],this.i=0}}const Vf=12,Ja=new WeakMap;class fi{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 Kf=Object.create(null);class dt{constructor(e,t,r,i=te.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||S.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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&&di(this.attrs,t||e.defaultAttrs||Kf)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new dt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new dt(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 O.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new O(c,i.depth-o,s.depth-o)}replace(e,t,r){return Hf(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 yr.resolveCached(this,e)}resolveNoCache(e){return yr.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.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()+")"),Kc(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=S.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.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=te.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(!te.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=S.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}dt.prototype.text=void 0;class pi extends dt{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):Kc(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 pi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pi(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 Kc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class En{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Wf(e,t);if(r.next==null)return En.empty;let i=Wc(r);r.next&&r.err("Unexpected trailing text");let s=Xf(Yf(i));return Qf(s,r),s}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 s=t;i&&s<r;s++)i=i.matchType(e.child(s).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 s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return S.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,a.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let 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(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.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 s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`\n`)}}En.empty=new En(!0);class Wf{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 Wc(n){let e=[];do{e.push(jf(n))}while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jf(n){let e=[];do{e.push(qf(n))}while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qf(n){let e=Zf(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=Gf(n,e);else break;return e}function Za(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Gf(n,e){let t=Za(n),r=t;return n.eat(",")&&(n.next!="}"?r=Za(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Jf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Zf(n){if(n.eat("(")){let e=Wc(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=Jf(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 Yf(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function jc(n,e){return e-n}function Ya(n,e){let t=[];return r(e),t.sort(jc);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Xf(n){let e=Object.create(null);return t(Ya(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);Ya(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new En(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(jc);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Qf(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qc(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 Gc(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Jc(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 s=n[i];s.validate&&s.validate(e[i])}}function Zc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new tp(n,r,e[r]);return t}let Xa=class Yc{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=Zc(e,r.attrs),this.defaultAttrs=qc(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==En.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Gc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dt(this,this.computeAttrs(e),S.from(t),te.setFrom(r))}createChecked(e=null,t,r){return t=S.from(t),this.checkContent(t),new dt(this,this.computeAttrs(e),t,te.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=S.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(S.empty,!0);return s?new dt(this,e,t.append(s),te.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){Jc(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:te.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Yc(s,t,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ep(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class tp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ep(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ns{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Zc(e,i.attrs),this.excluded=null;let s=qc(this.attrs);this.instance=s?new te(this,s):null}create(e=null){return!e&&this.instance?this.instance:new te(this,Gc(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ns(s,i++,t,o)),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){Jc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xc{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=Ae.from(e.nodes),t.marks=Ae.from(e.marks||{}),this.nodes=Xa.compile(this.spec.nodes,this),this.marks=ns.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 s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=En.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Qa(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Qa(this,o.split(" "))}this.nodeFromJSON=i=>dt.fromJSON(this,i),this.markFromJSON=i=>te.fromJSON(this,i),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 Xa){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 pi(r,r.defaultAttrs,e,te.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qa(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function np(n){return n.tag!=null}function rp(n){return n.style!=null}class qt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(np(i))this.tags.push(i);else if(rp(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new tl(this,t,!1);return r.addAll(e,te.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new tl(this,t,!0);return r.addAll(e,te.none,t.from,t.to),O.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(op(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=nl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=nl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qt(e,qt.schemaRules(e)))}}const Qc={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},ip={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ed={ol:!0,ul:!0},kr=1,oo=2,ar=4;function el(n,e,t){return e!=null?(e?kr:0)|(e==="full"?oo:0):n&&n.whitespace=="pre"?kr|oo:t&~ar}class jr{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=te.none,this.match=s||(o&ar?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(S.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&kr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=S.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(S.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&&!Qc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class tl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=el(null,t.preserveWhitespace,0)|(r?ar:0);i?s=new jr(i.type,i.attrs,te.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new jr(null,null,te.none,!0,null,o):s=new jr(e.schema.topNodeType,null,te.none,!0,null,o),this.nodes=[s],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,s=i.options&oo?"full":this.localPreserveWS||(i.options&kr)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`\n`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else 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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;ed.hasOwnProperty(o)&&this.parser.normalizeLists&&sp(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:ip.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Qc.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`\n`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.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(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=te.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):rl(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=el(e,s,o.options);o.options&ar&&o.content.length==0&&(a|=ar);let l=te.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):rl(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new jr(e,t,l,i,null,a)),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;this.localPreserveWS&&(this.nodes[t].options|=kr)}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),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(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 sp(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ed.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function op(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function nl(n){let e={};for(let t in n)e[t]=n[t];return e}function rl(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class An{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ns(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ii(Ns(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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ii(Ns(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return ii(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new An(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=il(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return il(e.marks)}}function il(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ns(n){return n.document||window.document}const sl=new WeakMap;function ap(n){let e=sl.get(n);return e===void 0&&sl.set(n,e=lp(n)),e}function lp(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 ii(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],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=ap(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=ii(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const td=65535,nd=Math.pow(2,16);function cp(n,e){return n+e*nd}function ol(n){return n&td}function dp(n){return(n-(n&td))/nd}const rd=1,id=2,si=4,sd=8;class ao{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&sd)>0}get deletedBefore(){return(this.delInfo&(rd|si))>0}get deletedAfter(){return(this.delInfo&(id|si))>0}get deletedAcross(){return(this.delInfo&si)>0}}class Je{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Je.empty)return Je.empty}recover(e){let t=0,r=ol(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+dp(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,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+i+(h<0?0:d);if(r)return f;let p=e==(t<0?l:u)?null:cp(a/3,e-l),m=e==l?id:e==u?rd:si;return(t<0?e!=l:e!=u)&&(m|=sd),new ao(f,m,p)}i+=d-c}return r?e+i:new ao(e+i,0,null)}touches(e,t){let r=0,i=ol(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new Je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Je.empty:new Je(e<0?[0,-e,0]:[0,0,e])}}Je.empty=new Je([]);class vr{constructor(e,t,r=0,i=(e?e.length:0)){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),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 vr;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 s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new ao(e,i,null)}}const _s=Object.create(null);class Be{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_s[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 _s)throw new RangeError("Duplicate use of step JSON ID "+e);return _s[e]=t,t.prototype.jsonID=e,t}}class ye{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,t,r,i){try{return ye.ok(e.replace(t,r,i))}catch(s){if(s instanceof ui)return ye.fail(s.message);throw s}}}function zo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(zo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return S.fromArray(r)}class Kt extends Be{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)),s=new O(zo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,s)}invert(){return new ct(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 Kt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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 Kt(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("addMark",Kt);class ct extends Be{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 O(zo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,r)}invert(){return new Kt(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 ct(t.pos,r.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(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 ct(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("removeMark",ct);class Wt extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new O(S.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 xn(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))}}Be.jsonID("addNodeMark",Wt);class xn extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new O(S.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 xn(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 xn(t.pos,e.markFromJSON(t.mark))}}Be.jsonID("removeNodeMark",xn);class Se extends Be{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&lo(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(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 Se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||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?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(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?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(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 Se(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}}Be.jsonID("replace",Se);class we extends Be{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(lo(e,this.from,this.gapFrom)||lo(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ye.fromReplace(e,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new Je([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 we(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new we(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 we(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}}Be.jsonID("replaceAround",we);function lo(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function up(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:i.push(o=new ct(h,f,u[m])));a&&a.to==h?a.to=f:s.push(a=new Kt(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function hp(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ns){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ct(o.from,o.to,o.style)))}function Ho(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Se(a,d,O.empty));else{r=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new ct(a,d,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new O(S.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(S.empty,!0);n.replace(a,a,new O(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function fp(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Zn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!fp(i,s,o))break}return null}function pp(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=S.empty,u=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,d=S.from(r.node(p).copy(d)),u++):l--;let h=S.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=S.from(i.node(p).copy(h)),f++):c++;n.step(new we(l,c,o,a,new O(d.append(h),u,f),d.size-u,!0))}function Fo(n,e,t=null,r=n){let i=mp(n,e),s=i&&gp(r,e);return s?i.map(al).concat({type:e,attrs:t}).concat(s.map(al)):null}function al(n){return{type:n,attrs:null}}function mp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function gp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function bp(n,e,t){let r=S.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new we(i,s,i,s,new O(r,0,0),t.length,!0))}function yp(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&kp(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&ad(n,o,a,s),Ho(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let d=n.mapping.slice(s),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new we(u,h,u+1,h-1,new O(S.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&od(n,o,a,s),!1}})}function od(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ad(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`\n`))}})}function kp(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function vp(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new we(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new O(S.from(o),0,0),1,!0))}function _t(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Ep(n,e,t=1,r){let i=n.doc.resolve(e),s=S.empty,o=S.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=S.from(i.node(a).copy(s));let d=r&&r[c];o=S.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new Se(e,e,new O(s.append(o),t,t),!0))}function tn(n,e){let t=n.resolve(e),r=t.index();return ld(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function xp(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function ld(n,e){return!!(n&&e&&!n.isLeaf&&xp(n,e))}function rs(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&ld(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Sp(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);ad(n,d.node(),d.before(),a)}o.inlineContent&&Ho(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new Se(c,l.map(e+t,-1),O.empty,!0)),r===!0){let d=n.doc.resolve(c);od(n,d.node(),d.before(),n.steps.length)}return n}function wp(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function cd(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function is(n,e,t=e,r=O.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return dd(i,s,r)?new Se(e,t,r):new Tp(i,s,r).fit()}function dd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Tp{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=S.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 s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new O(s,o,a);return e>-1?new we(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Os(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(S.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Os(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new O(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=Os(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new O(nr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new O(nr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(ud(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=rr(this.placed,t,S.from(d)),this.frontier[t].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?O.empty:new O(nr(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new O(nr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Is(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Is(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Is(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?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=rr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=rr(this.placed,this.depth,S.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(S.empty,!0);t.childCount&&(this.placed=rr(this.placed,this.frontier.length,t))}}function nr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(nr(n.firstChild.content,e-1,t)))}function rr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(rr(n.lastChild.content,e-1,t)))}function Os(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ud(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ud(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(S.empty,!0)))),n.copy(r)}function Is(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Cp(t,s.content,o)?a:null}function Cp(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Mp(n){return n.spec.defining||n.spec.definingForContent}function Ap(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(dd(i,s,r))return n.step(new Se(e,t,r));let o=fd(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Mp(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let k=i.node(g-1),E=i.index(g-1);if(k.canReplaceWith(E,E,p.type,p.marks))return n.replace(i.before(g),b?s.after(g):t,new O(hd(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function hd(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(hd(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(S.empty,!0))}return n}function Np(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=wp(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new O(S.from(r),0,0))}function _p(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=fd(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function fd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Hn extends Be{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 ye.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ye.fromReplace(e,this.pos,this.pos+1,new O(S.from(i),0,t.isLeaf?0:1))}getMap(){return Je.empty}invert(e){return new Hn(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 Hn(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 Hn(t.pos,t.attr,t.value)}}Be.jsonID("attr",Hn);class Er extends Be{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 ye.ok(r)}getMap(){return Je.empty}invert(e){return new Er(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 Er(t.attr,t.value)}}Be.jsonID("docAttr",Er);let Un=class extends Error{};Un=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Un.prototype=Object.create(Error.prototype);Un.prototype.constructor=Un;Un.prototype.name="TransformError";class pd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Un(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=O.empty){let i=is(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new O(S.from(r),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Ap(this,e,t,r),this}replaceRangeWith(e,t,r){return Np(this,e,t,r),this}deleteRange(e,t){return _p(this,e,t),this}lift(e,t){return pp(this,e,t),this}join(e,t=1){return Sp(this,e,t),this}wrap(e,t){return bp(this,e,t),this}setBlockType(e,t=e,r,i=null){return yp(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return vp(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Hn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Er(e,t)),this}addNodeMark(e,t){return this.step(new Wt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof te)t.isInSet(r.marks)&&this.step(new xn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new xn(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return Ep(this,e,t,r),this}addMark(e,t,r){return up(this,e,t,r),this}removeMark(e,t,r){return hp(this,e,t,r),this}clearIncompatible(e,t,r){return Ho(this,e,t,r),this}}const Ls=Object.create(null);class j{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Op(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=O.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?O.empty:t),a==0&&dl(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),dl(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new H(e):Ln(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Ln(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Ln(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ye(e.node(0))}static atStart(e){return Ln(e,e,0,0,1)||new Ye(e)}static atEnd(e){return Ln(e,e,e.content.size,e.childCount,-1)||new Ye(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ls[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 Ls)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ls[e]=t,t.prototype.jsonID=e,t}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}j.prototype.visible=!0;class Op{constructor(e,t){this.$from=e,this.$to=t}}let ll=!1;function cl(n){!ll&&!n.parent.inlineContent&&(ll=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class H extends j{constructor(e,t=e){cl(e),cl(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 j.near(r);let i=e.resolve(t.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ss(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 H(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 s=j.findFrom(t,r,!0)||j.findFrom(t,-r,!0);if(s)t=s.$head;else return j.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(j.findFrom(e,-r,!0)||j.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new H(e,t)}}j.jsonID("text",H);class ss{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ss(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends j{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),s=e.resolve(i);return r?j.near(s):new B(s)}content(){return new O(S.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Uo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;j.jsonID("node",B);class Uo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new ss(r,r):new Uo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&B.isSelectable(r)?new B(t):j.near(t)}}class Ye extends j{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let r=j.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ye(e)}map(e){return new Ye(e)}eq(e){return e instanceof Ye}getBookmark(){return Ip}}j.jsonID("all",Ye);const Ip={map(){return this},resolve(n){return new Ye(n)}};function Ln(n,e,t,r,i,s=!1){if(e.inlineContent)return H.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(n,t-(i<0?a.nodeSize:0))}else{let l=Ln(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function dl(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;let s=n.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}const ul=1,qr=2,hl=4;class Lp extends pd{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|ul)&~qr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ul)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qr,this}ensureMarks(e){return te.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&qr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~qr,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)||te.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 s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(j.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|=hl,this}get scrolledIntoView(){return(this.updated&hl)>0}}function fl(n,e){return!e||!n?n:n.bind(e)}class ir{constructor(e,t,r){this.name=e,this.init=fl(t.init,r),this.apply=fl(t.apply,r)}}const Rp=[new ir("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ir("selection",{init(n,e){return n.selection||j.atStart(e.doc)},apply(n){return n.selection}}),new ir("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ir("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Rs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Rp.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 ir(r.key,r.spec.state,r))})}}class zn{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 s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new zn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Lp(this)}static create(e){let t=new Rs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zn(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 Rs(this.schema,e.plugins),r=t.fields,i=new zn(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].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],s=i.spec.state;s&&s.toJSON&&(t[r]=s.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 Rs(e.schema,e.plugins),s=new zn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=dt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=j.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function md(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=md(i,e,{})),t[r]=i}return t}class ne{constructor(e){this.spec=e,this.props={},e.props&&md(e.props,this,this.props),this.key=e.key?e.key.key:gd("plugin")}getState(e){return e[this.key]}}const Ds=Object.create(null);function gd(n){return n in Ds?n+"$"+ ++Ds[n]:(Ds[n]=0,n+"$")}class ce{constructor(e="key"){this.key=gd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Vo=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function bd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const yd=(n,e,t)=>{let r=bd(n,t);if(!r)return!1;let i=Ko(r);if(!i){let o=r.blockRange(),a=o&&Zn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Md(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Vn(s,"end")||B.isSelectable(s)))for(let o=r.depth;;o--){let a=is(n.doc,r.before(o),r.after(o),O.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Vn(s,"end")?j.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):B.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Dp=(n,e,t)=>{let r=bd(n,t);if(!r)return!1;let i=Ko(r);return i?kd(n,i,e):!1},$p=(n,e,t)=>{let r=Ed(n,t);if(!r)return!1;let i=Wo(r);return i?kd(n,i,e):!1};function kd(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=is(n.doc,s,l,O.empty);if(!c||c.from!=s||c instanceof Se&&c.slice.size>=l-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(H.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Vn(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 vd=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Ko(r)}let o=s&&s.nodeBefore;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ko(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 Ed(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const xd=(n,e,t)=>{let r=Ed(n,t);if(!r)return!1;let i=Wo(r);if(!i)return!1;let s=i.nodeAfter;if(Md(n,i,e,1))return!0;if(r.parent.content.size==0&&(Vn(s,"start")||B.isSelectable(s))){let o=is(n.doc,r.before(),r.after(),O.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Vn(s,"start")?j.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):B.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Sd=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Wo(r)}let o=s&&s.nodeAfter;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos)).scrollIntoView()),!0)};function Wo(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 Pp=(n,e)=>{let t=n.selection,r=t instanceof B,i;if(r){if(t.node.isTextblock||!tn(n.doc,t.from))return!1;i=t.from}else if(i=rs(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(B.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Bp=(n,e)=>{let t=n.selection,r;if(t instanceof B){if(t.node.isTextblock||!tn(n.doc,t.to))return!1;r=t.to}else if(r=rs(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},zp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Zn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},wd=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`\n`).scrollIntoView()),!0)};function jo(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 Hp=(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),s=t.indexAfter(-1),o=jo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(j.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Td=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ye||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(H.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Cd=(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 s=t.before();if(_t(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Zn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Fp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!_t(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=jo(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof H||e.selection instanceof Ye)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=_t(d.doc,u,s.length,s);if(h||(s[0]=a?{type:a}:null,h=_t(d.doc,u,s.length,s)),!h)return!1;if(d.split(u,s.length,s),!l&&c&&r.node(o).type!=a){let f=d.mapping.map(r.before(o)),p=d.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const Up=Fp(),Vp=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(B.create(n.doc,i))),!0)};function Kp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Md(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Kp(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,p=S.empty;for(let b=o.length-1;b>=0;b--)p=S.from(o[b].create(null,p));p=S.from(i.copy(p));let m=n.tr.step(new we(e.pos-1,f,e.pos,f,new O(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&tn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:j.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Zn(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Vn(s,"start",!0)&&Vn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let b=S.empty;for(let E=p.length-1;E>=0;E--)b=S.from(p[E].copy(b));let k=n.tr.step(new we(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new O(b,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Ad(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(H.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Wp=Ad(-1),jp=Ad(1);function qp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Fo(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function pl(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function qo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}qo(Vo,yd,vd);qo(Vo,xd,Sd);qo(wd,Td,Cd,Up);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Gp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return Jp(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Jp(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new fi(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new fi(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Fo(s,t,r,e);return a?(n&&Zp(n,e,a,i,t),!0):!1}function Zp(n,e,t,r,i){let s=S.empty;for(let d=t.length-1;d>=0;d--)s=S.from(t[d].type.create(t[d].attrs,s));n.step(new we(e.start-(r?2:0),e.end,e.start,e.end,new O(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&_t(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function Yp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Xp(e,t,n,s):Qp(e,t,s):!0:!1}}function Xp(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new we(s-1,o,s,o,new O(S.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new fi(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Zn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return tn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function Qp(n,e,t){let r=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?S.empty:S.from(i))))return!1;let u=s.pos,h=u+o.nodeSize;return r.step(new we(u-(a?1:0),h+(l?1:0),u+1,h-1,new O((a?S.empty:S.from(i.copy(S.empty))).append(l?S.empty:S.from(i.copy(S.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function em(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=S.from(c?n.create():null),u=new O(S.from(n.create(null,S.from(a.type.create(null,d)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new we(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const Ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Kn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let co=null;const At=function(n,e,t){let r=co||(co=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},tm=function(){co=null},Sn=function(n,e,t,r){return t&&(ml(n,e,t,r,-1)||ml(n,e,t,r,1))},nm=/^(img|br|input|textarea|hr)$/i;function ml(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:tt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Ir(n)||nm.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ne(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?tt(n):0}else return!1}}function tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function rm(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=tt(n)}else if(n.parentNode&&!Ir(n))e=Ne(n),n=n.parentNode;else return null}}function im(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&&!Ir(n))e=Ne(n)+1,n=n.parentNode;else return null}}function sm(n,e,t){for(let r=e==0,i=e==tt(n);r||i;){if(n==t)return!0;let s=Ne(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==tt(n)}}function Ir(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 as=function(n){return n.focusNode&&Sn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function dn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function om(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function am(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(tt(r.startContainer),r.startOffset)}}}const bt=typeof navigator<"u"?navigator:null,gl=typeof document<"u"?document:null,nn=bt&&bt.userAgent||"",uo=/Edge\/(\d+)/.exec(nn),Nd=/MSIE \d/.exec(nn),ho=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),We=!!(Nd||ho||uo),Gt=Nd?document.documentMode:ho?+ho[1]:uo?+uo[1]:0,nt=!We&&/gecko\/(\d+)/i.test(nn);nt&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const fo=!We&&/Chrome\/(\d+)/.exec(nn),De=!!fo,_d=fo?+fo[1]:0,Fe=!We&&!!bt&&/Apple Computer/.test(bt.vendor),Wn=Fe&&(/Mobile\/\w+/.test(nn)||!!bt&&bt.maxTouchPoints>2),et=Wn||(bt?/Mac/.test(bt.platform):!1),lm=bt?/Win/.test(bt.platform):!1,Nt=/Android \d/.test(nn),Lr=!!gl&&"webkitFontSmoothing"in gl.documentElement.style,cm=Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function dm(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 wt(n,e){return typeof n=="number"?n:n[e]}function um(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 bl(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Kn(o);continue}let a=o,l=a==s.body,c=l?dm(s):um(a),d=0,u=0;if(e.top<c.top+wt(r,"top")?u=-(c.top-e.top+wt(i,"top")):e.bottom>c.bottom-wt(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+wt(i,"top")-c.top:e.bottom-c.bottom+wt(i,"bottom")),e.left<c.left+wt(r,"left")?d=-(c.left-e.left+wt(i,"left")):e.right>c.right-wt(r,"right")&&(d=e.right-c.right+wt(i,"right")),d||u)if(l)s.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Kn(o)}}function hm(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Od(n.dom)}}function Od(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Kn(r));return e}function fm({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Id(t,r==0?0:r-e)}function Id(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let On=null;function pm(n){if(n.setActive)return n.setActive();if(On)return n.focus(On);let e=Od(n);n.focus(On==null?{get preventScroll(){return On={preventScroll:!0},!0}}:void 0),On||(On=!1,Id(e,0))}function Ld(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=At(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=d,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?mm(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Ld(t,i)}function mm(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 s=Pt(r,1);if(s.top!=s.bottom&&Go(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Go(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function gm(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function bm(n,e,t){let{node:r,offset:i}=Ld(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function ym(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Rd(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)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Go(e,c))return Rd(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function km(n,e){let t=n.dom.ownerDocument,r,i=0,s=am(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Go(e,c)||(o=Rd(n.dom,e,c),!o))return null}if(Fe)for(let c=o;r&&c;c=Kn(c))c.draggable&&(r=void 0);if(o=gm(o,e),r){if(nt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;Lr&&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?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=ym(n,r,i,e))}a==null&&(a=bm(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function yl(n){return n.top<n.bottom||n.left<n.right}function Pt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(yl(r))return r}return Array.prototype.find.call(t,yl)||n.getBoundingClientRect()}const vm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dd(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Lr||nt;if(r.nodeType==3)if(o&&(vm.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Pt(At(r,i,i),t);if(nt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Pt(At(r,i-1,i-1),-1);if(c.top==l.top){let d=Pt(At(r,i,i+1),-1);if(d.top!=l.top)return Qn(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(l--,d=1):t<0?l--:c++,Qn(Pt(At(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return $s(l.getBoundingClientRect(),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];if(l.nodeType==1)return $s(l.getBoundingClientRect(),!0)}return $s(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?At(l,tt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Qn(Pt(c,1),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?At(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Qn(Pt(c,-1),!0)}return Qn(Pt(r.nodeType==3?At(r):r,-t),t>=0)}function Qn(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 $s(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 $d(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 Em(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return $d(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Dd(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=At(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const xm=/[\u0590-\u08ac]/;function Sm(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!xm.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:$d(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let kl=null,vl=null,El=!1;function wm(n,e,t){return kl==e&&vl==t?El:(kl=e,vl=t,El=t=="up"||t=="down"?Em(n,e,t):Sm(n,e,t))}const rt=0,xl=1,un=2,yt=3;class Rr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=rt,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 s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Ne(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 s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.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 s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}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 s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Bd){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Pd&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Ne(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Ne(s.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,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ne(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Ne(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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 s=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((nt||Fe)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`\n`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ne(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&Fe)&&Sn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Sn(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&nt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}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 s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?un:xl,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?un:yt}r=o}this.dirty=un}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?un:xl;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Pd extends Rr{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==rt&&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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Tm extends Rr{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 wn extends Rr{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=An.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=rt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=rt}}slice(e,t,r){let i=wn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=mo(s,t,o,r)),e>0&&(s=mo(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Jt extends Rr{constructor(e,t,r,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=An.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Fd(d,r,t),c?l=new Cm(e,t,r,i,d,u||null,h,c,s,o+1):t.isText?new ls(e,t,r,i,d,h,s):new Jt(e,t,r,i,d,u||null,h,s,o+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=()=>S.empty)}return e}matchesNode(e,t,r){return this.dirty==rt&&e.eq(this.node)&&mi(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,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Am(this,o&&o.node,e);Om(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?te.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==un)&&(o&&this.protectLocalComposition(e,o),zd(this.contentDOM,this.children,e),Wn&&Im(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Lm(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Tm(this,s,t,i);e.input.compositionNodes.push(o),this.children=mo(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==yt||!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=rt}updateOuterDeco(e){if(mi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Hd(this.dom,this.nodeDOM,po(this.outerDeco,this.node,t),po(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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Sl(n,e,t,r,i){Fd(r,e,n);let s=new Jt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class ls extends Jt{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,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==yt||this.dirty!=rt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=rt||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=rt,!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),s=document.createTextNode(i.text);return new ls(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Bd extends Rr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==rt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Cm extends Jt{constructor(e,t,r,i,s,o,a,l,c,d){super(e,t,r,i,s,o,a,c,d),this.spec=l}update(e,t,r,i){if(this.dirty==yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}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.root):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 zd(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=wl(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof wn){let l=r?r.previousSibling:n.lastChild;zd(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=wl(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const lr=function(n){n&&(this.nodeName=n)};lr.prototype=Object.create(null);const hn=[new lr];function po(n,e,t){if(n.length==0)return hn;let r=t?hn[0]:new lr,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new lr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new lr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Hd(n,e,t,r){if(t==hn&&r==hn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=hn[0]),i=l}Mm(i,a||hn[0],o)}return i}function Mm(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 s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);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 Fd(n,e,t){return Hd(n,n,hn,po(e,t,n.nodeType!=1))}function mi(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 wl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Am{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Nm(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,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=rt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=wn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==yt&&o.dom==o.contentDOM&&(o.dirty=un),o.update(e,t,r,s)?(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,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Jt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=yt&&mi(t,l.outerDeco));if(!h&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=un,u.updateChildren(i,o+1),u.dirty=rt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!mi(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Jt.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=Jt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),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 s=new Pd(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof wn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ls)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Fe||De)&&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 Bd(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 Nm(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof wn)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function _m(n,e){return n.type.side-e.type.side}function Om(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(_m);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(l=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function Im(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 Lm(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function mo(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(l.slice(t-c,l.size,r)))}return s}function Jo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(as(t)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&B.isSelectable(u)&&i.parent&&!(u.isInline&&sm(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new B(o==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;c=Zo(n,d,a,u)}return c}function Ud(n){return n.editable?n.hasFocus():Kd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ot(n,e=!1){let t=n.state.selection;if(Vd(n,t),!!Ud(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&De){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Sn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Dm(n);else{let{anchor:r,head:i}=t,s,o;Tl&&!(t instanceof H)&&(t.$from.parent.inlineContent||(s=Cl(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Cl(n,t.to))),n.docView.setSelection(r,i,n,e),Tl&&(s&&Ml(s),o&&Ml(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Rm(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Tl=Fe||De&&_d<63;function Cl(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Fe&&i&&i.contentEditable=="false")return Ps(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ps(i);if(s)return Ps(s)}}function Ps(n){return n.contentEditable="true",Fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ml(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Rm(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(()=>{(!Ud(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Dm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ne(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&Gt<=11&&(t.disabled=!0,t.disabled=!1)}function Vd(n,e){if(e instanceof B){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Al(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Al(n)}function Al(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Zo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||H.between(e,t,r)}function Nl(n){return n.editable&&!n.hasFocus()?!1:Kd(n)}function Kd(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 $m(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Sn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function go(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&j.findFrom(s,e)}function Bt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function _l(n,e,t){let r=n.state.selection;if(r instanceof H)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Bt(n,new H(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=go(n.state,e);return i&&i instanceof B?Bt(n,i):!1}else if(!(et&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?B.isSelectable(s)?Bt(n,new B(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Lr?Bt(n,new H(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Bt(n,new H(e>0?r.$to:r.$from));{let i=go(n.state,e);return i?Bt(n,i):!1}}}function gi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function cr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function In(n,e){return e<0?Pm(n):Bm(n)}function Pm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(nt&&t.nodeType==1&&r<gi(t)&&cr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(cr(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Wd(t))break;{let a=t.previousSibling;for(;a&&cr(a,-1);)i=t.parentNode,s=Ne(a),a=a.previousSibling;if(a)t=a,r=gi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?bo(n,t,r):i&&bo(n,i,s)}function Bm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=gi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(cr(a,1))s=t,o=++r;else break}else{if(Wd(t))break;{let a=t.nextSibling;for(;a&&cr(a,1);)s=a.parentNode,o=Ne(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=gi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&bo(n,s,o)}function Wd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function zm(n,e){for(;n&&e==n.childNodes.length&&!Ir(n);)e=Ne(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 Hm(n,e){for(;n&&!e&&!Ir(n);)e=Ne(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 bo(n,e,t){if(e.nodeType!=3){let s,o;(o=zm(e,t))?(e=o,t=0):(s=Hm(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(as(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ot(n)},50)}function Ol(n,e){let t=n.state.doc.resolve(e);if(!(De||lm)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Il(n,e,t){let r=n.state.selection;if(r instanceof H&&!r.empty||t.indexOf("s")>-1||et&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=go(n.state,e);if(o&&o instanceof B)return Bt(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ye?j.near(o,e):j.findFrom(o,e);return a?Bt(n,a):!1}return!1}function Ll(n,e){if(!(n.state.selection instanceof H))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Rl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Fm(n){if(!Fe||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;Rl(n,r,"true"),setTimeout(()=>Rl(n,r,"false"),20)}return!1}function Um(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Vm(n,e){let t=e.keyCode,r=Um(e);if(t==8||et&&t==72&&r=="c")return Ll(n,-1)||In(n,-1);if(t==46&&!e.shiftKey||et&&t==68&&r=="c")return Ll(n,1)||In(n,1);if(t==13||t==27)return!0;if(t==37||et&&t==66&&r=="c"){let i=t==37?Ol(n,n.state.selection.from)=="ltr"?-1:1:-1;return _l(n,i,r)||In(n,i)}else if(t==39||et&&t==70&&r=="c"){let i=t==39?Ol(n,n.state.selection.from)=="ltr"?1:-1:1;return _l(n,i,r)||In(n,i)}else{if(t==38||et&&t==80&&r=="c")return Il(n,-1,r)||In(n,-1);if(t==40||et&&t==78&&r=="c")return Fm(n)||Il(n,1,r)||In(n,1);if(r==(et?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Yo(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=n.someProp("clipboardSerializer")||An.fromSchema(n.state.schema),a=Yd(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Zd[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`\n\n`);return{dom:l,text:h,slice:e}}function jd(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return a=new O(S.from(n.state.schema.text(e.replace(/\r\n?/g,`\n`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(u)a=u;else{let h=i.marks(),{schema:f}=n.state,p=An.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=qm(t),Lr&&Gm(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||qt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Km.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Jm(Dl(a,+d[1],+d[2]),d[4]);else if(a=O.maxOpen(Wm(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Dl(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const Km=/^(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 Wm(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)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Gd(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Jd(o[o.length-1],s.length));let d=qd(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return S.from(o)}return n}function qd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function Gd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=Gd(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(S.from(qd(t,n,i+1))))}}function Jd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Jd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function yo(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=yo(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Dl(n,e,t){return e<n.openStart&&(n=new O(yo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new O(yo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Zd={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 $l=null;function Yd(){return $l||($l=document.implementation.createHTMLDocument("title"))}let Bs=null;function jm(n){let e=window.trustedTypes;return e?(Bs||(Bs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Bs.createHTML(n)):n}function qm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Yd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Zd[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=jm(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Gm(n){let e=n.querySelectorAll(De?"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 Jm(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:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=S.from(l.create(r[a+1],i)),s++,o++}return new O(i,s,o)}const Ue={},Ve={},Zm={touchstart:!0,touchmove:!0};class Ym{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Xm(n){for(let e in Ue){let t=Ue[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{eg(n,r)&&!Xo(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},Zm[e]?{passive:!0}:void 0)}Fe&&n.dom.addEventListener("input",()=>null),ko(n)}function jt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Qm(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 ko(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Xo(n,r))})}function Xo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function eg(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 tg(n,e){!Xo(n,e)&&Ue[e.type]&&(n.editable||!(e.type in Ve))&&Ue[e.type](n,e)}Ve.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Qd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Nt&&De&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wn&&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,dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Vm(n,t)?t.preventDefault():jt(n,"key")};Ve.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ve.keypress=(n,e)=>{let t=e;if(Qd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||et&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function cs(n){return{left:n.clientX,top:n.clientY}}function ng(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Qo(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Fn(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 rg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Fn(n,new B(t)),!0):!1}function ig(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof B&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(B.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Fn(n,B.create(n.state.doc,i)),!0):!1}function sg(n,e,t,r,i){return Qo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?ig(n,t):rg(n,t))}function og(n,e,t,r){return Qo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function ag(n,e,t,r){return Qo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||lg(n,t,r)}function lg(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Fn(n,H.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Fn(n,H.create(r,a+1,a+1+o.content.size));else if(B.isSelectable(o))Fn(n,B.create(r,a));else continue;return!0}}function ea(n){return bi(n)}const Xd=et?"metaKey":"ctrlKey";Ue.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=ea(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&ng(t,n.input.lastClick)&&!t[Xd]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(cs(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new cg(n,o,t,!!r)):(s=="doubleClick"?og:ag)(n,o.pos,o.inside,t)?t.preventDefault():jt(n,"pointer"))};class cg{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[Xd],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof B&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nt&&!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)),jt(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(()=>Ot(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(cs(e))),this.updateAllowDefault(e),this.allowDefault||!t?jt(this.view,"pointer"):sg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Fe&&this.mightDrag&&!this.mightDrag.node.isAtom||De&&!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)?(Fn(this.view,j.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):jt(this.view,"pointer")}move(e){this.updateAllowDefault(e),jt(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)}}Ue.touchstart=n=>{n.input.lastTouch=Date.now(),ea(n),jt(n,"pointer")};Ue.touchmove=n=>{n.input.lastTouch=Date.now(),jt(n,"pointer")};Ue.contextmenu=n=>ea(n);function Qd(n,e){return n.composing?!0:Fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const dg=Nt?5e3:-1;Ve.compositionstart=Ve.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),bi(n,!0),n.markCursor=null;else if(bi(n,!e.selection.empty),nt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}eu(n,dg)};Ve.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++,eu(n,20))};function eu(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>bi(n),e))}function tu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=hg());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ug(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=rm(e.focusNode,e.focusOffset),r=im(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function hg(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function bi(n,e=!1){if(!(Nt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),tu(n),e||n.docView&&n.docView.dirty){let t=Jo(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function fg(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 xr=We&&Gt<15||Wn&&cm<604;Ue.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=xr?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Yo(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):fg(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function mg(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?Sr(n,r.value,null,i,e):Sr(n,r.textContent,r.innerHTML,i,e)},50)}function Sr(n,e,t,r,i){let s=jd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||O.empty)))return!0;if(!s)return!1;let o=pg(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nu(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," "):""}Ve.paste=(n,e)=>{let t=e;if(n.composing&&!Nt)return;let r=xr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Sr(n,nu(r),r.getData("text/html"),i,t)?t.preventDefault():mg(n,t)};class ru{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const gg=et?"altKey":"ctrlKey";function iu(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[gg]}Ue.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(cs(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)o=B.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&&(o=B.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=Yo(n,a);(!t.dataTransfer.files.length||!De||_d>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(xr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",xr||t.dataTransfer.setData("text/plain",c),n.dragging=new ru(d,iu(n,t),o)};Ue.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ve.dragover=Ve.dragenter=(n,e)=>e.preventDefault();Ve.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(cs(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=jd(n,nu(t.dataTransfer),xr?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&iu(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||O.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?cd(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;if(a){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&B.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new B(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,k)=>p=k),c.setSelection(Zo(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Ue.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())&&Ot(n)},20))};Ue.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)};Ue.beforeinput=(n,e)=>{if(De&&Nt&&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",s=>s(n,dn(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 Ve)Ue[n]=Ve[n];function wr(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 yi{constructor(e,t){this.toDOM=e,this.spec=t||yn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new $e(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof yi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zt{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new $e(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Zt&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}static is(e){return e.type instanceof Zt}destroy(){}}class ta{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new $e(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof ta&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}destroy(){}}class $e{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new $e(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 $e(e,e,new yi(t,r))}static inline(e,t,r,i){return new $e(e,t,new Zt(r,i))}static node(e,t,r,i){return new $e(e,t,new ta(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zt}get widget(){return this.type instanceof yi}}const Rn=[],yn={};class ae{constructor(e,t){this.local=e.length?e:Rn,this.children=t.length?t:Rn}static create(e,t){return t.length?ki(t,e,0,yn):Re}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Re||e.maps.length==0?this:this.mapInner(e,t,0,0,r||yn)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?bg(this.children,o||[],e,t,r,i,s):o?new ae(o.sort(kn),Rn):Re}add(e,t){return t.length?this==Re?ae.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=ou(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,ki(d,a,c+1,yn)),s+=3}});let o=su(s?au(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ae(o.length?this.local.concat(o).sort(kn):this.local,i||this.children)}remove(e){return e.length==0||this==Re?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=Re?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ae(i,r):Re}forChild(e,t){if(this==Re)return this;if(t.isLeaf)return ae.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Zt){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new ae(i.sort(kn),Rn);return r?new Ft([a,r]):a}return r||Re}eq(e){if(this==e)return!0;if(!(e instanceof ae)||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 na(this.localsInner(e))}localsInner(e){if(this==Re)return Rn;if(e.inlineContent||!this.local.some(Zt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=na;const Re=ae.empty;class Ft{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,yn));return Ft.from(r)}forChild(e,t){if(t.isLeaf)return ae.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Re&&(s instanceof Ft?r=r.concat(s.members):r.push(s))}return Ft.from(r)}eq(e){if(!(e instanceof Ft)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?na(r?t:t.sort(kn)):Rn}static from(e){switch(e.length){case 0:return Re;case 1:return e[0];default:return new Ft(e.every(t=>t instanceof ae)?e:e.reduce((t,r)=>t.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function bg(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||h>k+d-u)continue;let E=a[b]+d-u;f>=E?a[b+1]=h<=E?-2:-1:h>=d&&g&&(a[b]+=g,a[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+s),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let h=t.map(n[c+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=a[c+2].mapInner(t,g,d+1,n[c]+s+1,o);b!=Re?(a[c]=u,a[c+1]=f,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=yg(a,n,e,t,i,s,o),d=ki(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ae(e.sort(kn),a)}function su(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 $e(i.from+e,i.to+e,i.type))}return t}function yg(n,e,t,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function ou(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function au(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ki(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let c=ou(n,a,l+t);if(c){s=!0;let d=ki(c,a,t+l+1,r);d!=Re&&i.push(l,l+a.nodeSize,d)}});let o=su(s?au(n):n,-t).sort(kn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ae(o,i):Re}function kn(n,e){return n.from-e.from||n.to-e.to}function na(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Pl(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Pl(e,i,r.copy(s.from,r.to)));break}}}return e}function Pl(n,e,t){for(;e<n.length&&kn(t,n[e])>0;)e++;n.splice(e,0,t)}function zs(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Re&&e.push(r)}),n.cursorWrapper&&e.push(ae.create(n.state.doc,[n.cursorWrapper.deco])),Ft.from(e)}const kg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},vg=We&&Gt<=11;class Eg{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 xg{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Eg,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]);We&&Gt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),vg&&(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,kg)),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(Nl(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(We&&Gt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sn(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 s=e.focusNode;s;s=Kn(s))t.add(s);for(let s=e.anchorNode;s;s=Kn(s))if(t.has(s)){r=s;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)&&Nl(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(nt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||Tg(e,u)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&as(r)&&(c=Jo(e))&&c.eq(j.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ot(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Sg(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ot(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 d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];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,s=e.nextSibling;if(We&&Gt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Ne(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Ne(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,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 Bl=new WeakMap,zl=!1;function Sg(n){if(!Bl.has(n)&&(Bl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=nt,zl)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."),zl=!0}}function Hl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Sn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function wg(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Hl(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?Hl(n,t):null}function Tg(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 Cg(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],as(l)||c.push({node:l.focusNode,offset:l.focusOffset})),De&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=g;break}if(!k||k.size)break}let u=n.state.doc,h=n.someProp("domParser")||qt.fromSchema(n.state.schema),f=u.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Mg,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function Mg(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Fe&&/^(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||Fe&&/^(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 Ag=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ng(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,L=Jo(n,A);if(L&&!n.state.selection.eq(L)){if(De&&Nt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",se=>se(n,dn(13,"Enter"))))return;let F=n.state.tr.setSelection(L);A=="pointer"?F.setMeta("pointer",!0):A=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),n.dispatch(F)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Cg(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=Ig(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Wn&&n.input.lastIOSEnter>Date.now()-225||Nt)&&i.some(A=>A.nodeType==1&&!Ag.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof H&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=Fl(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let L=n.state.tr.setSelection(A);s&&L.setMeta("composition",s),n.dispatch(L)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof H&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),We&&Gt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((Wn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Og(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,dn(8,"Backspace")))){Nt&&De&&n.domObserver.suppressSelectionUpdates();return}De&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Nt&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,dn(13,"Enter"))})},20));let E=p.start,x=p.endA,w=A=>{let L=A||n.state.tr.replace(E,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let F=Fl(n,L.doc,c.sel);F&&!(De&&n.composing&&F.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(F.head==E||F.head==L.mapping.map(x)-1)||We&&F.empty&&F.head==E)&&L.setSelection(F)}return s&&L.setMeta("composition",s),L.scrollIntoView()},M;if(k)if(m.pos==g.pos){We&&Gt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ot(n),20));let A=w(n.state.tr.delete(E,x)),L=d.resolve(p.start).marksAcross(d.resolve(p.endA));L&&A.ensureMarks(L),n.dispatch(A)}else if(p.endA==p.endB&&(M=_g(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let A=w(n.state.tr);M.type=="add"?A.addMark(E,x,M.mark):A.removeMark(E,x,M.mark),n.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),L=()=>w(n.state.tr.insertText(A,E,x));n.someProp("handleTextInput",F=>F(n,E,x,A,L))||n.dispatch(L())}else n.dispatch(w());else n.dispatch(w())}function Fl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Zo(n,e.resolve(t.anchor),e.resolve(t.head))}function _g(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(S.from(c).eq(n))return{mark:a,type:o}}function Og(n,e,t,r,i){if(t-e<=i.pos-r.pos||Hs(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Hs(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Hs(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Hs(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 s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Ig(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&n.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Ul(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<n.size&&Ul(n.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Ul(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 lu{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 Ym,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ql),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=Wl(this),Kl(this),this.nodeViews=jl(this),this.docView=Sl(this.state.doc,Vl(this),zs(this),this.dom,this),this.domObserver=new xg(this,(r,i,s,o)=>Ng(this,r,i,s,o)),this.domObserver.start(),Xm(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&&ko(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ql),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,s=!1,o=!1;e.storedMarks&&this.composing&&(tu(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=jl(this);Rg(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&ko(this),this.editable=Wl(this),Kl(this);let l=zs(this),c=Vl(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&hm(this);if(o){this.domObserver.stop();let f=u&&(We||De)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Lg(i.selection,e.selection);if(u){let p=De?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ug(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Sl(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$m(this))?Ot(this,f):(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&fm(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof B){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&bl(this,t.getBoundingClientRect(),e)}else bl(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 s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new ru(e.slice,e.move,i<0?void 0:B.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 o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(We){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&&pm(this.dom),Ot(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 km(this,e)}coordsAtPos(e,t=1){return Dd(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 wm(this,t||this.state,e)}pasteHTML(e,t){return Sr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Sr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yo(this,e)}destroy(){this.docView&&(Qm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return tg(this,e)}domSelectionRange(){let e=this.domSelection();return e?Fe&&this.root.nodeType===11&&om(this.dom.ownerDocument)==this.dom&&wg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}lu.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Vl(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"),[$e.node(0,n.state.doc.content.size,e)]}function Kl(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:$e.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Wl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Lg(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 jl(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 Rg(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 ql(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 Xt={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:"'"},vi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dg=typeof navigator<"u"&&/Mac/.test(navigator.platform),$g=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _e=0;_e<10;_e++)Xt[48+_e]=Xt[96+_e]=String(_e);for(var _e=1;_e<=24;_e++)Xt[_e+111]="F"+_e;for(var _e=65;_e<=90;_e++)Xt[_e]=String.fromCharCode(_e+32),vi[_e]=String.fromCharCode(_e);for(var Fs in Xt)vi.hasOwnProperty(Fs)||(vi[Fs]=Xt[Fs]);function Pg(n){var e=Dg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||$g&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?vi:Xt)[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 Bg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),zg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Hg(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Bg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Fg(n){let e=Object.create(null);for(let t in n)e[Hg(t)]=n[t];return e}function Us(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 Ug(n){return new ne({props:{handleKeyDown:cu(n)}})}function cu(n){let e=Fg(n);return function(t,r){let i=Pg(r),s,o=e[Us(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Us(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(zg&&r.ctrlKey&&r.altKey)&&(s=Xt[r.keyCode])&&s!=i){let a=e[Us(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Vg=Object.defineProperty,ra=(n,e)=>{for(var t in e)Vg(n,t,{get:e[t],enumerable:!0})};function ds(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var us=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const d=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,h])=>[u,(...p)=>{const m=this.buildProps(l,e),g=h(...p)(m);return o.push(g),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:ds({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},du={};ra(du,{blur:()=>Kg,clearContent:()=>Wg,clearNodes:()=>jg,command:()=>qg,createParagraphNear:()=>Gg,cut:()=>Jg,deleteCurrentNode:()=>Zg,deleteNode:()=>Yg,deleteRange:()=>Xg,deleteSelection:()=>Qg,enter:()=>eb,exitCode:()=>tb,extendMarkRange:()=>nb,first:()=>rb,focus:()=>sb,forEach:()=>ob,insertContent:()=>ab,insertContentAt:()=>db,joinBackward:()=>fb,joinDown:()=>hb,joinForward:()=>pb,joinItemBackward:()=>mb,joinItemForward:()=>gb,joinTextblockBackward:()=>bb,joinTextblockForward:()=>yb,joinUp:()=>ub,keyboardShortcut:()=>vb,lift:()=>Eb,liftEmptyBlock:()=>xb,liftListItem:()=>Sb,newlineInCode:()=>wb,resetAttributes:()=>Tb,scrollIntoView:()=>Cb,selectAll:()=>Mb,selectNodeBackward:()=>Ab,selectNodeForward:()=>Nb,selectParentNode:()=>_b,selectTextblockEnd:()=>Ob,selectTextblockStart:()=>Ib,setContent:()=>Lb,setMark:()=>Yb,setMeta:()=>Xb,setNode:()=>Qb,setNodeSelection:()=>ey,setTextSelection:()=>ty,sinkListItem:()=>ny,splitBlock:()=>ry,splitListItem:()=>iy,toggleList:()=>sy,toggleMark:()=>oy,toggleNode:()=>ay,toggleWrap:()=>ly,undoInputRule:()=>cy,unsetAllMarks:()=>dy,unsetMark:()=>uy,updateAttributes:()=>hy,wrapIn:()=>fy,wrapInList:()=>py});var Kg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Wg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),jg=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=Zn(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},qg=n=>e=>n(e),Gg=()=>({state:n,dispatch:e})=>Td(n,e),Jg=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},Zg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1};function ke(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Yg=n=>({tr:e,state:t,dispatch:r})=>{const i=ke(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Xg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Qg=()=>({state:n,dispatch:e})=>Vo(n,e),eb=()=>({commands:n})=>n.keyboardShortcut("Enter"),tb=()=>({state:n,dispatch:e})=>Hp(n,e);function ia(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ei(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ia(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function uu(n,e,t={}){return n.find(r=>r.type===e&&Ei(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Gl(n,e,t={}){return!!uu(n,e,t)}function jn(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!uu([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Gl([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&Gl([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function It(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var nb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=It(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const u=jn(l,s,e);if(u&&u.from<=c&&u.to>=d){const h=H.create(o,u.from,u.to);t.setSelection(h)}}return!0},rb=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function hu(n){return n instanceof H}function fn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function fu(n,e=null){if(!e)return null;const t=j.atStart(n),r=j.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?H.create(n,fn(0,i,s),fn(n.content.size,i,s)):H.create(n,fn(e,i,s),fn(e,i,s))}function ib(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function sa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var sb=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(sa()||ib())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!hu(t.state.selection))return o(),!0;const a=fu(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ob=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),ab=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),pu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&pu(r)}return n};function Gr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=(new window.DOMParser).parseFromString(e,"text/html").body;return pu(t)}function Tr(n,e,t){if(n instanceof dt||n instanceof S)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return S.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),Tr("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Xc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?qt.fromSchema(l).parseSlice(Gr(n),t.parseOptions):qt.fromSchema(l).parse(Gr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=qt.fromSchema(e);return t.slice?s.parseSlice(Gr(n),t.parseOptions).content:s.parse(Gr(n),t.parseOptions)}return Tr("",e,t)}function lb(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}var cb=n=>!("type"in n),db=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Tr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Tr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((cb(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=r.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof S){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,d,u)}else{m=a;const g=r.doc.resolve(d),b=g.node(),k=g.parentOffset===0,E=b.isText||b.isTextblock,x=b.content.size>0;k&&E&&x&&(d=Math.max(0,d-1)),r.replaceWith(d,u,m)}t.updateSelection&&lb(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0},ub=()=>({state:n,dispatch:e})=>Pp(n,e),hb=()=>({state:n,dispatch:e})=>Bp(n,e),fb=()=>({state:n,dispatch:e})=>yd(n,e),pb=()=>({state:n,dispatch:e})=>xd(n,e),mb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=rs(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},gb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=rs(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},bb=()=>({state:n,dispatch:e})=>Dp(n,e),yb=()=>({state:n,dispatch:e})=>$p(n,e);function mu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function kb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))sa()||mu()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var vb=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=kb(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Qt(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?ke(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;const f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=i-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Ei(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var Eb=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return Qt(t,i,e)?zp(t,r):!1},xb=()=>({state:n,dispatch:e})=>Cd(n,e),Sb=n=>({state:e,dispatch:t})=>{const r=ke(n,e.schema);return Yp(r)(e,t)},wb=()=>({state:n,dispatch:e})=>wd(n,e);function hs(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Jl(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Tb=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=hs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ke(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{s&&s===c.type&&t.setNodeMarkup(d,void 0,Jl(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(Jl(u.attrs,e)))})})}),!0):!1},Cb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Mb=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ye(n.doc);n.setSelection(t)}return!0},Ab=()=>({state:n,dispatch:e})=>vd(n,e),Nb=()=>({state:n,dispatch:e})=>Sd(n,e),_b=()=>({state:n,dispatch:e})=>Vp(n,e),Ob=()=>({state:n,dispatch:e})=>jp(n,e),Ib=()=>({state:n,dispatch:e})=>Wp(n,e);function vo(n,e,t={},r={}){return Tr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Lb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=vo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function gu(n,e){const t=It(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function bu(n,e){const t=new pd(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Rb(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Eo(n,e){const t=[];return n.descendants((r,i)=>{e(r)&&t.push({node:r,pos:i})}),t}function Db(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function $b(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function fs(n){return e=>$b(e.$from,n)}function $(n,e,t){return n.config[e]===void 0&&n.parent?$(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?$(n.parent,e,t):null}):n.config[e]}function oa(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",t);return r?[e,...oa(r())]:e}).flat(10)}function aa(n,e){const t=An.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function yu(n){return typeof n=="function"}function Q(n,e=void 0,...t){return yu(n)?e?n.bind(e)(...t):n(...t):n}function Pb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cr(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function ku(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cr(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=$(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=$(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...s,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function le(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=s}),r},{})}function xi(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>le(t,r),{})}function Bb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Zl(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Bb(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Yl(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Pb(t)?!1:t!=null))}function zb(n,e){var t;const r=ku(n),{nodeExtensions:i,markExtensions:s}=Cr(n),o=(t=i.find(c=>$(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((b,k)=>{const E=$(k,"extendNodeSchema",u);return{...b,...E?E(c):{}}},{}),f=Yl({...h,content:Q($(c,"content",u)),marks:Q($(c,"marks",u)),group:Q($(c,"group",u)),inline:Q($(c,"inline",u)),atom:Q($(c,"atom",u)),selectable:Q($(c,"selectable",u)),draggable:Q($(c,"draggable",u)),code:Q($(c,"code",u)),whitespace:Q($(c,"whitespace",u)),linebreakReplacement:Q($(c,"linebreakReplacement",u)),defining:Q($(c,"defining",u)),isolating:Q($(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var k,E;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(E=b?.attribute)==null?void 0:E.validate}]}))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(b=>Zl(b,d)));const m=$(c,"renderHTML",u);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:xi(b,d)}));const g=$(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((g,b)=>{const k=$(b,"extendMarkSchema",u);return{...g,...k?k(c):{}}},{}),f=Yl({...h,inclusive:Q($(c,"inclusive",u)),excludes:Q($(c,"excludes",u)),group:Q($(c,"group",u)),spanning:Q($(c,"spanning",u)),code:Q($(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var b,k;return[g.name,{default:(b=g?.attribute)==null?void 0:b.default,validate:(k=g?.attribute)==null?void 0:k.validate}]}))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>Zl(g,d)));const m=$(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:xi(g,d)})),[c.name,f]}));return new Xc({topNode:o,nodes:a,marks:l})}function Hb(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function la(n){return n.sort((t,r)=>{const i=$(t,"priority")||100,s=$(r,"priority")||100;return i>s?-1:i<s?1:0})}function vu(n){const e=la(oa(n)),t=Hb(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Eu(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`\n\n`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=s);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Fb(n,e){const t={from:0,to:n.content.size};return Eu(n,t,e)}function xu(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Ub(n,e){const t=ke(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function Su(n,e){const t=hs(typeof e=="string"?e:e.name,n.schema);return t==="node"?Ub(n,e):t==="mark"?gu(n,e):{}}function Vb(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Kb(n){const e=Vb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function wu(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),d=e.slice(s).map(l),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),Kb(r)}function ca(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=jn(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Wb=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function Vs(n,e){return e.nodes[n]||e.marks[n]||null}function oi(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var jb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function xo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?It(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>Ei(u.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),k=Math.min(p,g+m.nodeSize),E=k-b;o+=E,a.push(...m.marks.map(x=>({mark:x,from:b,to:k})))})}),o===0)return!1;const l=a.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>Ei(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function qb(n,e,t={}){if(!e)return Qt(n,null,t)||xo(n,null,t);const r=hs(e,n.schema);return r==="node"?Qt(n,e,t):r==="mark"?xo(n,e,t):!1}var Gb=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=fs(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Jb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Xl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Ql(n,e){const{nodeExtensions:t}=Cr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Q($(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function ps(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(ps(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Tu(n){return n instanceof B}function Zb(n,e,t){var r;const{selection:i}=e;let s=null;if(hu(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=f&&p}return!c}),c})}var Yb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=It(n,r.schema);if(i)if(o){const c=gu(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&t.addMark(p,m,l.create({...b.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return Zb(r,t,l)},Xb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Qb=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=ke(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>pl(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>pl(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ey=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=fn(n,0,r.content.size),s=B.create(r,i);e.setSelection(s)}return!0},ty=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=H.atStart(r).from,a=H.atEnd(r).to,l=fn(i,o,a),c=fn(s,o,a),d=H.create(r,l,c);e.setSelection(d)}return!0},ny=n=>({state:e,dispatch:t})=>{const r=ke(n,e.schema);return em(r)(e,t)};function ec(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var ry=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,d=oi(c,a.node().type.name,a.node().attrs);if(s instanceof B&&s.node.isBlock)return!a.parentOffset||!_t(o,a.pos)?!1:(r&&(n&&ec(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:Rb(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=_t(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&_t(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&ec(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},iy=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=ke(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=S.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let L=l.depth-k;L>=l.depth-3;L-=1)b=S.from(l.node(L).copy(b));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...oi(h,l.node().type.name,l.node().attrs),...e},w=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(x))||void 0;b=b.append(S.from(a.createAndFill(null,w)||void 0));const M=l.before(l.depth-(k-1));t.replace(M,l.after(-E),new O(b,4-k,0));let A=-1;t.doc.nodesBetween(M,t.doc.content.size,(L,F)=>{if(A>-1)return!1;L.isTextblock&&L.content.size===0&&(A=F+1)}),A>-1&&t.setSelection(H.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...oi(h,u.type.name,u.attrs),...e},m={...oi(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!_t(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:E}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!x||!i)return!0;const w=x.filter(M=>E.includes(M.type.name));t.ensureMarks(w)}return!0},Ks=(n,e)=>{const t=fs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,t.pos)&&n.join(t.pos),!0},Ws=(n,e)=>{const t=fs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,r)&&n.join(r),!0},sy=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,f=ke(n,o.schema),p=ke(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:k}=m,E=b.blockRange(k),x=g||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const w=fs(M=>Ql(M.type.name,u))(m);if(E.depth>=1&&w&&E.depth-w.depth<=1){if(w.node.type===f)return c.liftListItem(p);if(Ql(w.node.type.name,u)&&f.validContent(w.node.content)&&a)return l().command(()=>(s.setNodeMarkup(w.pos,f),!0)).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run()}return!t||!x||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run():l().command(()=>{const M=d().wrapInList(f,r),A=x.filter(L=>h.includes(L.type.name));return s.ensureMarks(A),M?!0:c.clearNodes()}).wrapInList(f,r).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run()},oy=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=It(n,r.schema);return xo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},ay=(n,e,t={})=>({state:r,commands:i})=>{const s=ke(n,r.schema),o=ke(e,r.schema),a=Qt(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},ly=(n,e={})=>({state:t,commands:r})=>{const i=ke(n,t.schema);return Qt(t,i,e)?r.lift(i):r.wrapIn(i,e)},cy=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},dy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},uy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=It(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:h,to:f}=a;const p=(s=c.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=jn(c,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},hy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=hs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ke(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let u,h,f,p;t.selection.empty?r.doc.nodesBetween(c,d,(m,g)=>{s&&s===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m)}):r.doc.nodesBetween(c,d,(m,g)=>{g<c&&s&&s===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m),g>=c&&g<=d&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const k=Math.max(g,c),E=Math.min(g+m.nodeSize,d);t.addMark(k,E,o.create({...b.attrs,...e}))}}))}),h&&(u!==void 0&&t.setNodeMarkup(u,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&t.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},fy=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return qp(i,e)(t,r)},py=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return Gp(i,e)(t,r)},my=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},ms=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},gy=(n,e)=>{if(ia(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Jr(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=jb(c)+s;return o.forEach(h=>{if(d)return;const f=gy(u,h.find);if(!f)return;const p=l.state.tr,m=ds({state:l.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:b,chain:k,can:E}=new us({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:k,can:E})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),d=!0)}),d}function by(n){const{editor:e,rules:t}=n,r=new ne({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=aa(S.from(d),o.schema);const{from:u}=l,h=u+d.length;Jr({editor:e,from:u,to:h,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Jr({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Jr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Jr({editor:e,from:o.pos,to:o.pos,text:`\n`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function yy(n){return Object.prototype.toString.call(n).slice(8,-1)}function Zr(n){return yy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Cu(n,e){const t={...n};return Zr(n)&&Zr(e)&&Object.keys(e).forEach(r=>{Zr(e[r])&&Zr(n[r])?t[r]=Cu(n[r],e[r]):t[r]=e[r]}),t}var da=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Q($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Q($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Cu(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},it=class Mu extends da{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Mu(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function ky(n){return typeof n=="number"}var vy=class{constructor(n){this.find=n.find,this.handler=n.handler}},Ey=(n,e,t)=>{if(ia(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function xy(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new us({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,i,(f,p)=>{var m,g,b,k,E;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const x=(E=(k=(b=f.content)==null?void 0:b.size)!=null?k:f.nodeSize)!=null?E:0,w=Math.max(r,p),M=Math.min(i,p+x);if(w>=M)return;const A=f.isText?f.text||"":f.textBetween(w-p,M-p,void 0,"");Ey(A,s.find,o).forEach(F=>{if(F.index===void 0)return;const se=w+F.index+1,Ie=se+F[0].length,Ce={from:t.tr.mapping.map(se),to:t.tr.mapping.map(Ie)},ze=s.handler({state:t,range:Ce,match:F,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(ze)})}),u.every(f=>f!==null)}var Yr=null,Sy=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function wy(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{const m=d.tr,g=ds({state:d,transaction:m});if(!(!xy({editor:e,state:g,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new ne({view(u){const h=p=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(p.target)?u.dom.parentElement:null,r&&(Yr=e)},f=()=>{Yr&&(Yr=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(s=r===u.dom.parentElement,a=h,!s){const f=Yr;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),k=!!b;if(!m&&!g&&!k)return;if(k){let{text:w}=b;typeof w=="string"?w=w:w=aa(S.from(w),f.schema);const{from:M}=b,A=M+w.length,L=Sy(w);return l({rule:d,state:f,from:M,to:{b:A},pasteEvt:L})}const E=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!ky(E)||!x||E===x.b))return l({rule:d,state:f,from:E,to:x,pasteEvt:o})}}))}var gs=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=vu(n),this.schema=zb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vs(e.name,this.schema)},r=$(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return la([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Vs(r.name,this.schema)},s=[],o=$(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&$(r,"exitable",i)&&(a.ArrowRight=()=>it.handleExit({editor:n,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:n})]));a={...a,...h}}const l=Ug(a);s.push(l);const c=$(r,"addInputRules",i);if(Xl(r,n.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=by({editor:n,rules:h}),p=Array.isArray(f)?f:[f];s.push(...p)}}const d=$(r,"addPasteRules",i);if(Xl(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const f=wy({editor:n,rules:h});s.push(...f)}}const u=$(r,"addProseMirrorPlugins",i);if(u){const h=u();s.push(...h)}return s})}get attributes(){return ku(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ke(t.name,this.schema)},s=$(t,"addNodeView",i);if(!s)return[];const o=(a,l,c,d,u)=>{const h=xi(a,r);return s()({node:a,view:l,getPos:c,decorations:d,innerDecorations:u,editor:n,extension:t,HTMLAttributes:h})};return[t.name,o]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:It(t.name,this.schema)},s=$(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const d=xi(a,r);return s()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{By(a,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vs(e.name,this.schema)};e.type==="mark"&&((t=Q($(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=$(e,"onBeforeCreate",r),s=$(e,"onCreate",r),o=$(e,"onUpdate",r),a=$(e,"onSelectionUpdate",r),l=$(e,"onTransaction",r),c=$(e,"onFocus",r),d=$(e,"onBlur",r),u=$(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};gs.resolve=vu;gs.sort=la;gs.flatten=oa;var Ty={};ra(Ty,{ClipboardTextSerializer:()=>Nu,Commands:()=>_u,Delete:()=>Ou,Drop:()=>Iu,Editable:()=>Lu,FocusEvents:()=>Du,Keymap:()=>$u,Paste:()=>Pu,Tabindex:()=>Bu,focusEventsPluginKey:()=>Ru});var ee=class Au extends da{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Au(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Nu=ee.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ne({key:new ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),l=xu(t);return Eu(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),_u=ee.create({name:"commands",addCommands(){return{...du}}}),Ou=ee.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const d=bu(n.before,[n,...e]);wu(d).forEach(f=>{d.mapping.mapResult(f.oldRange.from).deletedAfter&&d.mapping.mapResult(f.oldRange.to).deletedBefore&&d.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,b=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((f,p)=>{var m,g;if(f instanceof ct){const b=h.slice(p).map(f.from,-1),k=h.slice(p).map(f.to),E=h.invert().map(b,-1),x=h.invert().map(k),w=(m=d.doc.nodeAt(b-1))==null?void 0:m.marks.some(A=>A.eq(f.mark)),M=(g=d.doc.nodeAt(k))==null?void 0:g.marks.some(A=>A.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:E,to:x},newRange:{from:b,to:k},partial:!!(M||w),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Iu=ee.create({name:"drop",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Lu=ee.create({name:"editable",addProseMirrorPlugins(){return[new ne({key:new ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ru=new ce("focusEvents"),Du=ee.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ne({key:Ru,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),$u=ee.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&p.parent.childCount===1?g===u.pos:j.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return sa()||mu()?s:i},addProseMirrorPlugins(){return[new ne({key:new ce("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=j.atStart(e.doc).from,c=j.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!ps(t.doc))return;const h=t.tr,f=ds({state:t,transaction:h}),{commands:p}=new us({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),Pu=ee.create({name:"paste",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Bu=ee.create({name:"tabindex",addProseMirrorPlugins(){return[new ne({key:new ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Cy=class Dn{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Dn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Dn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Dn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Dn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Dn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},My=`.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;function Ay(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Ny=class extends my{constructor(n={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=fu(e,this.options.autofocus);this.editorState=zn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Ay(My,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=yu(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[Lu,Nu.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),_u,Du,$u,Bu,Iu,Pu,Ou].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new gs(r,this)}createCommandManager(){this.commandManager=new us({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=vo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=vo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new lu(n,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return Su(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return qb(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return aa(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`\n\n`,textSerializers:t={}}=n||{};return Fb(this.state.doc,{blockSeparator:e,textSerializers:{...xu(this.schema),...t}})}get isEmpty(){return ps(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Cy(e,this)}get $doc(){return this.$pos(0)}};function qn(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(ca(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function _y(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function So(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=Q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Gn(n){return new ms({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=Q(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Fo(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&tn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function Oy(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof B){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var Iy={};ra(Iy,{createAtomBlockMarkdownSpec:()=>Ly,createBlockMarkdownSpec:()=>Ry,createInlineMarkdownSpec:()=>Py,parseAttributes:()=>ua,parseIndentedBlocks:()=>wo,renderNestedMarkdownContent:()=>fa,serializeAttributes:()=>ha});function ua(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(d=>d.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,d])=>{var u;const h=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function ha(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Ly(n){const{nodeName:e,name:t,parseAttributes:r=ua,serializeAttributes:i=ha,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=d=>{if(!a)return d;const u={};return a.forEach(h=>{h in d&&(u[h]=d[h])}),u};return{parseMarkdown:(d,u)=>{const h={...s,...d.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(u=d.match(h))==null?void 0:u.index;return f!==void 0?f:-1},tokenize(d,u,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=d.match(f);if(!p)return;const m=p[1]||"",g=r(m);if(!o.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:d=>{const u=c(d.attrs||{}),h=i(u),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function Ry(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=ua,serializeAttributes:s=ha,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const h={};return l.forEach(f=>{f in u&&(h[f]=u[f])}),h};return{parseMarkdown:(u,h)=>{let f;if(r){const m=r(u);f=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?f=h.parseChildren(u.tokens||[]):f=h.parseInline(u.tokens||[]);const p={...o,...u.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(u){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=u.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[b,k=""]=g,E=i(k);let x=1;const w=b.length;let M="";const A=/^:::([\w-]*)(\s.*)?/gm,L=u.slice(w);for(A.lastIndex=0;;){const F=A.exec(L);if(F===null)break;const se=F.index,Ie=F[1];if(!((p=F[2])!=null&&p.endsWith(":::"))){if(Ie)x+=1;else if(x-=1,x===0){const Ce=L.slice(0,se);M=Ce.trim();const ze=u.slice(0,w+se+F[0].length);let Z=[];if(M)if(a==="block")for(Z=f.blockTokens(Ce),Z.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=f.inlineTokens(J.text))});Z.length>0;){const J=Z[Z.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))Z.pop();else break}else Z=f.inlineTokens(M);return{type:e,raw:ze,attributes:E,content:M,tokens:Z}}}}}},renderMarkdown:(u,h)=>{const f=d(u.attrs||{}),p=s(f),m=p?` {${p}}`:"",g=h.renderChildren(u.content||[],`\n\n`);return`:::${c}${m}\n\n${g}\n\n:::`}}}function Dy(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function $y(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Py(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Dy,serializeAttributes:s=$y,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{p in h&&(f[p]=h[p])}),f},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(a)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(f),m=p?.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=h.match(m);if(!g)return;let b="",k="";if(a){const[,x]=g;k=x}else{const[,x,w]=g;k=x,b=w||""}const E=i(k.trim());return{type:e,raw:g[0],content:b.trim(),attributes:E}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=d(h.attrs||{}),m=s(p),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function wo(n,e,t){var r,i,s,o;const a=n.split(`\n`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){d+=1;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:g}=p;c=`${c}${h}\n`;const b=[g];for(d+=1;d<a.length;){const w=a[d];if(w.trim()===""){const A=a.slice(d+1).findIndex(se=>se.trim()!=="");if(A===-1)break;if((((i=(r=a[d+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){b.push(w),c=`${c}${w}\n`,d+=1;continue}else break}if((((o=(s=w.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)b.push(w),c=`${c}${w}\n`,d+=1;else break}let k;const E=b.slice(1);if(E.length>0){const w=E.map(M=>M.slice(m+u)).join(`\n`);w.trim()&&(e.customNestedParser?k=e.customNestedParser(w):k=t.blockTokens(w))}const x=e.createToken(p,k);l.push(x)}if(l.length!==0)return{items:l,raw:c.trim()}}function fa(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const d=e.renderChildren([c]);if(d){const u=d.split(`\n`).map(h=>h?e.indent(h):"").join(`\n`);l.push(u)}}),l.join(`\n`)}function By(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,l)=>{const c=s.mapping.map(l),d=s.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==u.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,f)}}),s.docChanged&&e.view.dispatch(s)}var Oe=class zu extends da{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new zu(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Tn(n){return new vy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=Q(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(ca(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}var zy=/(^|[^`])`([^`]+)`(?!`)$/,Hy=/(^|[^`])`([^`]+)`(?!`)/g,Hu=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[qn({find:zy,type:this.type})]},addPasteRules(){return[Tn({find:Hy,type:this.type})]}}),Fy=Hu,js=4,Uy=/^```([a-z]+)?[\s\n]$/,Vy=/^~~~([a-z]+)?[\s\n]$/,Fu=Oe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:js,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",le(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`\n`):r=`\`\`\`${i}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:js,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,f=r.doc.textBetween(c,d,`\n`,`\n`).split(`\n`).map(p=>a+p).join(`\n`);return l.replaceWith(c,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:js,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=s,d=s.start(),u=s.end(),f=r.doc.textBetween(d,u,`\n`,`\n`).split(`\n`);let p=0,m=0;const g=c-d;for(let M=0;M<f.length;M+=1){if(m+f[M].length>=g){p=M;break}m+=f[M].length+1}const k=((l=f[p].match(/^ */))==null?void 0:l[0])||"",E=Math.min(k.length,t);if(E===0)return!0;let x=d;for(let M=0;M<p;M+=1)x+=f[M].length+1;return a.delete(x,x+E),c-x<=E&&a.setSelection(H.create(a.doc,x)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=r.doc.textBetween(l,c,`\n`,`\n`).split(`\n`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,t);return f.slice(g)}).join(`\n`);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`\n\n`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(j.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[So({find:Uy,type:this.type,getAttributes:n=>({language:n[1]})}),So({find:Vy,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ne({key:new ce("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`\n`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Ky=Fu;function Wy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qs,tc;function jy(){if(tc)return qs;tc=1;function n(y){return y instanceof Map?y.clear=y.delete=y.set=function(){throw new Error("map is read-only")}:y instanceof Set&&(y.add=y.clear=y.delete=function(){throw new Error("set is read-only")}),Object.freeze(y),Object.getOwnPropertyNames(y).forEach(v=>{const N=y[v],V=typeof N;(V==="object"||V==="function")&&!Object.isFrozen(N)&&n(N)}),y}class e{constructor(v){v.data===void 0&&(v.data={}),this.data=v.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(y){return y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(y,...v){const N=Object.create(null);for(const V in y)N[V]=y[V];return v.forEach(function(V){for(const fe in V)N[fe]=V[fe]}),N}const i="</span>",s=y=>!!y.scope,o=(y,{prefix:v})=>{if(y.startsWith("language:"))return y.replace("language:","language-");if(y.includes(".")){const N=y.split(".");return[`${v}${N.shift()}`,...N.map((V,fe)=>`${V}${"_".repeat(fe+1)}`)].join(" ")}return`${v}${y}`};class a{constructor(v,N){this.buffer="",this.classPrefix=N.classPrefix,v.walk(this)}addText(v){this.buffer+=t(v)}openNode(v){if(!s(v))return;const N=o(v.scope,{prefix:this.classPrefix});this.span(N)}closeNode(v){s(v)&&(this.buffer+=i)}value(){return this.buffer}span(v){this.buffer+=`<span class="${v}">`}}const l=(y={})=>{const v={children:[]};return Object.assign(v,y),v};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(v){this.top.children.push(v)}openNode(v){const N=l({scope:v});this.add(N),this.stack.push(N)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(v){return this.constructor._walk(v,this.rootNode)}static _walk(v,N){return typeof N=="string"?v.addText(N):N.children&&(v.openNode(N),N.children.forEach(V=>this._walk(v,V)),v.closeNode(N)),v}static _collapse(v){typeof v!="string"&&v.children&&(v.children.every(N=>typeof N=="string")?v.children=[v.children.join("")]:v.children.forEach(N=>{c._collapse(N)}))}}class d extends c{constructor(v){super(),this.options=v}addText(v){v!==""&&this.add(v)}startScope(v){this.openNode(v)}endScope(){this.closeNode()}__addSublanguage(v,N){const V=v.root;N&&(V.scope=`language:${N}`),this.add(V)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(y){return y?typeof y=="string"?y:y.source:null}function h(y){return m("(?=",y,")")}function f(y){return m("(?:",y,")*")}function p(y){return m("(?:",y,")?")}function m(...y){return y.map(N=>u(N)).join("")}function g(y){const v=y[y.length-1];return typeof v=="object"&&v.constructor===Object?(y.splice(y.length-1,1),v):{}}function b(...y){return"("+(g(y).capture?"":"?:")+y.map(V=>u(V)).join("|")+")"}function k(y){return new RegExp(y.toString()+"|").exec("").length-1}function E(y,v){const N=y&&y.exec(v);return N&&N.index===0}const x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(y,{joinWith:v}){let N=0;return y.map(V=>{N+=1;const fe=N;let pe=u(V),R="";for(;pe.length>0;){const I=x.exec(pe);if(!I){R+=pe;break}R+=pe.substring(0,I.index),pe=pe.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?R+="\\"+String(Number(I[1])+fe):(R+=I[0],I[0]==="("&&N++)}return R}).map(V=>`(${V})`).join(v)}const M=/\b\B/,A="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",F="\\b\\d+(\\.\\d+)?",se="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ie="\\b(0b[01]+)",Ce="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ze=(y={})=>{const v=/^#![ ]*\//;return y.binary&&(y.begin=m(v,/.*\b/,y.binary,/\b.*/)),r({scope:"meta",begin:v,end:/$/,relevance:0,"on:begin":(N,V)=>{N.index!==0&&V.ignoreMatch()}},y)},Z={begin:"\\\\[\\s\\S]",relevance:0},J={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},me={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},st={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Y=function(y,v,N={}){const V=r({scope:"comment",begin:y,end:v,contains:[]},N);V.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const fe=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return V.contains.push({begin:m(/[ ]+/,"(",fe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),V},He=Y("//","$"),qe=Y("/\\*","\\*/"),ot=Y("#","$"),xt={scope:"number",begin:F,relevance:0},sn={scope:"number",begin:se,relevance:0},Gh={scope:"number",begin:Ie,relevance:0},Jh={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},Zh={scope:"title",begin:A,relevance:0},Yh={scope:"title",begin:L,relevance:0},Xh={begin:"\\.\\s*"+L,relevance:0};var Br=Object.freeze({__proto__:null,APOS_STRING_MODE:J,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:Gh,BINARY_NUMBER_RE:Ie,COMMENT:Y,C_BLOCK_COMMENT_MODE:qe,C_LINE_COMMENT_MODE:He,C_NUMBER_MODE:sn,C_NUMBER_RE:se,END_SAME_AS_BEGIN:function(y){return Object.assign(y,{"on:begin":(v,N)=>{N.data._beginMatch=v[1]},"on:end":(v,N)=>{N.data._beginMatch!==v[1]&&N.ignoreMatch()}})},HASH_COMMENT_MODE:ot,IDENT_RE:A,MATCH_NOTHING_RE:M,METHOD_GUARD:Xh,NUMBER_MODE:xt,NUMBER_RE:F,PHRASAL_WORDS_MODE:st,QUOTE_STRING_MODE:me,REGEXP_MODE:Jh,RE_STARTERS_RE:Ce,SHEBANG:ze,TITLE_MODE:Zh,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:Yh});function Qh(y,v){y.input[y.index-1]==="."&&v.ignoreMatch()}function ef(y,v){y.className!==void 0&&(y.scope=y.className,delete y.className)}function tf(y,v){v&&y.beginKeywords&&(y.begin="\\b("+y.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",y.__beforeBegin=Qh,y.keywords=y.keywords||y.beginKeywords,delete y.beginKeywords,y.relevance===void 0&&(y.relevance=0))}function nf(y,v){Array.isArray(y.illegal)&&(y.illegal=b(...y.illegal))}function rf(y,v){if(y.match){if(y.begin||y.end)throw new Error("begin & end are not supported with match");y.begin=y.match,delete y.match}}function sf(y,v){y.relevance===void 0&&(y.relevance=1)}const of=(y,v)=>{if(!y.beforeMatch)return;if(y.starts)throw new Error("beforeMatch cannot be used with starts");const N=Object.assign({},y);Object.keys(y).forEach(V=>{delete y[V]}),y.keywords=N.keywords,y.begin=m(N.beforeMatch,h(N.begin)),y.starts={relevance:0,contains:[Object.assign(N,{endsParent:!0})]},y.relevance=0,delete N.beforeMatch},af=["of","and","for","in","not","or","if","then","parent","list","value"],lf="keyword";function Ia(y,v,N=lf){const V=Object.create(null);return typeof y=="string"?fe(N,y.split(" ")):Array.isArray(y)?fe(N,y):Object.keys(y).forEach(function(pe){Object.assign(V,Ia(y[pe],v,pe))}),V;function fe(pe,R){v&&(R=R.map(I=>I.toLowerCase())),R.forEach(function(I){const U=I.split("|");V[U[0]]=[pe,cf(U[0],U[1])]})}}function cf(y,v){return v?Number(v):df(y)?0:1}function df(y){return af.includes(y.toLowerCase())}const La={},on=y=>{console.error(y)},Ra=(y,...v)=>{console.log(`WARN: ${y}`,...v)},Nn=(y,v)=>{La[`${y}/${v}`]||(console.log(`Deprecated as of ${y}. ${v}`),La[`${y}/${v}`]=!0)},zr=new Error;function Da(y,v,{key:N}){let V=0;const fe=y[N],pe={},R={};for(let I=1;I<=v.length;I++)R[I+V]=fe[I],pe[I+V]=!0,V+=k(v[I-1]);y[N]=R,y[N]._emit=pe,y[N]._multi=!0}function uf(y){if(Array.isArray(y.begin)){if(y.skip||y.excludeBegin||y.returnBegin)throw on("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),zr;if(typeof y.beginScope!="object"||y.beginScope===null)throw on("beginScope must be object"),zr;Da(y,y.begin,{key:"beginScope"}),y.begin=w(y.begin,{joinWith:""})}}function hf(y){if(Array.isArray(y.end)){if(y.skip||y.excludeEnd||y.returnEnd)throw on("skip, excludeEnd, returnEnd not compatible with endScope: {}"),zr;if(typeof y.endScope!="object"||y.endScope===null)throw on("endScope must be object"),zr;Da(y,y.end,{key:"endScope"}),y.end=w(y.end,{joinWith:""})}}function ff(y){y.scope&&typeof y.scope=="object"&&y.scope!==null&&(y.beginScope=y.scope,delete y.scope)}function pf(y){ff(y),typeof y.beginScope=="string"&&(y.beginScope={_wrap:y.beginScope}),typeof y.endScope=="string"&&(y.endScope={_wrap:y.endScope}),uf(y),hf(y)}function mf(y){function v(R,I){return new RegExp(u(R),"m"+(y.case_insensitive?"i":"")+(y.unicodeRegex?"u":"")+(I?"g":""))}class N{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,U){U.position=this.position++,this.matchIndexes[this.matchAt]=U,this.regexes.push([U,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(U=>U[1]);this.matcherRe=v(w(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const U=this.matcherRe.exec(I);if(!U)return null;const xe=U.findIndex((Xn,xs)=>xs>0&&Xn!==void 0),ge=this.matchIndexes[xe];return U.splice(0,xe),Object.assign(U,ge)}}class V{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const U=new N;return this.rules.slice(I).forEach(([xe,ge])=>U.addRule(xe,ge)),U.compile(),this.multiRegexes[I]=U,U}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,U){this.rules.push([I,U]),U.type==="begin"&&this.count++}exec(I){const U=this.getMatcher(this.regexIndex);U.lastIndex=this.lastIndex;let xe=U.exec(I);if(this.resumingScanAtSamePosition()&&!(xe&&xe.index===this.lastIndex)){const ge=this.getMatcher(0);ge.lastIndex=this.lastIndex+1,xe=ge.exec(I)}return xe&&(this.regexIndex+=xe.position+1,this.regexIndex===this.count&&this.considerAll()),xe}}function fe(R){const I=new V;return R.contains.forEach(U=>I.addRule(U.begin,{rule:U,type:"begin"})),R.terminatorEnd&&I.addRule(R.terminatorEnd,{type:"end"}),R.illegal&&I.addRule(R.illegal,{type:"illegal"}),I}function pe(R,I){const U=R;if(R.isCompiled)return U;[ef,rf,pf,of].forEach(ge=>ge(R,I)),y.compilerExtensions.forEach(ge=>ge(R,I)),R.__beforeBegin=null,[tf,nf,sf].forEach(ge=>ge(R,I)),R.isCompiled=!0;let xe=null;return typeof R.keywords=="object"&&R.keywords.$pattern&&(R.keywords=Object.assign({},R.keywords),xe=R.keywords.$pattern,delete R.keywords.$pattern),xe=xe||/\w+/,R.keywords&&(R.keywords=Ia(R.keywords,y.case_insensitive)),U.keywordPatternRe=v(xe,!0),I&&(R.begin||(R.begin=/\B|\b/),U.beginRe=v(U.begin),!R.end&&!R.endsWithParent&&(R.end=/\B|\b/),R.end&&(U.endRe=v(U.end)),U.terminatorEnd=u(U.end)||"",R.endsWithParent&&I.terminatorEnd&&(U.terminatorEnd+=(R.end?"|":"")+I.terminatorEnd)),R.illegal&&(U.illegalRe=v(R.illegal)),R.contains||(R.contains=[]),R.contains=[].concat(...R.contains.map(function(ge){return gf(ge==="self"?R:ge)})),R.contains.forEach(function(ge){pe(ge,U)}),R.starts&&pe(R.starts,I),U.matcher=fe(U),U}if(y.compilerExtensions||(y.compilerExtensions=[]),y.contains&&y.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return y.classNameAliases=r(y.classNameAliases||{}),pe(y)}function $a(y){return y?y.endsWithParent||$a(y.starts):!1}function gf(y){return y.variants&&!y.cachedVariants&&(y.cachedVariants=y.variants.map(function(v){return r(y,{variants:null},v)})),y.cachedVariants?y.cachedVariants:$a(y)?r(y,{starts:y.starts?r(y.starts):null}):Object.isFrozen(y)?r(y):y}var bf="11.11.1";class yf extends Error{constructor(v,N){super(v),this.name="HTMLInjectionError",this.html=N}}const Es=t,Pa=r,Ba=Symbol("nomatch"),kf=7,za=function(y){const v=Object.create(null),N=Object.create(null),V=[];let fe=!0;const pe="Could not find the language '{}', did you forget to load/include a language module?",R={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function U(C){return I.noHighlightRe.test(C)}function xe(C){let P=C.className+" ";P+=C.parentNode?C.parentNode.className:"";const G=I.languageDetectRe.exec(P);if(G){const re=Rt(G[1]);return re||(Ra(pe.replace("{}",G[1])),Ra("Falling back to no-highlight mode for this block.",C)),re?G[1]:"no-highlight"}return P.split(/\s+/).find(re=>U(re)||Rt(re))}function ge(C,P,G){let re="",ve="";typeof P=="object"?(re=C,G=P.ignoreIllegals,ve=P.language):(Nn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Nn("10.7.0",`Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277`),ve=C,re=P),G===void 0&&(G=!0);const at={code:re,language:ve};Fr("before:highlight",at);const Dt=at.result?at.result:Xn(at.language,at.code,G);return Dt.code=at.code,Fr("after:highlight",Dt),Dt}function Xn(C,P,G,re){const ve=Object.create(null);function at(_,D){return _.keywords[D]}function Dt(){if(!K.keywords){Me.addText(ie);return}let _=0;K.keywordPatternRe.lastIndex=0;let D=K.keywordPatternRe.exec(ie),q="";for(;D;){q+=ie.substring(_,D.index);const X=ft.case_insensitive?D[0].toLowerCase():D[0],Le=at(K,X);if(Le){const[St,$f]=Le;if(Me.addText(q),q="",ve[X]=(ve[X]||0)+1,ve[X]<=kf&&(Kr+=$f),St.startsWith("_"))q+=D[0];else{const Pf=ft.classNameAliases[St]||St;ht(D[0],Pf)}}else q+=D[0];_=K.keywordPatternRe.lastIndex,D=K.keywordPatternRe.exec(ie)}q+=ie.substring(_),Me.addText(q)}function Ur(){if(ie==="")return;let _=null;if(typeof K.subLanguage=="string"){if(!v[K.subLanguage]){Me.addText(ie);return}_=Xn(K.subLanguage,ie,!0,qa[K.subLanguage]),qa[K.subLanguage]=_._top}else _=Ss(ie,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(Kr+=_.relevance),Me.__addSublanguage(_._emitter,_.language)}function Ge(){K.subLanguage!=null?Ur():Dt(),ie=""}function ht(_,D){_!==""&&(Me.startScope(D),Me.addText(_),Me.endScope())}function Va(_,D){let q=1;const X=D.length-1;for(;q<=X;){if(!_._emit[q]){q++;continue}const Le=ft.classNameAliases[_[q]]||_[q],St=D[q];Le?ht(St,Le):(ie=St,Dt(),ie=""),q++}}function Ka(_,D){return _.scope&&typeof _.scope=="string"&&Me.openNode(ft.classNameAliases[_.scope]||_.scope),_.beginScope&&(_.beginScope._wrap?(ht(ie,ft.classNameAliases[_.beginScope._wrap]||_.beginScope._wrap),ie=""):_.beginScope._multi&&(Va(_.beginScope,D),ie="")),K=Object.create(_,{parent:{value:K}}),K}function Wa(_,D,q){let X=E(_.endRe,q);if(X){if(_["on:end"]){const Le=new e(_);_["on:end"](D,Le),Le.isMatchIgnored&&(X=!1)}if(X){for(;_.endsParent&&_.parent;)_=_.parent;return _}}if(_.endsWithParent)return Wa(_.parent,D,q)}function Of(_){return K.matcher.regexIndex===0?(ie+=_[0],1):(Ms=!0,0)}function If(_){const D=_[0],q=_.rule,X=new e(q),Le=[q.__beforeBegin,q["on:begin"]];for(const St of Le)if(St&&(St(_,X),X.isMatchIgnored))return Of(D);return q.skip?ie+=D:(q.excludeBegin&&(ie+=D),Ge(),!q.returnBegin&&!q.excludeBegin&&(ie=D)),Ka(q,_),q.returnBegin?0:D.length}function Lf(_){const D=_[0],q=P.substring(_.index),X=Wa(K,_,q);if(!X)return Ba;const Le=K;K.endScope&&K.endScope._wrap?(Ge(),ht(D,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Ge(),Va(K.endScope,_)):Le.skip?ie+=D:(Le.returnEnd||Le.excludeEnd||(ie+=D),Ge(),Le.excludeEnd&&(ie=D));do{K.scope&&Me.closeNode(),!K.skip&&!K.subLanguage&&(Kr+=K.relevance),K=K.parent}while(K!==X.parent);return X.starts&&Ka(X.starts,_),Le.returnEnd?0:D.length}function Rf(){const _=[];for(let D=K;D!==ft;D=D.parent)D.scope&&_.unshift(D.scope);_.forEach(D=>Me.openNode(D))}let Vr={};function ja(_,D){const q=D&&D[0];if(ie+=_,q==null)return Ge(),0;if(Vr.type==="begin"&&D.type==="end"&&Vr.index===D.index&&q===""){if(ie+=P.slice(D.index,D.index+1),!fe){const X=new Error(`0 width match regex (${C})`);throw X.languageName=C,X.badRule=Vr.rule,X}return 1}if(Vr=D,D.type==="begin")return If(D);if(D.type==="illegal"&&!G){const X=new Error('Illegal lexeme "'+q+'" for mode "'+(K.scope||"<unnamed>")+'"');throw X.mode=K,X}else if(D.type==="end"){const X=Lf(D);if(X!==Ba)return X}if(D.type==="illegal"&&q==="")return ie+=`\n`,1;if(Cs>1e5&&Cs>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=q,q.length}const ft=Rt(C);if(!ft)throw on(pe.replace("{}",C)),new Error('Unknown language: "'+C+'"');const Df=mf(ft);let Ts="",K=re||Df;const qa={},Me=new I.__emitter(I);Rf();let ie="",Kr=0,an=0,Cs=0,Ms=!1;try{if(ft.__emitTokens)ft.__emitTokens(P,Me);else{for(K.matcher.considerAll();;){Cs++,Ms?Ms=!1:K.matcher.considerAll(),K.matcher.lastIndex=an;const _=K.matcher.exec(P);if(!_)break;const D=P.substring(an,_.index),q=ja(D,_);an=_.index+q}ja(P.substring(an))}return Me.finalize(),Ts=Me.toHTML(),{language:C,value:Ts,relevance:Kr,illegal:!1,_emitter:Me,_top:K}}catch(_){if(_.message&&_.message.includes("Illegal"))return{language:C,value:Es(P),illegal:!0,relevance:0,_illegalBy:{message:_.message,index:an,context:P.slice(an-100,an+100),mode:_.mode,resultSoFar:Ts},_emitter:Me};if(fe)return{language:C,value:Es(P),illegal:!1,relevance:0,errorRaised:_,_emitter:Me,_top:K};throw _}}function xs(C){const P={value:Es(C),illegal:!1,relevance:0,_top:R,_emitter:new I.__emitter(I)};return P._emitter.addText(C),P}function Ss(C,P){P=P||I.languages||Object.keys(v);const G=xs(C),re=P.filter(Rt).filter(Ua).map(Ge=>Xn(Ge,C,!1));re.unshift(G);const ve=re.sort((Ge,ht)=>{if(Ge.relevance!==ht.relevance)return ht.relevance-Ge.relevance;if(Ge.language&&ht.language){if(Rt(Ge.language).supersetOf===ht.language)return 1;if(Rt(ht.language).supersetOf===Ge.language)return-1}return 0}),[at,Dt]=ve,Ur=at;return Ur.secondBest=Dt,Ur}function vf(C,P,G){const re=P&&N[P]||G;C.classList.add("hljs"),C.classList.add(`language-${re}`)}function ws(C){let P=null;const G=xe(C);if(U(G))return;if(Fr("before:highlightElement",{el:C,language:G}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),I.throwUnescapedHTML))throw new yf("One of your code blocks includes unescaped HTML.",C.innerHTML);P=C;const re=P.textContent,ve=G?ge(re,{language:G,ignoreIllegals:!0}):Ss(re);C.innerHTML=ve.value,C.dataset.highlighted="yes",vf(C,G,ve.language),C.result={language:ve.language,re:ve.relevance,relevance:ve.relevance},ve.secondBest&&(C.secondBest={language:ve.secondBest.language,relevance:ve.secondBest.relevance}),Fr("after:highlightElement",{el:C,result:ve,text:re})}function Ef(C){I=Pa(I,C)}const xf=()=>{Hr(),Nn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Sf(){Hr(),Nn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ha=!1;function Hr(){function C(){Hr()}if(document.readyState==="loading"){Ha||window.addEventListener("DOMContentLoaded",C,!1),Ha=!0;return}document.querySelectorAll(I.cssSelector).forEach(ws)}function wf(C,P){let G=null;try{G=P(y)}catch(re){if(on("Language definition for '{}' could not be registered.".replace("{}",C)),fe)on(re);else throw re;G=R}G.name||(G.name=C),v[C]=G,G.rawDefinition=P.bind(null,y),G.aliases&&Fa(G.aliases,{languageName:C})}function Tf(C){delete v[C];for(const P of Object.keys(N))N[P]===C&&delete N[P]}function Cf(){return Object.keys(v)}function Rt(C){return C=(C||"").toLowerCase(),v[C]||v[N[C]]}function Fa(C,{languageName:P}){typeof C=="string"&&(C=[C]),C.forEach(G=>{N[G.toLowerCase()]=P})}function Ua(C){const P=Rt(C);return P&&!P.disableAutodetect}function Mf(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=P=>{C["before:highlightBlock"](Object.assign({block:P.el},P))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=P=>{C["after:highlightBlock"](Object.assign({block:P.el},P))})}function Af(C){Mf(C),V.push(C)}function Nf(C){const P=V.indexOf(C);P!==-1&&V.splice(P,1)}function Fr(C,P){const G=C;V.forEach(function(re){re[G]&&re[G](P)})}function _f(C){return Nn("10.7.0","highlightBlock will be removed entirely in v12.0"),Nn("10.7.0","Please use highlightElement now."),ws(C)}Object.assign(y,{highlight:ge,highlightAuto:Ss,highlightAll:Hr,highlightElement:ws,highlightBlock:_f,configure:Ef,initHighlighting:xf,initHighlightingOnLoad:Sf,registerLanguage:wf,unregisterLanguage:Tf,listLanguages:Cf,getLanguage:Rt,registerAliases:Fa,autoDetection:Ua,inherit:Pa,addPlugin:Af,removePlugin:Nf}),y.debugMode=function(){fe=!1},y.safeMode=function(){fe=!0},y.versionString=bf,y.regex={concat:m,lookahead:h,either:b,optional:p,anyNumberOfTimes:f};for(const C in Br)typeof Br[C]=="object"&&n(Br[C]);return Object.assign(y,Br),y},_n=za({});return _n.newInstance=()=>za({}),qs=_n,_n.HighlightJS=_n,_n.default=_n,qs}var qy=jy();const Uu=Wy(qy);function Vu(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?Vu(t.children,r):{text:t.value,classes:r}})}function nc(n){return n.value||n.children||[]}function Gy(n){return!!Uu.getLanguage(n)}function rc({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return Eo(n,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=t.listLanguages(),d=l&&(c.includes(l)||Gy(l)||(o=t.registered)!=null&&o.call(t,l))?nc(t.highlight(l,s.node.textContent)):nc(t.highlightAuto(s.node.textContent));Vu(d).forEach(u=>{const h=a+u.text.length;if(u.classes.length){const f=$e.inline(a,h,{class:u.classes.join(" ")});i.push(f)}a=h})}),ae.create(n,i)}function Jy(n){return typeof n=="function"}function Zy({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>Jy(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new ne({key:new ce("lowlight"),state:{init:(i,{doc:s})=>rc({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=Eo(o.doc,h=>h.type.name===n),u=Eo(a.doc,h=>h.type.name===n);return i.docChanged&&([l,c].includes(n)||u.length!==d.length||i.steps.some(h=>h.from!==void 0&&h.to!==void 0&&d.some(f=>f.pos>=h.from&&f.pos+f.node.nodeSize<=h.to)))?rc({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var Yy=Ky.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],Zy({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),Xy=Yy,Qy=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),e0=Qy,t0=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),n0=t0,r0=ee.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),i0=r0,s0=20,Ku=(n,e=0)=>{const t=[];return!n.children.length||e>s0||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...Ku(r,e+1))}),t},o0=n=>{if(!n.children.length)return;const e=Ku(n);e&&e.forEach(t=>{var r,i;const s=t.getAttribute("style"),o=(i=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},Wu=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&o0(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",le(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),a0=ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),l0=ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),c0=ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),d0=ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),u0=ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ee.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(a0.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(l0.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(c0.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(d0.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(u0.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Wu.configure(this.options.textStyle)),n}});var Si=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},h0=/^\s*>\s$/,f0=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Si("blockquote",{...le(this.options.HTMLAttributes,n),children:Si("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(i=>{const o=e.renderChildren(i).split(`\n`).map(a=>`> ${a}`).join(`\n`);t.push(o)}),t.flatMap(i=>[i,"> "]).slice(0,-1).join(`\n`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Gn({find:h0,type:this.type})]}}),p0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,m0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,g0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,b0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,y0=it.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Si("strong",{...le(this.options.HTMLAttributes,n),children:Si("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[qn({find:p0,type:this.type}),qn({find:g0,type:this.type})]},addPasteRules(){return[Tn({find:m0,type:this.type}),Tn({find:b0,type:this.type})]}}),k0=Oe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n\n`):""}),v0=Oe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",le(this.options.HTMLAttributes,n)]},renderText(){return`\n`},renderMarkdown:(n,e)=>e.indent(`\n`),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),E0=Oe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,le(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>So({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),x0=Oe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",le(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Oy(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Tu(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(B.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d?.create();u&&(o.insert(c,u),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_y({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),S0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,w0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,T0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,C0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,M0=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[qn({find:S0,type:this.type}),qn({find:T0,type:this.type})]},addPasteRules(){return[Tn({find:w0,type:this.type}),Tn({find:C0,type:this.type})]}});const A0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",N0="ελ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",To="numeric",Co="ascii",Mo="alpha",dr="asciinumeric",sr="alphanumeric",Ao="domain",ju="emoji",_0="scheme",O0="slashscheme",Gs="whitespace";function I0(n,e){return n in e||(e[n]=[]),e[n]}function pn(n,e,t){e[To]&&(e[dr]=!0,e[sr]=!0),e[Co]&&(e[dr]=!0,e[Mo]=!0),e[dr]&&(e[sr]=!0),e[Mo]&&(e[sr]=!0),e[sr]&&(e[Ao]=!0),e[ju]&&(e[Ao]=!0);for(const r in e){const i=I0(r,t);i.indexOf(n)<0&&i.push(n)}}function L0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ke(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ke.groups={};Ke.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],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return 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||Ke.groups;let i;return e&&e.j?i=e:(i=new Ke(e),t&&r&&pn(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||Ke.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new Ke,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ke,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(L0(o.t,r),t);pn(s,l,r)}else t&&pn(s,t,r);o.t=s}return i.j[n]=o,o}};const W=(n,e,t,r,i)=>n.ta(e,t,r,i),de=(n,e,t,r,i)=>n.tr(e,t,r,i),ic=(n,e,t,r,i)=>n.ts(e,t,r,i),T=(n,e,t,r,i)=>n.tt(e,t,r,i),Mt="WORD",No="UWORD",qu="ASCIINUMERICAL",Gu="ALPHANUMERICAL",Mr="LOCALHOST",_o="TLD",Oo="UTLD",ai="SCHEME",$n="SLASH_SCHEME",pa="NUM",Io="WS",ma="NL",ur="OPENBRACE",hr="CLOSEBRACE",wi="OPENBRACKET",Ti="CLOSEBRACKET",Ci="OPENPAREN",Mi="CLOSEPAREN",Ai="OPENANGLEBRACKET",Ni="CLOSEANGLEBRACKET",_i="FULLWIDTHLEFTPAREN",Oi="FULLWIDTHRIGHTPAREN",Ii="LEFTCORNERBRACKET",Li="RIGHTCORNERBRACKET",Ri="LEFTWHITECORNERBRACKET",Di="RIGHTWHITECORNERBRACKET",$i="FULLWIDTHLESSTHAN",Pi="FULLWIDTHGREATERTHAN",Bi="AMPERSAND",zi="APOSTROPHE",Hi="ASTERISK",zt="AT",Fi="BACKSLASH",Ui="BACKTICK",Vi="CARET",Ut="COLON",ga="COMMA",Ki="DOLLAR",pt="DOT",Wi="EQUALS",ba="EXCLAMATION",Qe="HYPHEN",fr="PERCENT",ji="PIPE",qi="PLUS",Gi="POUND",pr="QUERY",ya="QUOTE",Ju="FULLWIDTHMIDDLEDOT",ka="SEMI",mt="SLASH",mr="TILDE",Ji="UNDERSCORE",Zu="EMOJI",Zi="SYM";var Yu=Object.freeze({__proto__:null,ALPHANUMERICAL:Gu,AMPERSAND:Bi,APOSTROPHE:zi,ASCIINUMERICAL:qu,ASTERISK:Hi,AT:zt,BACKSLASH:Fi,BACKTICK:Ui,CARET:Vi,CLOSEANGLEBRACKET:Ni,CLOSEBRACE:hr,CLOSEBRACKET:Ti,CLOSEPAREN:Mi,COLON:Ut,COMMA:ga,DOLLAR:Ki,DOT:pt,EMOJI:Zu,EQUALS:Wi,EXCLAMATION:ba,FULLWIDTHGREATERTHAN:Pi,FULLWIDTHLEFTPAREN:_i,FULLWIDTHLESSTHAN:$i,FULLWIDTHMIDDLEDOT:Ju,FULLWIDTHRIGHTPAREN:Oi,HYPHEN:Qe,LEFTCORNERBRACKET:Ii,LEFTWHITECORNERBRACKET:Ri,LOCALHOST:Mr,NL:ma,NUM:pa,OPENANGLEBRACKET:Ai,OPENBRACE:ur,OPENBRACKET:wi,OPENPAREN:Ci,PERCENT:fr,PIPE:ji,PLUS:qi,POUND:Gi,QUERY:pr,QUOTE:ya,RIGHTCORNERBRACKET:Li,RIGHTWHITECORNERBRACKET:Di,SCHEME:ai,SEMI:ka,SLASH:mt,SLASH_SCHEME:$n,SYM:Zi,TILDE:mr,TLD:_o,UNDERSCORE:Ji,UTLD:Oo,UWORD:No,WORD:Mt,WS:Io});const Tt=/[a-z]/,er=/\p{L}/u,Js=/\p{Emoji}/u,Ct=/\d/,Zs=/\s/,sc="\r",Ys=`\n`,R0="️",D0="‍",Xs="";let Xr=null,Qr=null;function $0(n=[]){const e={};Ke.groups=e;const t=new Ke;Xr==null&&(Xr=oc(A0)),Qr==null&&(Qr=oc(N0)),T(t,"'",zi),T(t,"{",ur),T(t,"}",hr),T(t,"[",wi),T(t,"]",Ti),T(t,"(",Ci),T(t,")",Mi),T(t,"<",Ai),T(t,">",Ni),T(t,"(",_i),T(t,")",Oi),T(t,"「",Ii),T(t,"」",Li),T(t,"『",Ri),T(t,"』",Di),T(t,"<",$i),T(t,">",Pi),T(t,"&",Bi),T(t,"*",Hi),T(t,"@",zt),T(t,"`",Ui),T(t,"^",Vi),T(t,":",Ut),T(t,",",ga),T(t,"$",Ki),T(t,".",pt),T(t,"=",Wi),T(t,"!",ba),T(t,"-",Qe),T(t,"%",fr),T(t,"|",ji),T(t,"+",qi),T(t,"#",Gi),T(t,"?",pr),T(t,'"',ya),T(t,"/",mt),T(t,";",ka),T(t,"~",mr),T(t,"_",Ji),T(t,"\\",Fi),T(t,"・",Ju);const r=de(t,Ct,pa,{[To]:!0});de(r,Ct,r);const i=de(r,Tt,qu,{[dr]:!0}),s=de(r,er,Gu,{[sr]:!0}),o=de(t,Tt,Mt,{[Co]:!0});de(o,Ct,i),de(o,Tt,o),de(i,Ct,i),de(i,Tt,i);const a=de(t,er,No,{[Mo]:!0});de(a,Tt),de(a,Ct,s),de(a,er,a),de(s,Ct,s),de(s,Tt),de(s,er,s);const l=T(t,Ys,ma,{[Gs]:!0}),c=T(t,sc,Io,{[Gs]:!0}),d=de(t,Zs,Io,{[Gs]:!0});T(t,Xs,d),T(c,Ys,l),T(c,Xs,d),de(c,Zs,d),T(d,sc),T(d,Ys),de(d,Zs,d),T(d,Xs,d);const u=de(t,Js,Zu,{[ju]:!0});T(u,"#"),de(u,Js,u),T(u,R0,u);const h=T(u,D0);T(h,"#"),de(h,Js,u);const f=[[Tt,o],[Ct,i]],p=[[Tt,null],[er,a],[Ct,s]];for(let m=0;m<Xr.length;m++)$t(t,Xr[m],_o,Mt,f);for(let m=0;m<Qr.length;m++)$t(t,Qr[m],Oo,No,p);pn(_o,{tld:!0,ascii:!0},e),pn(Oo,{utld:!0,alpha:!0},e),$t(t,"file",ai,Mt,f),$t(t,"mailto",ai,Mt,f),$t(t,"http",$n,Mt,f),$t(t,"https",$n,Mt,f),$t(t,"ftp",$n,Mt,f),$t(t,"ftps",$n,Mt,f),pn(ai,{scheme:!0,ascii:!0},e),pn($n,{slashscheme:!0,ascii:!0},e),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],k=n[m][1]?{[_0]:!0}:{[O0]:!0};g.indexOf("-")>=0?k[Ao]=!0:Tt.test(g)?Ct.test(g)?k[dr]=!0:k[Co]=!0:k[To]=!0,ic(t,g,g,k)}return ic(t,"localhost",Mr,{ascii:!0}),t.jd=new Ke(Zi),{start:t,tokens:Object.assign({groups:e},Yu)}}function Xu(n,e){const t=P0(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=t[o].length,h++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=h,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function P0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function $t(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new Ke(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new Ke(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function oc(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Ar={defaultProtocol:"http",events:null,format:ac,formatHref:ac,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function va(n,e=null){let t=Object.assign({},Ar);n&&(t=Object.assign(t,n instanceof va?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}va.prototype={o:Ar,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]:Ar[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 ac(n){return n}function Qu(n,e){this.t="token",this.v=n,this.tk=e}Qu.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=Ar.defaultProtocol){return{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),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function bs(n,e){class t extends Qu{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const lc=bs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),cc=bs("text"),B0=bs("nl"),ei=bs("url",{isLink:!0,toHref(n=Ar.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Mr&&n[1].t===Ut}}),Xe=n=>new Ke(n);function z0({groups:n}){const e=n.domain.concat([Bi,Hi,zt,Fi,Ui,Vi,Ki,Wi,Qe,pa,fr,ji,qi,Gi,mt,Zi,mr,Ji]),t=[zi,Ut,ga,pt,ba,fr,pr,ya,ka,Ai,Ni,ur,hr,Ti,wi,Ci,Mi,_i,Oi,Ii,Li,Ri,Di,$i,Pi],r=[Bi,zi,Hi,Fi,Ui,Vi,Ki,Wi,Qe,ur,hr,fr,ji,qi,Gi,pr,mt,Zi,mr,Ji],i=Xe(),s=T(i,mr);W(s,r,s),W(s,n.domain,s);const o=Xe(),a=Xe(),l=Xe();W(i,n.domain,o),W(i,n.scheme,a),W(i,n.slashscheme,l),W(o,r,s),W(o,n.domain,o);const c=T(o,zt);T(s,zt,c),T(a,zt,c),T(l,zt,c);const d=T(s,pt);W(d,r,s),W(d,n.domain,s);const u=Xe();W(c,n.domain,u),W(u,n.domain,u);const h=T(u,pt);W(h,n.domain,u);const f=Xe(lc);W(h,n.tld,f),W(h,n.utld,f),T(c,Mr,f);const p=T(u,Qe);T(p,Qe,p),W(p,n.domain,u),W(f,n.domain,u),T(f,pt,h),T(f,Qe,p);const m=T(f,Ut);W(m,n.numeric,lc);const g=T(o,Qe),b=T(o,pt);T(g,Qe,g),W(g,n.domain,o),W(b,r,s),W(b,n.domain,o);const k=Xe(ei);W(b,n.tld,k),W(b,n.utld,k),W(k,n.domain,o),W(k,r,s),T(k,pt,b),T(k,Qe,g),T(k,zt,c);const E=T(k,Ut),x=Xe(ei);W(E,n.numeric,x);const w=Xe(ei),M=Xe();W(w,e,w),W(w,t,M),W(M,e,w),W(M,t,M),T(k,mt,w),T(x,mt,w);const A=T(a,Ut),L=T(l,Ut),F=T(L,mt),se=T(F,mt);W(a,n.domain,o),T(a,pt,b),T(a,Qe,g),W(l,n.domain,o),T(l,pt,b),T(l,Qe,g),W(A,n.domain,w),T(A,mt,w),T(A,pr,w),W(se,n.domain,w),W(se,e,w),T(se,mt,w);const Ie=[[ur,hr],[wi,Ti],[Ci,Mi],[Ai,Ni],[_i,Oi],[Ii,Li],[Ri,Di],[$i,Pi]];for(let Ce=0;Ce<Ie.length;Ce++){const[ze,Z]=Ie[Ce],J=T(w,ze);T(M,ze,J),T(J,Z,w);const me=Xe(ei);W(J,e,me);const st=Xe();W(J,t),W(me,e,me),W(me,t,st),W(st,e,me),W(st,t,st),T(me,Z,w),T(st,Z,w)}return T(i,Mr,k),T(i,ma,B0),{start:i,tokens:Yu}}function H0(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Qs(cc,e,o)),o=[]),i-=h,d-=h;const f=u.t,p=t.slice(i-d,i);s.push(Qs(f,e,p))}}return o.length>0&&s.push(Qs(cc,e,o)),s}function Qs(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const F0=typeof console<"u"&&console&&console.warn||(()=>{}),U0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function V0(){return Ke.groups={},oe.scanner=null,oe.parser=null,oe.tokenQueue=[],oe.pluginQueue=[],oe.customSchemes=[],oe.initialized=!1,oe}function dc(n,e=!1){if(oe.initialized&&F0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${U0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat`);oe.customSchemes.push([n,e])}function K0(){oe.scanner=$0(oe.customSchemes);for(let n=0;n<oe.tokenQueue.length;n++)oe.tokenQueue[n][1]({scanner:oe.scanner});oe.parser=z0(oe.scanner.tokens);for(let n=0;n<oe.pluginQueue.length;n++)oe.pluginQueue[n][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function Ea(n){return oe.initialized||K0(),H0(oe.parser.start,n,Xu(oe.scanner.start,n))}Ea.scan=Xu;function eh(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new va(t),i=Ea(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var xa="[\0-   ᠎ -\u2029  ]",W0=new RegExp(xa),j0=new RegExp(`${xa}$`),q0=new RegExp(xa,"g");function G0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function J0(n){return new ne({key:new ce("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=bu(t.doc,[...e]);if(wu(a).forEach(({newRange:c})=>{const d=Db(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!j0.test(f))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const f=h.split(W0).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=u.pos+h.lastIndexOf(p);if(!p)return!1;const g=Ea(p).map(b=>b.toObject(n.defaultProtocol));if(!G0(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{ca(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function Z0(n){return new ne({key:new ce("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;o=u.find(h=>h.nodeName==="A")}if(!o)return!1;const a=Su(e.state,n.type.name),l=(i=o?.href)!=null?i:a.href,c=(s=o?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&l?(window.open(l,c),!0):!1}}})}function Y0(n){return new ne({key:new ce("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=eh(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.href)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function ln(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(q0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var th=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){dc(n);return}dc(n.scheme,n.optionalSlashes)})},onDestroy(){V0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!ln(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!ln(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!ln(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",le(this.options.HTMLAttributes,n),0]:["a",le(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Tn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=eh(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!ln(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(J0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ln(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Z0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Y0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),X0=th,Q0=Object.defineProperty,ek=(n,e)=>{for(var t in e)Q0(n,t,{get:e[t],enumerable:!0})},tk="listItem",uc="textStyle",hc=/^\s*([-+*])\s$/,nh=Oe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tk,this.editor.getAttributes(uc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Gn({find:hc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Gn({find:hc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(uc),editor:this.editor})),[n]}}),rh=Oe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=n.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>fa(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),nk={};ek(nk,{findListItemPos:()=>Dr,getNextListDepth:()=>Sa,handleBackspace:()=>Lo,handleDelete:()=>Ro,hasListBefore:()=>ih,hasListItemAfter:()=>rk,hasListItemBefore:()=>sh,listItemHasSubList:()=>oh,nextListIsDeeper:()=>ah,nextListIsHigher:()=>lh});var Dr=(n,e)=>{const{$from:t}=e.selection,r=ke(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Sa=(n,e)=>{const t=Dr(n,e);if(!t)return!1;const[,r]=Wb(e,n,t.$pos.pos+4);return r},ih=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},sh=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},oh=(n,e,t)=>{if(!t)return!1;const r=ke(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Lo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Qt(n.state,e)&&ih(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Qt(n.state,e)||!Jb(n.state))return!1;const r=Dr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=oh(e,n.state,s);return sh(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},ah=(n,e)=>{const t=Sa(n,e),r=Dr(n,e);return!r||!t?!1:t>r.depth},lh=(n,e)=>{const t=Sa(n,e),r=Dr(n,e);return!r||!t?!1:t<r.depth},Ro=(n,e)=>{if(!Qt(n.state,e)||!Gb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:ah(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():lh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},rk=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},ch=ee.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ro(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ro(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Lo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Lo(n,t,r)&&(e=!0)}),e}}}}),fc=/^(\s*)(\d+)\.\s+(.*)$/,ik=/^\s/;function sk(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(fc);if(!s)break;const[,o,a,l]=s,c=o.length;let d=l,u=t+1;const h=[i];for(;u<n.length;){const f=n[u];if(f.match(fc))break;if(f.trim()==="")h.push(f),d+=`\n`,u+=1;else if(f.match(ik))h.push(f),d+=`\n${f.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join(`\n`)}),r=u,t=u}return[e,r]}function dh(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const a=o.content.split(`\n`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.slice(1).join(`\n`).trim();if(d){const f=t.blockTokens(d);c.push(...f)}let u=s+1;const h=[];for(;u<n.length&&n[u].indent>e;)h.push(n[u]),u+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=dh(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`\n`)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=u}else s+=1}return i}function ok(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var ak="listItem",pc="textStyle",mc=/^(\d+)\.\s$/,uh=Oe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",le(this.options.HTMLAttributes,t),0]:["ol",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?ok(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`\n`),[s,o]=sk(i);if(s.length===0)return;const a=dh(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`\n`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ak,this.editor.getAttributes(pc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Gn({find:mc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Gn({find:mc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(pc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),lk=/^\s*(\[([( |x])?\])\s$/,ck=Oe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",le(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return fa(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var u,h;a.ariaLabel=((h=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:h.call(u,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const p=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u)}),{dom:i,contentDOM:l,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[Gn({find:lk,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),dk=Oe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",le(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=wo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=wo(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(nh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(rh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ch.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(uh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(ck.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(dk.configure(this.options.taskList)),n}});var uk=Oe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",le(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,pk=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[qn({find:hk,type:this.type})]},addPasteRules(){return[Tn({find:fk,type:this.type})]}}),mk=Oe.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),gk=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",le(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function bk(n={}){return new ne({view(e){return new yk(e,n)}})}class yk{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 s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=u?p.bottom:p.top;u&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"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,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=cd(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends j{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ue.valid(r)?new ue(r):j.near(r)}content(){return O.empty}eq(e){return e instanceof ue&&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 ue(e.resolve(t.pos))}getBookmark(){return new wa(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!kk(e)||!vk(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&&ue.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(ue.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(ue.valid(a))return a}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;j.jsonID("gapcursor",ue);class wa{constructor(e){this.pos=e}map(e){return new wa(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):j.near(t)}}function hh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function kk(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||hh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function vk(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||hh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ek(){return new ne({props:{decorations:Tk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:Sk,handleKeyDown:xk,handleDOMEvents:{beforeinput:wk}}})}const xk=cu({ArrowLeft:ti("horiz",-1),ArrowRight:ti("horiz",1),ArrowUp:ti("vert",-1),ArrowDown:ti("vert",1)});function ti(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof H){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ue.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new ue(c))),!0):!1}}function Sk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}function wk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))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=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new O(i,0,0));return s.setSelection(H.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Tk(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[$e.widget(n.selection.head,e,{key:"gapcursor"})])}var Yi=200,Te=function(){};Te.prototype.append=function(e){return e.length?(e=Te.from(e),!this.length&&e||e.length<Yi&&this.leafAppend(e)||this.length<Yi&&e.leafPrepend(this)||this.appendInner(e)):this};Te.prototype.prepend=function(e){return e.length?Te.from(e).append(this):this};Te.prototype.appendInner=function(e){return new Ck(this,e)};Te.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Te.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Te.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Te.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)};Te.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Te.from=function(e){return e instanceof Te?e:e&&e.length?new fh(e):Te.empty};var fh=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Yi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Yi)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}(Te);Te.empty=new fh([]);var Ck=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,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Te);const Mk=500;class lt{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new gt(u.map));let f=u.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new gt(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(s)):u.selection,l=new lt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new gt(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-r.depth;return c>Nk&&(a=Ak(a,c),o-=c),new lt(a.append(s),o)}remapping(e,t){let r=new vr;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new gt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(l+1,f));g&&a++,r.push(new gt(p,m,g))}else r.push(new gt(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new gt(s.maps[h]));let d=this.items.slice(0,i).append(c).append(r),u=new lt(d,a);return u.emptyItemCount()>Mk&&(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=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new gt(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else o.map&&r--},this.items.length,0),new lt(Te.from(i.reverse()),s)}}lt.empty=new lt(Te.empty,0);function Ak(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class gt{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 gt(t.getMap().invert(),t,this.selection)}}}class Ht{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Nk=20;function _k(n,e,t,r){let i=t.getMeta(vn),s;if(i)return i.historyState;t.getMeta(Lk)&&(n=new Ht(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(vn))return o.getMeta(vn).redo?new Ht(n.done.addTransform(t,void 0,r,li(e)),n.undone,gc(t.mapping.maps),n.prevTime,n.prevComposition):new Ht(n.done,n.undone.addTransform(t,void 0,r,li(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Ok(t,n.prevRanges)),c=o?eo(n.prevRanges,t.mapping):gc(t.mapping.maps);return new Ht(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,li(e)),lt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Ht(n.done.rebased(t,s),n.undone.rebased(t,s),eo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ht(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),eo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Ok(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function gc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function eo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function Ik(n,e,t){let r=li(e),i=vn.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Ht(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(vn,{redo:t,historyState:l})}let to=!1,bc=null;function li(n){let e=n.plugins;if(bc!=e){to=!1,bc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){to=!0;break}}return to}const vn=new ce("history"),Lk=new ce("closeHistory");function Rk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ne({key:vn,state:{init(){return new Ht(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return _k(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?mh:r=="historyRedo"?gh:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function ph(n,e){return(t,r)=>{let i=vn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Ik(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const mh=ph(!1,!0),gh=ph(!0,!0);ee.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ne({key:new ce("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var Dk=ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bk(this.options)]}});ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ne({key:new ce("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push($e.node(c,c+l.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var $k=ee.create({name:"gapCursor",addProseMirrorPlugins(){return[Ek()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Q($(n,"allowGapCursor",t)))!=null?e:null}}});ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ne({key:new ce("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&ps(o);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=$e.node(a,a+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ae.create(n,i)}}})]}});ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ne({key:new ce("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Tu(t.selection)||n.view.dragging?null:ae.create(t.doc,[$e.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function yc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Pk=ee.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ce(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new ne({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),u=a.content.size,h=c.nodes[t];if(d)return l.insert(u,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!yc({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged)return s;const o=i.doc.lastChild;return!yc({node:o,types:r})}}})]}}),Bk=ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>mh(n,e),redo:()=>({state:n,dispatch:e})=>gh(n,e)}},addProseMirrorPlugins(){return[Rk(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),zk=ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(y0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(f0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(nh.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Hu.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Fu.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(k0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Dk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push($k.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(v0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(E0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Bk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(x0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(M0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(rh.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(ch.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(th.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(uh.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(uk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(pk.configure(this.options.strike)),this.options.text!==!1&&i.push(mk.configure(this.options.text)),this.options.underline!==!1&&i.push(gk.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Pk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Hk=zk;
2
- /**
3
- * @license
4
- * Copyright 2019 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */const ci=globalThis,Ta=ci.ShadowRoot&&(ci.ShadyCSS===void 0||ci.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ca=Symbol(),kc=new WeakMap;let bh=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ca)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Ta&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=kc.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&kc.set(t,e))}return e}toString(){return this.cssText}};const yh=n=>new bh(typeof n=="string"?n:n+"",void 0,Ca),vt=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new bh(t,n,Ca)},Fk=(n,e)=>{if(Ta)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=ci.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},vc=Ta?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return yh(t)})(n):n;
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */const{is:Uk,defineProperty:Vk,getOwnPropertyDescriptor:Kk,getOwnPropertyNames:Wk,getOwnPropertySymbols:jk,getPrototypeOf:qk}=Object,ys=globalThis,Ec=ys.trustedTypes,Gk=Ec?Ec.emptyScript:"",Jk=ys.reactiveElementPolyfillSupport,gr=(n,e)=>n,Xi={toAttribute(n,e){switch(e){case Boolean:n=n?Gk:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ma=(n,e)=>!Uk(n,e),xc={attribute:!0,type:String,converter:Xi,reflect:!1,useDefault:!1,hasChanged:Ma};Symbol.metadata??=Symbol("metadata"),ys.litPropertyMetadata??=new WeakMap;let Pn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=xc){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Vk(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=Kk(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xc}static _$Ei(){if(this.hasOwnProperty(gr("elementProperties")))return;const e=qk(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(gr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(gr("properties"))){const t=this.properties,r=[...Wk(t),...jk(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(vc(i))}else e!==void 0&&t.push(vc(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Fk(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const s=(r.converter?.toAttribute!==void 0?r.converter:Xi).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=r.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Xi;this._$Em=i;const a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const i=this.constructor,s=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??Ma)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[i,s]of r){const{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Pn.elementStyles=[],Pn.shadowRootOptions={mode:"open"},Pn[gr("elementProperties")]=new Map,Pn[gr("finalized")]=new Map,Jk?.({ReactiveElement:Pn}),(ys.reactiveElementVersions??=[]).push("2.1.1");
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */const Aa=globalThis,Qi=Aa.trustedTypes,Sc=Qi?Qi.createPolicy("lit-html",{createHTML:n=>n}):void 0,kh="$lit$",Vt=`lit$${Math.random().toFixed(9).slice(2)}$`,vh="?"+Vt,Zk=`<${vh}>`,Cn=document,Nr=()=>Cn.createComment(""),_r=n=>n===null||typeof n!="object"&&typeof n!="function",Na=Array.isArray,Yk=n=>Na(n)||typeof n?.[Symbol.iterator]=="function",no=`[ \t\n\f\r]`,tr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wc=/-->/g,Tc=/>/g,cn=RegExp(`>|${no}(?:([^\\s"'>=/]+)(${no}*=${no}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Cc=/'/g,Mc=/"/g,Eh=/^(?:script|style|textarea|title)$/i,Xk=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),z=Xk(1),Mn=Symbol.for("lit-noChange"),he=Symbol.for("lit-nothing"),Ac=new WeakMap,mn=Cn.createTreeWalker(Cn,129);function xh(n,e){if(!Na(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Sc!==void 0?Sc.createHTML(e):e}const Qk=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=tr;for(let a=0;a<t;a++){const l=n[a];let c,d,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,d=o.exec(l),d!==null);)h=o.lastIndex,o===tr?d[1]==="!--"?o=wc:d[1]!==void 0?o=Tc:d[2]!==void 0?(Eh.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=cn):d[3]!==void 0&&(o=cn):o===cn?d[0]===">"?(o=i??tr,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?cn:d[3]==='"'?Mc:Cc):o===Mc||o===Cc?o=cn:o===wc||o===Tc?o=tr:(o=cn,i=void 0);const f=o===cn&&n[a+1].startsWith("/>")?" ":"";s+=o===tr?l+Zk:u>=0?(r.push(c),l.slice(0,u)+kh+l.slice(u)+Vt+f):l+Vt+(u===-2?a:f)}return[xh(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class Or{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[c,d]=Qk(e,t);if(this.el=Or.createElement(c,r),mn.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=mn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(kh)){const h=d[o++],f=i.getAttribute(u).split(Vt),p=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:p[2],strings:f,ctor:p[1]==="."?tv:p[1]==="?"?nv:p[1]==="@"?rv:ks}),i.removeAttribute(u)}else u.startsWith(Vt)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Eh.test(i.tagName)){const u=i.textContent.split(Vt),h=u.length-1;if(h>0){i.textContent=Qi?Qi.emptyScript:"";for(let f=0;f<h;f++)i.append(u[f],Nr()),mn.nextNode(),l.push({type:2,index:++s});i.append(u[h],Nr())}}}else if(i.nodeType===8)if(i.data===vh)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Vt,u+1))!==-1;)l.push({type:7,index:s}),u+=Vt.length-1}s++}}static createElement(e,t){const r=Cn.createElement("template");return r.innerHTML=e,r}}function Jn(n,e,t=n,r){if(e===Mn)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl;const s=_r(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Jn(n,i._$AS(n,e.values),i,r)),e}class ev{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Cn).importNode(t,!0);mn.currentNode=i;let s=mn.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new $r(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new iv(s,this,e)),this._$AV.push(c),l=r[++a]}o!==l?.index&&(s=mn.nextNode(),o++)}return mn.currentNode=Cn,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class $r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=he,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Jn(this,e,t),_r(e)?e===he||e==null||e===""?(this._$AH!==he&&this._$AR(),this._$AH=he):e!==this._$AH&&e!==Mn&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Yk(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==he&&_r(this._$AH)?this._$AA.nextSibling.data=e:this.T(Cn.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Or.createElement(xh(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new ev(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Ac.get(e.strings);return t===void 0&&Ac.set(e.strings,t=new Or(e)),t}k(e){Na(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new $r(this.O(Nr()),this.O(Nr()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class ks{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=he,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=he}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=Jn(this,e,t,0),o=!_r(e)||e!==this._$AH&&e!==Mn,o&&(this._$AH=e);else{const a=e;let l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Jn(this,a[r+l],t,l),c===Mn&&(c=this._$AH[l]),o||=!_r(c)||c!==this._$AH[l],c===he?e=he:e!==he&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===he?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class tv extends ks{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===he?void 0:e}}class nv extends ks{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==he)}}class rv extends ks{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Jn(this,e,t,0)??he)===Mn)return;const r=this._$AH,i=e===he&&r!==he||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==he&&(r===he||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class iv{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Jn(this,e)}}const sv=Aa.litHtmlPolyfillSupport;sv?.(Or,$r),(Aa.litHtmlVersions??=[]).push("3.3.1");const Ze=(n,e,t)=>{const r=t?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const s=t?.renderBefore??null;r._$litPart$=i=new $r(e.insertBefore(Nr(),s),s,void 0,t??{})}return i._$AI(n),i};
17
- /**
18
- * @license
19
- * Copyright 2017 Google LLC
20
- * SPDX-License-Identifier: BSD-3-Clause
21
- */const _a=globalThis;let Yt=class extends Pn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ze(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Mn}};Yt._$litElement$=!0,Yt.finalized=!0,_a.litElementHydrateSupport?.({LitElement:Yt});const ov=_a.litElementPolyfillSupport;ov?.({LitElement:Yt});(_a.litElementVersions??=[]).push("4.2.1");
22
- /**
23
- * @license
24
- * Copyright 2017 Google LLC
25
- * SPDX-License-Identifier: BSD-3-Clause
26
- */const vs=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};
27
- /**
28
- * @license
29
- * Copyright 2017 Google LLC
30
- * SPDX-License-Identifier: BSD-3-Clause
31
- */const av={attribute:!0,type:String,converter:Xi,reflect:!1,hasChanged:Ma},lv=(n=av,e,t)=>{const{kind:r,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),s.set(t.name,n),r==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,n)},init(a){return a!==void 0&&this.C(o,void 0,n,a),a}}}if(r==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,n)}}throw Error("Unsupported decorator location: "+r)};function Ee(n){return(e,t)=>typeof t=="object"?lv(n,e,t):((r,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,r),o?Object.getOwnPropertyDescriptor(i,s):void 0})(n,e,t)}
32
- /**
33
- * @license
34
- * Copyright 2017 Google LLC
35
- * SPDX-License-Identifier: BSD-3-Clause
36
- */function Et(n){return Ee({...n,state:!0,attribute:!1})}
37
- /**
38
- * @license
39
- * Copyright 2017 Google LLC
40
- * SPDX-License-Identifier: BSD-3-Clause
41
- */const cv=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);
42
- /**
43
- * @license
44
- * Copyright 2017 Google LLC
45
- * SPDX-License-Identifier: BSD-3-Clause
46
- */function Pr(n,e){return(t,r,i)=>{const s=o=>o.renderRoot?.querySelector(n)??null;return cv(t,r,{get(){return s(this)}})}}
47
- /**
48
- * @license
49
- * Copyright 2020 Google LLC
50
- * SPDX-License-Identifier: BSD-3-Clause
51
- */const dv=n=>n.strings===void 0;
52
- /**
53
- * @license
54
- * Copyright 2017 Google LLC
55
- * SPDX-License-Identifier: BSD-3-Clause
56
- */const Sh={CHILD:2},wh=n=>(...e)=>({_$litDirective$:n,values:e});class Th{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
57
- /**
58
- * @license
59
- * Copyright 2017 Google LLC
60
- * SPDX-License-Identifier: BSD-3-Clause
61
- */const br=(n,e)=>{const t=n._$AN;if(t===void 0)return!1;for(const r of t)r._$AO?.(e,!1),br(r,e);return!0},es=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},Ch=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),fv(e)}};function uv(n){this._$AN!==void 0?(es(this),this._$AM=n,Ch(this)):this._$AM=n}function hv(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)br(r[s],!1),es(r[s]);else r!=null&&(br(r,!1),es(r));else br(this,n)}const fv=n=>{n.type==Sh.CHILD&&(n._$AP??=hv,n._$AQ??=uv)};class pv extends Th{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Ch(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(br(this,e),es(this))}setValue(e){if(dv(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const ro=new WeakMap,mv=wh(class extends pv{render(n){return he}update(n,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=n.options?.host,this.rt(this.ct=n.element)),he}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=ro.get(e);t===void 0&&(t=new WeakMap,ro.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?ro.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function gv(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=n.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],w=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...k,...E,"set","shopt",...x,...w]},contains:[f,n.SHEBANG(),p,u,s,o,b,a,l,c,d,t]}}function bv(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[n.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(k,E,b,[u,{begin:n.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function yv(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],x={type:m,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},w={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},M=[w,u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:M.concat([{begin:/\(/,end:/\)/,keywords:x,contains:M.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:f,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,L,w,M,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:x,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function kv(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=n.inherit(n.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=n.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=n.inherit(h,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,f]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},g=n.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});h.contains=[m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.C_BLOCK_COMMENT_MODE],f.contains=[g,p,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},E=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}]}),n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,l,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},x]}}const vv=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Ev=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],xv=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Sv=[...Ev,...xv],wv=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Tv=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Cv=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Mv=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Av(n){const e=n.regex,t=vv(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Tv.join("|")+")"},{begin:":(:)?("+Cv.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Mv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:wv.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sv.join("|")+")\\b"}]}}var Bn="[0-9](_*[0-9])*",ni=`\\.(${Bn})`,ri="[0-9a-fA-F](_*[0-9a-fA-F])*",Nc={className:"number",variants:[{begin:`(\\b(${Bn})((${ni})|\\.)?|(${ni}))[eE][+-]?(${Bn})[fFdD]?\\b`},{begin:`\\b(${Bn})((${ni})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ni})[fFdD]?\\b`},{begin:`\\b(${Bn})[fFdD]\\b`},{begin:`\\b0[xX]((${ri})\\.?|(${ri})?\\.(${ri}))[pP][+-]?(${Bn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ri})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Mh(n,e,t){return t===-1?"":n.replace(e,r=>Mh(n,e,t-1))}function Nv(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+Mh("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[d,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,Nc,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Nc,c]}}const _c="[A-Za-z$_][0-9A-Za-z$_]*",_v=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Ov=["true","false","null","undefined","NaN","Infinity"],Ah=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Nh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],_h=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Iv=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Lv=[].concat(_h,Ah,Nh);function Rv(n){const e=n.regex,t=(Y,{after:He})=>{const qe="</"+Y[0].slice(1);return Y.input.indexOf(qe,He)!==-1},r=_c,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const qe=Y[0].length+Y.index,ot=Y.input[qe];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:qe})||He.ignoreMatch());let xt;const sn=Y.input.substring(qe);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:_c,keyword:_v,literal:Ov,built_in:Lv,"variable.language":Iv},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},E=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const x=[].concat(k,h.contains),w=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ah,...Nh]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},se={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},Ie={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ce(Y){return e.concat("(?!",Y.join("|"),")")}const ze={match:e.concat(/\b/,Ce([..._h,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},me="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(me)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:me,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},se,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},ze,Ie,A,J,{match:/\$[(.]/}]}}function Dv(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function $v(n){const e=n.regex,t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=n.inherit(c,{contains:[]}),h=n.inherit(d,{contains:[]});c.contains.push(h),d.contains.push(u);let f=[t,l];return[c,d,u,h].forEach(b=>{b.contains=b.contains.concat(f)}),f=f.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},t,s,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Pv(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),s=e.concat(/[A-Z]+/,t),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=n.inherit(n.APOS_STRING_MODE,{illegal:null}),d=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Z,J)=>{J.data._beginMatch=Z[1]||Z[2]},"on:end":(Z,J)=>{J.data._beginMatch!==Z[1]&&J.ignoreMatch()}},h=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ \t\n]`,p={scope:"string",variants:[d,c,u,h]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],k=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:b,literal:(Z=>{const J=[];return Z.forEach(me=>{J.push(me),me.toLowerCase()===me?J.push(me.toUpperCase()):J.push(me.toLowerCase())}),J})(g),built_in:k},w=Z=>Z.map(J=>J.replace(/\|\d+$/,"")),M={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",w(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(r,"\\b(?!\\()"),L={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},F={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},se={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[F,o,L,n.C_BLOCK_COMMENT_MODE,p,m,M]},Ie={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",w(b).join("\\b|"),"|",w(k).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[se]};se.contains.push(Ie);const Ce=[F,L,n.C_BLOCK_COMMENT_MODE,p,m,M],ze={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...Ce]},...Ce,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:x,contains:[ze,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,Ie,L,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},M,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",ze,o,L,n.C_BLOCK_COMMENT_MODE,p,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},p,m]}}function Bv(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function zv(n){const e=n.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[n.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,d,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,n.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,u]}]}}function Hv(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},u={className:"string",contains:[n.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},M=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:t}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=M,m.contains=M;const se=[{begin:/^\s*=>/,starts:{end:"$",contains:M}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:M}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(se).concat(c).concat(M)}}function Fv(n){const e=n.regex,t=/(r#)?/,r=e.concat(t,n.UNDERSCORE_IDENT_RE),i=e.concat(t,n.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:n.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.COMMENT("/\\*","\\*/",{contains:["self"]}),n.inherit(n.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:n.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},s]}}function Uv(n){const e=n.regex,t=n.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...l].filter(w=>!d.includes(w)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function k(w){return e.concat(/\b/,e.either(...w.map(M=>M.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:k(h),relevance:0};function x(w,{exceptions:M,when:A}={}){const L=A;return M=M||[],w.map(F=>F.match(/\|\d+$/)||M.includes(F)?F:L(F)?`${F}|0`:F)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(p,{when:w=>w.length<3}),literal:s,type:a,built_in:u},contains:[{scope:"type",match:k(o)},E,b,m,r,i,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,g]}}const ts="[A-Za-z$_][0-9A-Za-z$_]*",Oh=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Ih=["true","false","null","undefined","NaN","Infinity"],Lh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Rh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Dh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],$h=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ph=[].concat(Dh,Lh,Rh);function Vv(n){const e=n.regex,t=(Y,{after:He})=>{const qe="</"+Y[0].slice(1);return Y.input.indexOf(qe,He)!==-1},r=ts,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const qe=Y[0].length+Y.index,ot=Y.input[qe];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:qe})||He.ignoreMatch());let xt;const sn=Y.input.substring(qe);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:ts,keyword:Oh,literal:Ih,built_in:Ph,"variable.language":$h},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},E=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const x=[].concat(k,h.contains),w=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Lh,...Rh]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},se={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},Ie={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ce(Y){return e.concat("(?!",Y.join("|"),")")}const ze={match:e.concat(/\b/,Ce([...Dh,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},me="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(me)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:me,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},se,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},ze,Ie,A,J,{match:/\$[(.]/}]}}function Kv(n){const e=n.regex,t=Vv(n),r=ts,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[t.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ts,keyword:Oh.concat(l),literal:Ih,built_in:Ph.concat(i),"variable.language":$h},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{const k=m.contains.findIndex(E=>E.label===g);if(k===-1)throw new Error("can not find mode to replace");m.contains.splice(k,1,b)};Object.assign(t.keywords,c),t.exports.PARAMS_CONTAINS.push(d);const h=t.contains.find(m=>m.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,h,f]),t.contains=t.contains.concat([d,s,o,f]),u(t,"shebang",n.SHEBANG()),u(t,"use_strict",a);const p=t.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}function Wv(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),l=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(t,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function jv(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[n.BACKSLASH_ESCAPE,i]},a=n.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:n.C_NUMBER_RE+"\\b",relevance:0},p,m,s,o],b=[...g];return b.pop(),b.push(a),f.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const Oc={},qv="hljs-";function Gv(n){const e=Uu.newInstance();return{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,d){const u=d||Oc,h=typeof u.prefix=="string"?u.prefix:qv;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:Jv,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,m=p.data;return m.language=f.language,m.relevance=f.relevance,p}function r(l,c){const u=(c||Oc).subset||i();let h=-1,f=0,p;for(;++h<u.length;){const m=u[h];if(!e.getLanguage(m))continue;const g=t(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>f&&(f=g.data.relevance,p=g)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class Jv{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Bh=Gv();Bh.register({bash:gv,c:bv,cpp:yv,csharp:kv,css:Av,java:Nv,javascript:Rv,json:Dv,markdown:$v,plaintext:Bv,php:Pv,python:zv,ruby:Hv,rust:Fv,sql:Uv,typescript:Kv,xml:Wv,yaml:jv});const Zv=[{key:"bash",label:"Bash"},{key:"c",label:"C"},{key:"cpp",label:"C++"},{key:"csharp",label:"C#"},{key:"css",label:"CSS"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"json",label:"JSON"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"plaintext",label:"Plain Text"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"rust",label:"Rust"},{key:"sql",label:"SQL"},{key:"typescript",label:"TypeScript"},{key:"xml",label:"XML"},{key:"yaml",label:"YAML"}];class Yv{constructor(e,t,r,i,s){this.node=e,this.editor=t,this.getPos=r,this.dom=document.createElement("div"),this.dom.classList.add("code-block-wrapper"),this.dom.style.position="relative";const o=document.createElement("pre");e.attrs.language&&o.setAttribute("data-language",e.attrs.language),this.contentDOM=document.createElement("code"),e.attrs.language&&(this.contentDOM.className=`language-${e.attrs.language}`),o.appendChild(this.contentDOM),this.dom.appendChild(o),this.selectContainer=document.createElement("div"),this.selectContainer.classList.add("code-block-selector"),this.dom.appendChild(this.selectContainer),this.renderSelector(),this.setupSelectionTracking()}setupSelectionTracking(){this.selectionUpdateHandler=()=>{const e=this.getPos();if(e===void 0)return;const{from:t}=this.editor.state.selection,r=e,i=e+this.node.nodeSize;t>=r&&t<i?this.dom.classList.add("has-focus"):this.dom.classList.remove("has-focus")},this.editor.on("selectionUpdate",this.selectionUpdateHandler),this.editor.on("transaction",this.selectionUpdateHandler),this.selectionUpdateHandler()}renderSelector(){const e=this.node.attrs.language||"plaintext",t=z`
1
+ function Hc(n){return typeof n=="object"&&n!==null&&"j"in n}const Hf={en:{en:"English",fr:"French",es:"Spanish",de:"German",it:"Italian",pt:"Portuguese"},fr:{en:"Anglais",fr:"Français",es:"Espagnol",de:"Allemand",it:"Italien",pt:"Portugais"},es:{en:"Inglés",fr:"Francés",es:"Español",de:"Alemán",it:"Italiano",pt:"Portugués"},de:{en:"Englisch",fr:"Französisch",es:"Spanisch",de:"Deutsch",it:"Italienisch",pt:"Portugiesisch"},it:{en:"Inglese",fr:"Francese",es:"Spagnolo",de:"Tedesco",it:"Italiano",pt:"Portoghese"},pt:{en:"Inglês",fr:"Francês",es:"Espanhol",de:"Alemão",it:"Italiano",pt:"Português"}},Ya=Object.keys(Hf);function Ff(n,{pluginLanguages:e,siteLanguages:t=[]}){if(e.includes(n)||Ya.includes(n)&&e.includes(n))return n;const r=t.find(i=>Ya.includes(i)&&e.includes(i));return r||(e.includes("en")?"en":e[0]??"en")}function Ae(n){this.content=n}Ae.prototype={constructor:Ae,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Ae(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ae(t)},addToStart:function(n,e){return new Ae([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ae(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Ae(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=Ae.from(n),n.size?new Ae(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ae.from(n),n.size?new Ae(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ae.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}};Ae.from=function(n){if(n instanceof Ae)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ae(e)};function Fc(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Fc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Uc(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=Uc(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class S{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,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new S(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 s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new S(r,i)}cutByIndex(e,t){return e==t?S.empty:e==0&&t==this.content.length?this:new S(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new S(i,s)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(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 Fc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Uc(this,e,t,r)}findIndex(e){if(e==0)return Wr(0,e);if(e==this.size)return Wr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Wr(t+1,s):Wr(t,r);r=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 S.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new S(t||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const As={index:0,offset:0};function Wr(n,e){return As.index=n,As.offset=e,As}function di(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(!di(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!di(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let te=class io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&di(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 io.none;if(e instanceof io)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};te.none=[];class ui extends Error{}class O{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=Kc(this.content,e+this.openStart,t);return r&&new O(r,this.openStart,this.openEnd)}removeBetween(e,t){return new O(Vc(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 O.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 O(S.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new O(e,r,i)}}O.empty=new O(S.empty,0,0);function Vc(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Vc(s.content,e-i-1,t-i-1)))}function Kc(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Kc(o.content,e-s-1,t,o);return a&&n.replaceChild(i,o.copy(a))}function Uf(n,e,t){if(t.openStart>n.depth)throw new ui("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ui("Inconsistent open depths");return Wc(n,e,t,0)}function Wc(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Wc(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return bn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Vf(t,n);return bn(s,qc(n,o,a,e,r))}else return bn(s,hi(n,e,r))}function jc(n,e){if(!e.type.compatibleContent(n.type))throw new ui("Cannot join "+e.type.name+" onto "+n.type.name)}function so(n,e,t){let r=n.node(t);return jc(r,e.node(t)),r}function gn(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 or(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(gn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)gn(i.child(a),r);e&&e.depth==t&&e.textOffset&&gn(e.nodeBefore,r)}function bn(n,e){return n.type.checkContent(e),n.copy(e)}function qc(n,e,t,r,i){let s=n.depth>i&&so(n,e,i+1),o=r.depth>i&&so(t,r,i+1),a=[];return or(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(jc(s,o),gn(bn(s,qc(n,e,t,r,i+1)),a)):(s&&gn(bn(s,hi(n,e,i+1)),a),or(e,t,i,a),o&&gn(bn(o,hi(t,r,i+1)),a)),or(r,null,i,a),new S(a)}function hi(n,e,t){let r=[];if(or(null,n,t,r),n.depth>t){let i=so(n,e,t+1);gn(bn(i,hi(n,e,t+1)),r)}return or(e,null,t,r),new S(r)}function Vf(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(S.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class yr{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 fi(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,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new yr(t,r,s)}static resolveCached(e,t){let r=Xa.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Xa.set(e,r=new Kf);let i=r.elts[r.i]=yr.resolve(e,t);return r.i=(r.i+1)%Wf,i}}class Kf{constructor(){this.elts=[],this.i=0}}const Wf=12,Xa=new WeakMap;class fi{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 jf=Object.create(null);class dt{constructor(e,t,r,i=te.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||S.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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&&di(this.attrs,t||e.defaultAttrs||jf)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new dt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new dt(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 O.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new O(c,i.depth-o,s.depth-o)}replace(e,t,r){return Uf(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 yr.resolveCached(this,e)}resolveNoCache(e){return yr.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.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()+")"),Gc(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=S.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.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=te.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(!te.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=S.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}dt.prototype.text=void 0;class pi extends dt{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):Gc(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 pi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pi(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 Gc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class vn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new qf(e,t);if(r.next==null)return vn.empty;let i=Jc(r);r.next&&r.err("Unexpected trailing text");let s=ep(Qf(i));return tp(s,r),s}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 s=t;i&&s<r;s++)i=i.matchType(e.child(s).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 s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return S.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,a.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let 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(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.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 s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`\n`)}}vn.empty=new vn(!0);class qf{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 Jc(n){let e=[];do{e.push(Gf(n))}while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gf(n){let e=[];do{e.push(Jf(n))}while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Jf(n){let e=Xf(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=Zf(n,e);else break;return e}function Qa(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Zf(n,e){let t=Qa(n),r=t;return n.eat(",")&&(n.next!="}"?r=Qa(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Yf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Xf(n){if(n.eat("(")){let e=Jc(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=Yf(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 Qf(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Zc(n,e){return e-n}function el(n,e){let t=[];return r(e),t.sort(Zc);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function ep(n){let e=Object.create(null);return t(el(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);el(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new vn(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Zc);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function tp(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Yc(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 Xc(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Qc(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 s=n[i];s.validate&&s.validate(e[i])}}function ed(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new rp(n,r,e[r]);return t}let tl=class td{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=ed(e,r.attrs),this.defaultAttrs=Yc(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==vn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Xc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dt(this,this.computeAttrs(e),S.from(t),te.setFrom(r))}createChecked(e=null,t,r){return t=S.from(t),this.checkContent(t),new dt(this,this.computeAttrs(e),t,te.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=S.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(S.empty,!0);return s?new dt(this,e,t.append(s),te.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){Qc(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:te.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new td(s,t,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function np(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class rp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?np(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ns{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=ed(e,i.attrs),this.excluded=null;let s=Yc(this.attrs);this.instance=s?new te(this,s):null}create(e=null){return!e&&this.instance?this.instance:new te(this,Xc(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ns(s,i++,t,o)),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){Qc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class nd{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=Ae.from(e.nodes),t.marks=Ae.from(e.marks||{}),this.nodes=tl.compile(this.spec.nodes,this),this.marks=ns.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 s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=vn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?nl(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:nl(this,o.split(" "))}this.nodeFromJSON=i=>dt.fromJSON(this,i),this.markFromJSON=i=>te.fromJSON(this,i),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 tl){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 pi(r,r.defaultAttrs,e,te.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function nl(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ip(n){return n.tag!=null}function sp(n){return n.style!=null}class qt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(ip(i))this.tags.push(i);else if(sp(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new il(this,t,!1);return r.addAll(e,te.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new il(this,t,!0);return r.addAll(e,te.none,t.from,t.to),O.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(lp(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=sl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=sl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qt(e,qt.schemaRules(e)))}}const rd={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},op={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},id={ol:!0,ul:!0},kr=1,oo=2,ar=4;function rl(n,e,t){return e!=null?(e?kr:0)|(e==="full"?oo:0):n&&n.whitespace=="pre"?kr|oo:t&~ar}class jr{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=te.none,this.match=s||(o&ar?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(S.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&kr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=S.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(S.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&&!rd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class il{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=rl(null,t.preserveWhitespace,0)|(r?ar:0);i?s=new jr(i.type,i.attrs,te.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new jr(null,null,te.none,!0,null,o):s=new jr(e.schema.topNodeType,null,te.none,!0,null,o),this.nodes=[s],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,s=i.options&oo?"full":this.localPreserveWS||(i.options&kr)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`\n`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else 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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;id.hasOwnProperty(o)&&this.parser.normalizeLists&&ap(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:op.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(rd.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`\n`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.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(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=te.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):ol(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=rl(e,s,o.options);o.options&ar&&o.content.length==0&&(a|=ar);let l=te.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ol(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new jr(e,t,l,i,null,a)),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;this.localPreserveWS&&(this.nodes[t].options|=kr)}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),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(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 ap(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&id.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function lp(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function sl(n){let e={};for(let t in n)e[t]=n[t];return e}function ol(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class An{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ns(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ii(Ns(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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ii(Ns(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return ii(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new An(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=al(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return al(e.marks)}}function al(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ns(n){return n.document||window.document}const ll=new WeakMap;function cp(n){let e=ll.get(n);return e===void 0&&ll.set(n,e=dp(n)),e}function dp(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 ii(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],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=cp(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=ii(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const sd=65535,od=Math.pow(2,16);function up(n,e){return n+e*od}function cl(n){return n&sd}function hp(n){return(n-(n&sd))/od}const ad=1,ld=2,si=4,cd=8;class ao{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&cd)>0}get deletedBefore(){return(this.delInfo&(ad|si))>0}get deletedAfter(){return(this.delInfo&(ld|si))>0}get deletedAcross(){return(this.delInfo&si)>0}}class Je{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Je.empty)return Je.empty}recover(e){let t=0,r=cl(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+hp(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,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+i+(h<0?0:d);if(r)return f;let p=e==(t<0?l:u)?null:up(a/3,e-l),m=e==l?ld:e==u?ad:si;return(t<0?e!=l:e!=u)&&(m|=cd),new ao(f,m,p)}i+=d-c}return r?e+i:new ao(e+i,0,null)}touches(e,t){let r=0,i=cl(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new Je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Je.empty:new Je(e<0?[0,-e,0]:[0,0,e])}}Je.empty=new Je([]);class Er{constructor(e,t,r=0,i=(e?e.length:0)){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Er(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),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 Er;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 s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new ao(e,i,null)}}const _s=Object.create(null);class Be{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_s[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 _s)throw new RangeError("Duplicate use of step JSON ID "+e);return _s[e]=t,t.prototype.jsonID=e,t}}class ye{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,t,r,i){try{return ye.ok(e.replace(t,r,i))}catch(s){if(s instanceof ui)return ye.fail(s.message);throw s}}}function zo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(zo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return S.fromArray(r)}class Kt extends Be{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)),s=new O(zo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,s)}invert(){return new ct(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 Kt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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 Kt(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("addMark",Kt);class ct extends Be{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 O(zo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,r)}invert(){return new Kt(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 ct(t.pos,r.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(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 ct(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("removeMark",ct);class Wt extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new O(S.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 xn(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))}}Be.jsonID("addNodeMark",Wt);class xn extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new O(S.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 xn(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 xn(t.pos,e.markFromJSON(t.mark))}}Be.jsonID("removeNodeMark",xn);class Se extends Be{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&lo(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(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 Se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||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?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(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?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(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 Se(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}}Be.jsonID("replace",Se);class we extends Be{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(lo(e,this.from,this.gapFrom)||lo(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ye.fromReplace(e,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new Je([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 we(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new we(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 we(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}}Be.jsonID("replaceAround",we);function lo(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function fp(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:i.push(o=new ct(h,f,u[m])));a&&a.to==h?a.to=f:s.push(a=new Kt(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function pp(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ns){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ct(o.from,o.to,o.style)))}function Ho(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Se(a,d,O.empty));else{r=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new ct(a,d,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new O(S.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(S.empty,!0);n.replace(a,a,new O(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function mp(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Zn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!mp(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function gp(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=S.empty,u=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,d=S.from(r.node(p).copy(d)),u++):l--;let h=S.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=S.from(i.node(p).copy(h)),f++):c++;n.step(new we(l,c,o,a,new O(d.append(h),u,f),d.size-u,!0))}function Fo(n,e,t=null,r=n){let i=bp(n,e),s=i&&yp(r,e);return s?i.map(dl).concat({type:e,attrs:t}).concat(s.map(dl)):null}function dl(n){return{type:n,attrs:null}}function bp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function yp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function kp(n,e,t){let r=S.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new we(i,s,i,s,new O(r,0,0),t.length,!0))}function Ep(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&vp(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&ud(n,o,a,s),Ho(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let d=n.mapping.slice(s),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new we(u,h,u+1,h-1,new O(S.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&dd(n,o,a,s),!1}})}function dd(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ud(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`\n`))}})}function vp(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function xp(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new we(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new O(S.from(o),0,0),1,!0))}function _t(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Sp(n,e,t=1,r){let i=n.doc.resolve(e),s=S.empty,o=S.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=S.from(i.node(a).copy(s));let d=r&&r[c];o=S.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new Se(e,e,new O(s.append(o),t,t),!0))}function tn(n,e){let t=n.resolve(e),r=t.index();return hd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function wp(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function hd(n,e){return!!(n&&e&&!n.isLeaf&&wp(n,e))}function rs(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&hd(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Tp(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);ud(n,d.node(),d.before(),a)}o.inlineContent&&Ho(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new Se(c,l.map(e+t,-1),O.empty,!0)),r===!0){let d=n.doc.resolve(c);dd(n,d.node(),d.before(),n.steps.length)}return n}function Cp(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function fd(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function is(n,e,t=e,r=O.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return pd(i,s,r)?new Se(e,t,r):new Mp(i,s,r).fit()}function pd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Mp{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=S.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 s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new O(s,o,a);return e>-1?new we(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Os(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(S.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Os(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new O(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=Os(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new O(nr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new O(nr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(md(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=rr(this.placed,t,S.from(d)),this.frontier[t].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?O.empty:new O(nr(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new O(nr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Is(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Is(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Is(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?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=rr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=rr(this.placed,this.depth,S.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(S.empty,!0);t.childCount&&(this.placed=rr(this.placed,this.frontier.length,t))}}function nr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(nr(n.firstChild.content,e-1,t)))}function rr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(rr(n.lastChild.content,e-1,t)))}function Os(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function md(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,md(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(S.empty,!0)))),n.copy(r)}function Is(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Ap(t,s.content,o)?a:null}function Ap(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Np(n){return n.spec.defining||n.spec.definingForContent}function _p(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(pd(i,s,r))return n.step(new Se(e,t,r));let o=bd(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Np(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let k=i.node(g-1),v=i.index(g-1);if(k.canReplaceWith(v,v,p.type,p.marks))return n.replace(i.before(g),y?s.after(g):t,new O(gd(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function gd(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(gd(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(S.empty,!0))}return n}function Op(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Cp(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new O(S.from(r),0,0))}function Ip(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=bd(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function bd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Hn extends Be{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 ye.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ye.fromReplace(e,this.pos,this.pos+1,new O(S.from(i),0,t.isLeaf?0:1))}getMap(){return Je.empty}invert(e){return new Hn(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 Hn(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 Hn(t.pos,t.attr,t.value)}}Be.jsonID("attr",Hn);class vr extends Be{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 ye.ok(r)}getMap(){return Je.empty}invert(e){return new vr(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 vr(t.attr,t.value)}}Be.jsonID("docAttr",vr);let Un=class extends Error{};Un=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Un.prototype=Object.create(Error.prototype);Un.prototype.constructor=Un;Un.prototype.name="TransformError";class yd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Er}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Un(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=O.empty){let i=is(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new O(S.from(r),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _p(this,e,t,r),this}replaceRangeWith(e,t,r){return Op(this,e,t,r),this}deleteRange(e,t){return Ip(this,e,t),this}lift(e,t){return gp(this,e,t),this}join(e,t=1){return Tp(this,e,t),this}wrap(e,t){return kp(this,e,t),this}setBlockType(e,t=e,r,i=null){return Ep(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return xp(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Hn(e,t,r)),this}setDocAttribute(e,t){return this.step(new vr(e,t)),this}addNodeMark(e,t){return this.step(new Wt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof te)t.isInSet(r.marks)&&this.step(new xn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new xn(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return Sp(this,e,t,r),this}addMark(e,t,r){return fp(this,e,t,r),this}removeMark(e,t,r){return pp(this,e,t,r),this}clearIncompatible(e,t,r){return Ho(this,e,t,r),this}}const Ls=Object.create(null);class j{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Lp(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=O.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?O.empty:t),a==0&&fl(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),fl(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new H(e):Ln(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Ln(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Ln(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ye(e.node(0))}static atStart(e){return Ln(e,e,0,0,1)||new Ye(e)}static atEnd(e){return Ln(e,e,e.content.size,e.childCount,-1)||new Ye(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ls[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 Ls)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ls[e]=t,t.prototype.jsonID=e,t}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}j.prototype.visible=!0;class Lp{constructor(e,t){this.$from=e,this.$to=t}}let ul=!1;function hl(n){!ul&&!n.parent.inlineContent&&(ul=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class H extends j{constructor(e,t=e){hl(e),hl(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 j.near(r);let i=e.resolve(t.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ss(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 H(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 s=j.findFrom(t,r,!0)||j.findFrom(t,-r,!0);if(s)t=s.$head;else return j.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(j.findFrom(e,-r,!0)||j.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new H(e,t)}}j.jsonID("text",H);class ss{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ss(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends j{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),s=e.resolve(i);return r?j.near(s):new B(s)}content(){return new O(S.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Uo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;j.jsonID("node",B);class Uo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new ss(r,r):new Uo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&B.isSelectable(r)?new B(t):j.near(t)}}class Ye extends j{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let r=j.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ye(e)}map(e){return new Ye(e)}eq(e){return e instanceof Ye}getBookmark(){return Rp}}j.jsonID("all",Ye);const Rp={map(){return this},resolve(n){return new Ye(n)}};function Ln(n,e,t,r,i,s=!1){if(e.inlineContent)return H.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(n,t-(i<0?a.nodeSize:0))}else{let l=Ln(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function fl(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;let s=n.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}const pl=1,qr=2,ml=4;class Dp extends yd{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|pl)&~qr,this.storedMarks=null,this}get selectionSet(){return(this.updated&pl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qr,this}ensureMarks(e){return te.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&qr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~qr,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)||te.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),!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(j.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|=ml,this}get scrolledIntoView(){return(this.updated&ml)>0}}function gl(n,e){return!e||!n?n:n.bind(e)}class ir{constructor(e,t,r){this.name=e,this.init=gl(t.init,r),this.apply=gl(t.apply,r)}}const $p=[new ir("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ir("selection",{init(n,e){return n.selection||j.atStart(e.doc)},apply(n){return n.selection}}),new ir("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ir("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Rs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$p.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 ir(r.key,r.spec.state,r))})}}class zn{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 s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new zn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Dp(this)}static create(e){let t=new Rs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zn(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 Rs(this.schema,e.plugins),r=t.fields,i=new zn(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].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],s=i.spec.state;s&&s.toJSON&&(t[r]=s.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 Rs(e.schema,e.plugins),s=new zn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=dt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=j.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function kd(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=kd(i,e,{})),t[r]=i}return t}class ne{constructor(e){this.spec=e,this.props={},e.props&&kd(e.props,this,this.props),this.key=e.key?e.key.key:Ed("plugin")}getState(e){return e[this.key]}}const Ds=Object.create(null);function Ed(n){return n in Ds?n+"$"+ ++Ds[n]:(Ds[n]=0,n+"$")}class ce{constructor(e="key"){this.key=Ed(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Vo=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function vd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const xd=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let i=Ko(r);if(!i){let o=r.blockRange(),a=o&&Zn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Od(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Vn(s,"end")||B.isSelectable(s)))for(let o=r.depth;;o--){let a=is(n.doc,r.before(o),r.after(o),O.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Vn(s,"end")?j.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):B.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Pp=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let i=Ko(r);return i?Sd(n,i,e):!1},Bp=(n,e,t)=>{let r=Td(n,t);if(!r)return!1;let i=Wo(r);return i?Sd(n,i,e):!1};function Sd(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=is(n.doc,s,l,O.empty);if(!c||c.from!=s||c instanceof Se&&c.slice.size>=l-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(H.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Vn(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 wd=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Ko(r)}let o=s&&s.nodeBefore;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ko(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 Td(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Cd=(n,e,t)=>{let r=Td(n,t);if(!r)return!1;let i=Wo(r);if(!i)return!1;let s=i.nodeAfter;if(Od(n,i,e,1))return!0;if(r.parent.content.size==0&&(Vn(s,"start")||B.isSelectable(s))){let o=is(n.doc,r.before(),r.after(),O.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Vn(s,"start")?j.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):B.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Md=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Wo(r)}let o=s&&s.nodeAfter;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos)).scrollIntoView()),!0)};function Wo(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 zp=(n,e)=>{let t=n.selection,r=t instanceof B,i;if(r){if(t.node.isTextblock||!tn(n.doc,t.from))return!1;i=t.from}else if(i=rs(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(B.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Hp=(n,e)=>{let t=n.selection,r;if(t instanceof B){if(t.node.isTextblock||!tn(n.doc,t.to))return!1;r=t.to}else if(r=rs(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Fp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Zn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Ad=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`\n`).scrollIntoView()),!0)};function jo(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 Up=(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),s=t.indexAfter(-1),o=jo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(j.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Nd=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ye||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(H.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},_d=(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 s=t.before();if(_t(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Zn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Vp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!_t(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=jo(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof H||e.selection instanceof Ye)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=_t(d.doc,u,s.length,s);if(h||(s[0]=a?{type:a}:null,h=_t(d.doc,u,s.length,s)),!h)return!1;if(d.split(u,s.length,s),!l&&c&&r.node(o).type!=a){let f=d.mapping.map(r.before(o)),p=d.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const Kp=Vp(),Wp=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(B.create(n.doc,i))),!0)};function jp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Od(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&jp(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,p=S.empty;for(let y=o.length-1;y>=0;y--)p=S.from(o[y].create(null,p));p=S.from(i.copy(p));let m=n.tr.step(new we(e.pos-1,f,e.pos,f,new O(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&tn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:j.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Zn(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Vn(s,"start",!0)&&Vn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let y=S.empty;for(let v=p.length-1;v>=0;v--)y=S.from(p[v].copy(y));let k=n.tr.step(new we(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new O(y,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Id(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(H.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const qp=Id(-1),Gp=Id(1);function Jp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Fo(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function bl(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function qo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}qo(Vo,xd,wd);qo(Vo,Cd,Md);qo(Ad,Nd,_d,Kp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Zp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return Yp(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Yp(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new fi(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new fi(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Fo(s,t,r,e);return a?(n&&Xp(n,e,a,i,t),!0):!1}function Xp(n,e,t,r,i){let s=S.empty;for(let d=t.length-1;d>=0;d--)s=S.from(t[d].type.create(t[d].attrs,s));n.step(new we(e.start-(r?2:0),e.end,e.start,e.end,new O(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&_t(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function Qp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?em(e,t,n,s):tm(e,t,s):!0:!1}}function em(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new we(s-1,o,s,o,new O(S.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new fi(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Zn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return tn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function tm(n,e,t){let r=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?S.empty:S.from(i))))return!1;let u=s.pos,h=u+o.nodeSize;return r.step(new we(u-(a?1:0),h+(l?1:0),u+1,h-1,new O((a?S.empty:S.from(i.copy(S.empty))).append(l?S.empty:S.from(i.copy(S.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function nm(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=S.from(c?n.create():null),u=new O(S.from(n.create(null,S.from(a.type.create(null,d)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new we(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const Ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Kn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let co=null;const At=function(n,e,t){let r=co||(co=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},rm=function(){co=null},Sn=function(n,e,t,r){return t&&(yl(n,e,t,r,-1)||yl(n,e,t,r,1))},im=/^(img|br|input|textarea|hr)$/i;function yl(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:tt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Ir(n)||im.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ne(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?tt(n):0}else return!1}}function tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sm(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=tt(n)}else if(n.parentNode&&!Ir(n))e=Ne(n),n=n.parentNode;else return null}}function om(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&&!Ir(n))e=Ne(n)+1,n=n.parentNode;else return null}}function am(n,e,t){for(let r=e==0,i=e==tt(n);r||i;){if(n==t)return!0;let s=Ne(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==tt(n)}}function Ir(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 as=function(n){return n.focusNode&&Sn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function dn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function lm(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function cm(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(tt(r.startContainer),r.startOffset)}}}const bt=typeof navigator<"u"?navigator:null,kl=typeof document<"u"?document:null,nn=bt&&bt.userAgent||"",uo=/Edge\/(\d+)/.exec(nn),Ld=/MSIE \d/.exec(nn),ho=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),We=!!(Ld||ho||uo),Gt=Ld?document.documentMode:ho?+ho[1]:uo?+uo[1]:0,nt=!We&&/gecko\/(\d+)/i.test(nn);nt&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const fo=!We&&/Chrome\/(\d+)/.exec(nn),De=!!fo,Rd=fo?+fo[1]:0,Fe=!We&&!!bt&&/Apple Computer/.test(bt.vendor),Wn=Fe&&(/Mobile\/\w+/.test(nn)||!!bt&&bt.maxTouchPoints>2),et=Wn||(bt?/Mac/.test(bt.platform):!1),dm=bt?/Win/.test(bt.platform):!1,Nt=/Android \d/.test(nn),Lr=!!kl&&"webkitFontSmoothing"in kl.documentElement.style,um=Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function hm(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 wt(n,e){return typeof n=="number"?n:n[e]}function fm(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 El(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Kn(o);continue}let a=o,l=a==s.body,c=l?hm(s):fm(a),d=0,u=0;if(e.top<c.top+wt(r,"top")?u=-(c.top-e.top+wt(i,"top")):e.bottom>c.bottom-wt(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+wt(i,"top")-c.top:e.bottom-c.bottom+wt(i,"bottom")),e.left<c.left+wt(r,"left")?d=-(c.left-e.left+wt(i,"left")):e.right>c.right-wt(r,"right")&&(d=e.right-c.right+wt(i,"right")),d||u)if(l)s.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Kn(o)}}function pm(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Dd(n.dom)}}function Dd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Kn(r));return e}function mm({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;$d(t,r==0?0:r-e)}function $d(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let On=null;function gm(n){if(n.setActive)return n.setActive();if(On)return n.focus(On);let e=Dd(n);n.focus(On==null?{get preventScroll(){return On={preventScroll:!0},!0}}:void 0),On||(On=!1,$d(e,0))}function Pd(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=At(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=d,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?bm(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Pd(t,i)}function bm(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 s=Pt(r,1);if(s.top!=s.bottom&&Go(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Go(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function ym(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function km(n,e,t){let{node:r,offset:i}=Pd(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Em(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Bd(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)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Go(e,c))return Bd(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function vm(n,e){let t=n.dom.ownerDocument,r,i=0,s=cm(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Go(e,c)||(o=Bd(n.dom,e,c),!o))return null}if(Fe)for(let c=o;r&&c;c=Kn(c))c.draggable&&(r=void 0);if(o=ym(o,e),r){if(nt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;Lr&&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?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Em(n,r,i,e))}a==null&&(a=km(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function vl(n){return n.top<n.bottom||n.left<n.right}function Pt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(vl(r))return r}return Array.prototype.find.call(t,vl)||n.getBoundingClientRect()}const xm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zd(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Lr||nt;if(r.nodeType==3)if(o&&(xm.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Pt(At(r,i,i),t);if(nt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Pt(At(r,i-1,i-1),-1);if(c.top==l.top){let d=Pt(At(r,i,i+1),-1);if(d.top!=l.top)return Qn(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(l--,d=1):t<0?l--:c++,Qn(Pt(At(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return $s(l.getBoundingClientRect(),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];if(l.nodeType==1)return $s(l.getBoundingClientRect(),!0)}return $s(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?At(l,tt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Qn(Pt(c,1),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?At(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Qn(Pt(c,-1),!0)}return Qn(Pt(r.nodeType==3?At(r):r,-t),t>=0)}function Qn(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 $s(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 Hd(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 Sm(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Hd(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=zd(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=At(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const wm=/[\u0590-\u08ac]/;function Tm(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!wm.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Hd(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let xl=null,Sl=null,wl=!1;function Cm(n,e,t){return xl==e&&Sl==t?wl:(xl=e,Sl=t,wl=t=="up"||t=="down"?Sm(n,e,t):Tm(n,e,t))}const rt=0,Tl=1,un=2,yt=3;class Rr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=rt,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 s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Ne(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 s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.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 s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}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 s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Ud){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Fd&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Ne(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Ne(s.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,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ne(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Ne(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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 s=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((nt||Fe)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`\n`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ne(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&Fe)&&Sn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Sn(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&nt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}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 s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?un:Tl,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?un:yt}r=o}this.dirty=un}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?un:Tl;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Fd extends Rr{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==rt&&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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Mm extends Rr{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 wn extends Rr{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=An.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=rt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=rt}}slice(e,t,r){let i=wn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=mo(s,t,o,r)),e>0&&(s=mo(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Jt extends Rr{constructor(e,t,r,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=An.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Wd(d,r,t),c?l=new Am(e,t,r,i,d,u||null,h,c,s,o+1):t.isText?new ls(e,t,r,i,d,h,s):new Jt(e,t,r,i,d,u||null,h,s,o+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=()=>S.empty)}return e}matchesNode(e,t,r){return this.dirty==rt&&e.eq(this.node)&&mi(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,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new _m(this,o&&o.node,e);Lm(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?te.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==un)&&(o&&this.protectLocalComposition(e,o),Vd(this.contentDOM,this.children,e),Wn&&Rm(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Dm(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Mm(this,s,t,i);e.input.compositionNodes.push(o),this.children=mo(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==yt||!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=rt}updateOuterDeco(e){if(mi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Kd(this.dom,this.nodeDOM,po(this.outerDeco,this.node,t),po(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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Cl(n,e,t,r,i){Wd(r,e,n);let s=new Jt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class ls extends Jt{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,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==yt||this.dirty!=rt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=rt||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=rt,!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),s=document.createTextNode(i.text);return new ls(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ud extends Rr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==rt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Am extends Jt{constructor(e,t,r,i,s,o,a,l,c,d){super(e,t,r,i,s,o,a,c,d),this.spec=l}update(e,t,r,i){if(this.dirty==yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}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.root):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 Vd(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=Ml(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof wn){let l=r?r.previousSibling:n.lastChild;Vd(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Ml(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const lr=function(n){n&&(this.nodeName=n)};lr.prototype=Object.create(null);const hn=[new lr];function po(n,e,t){if(n.length==0)return hn;let r=t?hn[0]:new lr,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new lr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new lr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Kd(n,e,t,r){if(t==hn&&r==hn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=hn[0]),i=l}Nm(i,a||hn[0],o)}return i}function Nm(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 s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);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 Wd(n,e,t){return Kd(n,n,hn,po(e,t,n.nodeType!=1))}function mi(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 Ml(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class _m{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Om(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,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=rt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=wn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==yt&&o.dom==o.contentDOM&&(o.dirty=un),o.update(e,t,r,s)?(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,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Jt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=yt&&mi(t,l.outerDeco));if(!h&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=un,u.updateChildren(i,o+1),u.dirty=rt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!mi(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Jt.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=Jt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),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 s=new Fd(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof wn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ls)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Fe||De)&&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 Ud(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 Om(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof wn)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Im(n,e){return n.type.side-e.type.side}function Lm(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(Im);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function Rm(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 Dm(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function mo(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(l.slice(t-c,l.size,r)))}return s}function Jo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(as(t)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&B.isSelectable(u)&&i.parent&&!(u.isInline&&am(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new B(o==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;c=Zo(n,d,a,u)}return c}function jd(n){return n.editable?n.hasFocus():Gd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ot(n,e=!1){let t=n.state.selection;if(qd(n,t),!!jd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&De){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Sn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Pm(n);else{let{anchor:r,head:i}=t,s,o;Al&&!(t instanceof H)&&(t.$from.parent.inlineContent||(s=Nl(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Nl(n,t.to))),n.docView.setSelection(r,i,n,e),Al&&(s&&_l(s),o&&_l(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$m(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Al=Fe||De&&Rd<63;function Nl(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Fe&&i&&i.contentEditable=="false")return Ps(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ps(i);if(s)return Ps(s)}}function Ps(n){return n.contentEditable="true",Fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function _l(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function $m(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(()=>{(!jd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Pm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ne(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&Gt<=11&&(t.disabled=!0,t.disabled=!1)}function qd(n,e){if(e instanceof B){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ol(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ol(n)}function Ol(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Zo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||H.between(e,t,r)}function Il(n){return n.editable&&!n.hasFocus()?!1:Gd(n)}function Gd(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 Bm(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Sn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function go(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&j.findFrom(s,e)}function Bt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ll(n,e,t){let r=n.state.selection;if(r instanceof H)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Bt(n,new H(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=go(n.state,e);return i&&i instanceof B?Bt(n,i):!1}else if(!(et&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?B.isSelectable(s)?Bt(n,new B(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Lr?Bt(n,new H(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Bt(n,new H(e>0?r.$to:r.$from));{let i=go(n.state,e);return i?Bt(n,i):!1}}}function gi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function cr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function In(n,e){return e<0?zm(n):Hm(n)}function zm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(nt&&t.nodeType==1&&r<gi(t)&&cr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(cr(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Jd(t))break;{let a=t.previousSibling;for(;a&&cr(a,-1);)i=t.parentNode,s=Ne(a),a=a.previousSibling;if(a)t=a,r=gi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?bo(n,t,r):i&&bo(n,i,s)}function Hm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=gi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(cr(a,1))s=t,o=++r;else break}else{if(Jd(t))break;{let a=t.nextSibling;for(;a&&cr(a,1);)s=a.parentNode,o=Ne(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=gi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&bo(n,s,o)}function Jd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Fm(n,e){for(;n&&e==n.childNodes.length&&!Ir(n);)e=Ne(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 Um(n,e){for(;n&&!e&&!Ir(n);)e=Ne(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 bo(n,e,t){if(e.nodeType!=3){let s,o;(o=Fm(e,t))?(e=o,t=0):(s=Um(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(as(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ot(n)},50)}function Rl(n,e){let t=n.state.doc.resolve(e);if(!(De||dm)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Dl(n,e,t){let r=n.state.selection;if(r instanceof H&&!r.empty||t.indexOf("s")>-1||et&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=go(n.state,e);if(o&&o instanceof B)return Bt(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ye?j.near(o,e):j.findFrom(o,e);return a?Bt(n,a):!1}return!1}function $l(n,e){if(!(n.state.selection instanceof H))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Pl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Vm(n){if(!Fe||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;Pl(n,r,"true"),setTimeout(()=>Pl(n,r,"false"),20)}return!1}function Km(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Wm(n,e){let t=e.keyCode,r=Km(e);if(t==8||et&&t==72&&r=="c")return $l(n,-1)||In(n,-1);if(t==46&&!e.shiftKey||et&&t==68&&r=="c")return $l(n,1)||In(n,1);if(t==13||t==27)return!0;if(t==37||et&&t==66&&r=="c"){let i=t==37?Rl(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ll(n,i,r)||In(n,i)}else if(t==39||et&&t==70&&r=="c"){let i=t==39?Rl(n,n.state.selection.from)=="ltr"?1:-1:1;return Ll(n,i,r)||In(n,i)}else{if(t==38||et&&t==80&&r=="c")return Dl(n,-1,r)||In(n,-1);if(t==40||et&&t==78&&r=="c")return Vm(n)||Dl(n,1,r)||In(n,1);if(r==(et?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Yo(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=n.someProp("clipboardSerializer")||An.fromSchema(n.state.schema),a=tu(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=eu[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`\n\n`);return{dom:l,text:h,slice:e}}function Zd(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return a=new O(S.from(n.state.schema.text(e.replace(/\r\n?/g,`\n`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(u)a=u;else{let h=i.marks(),{schema:f}=n.state,p=An.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=Jm(t),Lr&&Zm(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||qt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!jm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Ym(Bl(a,+d[1],+d[2]),d[4]);else if(a=O.maxOpen(qm(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Bl(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const jm=/^(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 qm(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)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Xd(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Qd(o[o.length-1],s.length));let d=Yd(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return S.from(o)}return n}function Yd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function Xd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=Xd(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(S.from(Yd(t,n,i+1))))}}function Qd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Qd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function yo(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=yo(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Bl(n,e,t){return e<n.openStart&&(n=new O(yo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new O(yo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const eu={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 zl=null;function tu(){return zl||(zl=document.implementation.createHTMLDocument("title"))}let Bs=null;function Gm(n){let e=window.trustedTypes;return e?(Bs||(Bs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Bs.createHTML(n)):n}function Jm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=tu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&eu[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Gm(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Zm(n){let e=n.querySelectorAll(De?"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 Ym(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:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=S.from(l.create(r[a+1],i)),s++,o++}return new O(i,s,o)}const Ue={},Ve={},Xm={touchstart:!0,touchmove:!0};class Qm{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function eg(n){for(let e in Ue){let t=Ue[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ng(n,r)&&!Xo(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},Xm[e]?{passive:!0}:void 0)}Fe&&n.dom.addEventListener("input",()=>null),ko(n)}function jt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function tg(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 ko(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Xo(n,r))})}function Xo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function ng(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 rg(n,e){!Xo(n,e)&&Ue[e.type]&&(n.editable||!(e.type in Ve))&&Ue[e.type](n,e)}Ve.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ru(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Nt&&De&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wn&&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,dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Wm(n,t)?t.preventDefault():jt(n,"key")};Ve.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ve.keypress=(n,e)=>{let t=e;if(ru(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||et&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function cs(n){return{left:n.clientX,top:n.clientY}}function ig(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Qo(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Fn(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 sg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Fn(n,new B(t)),!0):!1}function og(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof B&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(B.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Fn(n,B.create(n.state.doc,i)),!0):!1}function ag(n,e,t,r,i){return Qo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?og(n,t):sg(n,t))}function lg(n,e,t,r){return Qo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function cg(n,e,t,r){return Qo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||dg(n,t,r)}function dg(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Fn(n,H.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Fn(n,H.create(r,a+1,a+1+o.content.size));else if(B.isSelectable(o))Fn(n,B.create(r,a));else continue;return!0}}function ea(n){return bi(n)}const nu=et?"metaKey":"ctrlKey";Ue.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=ea(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&ig(t,n.input.lastClick)&&!t[nu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(cs(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ug(n,o,t,!!r)):(s=="doubleClick"?lg:cg)(n,o.pos,o.inside,t)?t.preventDefault():jt(n,"pointer"))};class ug{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[nu],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof B&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nt&&!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)),jt(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(()=>Ot(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(cs(e))),this.updateAllowDefault(e),this.allowDefault||!t?jt(this.view,"pointer"):ag(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Fe&&this.mightDrag&&!this.mightDrag.node.isAtom||De&&!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)?(Fn(this.view,j.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):jt(this.view,"pointer")}move(e){this.updateAllowDefault(e),jt(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)}}Ue.touchstart=n=>{n.input.lastTouch=Date.now(),ea(n),jt(n,"pointer")};Ue.touchmove=n=>{n.input.lastTouch=Date.now(),jt(n,"pointer")};Ue.contextmenu=n=>ea(n);function ru(n,e){return n.composing?!0:Fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const hg=Nt?5e3:-1;Ve.compositionstart=Ve.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),bi(n,!0),n.markCursor=null;else if(bi(n,!e.selection.empty),nt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}iu(n,hg)};Ve.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++,iu(n,20))};function iu(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>bi(n),e))}function su(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=pg());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function fg(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=sm(e.focusNode,e.focusOffset),r=om(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function pg(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function bi(n,e=!1){if(!(Nt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),su(n),e||n.docView&&n.docView.dirty){let t=Jo(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function mg(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 xr=We&&Gt<15||Wn&&um<604;Ue.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=xr?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Yo(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):mg(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function gg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function bg(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?Sr(n,r.value,null,i,e):Sr(n,r.textContent,r.innerHTML,i,e)},50)}function Sr(n,e,t,r,i){let s=Zd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||O.empty)))return!0;if(!s)return!1;let o=gg(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ou(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," "):""}Ve.paste=(n,e)=>{let t=e;if(n.composing&&!Nt)return;let r=xr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Sr(n,ou(r),r.getData("text/html"),i,t)?t.preventDefault():bg(n,t)};class au{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const yg=et?"altKey":"ctrlKey";function lu(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[yg]}Ue.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(cs(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)o=B.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&&(o=B.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=Yo(n,a);(!t.dataTransfer.files.length||!De||Rd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(xr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",xr||t.dataTransfer.setData("text/plain",c),n.dragging=new au(d,lu(n,t),o)};Ue.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ve.dragover=Ve.dragenter=(n,e)=>e.preventDefault();Ve.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(cs(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=Zd(n,ou(t.dataTransfer),xr?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&lu(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||O.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?fd(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;if(a){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&B.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new B(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,k)=>p=k),c.setSelection(Zo(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Ue.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())&&Ot(n)},20))};Ue.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)};Ue.beforeinput=(n,e)=>{if(De&&Nt&&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",s=>s(n,dn(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 Ve)Ue[n]=Ve[n];function wr(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 yi{constructor(e,t){this.toDOM=e,this.spec=t||yn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new $e(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof yi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zt{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new $e(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Zt&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}static is(e){return e.type instanceof Zt}destroy(){}}class ta{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new $e(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof ta&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}destroy(){}}class $e{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new $e(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 $e(e,e,new yi(t,r))}static inline(e,t,r,i){return new $e(e,t,new Zt(r,i))}static node(e,t,r,i){return new $e(e,t,new ta(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zt}get widget(){return this.type instanceof yi}}const Rn=[],yn={};class ae{constructor(e,t){this.local=e.length?e:Rn,this.children=t.length?t:Rn}static create(e,t){return t.length?ki(t,e,0,yn):Re}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Re||e.maps.length==0?this:this.mapInner(e,t,0,0,r||yn)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?kg(this.children,o||[],e,t,r,i,s):o?new ae(o.sort(kn),Rn):Re}add(e,t){return t.length?this==Re?ae.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=du(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,ki(d,a,c+1,yn)),s+=3}});let o=cu(s?uu(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ae(o.length?this.local.concat(o).sort(kn):this.local,i||this.children)}remove(e){return e.length==0||this==Re?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=Re?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ae(i,r):Re}forChild(e,t){if(this==Re)return this;if(t.isLeaf)return ae.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Zt){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new ae(i.sort(kn),Rn);return r?new Ft([a,r]):a}return r||Re}eq(e){if(this==e)return!0;if(!(e instanceof ae)||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 na(this.localsInner(e))}localsInner(e){if(this==Re)return Rn;if(e.inlineContent||!this.local.some(Zt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=na;const Re=ae.empty;class Ft{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,yn));return Ft.from(r)}forChild(e,t){if(t.isLeaf)return ae.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Re&&(s instanceof Ft?r=r.concat(s.members):r.push(s))}return Ft.from(r)}eq(e){if(!(e instanceof Ft)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?na(r?t:t.sort(kn)):Rn}static from(e){switch(e.length){case 0:return Re;case 1:return e[0];default:return new Ft(e.every(t=>t instanceof ae)?e:e.reduce((t,r)=>t.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function kg(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<a.length;y+=3){let k=a[y+1];if(k<0||h>k+d-u)continue;let v=a[y]+d-u;f>=v?a[y+1]=h<=v?-2:-1:h>=d&&g&&(a[y]+=g,a[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+s),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let h=t.map(n[c+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let y=a[c+2].mapInner(t,g,d+1,n[c]+s+1,o);y!=Re?(a[c]=u,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Eg(a,n,e,t,i,s,o),d=ki(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ae(e.sort(kn),a)}function cu(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 $e(i.from+e,i.to+e,i.type))}return t}function Eg(n,e,t,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function du(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function uu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ki(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let c=du(n,a,l+t);if(c){s=!0;let d=ki(c,a,t+l+1,r);d!=Re&&i.push(l,l+a.nodeSize,d)}});let o=cu(s?uu(n):n,-t).sort(kn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ae(o,i):Re}function kn(n,e){return n.from-e.from||n.to-e.to}function na(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Hl(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Hl(e,i,r.copy(s.from,r.to)));break}}}return e}function Hl(n,e,t){for(;e<n.length&&kn(t,n[e])>0;)e++;n.splice(e,0,t)}function zs(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Re&&e.push(r)}),n.cursorWrapper&&e.push(ae.create(n.state.doc,[n.cursorWrapper.deco])),Ft.from(e)}const vg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xg=We&&Gt<=11;class Sg{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 wg{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Sg,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]);We&&Gt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),xg&&(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,vg)),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(Il(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(We&&Gt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sn(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 s=e.focusNode;s;s=Kn(s))t.add(s);for(let s=e.anchorNode;s;s=Kn(s))if(t.has(s)){r=s;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)&&Il(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(nt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||Mg(e,u)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&as(r)&&(c=Jo(e))&&c.eq(j.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ot(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Tg(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ot(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 d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];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,s=e.nextSibling;if(We&&Gt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Ne(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Ne(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,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 Fl=new WeakMap,Ul=!1;function Tg(n){if(!Fl.has(n)&&(Fl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=nt,Ul)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."),Ul=!0}}function Vl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Sn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function Cg(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Vl(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?Vl(n,t):null}function Mg(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 Ag(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],as(l)||c.push({node:l.focusNode,offset:l.focusOffset})),De&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){s=g;break}if(!k||k.size)break}let u=n.state.doc,h=n.someProp("domParser")||qt.fromSchema(n.state.schema),f=u.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Ng,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function Ng(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Fe&&/^(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||Fe&&/^(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 _g=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Og(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,L=Jo(n,A);if(L&&!n.state.selection.eq(L)){if(De&&Nt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",se=>se(n,dn(13,"Enter"))))return;let F=n.state.tr.setSelection(L);A=="pointer"?F.setMeta("pointer",!0):A=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),n.dispatch(F)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Ag(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=Rg(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Wn&&n.input.lastIOSEnter>Date.now()-225||Nt)&&i.some(A=>A.nodeType==1&&!_g.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof H&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=Kl(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let L=n.state.tr.setSelection(A);s&&L.setMeta("composition",s),n.dispatch(L)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof H&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),We&&Gt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=d.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Wn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Lg(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,dn(8,"Backspace")))){Nt&&De&&n.domObserver.suppressSelectionUpdates();return}De&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Nt&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,dn(13,"Enter"))})},20));let v=p.start,x=p.endA,w=A=>{let L=A||n.state.tr.replace(v,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let F=Kl(n,L.doc,c.sel);F&&!(De&&n.composing&&F.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(F.head==v||F.head==L.mapping.map(x)-1)||We&&F.empty&&F.head==v)&&L.setSelection(F)}return s&&L.setMeta("composition",s),L.scrollIntoView()},M;if(k)if(m.pos==g.pos){We&&Gt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ot(n),20));let A=w(n.state.tr.delete(v,x)),L=d.resolve(p.start).marksAcross(d.resolve(p.endA));L&&A.ensureMarks(L),n.dispatch(A)}else if(p.endA==p.endB&&(M=Ig(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let A=w(n.state.tr);M.type=="add"?A.addMark(v,x,M.mark):A.removeMark(v,x,M.mark),n.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),L=()=>w(n.state.tr.insertText(A,v,x));n.someProp("handleTextInput",F=>F(n,v,x,A,L))||n.dispatch(L())}else n.dispatch(w());else n.dispatch(w())}function Kl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Zo(n,e.resolve(t.anchor),e.resolve(t.head))}function Ig(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(S.from(c).eq(n))return{mark:a,type:o}}function Lg(n,e,t,r,i){if(t-e<=i.pos-r.pos||Hs(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Hs(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Hs(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Hs(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 s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Rg(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&n.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Wl(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<n.size&&Wl(n.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Wl(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 hu{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 Qm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Zl),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=Gl(this),ql(this),this.nodeViews=Jl(this),this.docView=Cl(this.state.doc,jl(this),zs(this),this.dom,this),this.domObserver=new wg(this,(r,i,s,o)=>Og(this,r,i,s,o)),this.domObserver.start(),eg(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&&ko(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zl),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,s=!1,o=!1;e.storedMarks&&this.composing&&(su(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Jl(this);$g(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&ko(this),this.editable=Gl(this),ql(this);let l=zs(this),c=jl(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&pm(this);if(o){this.domObserver.stop();let f=u&&(We||De)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Dg(i.selection,e.selection);if(u){let p=De?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fg(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Cl(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Bm(this))?Ot(this,f):(qd(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&mm(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof B){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&El(this,t.getBoundingClientRect(),e)}else El(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 s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new au(e.slice,e.move,i<0?void 0:B.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 o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(We){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&&gm(this.dom),Ot(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 vm(this,e)}coordsAtPos(e,t=1){return zd(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 Cm(this,t||this.state,e)}pasteHTML(e,t){return Sr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Sr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yo(this,e)}destroy(){this.docView&&(tg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,rm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rg(this,e)}domSelectionRange(){let e=this.domSelection();return e?Fe&&this.root.nodeType===11&&lm(this.dom.ownerDocument)==this.dom&&Cg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}hu.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function jl(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"),[$e.node(0,n.state.doc.content.size,e)]}function ql(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:$e.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Gl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Dg(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 Jl(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 $g(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 Zl(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 Xt={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:"'"},Ei={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Pg=typeof navigator<"u"&&/Mac/.test(navigator.platform),Bg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _e=0;_e<10;_e++)Xt[48+_e]=Xt[96+_e]=String(_e);for(var _e=1;_e<=24;_e++)Xt[_e+111]="F"+_e;for(var _e=65;_e<=90;_e++)Xt[_e]=String.fromCharCode(_e+32),Ei[_e]=String.fromCharCode(_e);for(var Fs in Xt)Ei.hasOwnProperty(Fs)||(Ei[Fs]=Xt[Fs]);function zg(n){var e=Pg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Bg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ei:Xt)[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 Hg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Fg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ug(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Hg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Vg(n){let e=Object.create(null);for(let t in n)e[Ug(t)]=n[t];return e}function Us(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 Kg(n){return new ne({props:{handleKeyDown:fu(n)}})}function fu(n){let e=Vg(n);return function(t,r){let i=zg(r),s,o=e[Us(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Us(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Fg&&r.ctrlKey&&r.altKey)&&(s=Xt[r.keyCode])&&s!=i){let a=e[Us(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Wg=Object.defineProperty,ra=(n,e)=>{for(var t in e)Wg(n,t,{get:e[t],enumerable:!0})};function ds(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var us=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const d=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,h])=>[u,(...p)=>{const m=this.buildProps(l,e),g=h(...p)(m);return o.push(g),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:ds({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},pu={};ra(pu,{blur:()=>jg,clearContent:()=>qg,clearNodes:()=>Gg,command:()=>Jg,createParagraphNear:()=>Zg,cut:()=>Yg,deleteCurrentNode:()=>Xg,deleteNode:()=>Qg,deleteRange:()=>eb,deleteSelection:()=>tb,enter:()=>nb,exitCode:()=>rb,extendMarkRange:()=>ib,first:()=>sb,focus:()=>ab,forEach:()=>lb,insertContent:()=>cb,insertContentAt:()=>hb,joinBackward:()=>mb,joinDown:()=>pb,joinForward:()=>gb,joinItemBackward:()=>bb,joinItemForward:()=>yb,joinTextblockBackward:()=>kb,joinTextblockForward:()=>Eb,joinUp:()=>fb,keyboardShortcut:()=>xb,lift:()=>Sb,liftEmptyBlock:()=>wb,liftListItem:()=>Tb,newlineInCode:()=>Cb,resetAttributes:()=>Mb,scrollIntoView:()=>Ab,selectAll:()=>Nb,selectNodeBackward:()=>_b,selectNodeForward:()=>Ob,selectParentNode:()=>Ib,selectTextblockEnd:()=>Lb,selectTextblockStart:()=>Rb,setContent:()=>Db,setMark:()=>Qb,setMeta:()=>ey,setNode:()=>ty,setNodeSelection:()=>ny,setTextSelection:()=>ry,sinkListItem:()=>iy,splitBlock:()=>sy,splitListItem:()=>oy,toggleList:()=>ay,toggleMark:()=>ly,toggleNode:()=>cy,toggleWrap:()=>dy,undoInputRule:()=>uy,unsetAllMarks:()=>hy,unsetMark:()=>fy,updateAttributes:()=>py,wrapIn:()=>my,wrapInList:()=>gy});var jg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),qg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Gg=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=Zn(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},Jg=n=>e=>n(e),Zg=()=>({state:n,dispatch:e})=>Nd(n,e),Yg=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},Xg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1};function ke(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Qg=n=>({tr:e,state:t,dispatch:r})=>{const i=ke(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},eb=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},tb=()=>({state:n,dispatch:e})=>Vo(n,e),nb=()=>({commands:n})=>n.keyboardShortcut("Enter"),rb=()=>({state:n,dispatch:e})=>Up(n,e);function ia(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function vi(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ia(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function mu(n,e,t={}){return n.find(r=>r.type===e&&vi(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Yl(n,e,t={}){return!!mu(n,e,t)}function jn(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!mu([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Yl([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&Yl([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function It(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var ib=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=It(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const u=jn(l,s,e);if(u&&u.from<=c&&u.to>=d){const h=H.create(o,u.from,u.to);t.setSelection(h)}}return!0},sb=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function gu(n){return n instanceof H}function fn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function bu(n,e=null){if(!e)return null;const t=j.atStart(n),r=j.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?H.create(n,fn(0,i,s),fn(n.content.size,i,s)):H.create(n,fn(e,i,s),fn(e,i,s))}function ob(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function sa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var ab=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(sa()||ob())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!gu(t.state.selection))return o(),!0;const a=bu(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},lb=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),cb=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),yu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&yu(r)}return n};function Gr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=(new window.DOMParser).parseFromString(e,"text/html").body;return yu(t)}function Tr(n,e,t){if(n instanceof dt||n instanceof S)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return S.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),Tr("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new nd({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?qt.fromSchema(l).parseSlice(Gr(n),t.parseOptions):qt.fromSchema(l).parse(Gr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=qt.fromSchema(e);return t.slice?s.parseSlice(Gr(n),t.parseOptions).content:s.parse(Gr(n),t.parseOptions)}return Tr("",e,t)}function db(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}var ub=n=>!("type"in n),hb=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Tr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Tr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((ub(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=r.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof S){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,d,u)}else{m=a;const g=r.doc.resolve(d),y=g.node(),k=g.parentOffset===0,v=y.isText||y.isTextblock,x=y.content.size>0;k&&v&&x&&(d=Math.max(0,d-1)),r.replaceWith(d,u,m)}t.updateSelection&&db(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0},fb=()=>({state:n,dispatch:e})=>zp(n,e),pb=()=>({state:n,dispatch:e})=>Hp(n,e),mb=()=>({state:n,dispatch:e})=>xd(n,e),gb=()=>({state:n,dispatch:e})=>Cd(n,e),bb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=rs(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},yb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=rs(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},kb=()=>({state:n,dispatch:e})=>Pp(n,e),Eb=()=>({state:n,dispatch:e})=>Bp(n,e);function ku(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))sa()||ku()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var xb=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=vb(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Qt(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?ke(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;const f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=i-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>vi(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var Sb=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return Qt(t,i,e)?Fp(t,r):!1},wb=()=>({state:n,dispatch:e})=>_d(n,e),Tb=n=>({state:e,dispatch:t})=>{const r=ke(n,e.schema);return Qp(r)(e,t)},Cb=()=>({state:n,dispatch:e})=>Ad(n,e);function hs(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Xl(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Mb=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=hs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ke(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{s&&s===c.type&&t.setNodeMarkup(d,void 0,Xl(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(Xl(u.attrs,e)))})})}),!0):!1},Ab=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Nb=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ye(n.doc);n.setSelection(t)}return!0},_b=()=>({state:n,dispatch:e})=>wd(n,e),Ob=()=>({state:n,dispatch:e})=>Md(n,e),Ib=()=>({state:n,dispatch:e})=>Wp(n,e),Lb=()=>({state:n,dispatch:e})=>Gp(n,e),Rb=()=>({state:n,dispatch:e})=>qp(n,e);function Eo(n,e,t={},r={}){return Tr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Db=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Eo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Eu(n,e){const t=It(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function vu(n,e){const t=new yd(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function $b(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function vo(n,e){const t=[];return n.descendants((r,i)=>{e(r)&&t.push({node:r,pos:i})}),t}function Pb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function Bb(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function fs(n){return e=>Bb(e.$from,n)}function $(n,e,t){return n.config[e]===void 0&&n.parent?$(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?$(n.parent,e,t):null}):n.config[e]}function oa(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",t);return r?[e,...oa(r())]:e}).flat(10)}function aa(n,e){const t=An.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function xu(n){return typeof n=="function"}function Q(n,e=void 0,...t){return xu(n)?e?n.bind(e)(...t):n(...t):n}function zb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cr(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Su(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cr(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=$(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=$(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...s,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function le(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=s}),r},{})}function xi(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>le(t,r),{})}function Hb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Ql(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Hb(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function ec(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&zb(t)?!1:t!=null))}function tc(n){var e,t,r;const i={};return!((e=n?.attribute)!=null&&e.isRequired)&&((t=n?.attribute)==null?void 0:t.default)!==void 0&&(i.default=n.attribute.default),((r=n?.attribute)==null?void 0:r.validate)!==void 0&&(i.validate=n.attribute.validate),[n.name,i]}function Fb(n,e){var t;const r=Su(n),{nodeExtensions:i,markExtensions:s}=Cr(n),o=(t=i.find(c=>$(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((y,k)=>{const v=$(k,"extendNodeSchema",u);return{...y,...v?v(c):{}}},{}),f=ec({...h,content:Q($(c,"content",u)),marks:Q($(c,"marks",u)),group:Q($(c,"group",u)),inline:Q($(c,"inline",u)),atom:Q($(c,"atom",u)),selectable:Q($(c,"selectable",u)),draggable:Q($(c,"draggable",u)),code:Q($(c,"code",u)),whitespace:Q($(c,"whitespace",u)),linebreakReplacement:Q($(c,"linebreakReplacement",u)),defining:Q($(c,"defining",u)),isolating:Q($(c,"isolating",u)),attrs:Object.fromEntries(d.map(tc))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(y=>Ql(y,d)));const m=$(c,"renderHTML",u);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:xi(y,d)}));const g=$(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((g,y)=>{const k=$(y,"extendMarkSchema",u);return{...g,...k?k(c):{}}},{}),f=ec({...h,inclusive:Q($(c,"inclusive",u)),excludes:Q($(c,"excludes",u)),group:Q($(c,"group",u)),spanning:Q($(c,"spanning",u)),code:Q($(c,"code",u)),attrs:Object.fromEntries(d.map(tc))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>Ql(g,d)));const m=$(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:xi(g,d)})),[c.name,f]}));return new nd({topNode:o,nodes:a,marks:l})}function Ub(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function la(n){return n.sort((t,r)=>{const i=$(t,"priority")||100,s=$(r,"priority")||100;return i>s?-1:i<s?1:0})}function wu(n){const e=la(oa(n)),t=Ub(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Tu(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`\n\n`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=s);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Vb(n,e){const t={from:0,to:n.content.size};return Tu(n,t,e)}function Cu(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Kb(n,e){const t=ke(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function Mu(n,e){const t=hs(typeof e=="string"?e:e.name,n.schema);return t==="node"?Kb(n,e):t==="mark"?Eu(n,e):{}}function Wb(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function jb(n){const e=Wb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Au(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),d=e.slice(s).map(l),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),jb(r)}function ca(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=jn(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var qb=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function Vs(n,e){return e.nodes[n]||e.marks[n]||null}function oi(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Gb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function xo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?It(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>vi(u.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(f,g),k=Math.min(p,g+m.nodeSize),v=k-y;o+=v,a.push(...m.marks.map(x=>({mark:x,from:y,to:k})))})}),o===0)return!1;const l=a.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>vi(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function Jb(n,e,t={}){if(!e)return Qt(n,null,t)||xo(n,null,t);const r=hs(e,n.schema);return r==="node"?Qt(n,e,t):r==="mark"?xo(n,e,t):!1}var Zb=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=fs(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Yb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function nc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function rc(n,e){const{nodeExtensions:t}=Cr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Q($(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function ps(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(ps(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Nu(n){return n instanceof B}function Xb(n,e,t){var r;const{selection:i}=e;let s=null;if(gu(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=f&&p}return!c}),c})}var Qb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=It(n,r.schema);if(i)if(o){const c=Eu(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&t.addMark(p,m,l.create({...y.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return Xb(r,t,l)},ey=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),ty=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=ke(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>bl(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>bl(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ny=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=fn(n,0,r.content.size),s=B.create(r,i);e.setSelection(s)}return!0},ry=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=H.atStart(r).from,a=H.atEnd(r).to,l=fn(i,o,a),c=fn(s,o,a),d=H.create(r,l,c);e.setSelection(d)}return!0},iy=n=>({state:e,dispatch:t})=>{const r=ke(n,e.schema);return nm(r)(e,t)};function ic(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var sy=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,d=oi(c,a.node().type.name,a.node().attrs);if(s instanceof B&&s.node.isBlock)return!a.parentOffset||!_t(o,a.pos)?!1:(r&&(n&&ic(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:$b(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=_t(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&_t(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&ic(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},oy=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=ke(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=S.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let L=l.depth-k;L>=l.depth-3;L-=1)y=S.from(l.node(L).copy(y));const v=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...oi(h,l.node().type.name,l.node().attrs),...e},w=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(x))||void 0;y=y.append(S.from(a.createAndFill(null,w)||void 0));const M=l.before(l.depth-(k-1));t.replace(M,l.after(-v),new O(y,4-k,0));let A=-1;t.doc.nodesBetween(M,t.doc.content.size,(L,F)=>{if(A>-1)return!1;L.isTextblock&&L.content.size===0&&(A=F+1)}),A>-1&&t.setSelection(H.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...oi(h,u.type.name,u.attrs),...e},m={...oi(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!_t(t.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:k}=r,{splittableMarks:v}=s.extensionManager,x=k||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!x||!i)return!0;const w=x.filter(M=>v.includes(M.type.name));t.ensureMarks(w)}return!0},Ks=(n,e)=>{const t=fs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,t.pos)&&n.join(t.pos),!0},Ws=(n,e)=>{const t=fs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,r)&&n.join(r),!0},ay=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,f=ke(n,o.schema),p=ke(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:k}=m,v=y.blockRange(k),x=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const w=fs(M=>rc(M.type.name,u))(m);if(v.depth>=1&&w&&v.depth-w.depth<=1){if(w.node.type===f)return c.liftListItem(p);if(rc(w.node.type.name,u)&&f.validContent(w.node.content)&&a)return l().command(()=>(s.setNodeMarkup(w.pos,f),!0)).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run()}return!t||!x||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run():l().command(()=>{const M=d().wrapInList(f,r),A=x.filter(L=>h.includes(L.type.name));return s.ensureMarks(A),M?!0:c.clearNodes()}).wrapInList(f,r).command(()=>Ks(s,f)).command(()=>Ws(s,f)).run()},ly=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=It(n,r.schema);return xo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},cy=(n,e,t={})=>({state:r,commands:i})=>{const s=ke(n,r.schema),o=ke(e,r.schema),a=Qt(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},dy=(n,e={})=>({state:t,commands:r})=>{const i=ke(n,t.schema);return Qt(t,i,e)?r.lift(i):r.wrapIn(i,e)},uy=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},hy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},fy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=It(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:h,to:f}=a;const p=(s=c.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=jn(c,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},py=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=hs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ke(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let u,h,f,p;t.selection.empty?r.doc.nodesBetween(c,d,(m,g)=>{s&&s===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m)}):r.doc.nodesBetween(c,d,(m,g)=>{g<c&&s&&s===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m),g>=c&&g<=d&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){const k=Math.max(g,c),v=Math.min(g+m.nodeSize,d);t.addMark(k,v,o.create({...y.attrs,...e}))}}))}),h&&(u!==void 0&&t.setNodeMarkup(u,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&t.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},my=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return Jp(i,e)(t,r)},gy=(n,e={})=>({state:t,dispatch:r})=>{const i=ke(n,t.schema);return Zp(i,e)(t,r)},by=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},ms=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},yy=(n,e)=>{if(ia(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Jr(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=Gb(c)+s;return o.forEach(h=>{if(d)return;const f=yy(u,h.find);if(!f)return;const p=l.state.tr,m=ds({state:l.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:y,chain:k,can:v}=new us({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:y,chain:k,can:v})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),d=!0)}),d}function ky(n){const{editor:e,rules:t}=n,r=new ne({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=aa(S.from(d),o.schema);const{from:u}=l,h=u+d.length;Jr({editor:e,from:u,to:h,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Jr({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Jr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Jr({editor:e,from:o.pos,to:o.pos,text:`\n`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Ey(n){return Object.prototype.toString.call(n).slice(8,-1)}function Zr(n){return Ey(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function _u(n,e){const t={...n};return Zr(n)&&Zr(e)&&Object.keys(e).forEach(r=>{Zr(e[r])&&Zr(n[r])?t[r]=_u(n[r],e[r]):t[r]=e[r]}),t}var da=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Q($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Q($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>_u(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},it=class Ou extends da{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Ou(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function vy(n){return typeof n=="number"}var xy=class{constructor(n){this.find=n.find,this.handler=n.handler}},Sy=(n,e,t)=>{if(ia(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function wy(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new us({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,i,(f,p)=>{var m,g,y,k,v;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const x=(v=(k=(y=f.content)==null?void 0:y.size)!=null?k:f.nodeSize)!=null?v:0,w=Math.max(r,p),M=Math.min(i,p+x);if(w>=M)return;const A=f.isText?f.text||"":f.textBetween(w-p,M-p,void 0,"");Sy(A,s.find,o).forEach(F=>{if(F.index===void 0)return;const se=w+F.index+1,Ie=se+F[0].length,Ce={from:t.tr.mapping.map(se),to:t.tr.mapping.map(Ie)},ze=s.handler({state:t,range:Ce,match:F,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(ze)})}),u.every(f=>f!==null)}var Yr=null,Ty=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Cy(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{const m=d.tr,g=ds({state:d,transaction:m});if(!(!wy({editor:e,state:g,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new ne({view(u){const h=p=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(p.target)?u.dom.parentElement:null,r&&(Yr=e)},f=()=>{Yr&&(Yr=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(s=r===u.dom.parentElement,a=h,!s){const f=Yr;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),k=!!y;if(!m&&!g&&!k)return;if(k){let{text:w}=y;typeof w=="string"?w=w:w=aa(S.from(w),f.schema);const{from:M}=y,A=M+w.length,L=Ty(w);return l({rule:d,state:f,from:M,to:{b:A},pasteEvt:L})}const v=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!vy(v)||!x||v===x.b))return l({rule:d,state:f,from:v,to:x,pasteEvt:o})}}))}var gs=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=wu(n),this.schema=Fb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vs(e.name,this.schema)},r=$(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return la([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Vs(r.name,this.schema)},s=[],o=$(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&$(r,"exitable",i)&&(a.ArrowRight=()=>it.handleExit({editor:n,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:n})]));a={...a,...h}}const l=Kg(a);s.push(l);const c=$(r,"addInputRules",i);if(nc(r,n.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=ky({editor:n,rules:h}),p=Array.isArray(f)?f:[f];s.push(...p)}}const d=$(r,"addPasteRules",i);if(nc(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const f=Cy({editor:n,rules:h});s.push(...f)}}const u=$(r,"addProseMirrorPlugins",i);if(u){const h=u();s.push(...h)}return s})}get attributes(){return Su(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ke(t.name,this.schema)},s=$(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,d,u,h)=>{const f=xi(l,r);return o({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:n,extension:t,HTMLAttributes:f})};return[t.name,a]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:It(t.name,this.schema)},s=$(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const d=xi(a,r);return s()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{Hy(a,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vs(e.name,this.schema)};e.type==="mark"&&((t=Q($(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=$(e,"onBeforeCreate",r),s=$(e,"onCreate",r),o=$(e,"onUpdate",r),a=$(e,"onSelectionUpdate",r),l=$(e,"onTransaction",r),c=$(e,"onFocus",r),d=$(e,"onBlur",r),u=$(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};gs.resolve=wu;gs.sort=la;gs.flatten=oa;var My={};ra(My,{ClipboardTextSerializer:()=>Lu,Commands:()=>Ru,Delete:()=>Du,Drop:()=>$u,Editable:()=>Pu,FocusEvents:()=>zu,Keymap:()=>Hu,Paste:()=>Fu,Tabindex:()=>Uu,focusEventsPluginKey:()=>Bu});var ee=class Iu extends da{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Iu(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Lu=ee.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ne({key:new ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),l=Cu(t);return Tu(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Ru=ee.create({name:"commands",addCommands(){return{...pu}}}),Du=ee.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const d=vu(n.before,[n,...e]);Au(d).forEach(f=>{d.mapping.mapResult(f.oldRange.from).deletedAfter&&d.mapping.mapResult(f.oldRange.to).deletedBefore&&d.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,y=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((f,p)=>{var m,g;if(f instanceof ct){const y=h.slice(p).map(f.from,-1),k=h.slice(p).map(f.to),v=h.invert().map(y,-1),x=h.invert().map(k),w=(m=d.doc.nodeAt(y-1))==null?void 0:m.marks.some(A=>A.eq(f.mark)),M=(g=d.doc.nodeAt(k))==null?void 0:g.marks.some(A=>A.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:v,to:x},newRange:{from:y,to:k},partial:!!(M||w),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),$u=ee.create({name:"drop",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Pu=ee.create({name:"editable",addProseMirrorPlugins(){return[new ne({key:new ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Bu=new ce("focusEvents"),zu=ee.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ne({key:Bu,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Hu=ee.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&p.parent.childCount===1?g===u.pos:j.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return sa()||ku()?s:i},addProseMirrorPlugins(){return[new ne({key:new ce("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=j.atStart(e.doc).from,c=j.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!ps(t.doc))return;const h=t.tr,f=ds({state:t,transaction:h}),{commands:p}=new us({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),Fu=ee.create({name:"paste",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Uu=ee.create({name:"tabindex",addProseMirrorPlugins(){return[new ne({key:new ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Ay=class Dn{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Dn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Dn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Dn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Dn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Dn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Ny=`.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;function _y(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Oy=class extends by{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=bu(e,this.options.autofocus);this.editorState=zn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=_y(Ny,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=xu(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[Pu,Lu.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ru,zu,Hu,Uu,$u,Fu,Du].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new gs(r,this)}createCommandManager(){this.commandManager=new us({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Eo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=Eo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new hu(n,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return Mu(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return Jb(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return aa(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`\n\n`,textSerializers:t={}}=n||{};return Vb(this.state.doc,{blockSeparator:e,textSerializers:{...Cu(this.schema),...t}})}get isEmpty(){return ps(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Ay(e,this)}get $doc(){return this.$pos(0)}};function qn(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(ca(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Iy(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function So(n){return new ms({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=Q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Gn(n){return new ms({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=Q(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Fo(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&tn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function Ly(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof B){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var Ry={};ra(Ry,{createAtomBlockMarkdownSpec:()=>Dy,createBlockMarkdownSpec:()=>$y,createInlineMarkdownSpec:()=>zy,parseAttributes:()=>ua,parseIndentedBlocks:()=>wo,renderNestedMarkdownContent:()=>fa,serializeAttributes:()=>ha});function ua(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(d=>d.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,d])=>{var u;const h=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function ha(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Dy(n){const{nodeName:e,name:t,parseAttributes:r=ua,serializeAttributes:i=ha,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=d=>{if(!a)return d;const u={};return a.forEach(h=>{h in d&&(u[h]=d[h])}),u};return{parseMarkdown:(d,u)=>{const h={...s,...d.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(u=d.match(h))==null?void 0:u.index;return f!==void 0?f:-1},tokenize(d,u,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=d.match(f);if(!p)return;const m=p[1]||"",g=r(m);if(!o.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:d=>{const u=c(d.attrs||{}),h=i(u),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function $y(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=ua,serializeAttributes:s=ha,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const h={};return l.forEach(f=>{f in u&&(h[f]=u[f])}),h};return{parseMarkdown:(u,h)=>{let f;if(r){const m=r(u);f=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?f=h.parseChildren(u.tokens||[]):f=h.parseInline(u.tokens||[]);const p={...o,...u.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(u){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=u.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[y,k=""]=g,v=i(k);let x=1;const w=y.length;let M="";const A=/^:::([\w-]*)(\s.*)?/gm,L=u.slice(w);for(A.lastIndex=0;;){const F=A.exec(L);if(F===null)break;const se=F.index,Ie=F[1];if(!((p=F[2])!=null&&p.endsWith(":::"))){if(Ie)x+=1;else if(x-=1,x===0){const Ce=L.slice(0,se);M=Ce.trim();const ze=u.slice(0,w+se+F[0].length);let Z=[];if(M)if(a==="block")for(Z=f.blockTokens(Ce),Z.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=f.inlineTokens(J.text))});Z.length>0;){const J=Z[Z.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))Z.pop();else break}else Z=f.inlineTokens(M);return{type:e,raw:ze,attributes:v,content:M,tokens:Z}}}}}},renderMarkdown:(u,h)=>{const f=d(u.attrs||{}),p=s(f),m=p?` {${p}}`:"",g=h.renderChildren(u.content||[],`\n\n`);return`:::${c}${m}\n\n${g}\n\n:::`}}}function Py(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function By(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function zy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Py,serializeAttributes:s=By,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{p in h&&(f[p]=h[p])}),f},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(a)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(f),m=p?.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=h.match(m);if(!g)return;let y="",k="";if(a){const[,x]=g;k=x}else{const[,x,w]=g;k=x,y=w||""}const v=i(k.trim());return{type:e,raw:g[0],content:y.trim(),attributes:v}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=d(h.attrs||{}),m=s(p),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function wo(n,e,t){var r,i,s,o;const a=n.split(`\n`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){d+=1;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:g}=p;c=`${c}${h}\n`;const y=[g];for(d+=1;d<a.length;){const w=a[d];if(w.trim()===""){const A=a.slice(d+1).findIndex(se=>se.trim()!=="");if(A===-1)break;if((((i=(r=a[d+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){y.push(w),c=`${c}${w}\n`,d+=1;continue}else break}if((((o=(s=w.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)y.push(w),c=`${c}${w}\n`,d+=1;else break}let k;const v=y.slice(1);if(v.length>0){const w=v.map(M=>M.slice(m+u)).join(`\n`);w.trim()&&(e.customNestedParser?k=e.customNestedParser(w):k=t.blockTokens(w))}const x=e.createToken(p,k);l.push(x)}if(l.length!==0)return{items:l,raw:c.trim()}}function fa(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const d=e.renderChildren([c]);if(d){const u=d.split(`\n`).map(h=>h?e.indent(h):"").join(`\n`);l.push(u)}}),l.join(`\n`)}function Hy(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,l)=>{const c=s.mapping.map(l),d=s.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==u.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,f)}}),s.docChanged&&e.view.dispatch(s)}var Oe=class Vu extends da{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Vu(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Tn(n){return new xy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=Q(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(ca(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}var Fy=/(^|[^`])`([^`]+)`(?!`)$/,Uy=/(^|[^`])`([^`]+)`(?!`)/g,Ku=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[qn({find:Fy,type:this.type})]},addPasteRules(){return[Tn({find:Uy,type:this.type})]}}),Vy=Ku,js=4,Ky=/^```([a-z]+)?[\s\n]$/,Wy=/^~~~([a-z]+)?[\s\n]$/,Wu=Oe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:js,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",le(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`\n`):r=`\`\`\`${i}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:js,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,f=r.doc.textBetween(c,d,`\n`,`\n`).split(`\n`).map(p=>a+p).join(`\n`);return l.replaceWith(c,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:js,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=s,d=s.start(),u=s.end(),f=r.doc.textBetween(d,u,`\n`,`\n`).split(`\n`);let p=0,m=0;const g=c-d;for(let M=0;M<f.length;M+=1){if(m+f[M].length>=g){p=M;break}m+=f[M].length+1}const k=((l=f[p].match(/^ */))==null?void 0:l[0])||"",v=Math.min(k.length,t);if(v===0)return!0;let x=d;for(let M=0;M<p;M+=1)x+=f[M].length+1;return a.delete(x,x+v),c-x<=v&&a.setSelection(H.create(a.doc,x)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=r.doc.textBetween(l,c,`\n`,`\n`).split(`\n`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,t);return f.slice(g)}).join(`\n`);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`\n\n`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(j.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[So({find:Ky,type:this.type,getAttributes:n=>({language:n[1]})}),So({find:Wy,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ne({key:new ce("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`\n`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),jy=Wu;function qy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qs,sc;function Gy(){if(sc)return qs;sc=1;function n(b){return b instanceof Map?b.clear=b.delete=b.set=function(){throw new Error("map is read-only")}:b instanceof Set&&(b.add=b.clear=b.delete=function(){throw new Error("set is read-only")}),Object.freeze(b),Object.getOwnPropertyNames(b).forEach(E=>{const N=b[E],V=typeof N;(V==="object"||V==="function")&&!Object.isFrozen(N)&&n(N)}),b}class e{constructor(E){E.data===void 0&&(E.data={}),this.data=E.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(b,...E){const N=Object.create(null);for(const V in b)N[V]=b[V];return E.forEach(function(V){for(const fe in V)N[fe]=V[fe]}),N}const i="</span>",s=b=>!!b.scope,o=(b,{prefix:E})=>{if(b.startsWith("language:"))return b.replace("language:","language-");if(b.includes(".")){const N=b.split(".");return[`${E}${N.shift()}`,...N.map((V,fe)=>`${V}${"_".repeat(fe+1)}`)].join(" ")}return`${E}${b}`};class a{constructor(E,N){this.buffer="",this.classPrefix=N.classPrefix,E.walk(this)}addText(E){this.buffer+=t(E)}openNode(E){if(!s(E))return;const N=o(E.scope,{prefix:this.classPrefix});this.span(N)}closeNode(E){s(E)&&(this.buffer+=i)}value(){return this.buffer}span(E){this.buffer+=`<span class="${E}">`}}const l=(b={})=>{const E={children:[]};return Object.assign(E,b),E};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(E){this.top.children.push(E)}openNode(E){const N=l({scope:E});this.add(N),this.stack.push(N)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(E){return this.constructor._walk(E,this.rootNode)}static _walk(E,N){return typeof N=="string"?E.addText(N):N.children&&(E.openNode(N),N.children.forEach(V=>this._walk(E,V)),E.closeNode(N)),E}static _collapse(E){typeof E!="string"&&E.children&&(E.children.every(N=>typeof N=="string")?E.children=[E.children.join("")]:E.children.forEach(N=>{c._collapse(N)}))}}class d extends c{constructor(E){super(),this.options=E}addText(E){E!==""&&this.add(E)}startScope(E){this.openNode(E)}endScope(){this.closeNode()}__addSublanguage(E,N){const V=E.root;N&&(V.scope=`language:${N}`),this.add(V)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(b){return b?typeof b=="string"?b:b.source:null}function h(b){return m("(?=",b,")")}function f(b){return m("(?:",b,")*")}function p(b){return m("(?:",b,")?")}function m(...b){return b.map(N=>u(N)).join("")}function g(b){const E=b[b.length-1];return typeof E=="object"&&E.constructor===Object?(b.splice(b.length-1,1),E):{}}function y(...b){return"("+(g(b).capture?"":"?:")+b.map(V=>u(V)).join("|")+")"}function k(b){return new RegExp(b.toString()+"|").exec("").length-1}function v(b,E){const N=b&&b.exec(E);return N&&N.index===0}const x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function w(b,{joinWith:E}){let N=0;return b.map(V=>{N+=1;const fe=N;let pe=u(V),R="";for(;pe.length>0;){const I=x.exec(pe);if(!I){R+=pe;break}R+=pe.substring(0,I.index),pe=pe.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?R+="\\"+String(Number(I[1])+fe):(R+=I[0],I[0]==="("&&N++)}return R}).map(V=>`(${V})`).join(E)}const M=/\b\B/,A="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",F="\\b\\d+(\\.\\d+)?",se="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ie="\\b(0b[01]+)",Ce="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ze=(b={})=>{const E=/^#![ ]*\//;return b.binary&&(b.begin=m(E,/.*\b/,b.binary,/\b.*/)),r({scope:"meta",begin:E,end:/$/,relevance:0,"on:begin":(N,V)=>{N.index!==0&&V.ignoreMatch()}},b)},Z={begin:"\\\\[\\s\\S]",relevance:0},J={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},me={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},st={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Y=function(b,E,N={}){const V=r({scope:"comment",begin:b,end:E,contains:[]},N);V.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const fe=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return V.contains.push({begin:m(/[ ]+/,"(",fe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),V},He=Y("//","$"),qe=Y("/\\*","\\*/"),ot=Y("#","$"),xt={scope:"number",begin:F,relevance:0},sn={scope:"number",begin:se,relevance:0},Zh={scope:"number",begin:Ie,relevance:0},Yh={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},Xh={scope:"title",begin:A,relevance:0},Qh={scope:"title",begin:L,relevance:0},ef={begin:"\\.\\s*"+L,relevance:0};var Br=Object.freeze({__proto__:null,APOS_STRING_MODE:J,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:Zh,BINARY_NUMBER_RE:Ie,COMMENT:Y,C_BLOCK_COMMENT_MODE:qe,C_LINE_COMMENT_MODE:He,C_NUMBER_MODE:sn,C_NUMBER_RE:se,END_SAME_AS_BEGIN:function(b){return Object.assign(b,{"on:begin":(E,N)=>{N.data._beginMatch=E[1]},"on:end":(E,N)=>{N.data._beginMatch!==E[1]&&N.ignoreMatch()}})},HASH_COMMENT_MODE:ot,IDENT_RE:A,MATCH_NOTHING_RE:M,METHOD_GUARD:ef,NUMBER_MODE:xt,NUMBER_RE:F,PHRASAL_WORDS_MODE:st,QUOTE_STRING_MODE:me,REGEXP_MODE:Yh,RE_STARTERS_RE:Ce,SHEBANG:ze,TITLE_MODE:Xh,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:Qh});function tf(b,E){b.input[b.index-1]==="."&&E.ignoreMatch()}function nf(b,E){b.className!==void 0&&(b.scope=b.className,delete b.className)}function rf(b,E){E&&b.beginKeywords&&(b.begin="\\b("+b.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",b.__beforeBegin=tf,b.keywords=b.keywords||b.beginKeywords,delete b.beginKeywords,b.relevance===void 0&&(b.relevance=0))}function sf(b,E){Array.isArray(b.illegal)&&(b.illegal=y(...b.illegal))}function of(b,E){if(b.match){if(b.begin||b.end)throw new Error("begin & end are not supported with match");b.begin=b.match,delete b.match}}function af(b,E){b.relevance===void 0&&(b.relevance=1)}const lf=(b,E)=>{if(!b.beforeMatch)return;if(b.starts)throw new Error("beforeMatch cannot be used with starts");const N=Object.assign({},b);Object.keys(b).forEach(V=>{delete b[V]}),b.keywords=N.keywords,b.begin=m(N.beforeMatch,h(N.begin)),b.starts={relevance:0,contains:[Object.assign(N,{endsParent:!0})]},b.relevance=0,delete N.beforeMatch},cf=["of","and","for","in","not","or","if","then","parent","list","value"],df="keyword";function Da(b,E,N=df){const V=Object.create(null);return typeof b=="string"?fe(N,b.split(" ")):Array.isArray(b)?fe(N,b):Object.keys(b).forEach(function(pe){Object.assign(V,Da(b[pe],E,pe))}),V;function fe(pe,R){E&&(R=R.map(I=>I.toLowerCase())),R.forEach(function(I){const U=I.split("|");V[U[0]]=[pe,uf(U[0],U[1])]})}}function uf(b,E){return E?Number(E):hf(b)?0:1}function hf(b){return cf.includes(b.toLowerCase())}const $a={},on=b=>{console.error(b)},Pa=(b,...E)=>{console.log(`WARN: ${b}`,...E)},Nn=(b,E)=>{$a[`${b}/${E}`]||(console.log(`Deprecated as of ${b}. ${E}`),$a[`${b}/${E}`]=!0)},zr=new Error;function Ba(b,E,{key:N}){let V=0;const fe=b[N],pe={},R={};for(let I=1;I<=E.length;I++)R[I+V]=fe[I],pe[I+V]=!0,V+=k(E[I-1]);b[N]=R,b[N]._emit=pe,b[N]._multi=!0}function ff(b){if(Array.isArray(b.begin)){if(b.skip||b.excludeBegin||b.returnBegin)throw on("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),zr;if(typeof b.beginScope!="object"||b.beginScope===null)throw on("beginScope must be object"),zr;Ba(b,b.begin,{key:"beginScope"}),b.begin=w(b.begin,{joinWith:""})}}function pf(b){if(Array.isArray(b.end)){if(b.skip||b.excludeEnd||b.returnEnd)throw on("skip, excludeEnd, returnEnd not compatible with endScope: {}"),zr;if(typeof b.endScope!="object"||b.endScope===null)throw on("endScope must be object"),zr;Ba(b,b.end,{key:"endScope"}),b.end=w(b.end,{joinWith:""})}}function mf(b){b.scope&&typeof b.scope=="object"&&b.scope!==null&&(b.beginScope=b.scope,delete b.scope)}function gf(b){mf(b),typeof b.beginScope=="string"&&(b.beginScope={_wrap:b.beginScope}),typeof b.endScope=="string"&&(b.endScope={_wrap:b.endScope}),ff(b),pf(b)}function bf(b){function E(R,I){return new RegExp(u(R),"m"+(b.case_insensitive?"i":"")+(b.unicodeRegex?"u":"")+(I?"g":""))}class N{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,U){U.position=this.position++,this.matchIndexes[this.matchAt]=U,this.regexes.push([U,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(U=>U[1]);this.matcherRe=E(w(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const U=this.matcherRe.exec(I);if(!U)return null;const xe=U.findIndex((Xn,xs)=>xs>0&&Xn!==void 0),ge=this.matchIndexes[xe];return U.splice(0,xe),Object.assign(U,ge)}}class V{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const U=new N;return this.rules.slice(I).forEach(([xe,ge])=>U.addRule(xe,ge)),U.compile(),this.multiRegexes[I]=U,U}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,U){this.rules.push([I,U]),U.type==="begin"&&this.count++}exec(I){const U=this.getMatcher(this.regexIndex);U.lastIndex=this.lastIndex;let xe=U.exec(I);if(this.resumingScanAtSamePosition()&&!(xe&&xe.index===this.lastIndex)){const ge=this.getMatcher(0);ge.lastIndex=this.lastIndex+1,xe=ge.exec(I)}return xe&&(this.regexIndex+=xe.position+1,this.regexIndex===this.count&&this.considerAll()),xe}}function fe(R){const I=new V;return R.contains.forEach(U=>I.addRule(U.begin,{rule:U,type:"begin"})),R.terminatorEnd&&I.addRule(R.terminatorEnd,{type:"end"}),R.illegal&&I.addRule(R.illegal,{type:"illegal"}),I}function pe(R,I){const U=R;if(R.isCompiled)return U;[nf,of,gf,lf].forEach(ge=>ge(R,I)),b.compilerExtensions.forEach(ge=>ge(R,I)),R.__beforeBegin=null,[rf,sf,af].forEach(ge=>ge(R,I)),R.isCompiled=!0;let xe=null;return typeof R.keywords=="object"&&R.keywords.$pattern&&(R.keywords=Object.assign({},R.keywords),xe=R.keywords.$pattern,delete R.keywords.$pattern),xe=xe||/\w+/,R.keywords&&(R.keywords=Da(R.keywords,b.case_insensitive)),U.keywordPatternRe=E(xe,!0),I&&(R.begin||(R.begin=/\B|\b/),U.beginRe=E(U.begin),!R.end&&!R.endsWithParent&&(R.end=/\B|\b/),R.end&&(U.endRe=E(U.end)),U.terminatorEnd=u(U.end)||"",R.endsWithParent&&I.terminatorEnd&&(U.terminatorEnd+=(R.end?"|":"")+I.terminatorEnd)),R.illegal&&(U.illegalRe=E(R.illegal)),R.contains||(R.contains=[]),R.contains=[].concat(...R.contains.map(function(ge){return yf(ge==="self"?R:ge)})),R.contains.forEach(function(ge){pe(ge,U)}),R.starts&&pe(R.starts,I),U.matcher=fe(U),U}if(b.compilerExtensions||(b.compilerExtensions=[]),b.contains&&b.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return b.classNameAliases=r(b.classNameAliases||{}),pe(b)}function za(b){return b?b.endsWithParent||za(b.starts):!1}function yf(b){return b.variants&&!b.cachedVariants&&(b.cachedVariants=b.variants.map(function(E){return r(b,{variants:null},E)})),b.cachedVariants?b.cachedVariants:za(b)?r(b,{starts:b.starts?r(b.starts):null}):Object.isFrozen(b)?r(b):b}var kf="11.11.1";class Ef extends Error{constructor(E,N){super(E),this.name="HTMLInjectionError",this.html=N}}const vs=t,Ha=r,Fa=Symbol("nomatch"),vf=7,Ua=function(b){const E=Object.create(null),N=Object.create(null),V=[];let fe=!0;const pe="Could not find the language '{}', did you forget to load/include a language module?",R={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function U(C){return I.noHighlightRe.test(C)}function xe(C){let P=C.className+" ";P+=C.parentNode?C.parentNode.className:"";const G=I.languageDetectRe.exec(P);if(G){const re=Rt(G[1]);return re||(Pa(pe.replace("{}",G[1])),Pa("Falling back to no-highlight mode for this block.",C)),re?G[1]:"no-highlight"}return P.split(/\s+/).find(re=>U(re)||Rt(re))}function ge(C,P,G){let re="",Ee="";typeof P=="object"?(re=C,G=P.ignoreIllegals,Ee=P.language):(Nn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Nn("10.7.0",`Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277`),Ee=C,re=P),G===void 0&&(G=!0);const at={code:re,language:Ee};Fr("before:highlight",at);const Dt=at.result?at.result:Xn(at.language,at.code,G);return Dt.code=at.code,Fr("after:highlight",Dt),Dt}function Xn(C,P,G,re){const Ee=Object.create(null);function at(_,D){return _.keywords[D]}function Dt(){if(!K.keywords){Me.addText(ie);return}let _=0;K.keywordPatternRe.lastIndex=0;let D=K.keywordPatternRe.exec(ie),q="";for(;D;){q+=ie.substring(_,D.index);const X=ft.case_insensitive?D[0].toLowerCase():D[0],Le=at(K,X);if(Le){const[St,Bf]=Le;if(Me.addText(q),q="",Ee[X]=(Ee[X]||0)+1,Ee[X]<=vf&&(Kr+=Bf),St.startsWith("_"))q+=D[0];else{const zf=ft.classNameAliases[St]||St;ht(D[0],zf)}}else q+=D[0];_=K.keywordPatternRe.lastIndex,D=K.keywordPatternRe.exec(ie)}q+=ie.substring(_),Me.addText(q)}function Ur(){if(ie==="")return;let _=null;if(typeof K.subLanguage=="string"){if(!E[K.subLanguage]){Me.addText(ie);return}_=Xn(K.subLanguage,ie,!0,Za[K.subLanguage]),Za[K.subLanguage]=_._top}else _=Ss(ie,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(Kr+=_.relevance),Me.__addSublanguage(_._emitter,_.language)}function Ge(){K.subLanguage!=null?Ur():Dt(),ie=""}function ht(_,D){_!==""&&(Me.startScope(D),Me.addText(_),Me.endScope())}function ja(_,D){let q=1;const X=D.length-1;for(;q<=X;){if(!_._emit[q]){q++;continue}const Le=ft.classNameAliases[_[q]]||_[q],St=D[q];Le?ht(St,Le):(ie=St,Dt(),ie=""),q++}}function qa(_,D){return _.scope&&typeof _.scope=="string"&&Me.openNode(ft.classNameAliases[_.scope]||_.scope),_.beginScope&&(_.beginScope._wrap?(ht(ie,ft.classNameAliases[_.beginScope._wrap]||_.beginScope._wrap),ie=""):_.beginScope._multi&&(ja(_.beginScope,D),ie="")),K=Object.create(_,{parent:{value:K}}),K}function Ga(_,D,q){let X=v(_.endRe,q);if(X){if(_["on:end"]){const Le=new e(_);_["on:end"](D,Le),Le.isMatchIgnored&&(X=!1)}if(X){for(;_.endsParent&&_.parent;)_=_.parent;return _}}if(_.endsWithParent)return Ga(_.parent,D,q)}function Lf(_){return K.matcher.regexIndex===0?(ie+=_[0],1):(Ms=!0,0)}function Rf(_){const D=_[0],q=_.rule,X=new e(q),Le=[q.__beforeBegin,q["on:begin"]];for(const St of Le)if(St&&(St(_,X),X.isMatchIgnored))return Lf(D);return q.skip?ie+=D:(q.excludeBegin&&(ie+=D),Ge(),!q.returnBegin&&!q.excludeBegin&&(ie=D)),qa(q,_),q.returnBegin?0:D.length}function Df(_){const D=_[0],q=P.substring(_.index),X=Ga(K,_,q);if(!X)return Fa;const Le=K;K.endScope&&K.endScope._wrap?(Ge(),ht(D,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Ge(),ja(K.endScope,_)):Le.skip?ie+=D:(Le.returnEnd||Le.excludeEnd||(ie+=D),Ge(),Le.excludeEnd&&(ie=D));do{K.scope&&Me.closeNode(),!K.skip&&!K.subLanguage&&(Kr+=K.relevance),K=K.parent}while(K!==X.parent);return X.starts&&qa(X.starts,_),Le.returnEnd?0:D.length}function $f(){const _=[];for(let D=K;D!==ft;D=D.parent)D.scope&&_.unshift(D.scope);_.forEach(D=>Me.openNode(D))}let Vr={};function Ja(_,D){const q=D&&D[0];if(ie+=_,q==null)return Ge(),0;if(Vr.type==="begin"&&D.type==="end"&&Vr.index===D.index&&q===""){if(ie+=P.slice(D.index,D.index+1),!fe){const X=new Error(`0 width match regex (${C})`);throw X.languageName=C,X.badRule=Vr.rule,X}return 1}if(Vr=D,D.type==="begin")return Rf(D);if(D.type==="illegal"&&!G){const X=new Error('Illegal lexeme "'+q+'" for mode "'+(K.scope||"<unnamed>")+'"');throw X.mode=K,X}else if(D.type==="end"){const X=Df(D);if(X!==Fa)return X}if(D.type==="illegal"&&q==="")return ie+=`\n`,1;if(Cs>1e5&&Cs>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=q,q.length}const ft=Rt(C);if(!ft)throw on(pe.replace("{}",C)),new Error('Unknown language: "'+C+'"');const Pf=bf(ft);let Ts="",K=re||Pf;const Za={},Me=new I.__emitter(I);$f();let ie="",Kr=0,an=0,Cs=0,Ms=!1;try{if(ft.__emitTokens)ft.__emitTokens(P,Me);else{for(K.matcher.considerAll();;){Cs++,Ms?Ms=!1:K.matcher.considerAll(),K.matcher.lastIndex=an;const _=K.matcher.exec(P);if(!_)break;const D=P.substring(an,_.index),q=Ja(D,_);an=_.index+q}Ja(P.substring(an))}return Me.finalize(),Ts=Me.toHTML(),{language:C,value:Ts,relevance:Kr,illegal:!1,_emitter:Me,_top:K}}catch(_){if(_.message&&_.message.includes("Illegal"))return{language:C,value:vs(P),illegal:!0,relevance:0,_illegalBy:{message:_.message,index:an,context:P.slice(an-100,an+100),mode:_.mode,resultSoFar:Ts},_emitter:Me};if(fe)return{language:C,value:vs(P),illegal:!1,relevance:0,errorRaised:_,_emitter:Me,_top:K};throw _}}function xs(C){const P={value:vs(C),illegal:!1,relevance:0,_top:R,_emitter:new I.__emitter(I)};return P._emitter.addText(C),P}function Ss(C,P){P=P||I.languages||Object.keys(E);const G=xs(C),re=P.filter(Rt).filter(Wa).map(Ge=>Xn(Ge,C,!1));re.unshift(G);const Ee=re.sort((Ge,ht)=>{if(Ge.relevance!==ht.relevance)return ht.relevance-Ge.relevance;if(Ge.language&&ht.language){if(Rt(Ge.language).supersetOf===ht.language)return 1;if(Rt(ht.language).supersetOf===Ge.language)return-1}return 0}),[at,Dt]=Ee,Ur=at;return Ur.secondBest=Dt,Ur}function xf(C,P,G){const re=P&&N[P]||G;C.classList.add("hljs"),C.classList.add(`language-${re}`)}function ws(C){let P=null;const G=xe(C);if(U(G))return;if(Fr("before:highlightElement",{el:C,language:G}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),I.throwUnescapedHTML))throw new Ef("One of your code blocks includes unescaped HTML.",C.innerHTML);P=C;const re=P.textContent,Ee=G?ge(re,{language:G,ignoreIllegals:!0}):Ss(re);C.innerHTML=Ee.value,C.dataset.highlighted="yes",xf(C,G,Ee.language),C.result={language:Ee.language,re:Ee.relevance,relevance:Ee.relevance},Ee.secondBest&&(C.secondBest={language:Ee.secondBest.language,relevance:Ee.secondBest.relevance}),Fr("after:highlightElement",{el:C,result:Ee,text:re})}function Sf(C){I=Ha(I,C)}const wf=()=>{Hr(),Nn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Tf(){Hr(),Nn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Va=!1;function Hr(){function C(){Hr()}if(document.readyState==="loading"){Va||window.addEventListener("DOMContentLoaded",C,!1),Va=!0;return}document.querySelectorAll(I.cssSelector).forEach(ws)}function Cf(C,P){let G=null;try{G=P(b)}catch(re){if(on("Language definition for '{}' could not be registered.".replace("{}",C)),fe)on(re);else throw re;G=R}G.name||(G.name=C),E[C]=G,G.rawDefinition=P.bind(null,b),G.aliases&&Ka(G.aliases,{languageName:C})}function Mf(C){delete E[C];for(const P of Object.keys(N))N[P]===C&&delete N[P]}function Af(){return Object.keys(E)}function Rt(C){return C=(C||"").toLowerCase(),E[C]||E[N[C]]}function Ka(C,{languageName:P}){typeof C=="string"&&(C=[C]),C.forEach(G=>{N[G.toLowerCase()]=P})}function Wa(C){const P=Rt(C);return P&&!P.disableAutodetect}function Nf(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=P=>{C["before:highlightBlock"](Object.assign({block:P.el},P))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=P=>{C["after:highlightBlock"](Object.assign({block:P.el},P))})}function _f(C){Nf(C),V.push(C)}function Of(C){const P=V.indexOf(C);P!==-1&&V.splice(P,1)}function Fr(C,P){const G=C;V.forEach(function(re){re[G]&&re[G](P)})}function If(C){return Nn("10.7.0","highlightBlock will be removed entirely in v12.0"),Nn("10.7.0","Please use highlightElement now."),ws(C)}Object.assign(b,{highlight:ge,highlightAuto:Ss,highlightAll:Hr,highlightElement:ws,highlightBlock:If,configure:Sf,initHighlighting:wf,initHighlightingOnLoad:Tf,registerLanguage:Cf,unregisterLanguage:Mf,listLanguages:Af,getLanguage:Rt,registerAliases:Ka,autoDetection:Wa,inherit:Ha,addPlugin:_f,removePlugin:Of}),b.debugMode=function(){fe=!1},b.safeMode=function(){fe=!0},b.versionString=kf,b.regex={concat:m,lookahead:h,either:y,optional:p,anyNumberOfTimes:f};for(const C in Br)typeof Br[C]=="object"&&n(Br[C]);return Object.assign(b,Br),b},_n=Ua({});return _n.newInstance=()=>Ua({}),qs=_n,_n.HighlightJS=_n,_n.default=_n,qs}var Jy=Gy();const ju=qy(Jy);function qu(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?qu(t.children,r):{text:t.value,classes:r}})}function oc(n){return n.value||n.children||[]}function Zy(n){return!!ju.getLanguage(n)}function ac({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return vo(n,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=t.listLanguages(),d=l&&(c.includes(l)||Zy(l)||(o=t.registered)!=null&&o.call(t,l))?oc(t.highlight(l,s.node.textContent)):oc(t.highlightAuto(s.node.textContent));qu(d).forEach(u=>{const h=a+u.text.length;if(u.classes.length){const f=$e.inline(a,h,{class:u.classes.join(" ")});i.push(f)}a=h})}),ae.create(n,i)}function Yy(n){return typeof n=="function"}function Xy({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>Yy(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new ne({key:new ce("lowlight"),state:{init:(i,{doc:s})=>ac({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=vo(o.doc,h=>h.type.name===n),u=vo(a.doc,h=>h.type.name===n);return i.docChanged&&([l,c].includes(n)||u.length!==d.length||i.steps.some(h=>h.from!==void 0&&h.to!==void 0&&d.some(f=>f.pos>=h.from&&f.pos+f.node.nodeSize<=h.to)))?ac({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var Qy=jy.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],Xy({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),e0=Qy,Gu=Oe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n\n`):""}),t0=Gu,n0=Object.defineProperty,r0=(n,e)=>{for(var t in e)n0(n,t,{get:e[t],enumerable:!0})},i0="listItem",lc="textStyle",cc=/^\s*([-+*])\s$/,pa=Oe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i0,this.editor.getAttributes(lc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Gn({find:cc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Gn({find:cc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lc),editor:this.editor})),[n]}}),ma=Oe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=n.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>fa(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),s0={};r0(s0,{findListItemPos:()=>Dr,getNextListDepth:()=>ga,handleBackspace:()=>To,handleDelete:()=>Co,hasListBefore:()=>Ju,hasListItemAfter:()=>o0,hasListItemBefore:()=>Zu,listItemHasSubList:()=>Yu,nextListIsDeeper:()=>Xu,nextListIsHigher:()=>Qu});var Dr=(n,e)=>{const{$from:t}=e.selection,r=ke(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},ga=(n,e)=>{const t=Dr(n,e);if(!t)return!1;const[,r]=qb(e,n,t.$pos.pos+4);return r},Ju=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},Zu=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},Yu=(n,e,t)=>{if(!t)return!1;const r=ke(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},To=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Qt(n.state,e)&&Ju(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Qt(n.state,e)||!Yb(n.state))return!1;const r=Dr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Yu(e,n.state,s);return Zu(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Xu=(n,e)=>{const t=ga(n,e),r=Dr(n,e);return!r||!t?!1:t>r.depth},Qu=(n,e)=>{const t=ga(n,e),r=Dr(n,e);return!r||!t?!1:t<r.depth},Co=(n,e)=>{if(!Qt(n.state,e)||!Zb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Xu(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Qu(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},o0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},eh=ee.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Co(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Co(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&To(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&To(n,t,r)&&(e=!0)}),e}}}}),dc=/^(\s*)(\d+)\.\s+(.*)$/,a0=/^\s/;function l0(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(dc);if(!s)break;const[,o,a,l]=s,c=o.length;let d=l,u=t+1;const h=[i];for(;u<n.length;){const f=n[u];if(f.match(dc))break;if(f.trim()==="")h.push(f),d+=`\n`,u+=1;else if(f.match(a0))h.push(f),d+=`\n${f.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join(`\n`)}),r=u,t=u}return[e,r]}function th(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const a=o.content.split(`\n`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.slice(1).join(`\n`).trim();if(d){const f=t.blockTokens(d);c.push(...f)}let u=s+1;const h=[];for(;u<n.length&&n[u].indent>e;)h.push(n[u]),u+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=th(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`\n`)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=u}else s+=1}return i}function c0(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var d0="listItem",uc="textStyle",hc=/^(\d+)\.\s$/,ba=Oe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",le(this.options.HTMLAttributes,t),0]:["ol",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?c0(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`\n`),[s,o]=l0(i);if(s.length===0)return;const a=th(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`\n`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(d0,this.editor.getAttributes(uc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Gn({find:hc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Gn({find:hc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(uc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),u0=/^\s*(\[([( |x])?\])\s$/,h0=Oe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",le(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return fa(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var u,h;a.ariaLabel=((h=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:h.call(u,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const p=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u)}),{dom:i,contentDOM:l,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[Gn({find:u0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),f0=Oe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",le(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=wo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=wo(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(pa.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(ma.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(eh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(ba.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(h0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(f0.configure(this.options.taskList)),n}});var p0=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),m0=p0,g0=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),b0=g0,y0=ee.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),k0=y0,E0=20,nh=(n,e=0)=>{const t=[];return!n.children.length||e>E0||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...nh(r,e+1))}),t},v0=n=>{if(!n.children.length)return;const e=nh(n);e&&e.forEach(t=>{var r,i;const s=t.getAttribute("style"),o=(i=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},rh=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&v0(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",le(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),x0=ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),S0=ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),w0=ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),T0=ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),C0=ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ee.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(x0.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(S0.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(w0.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(T0.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(C0.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(rh.configure(this.options.textStyle)),n}});var Si=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},M0=/^\s*>\s$/,A0=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Si("blockquote",{...le(this.options.HTMLAttributes,n),children:Si("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(i=>{const a=e.renderChildren([i]).split(`\n`).map(l=>l.trim()===""?t:`${t} ${l}`);r.push(a.join(`\n`))}),r.join(`\n${t}\n`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Gn({find:M0,type:this.type})]}}),N0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,O0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,I0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,L0=it.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Si("strong",{...le(this.options.HTMLAttributes,n),children:Si("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[qn({find:N0,type:this.type}),qn({find:O0,type:this.type})]},addPasteRules(){return[Tn({find:_0,type:this.type}),Tn({find:I0,type:this.type})]}}),R0=Oe.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",le(this.options.HTMLAttributes,n)]},renderText(){return`\n`},renderMarkdown:()=>` \n`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),D0=Oe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,le(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>So({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),$0=Oe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",le(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Ly(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Nu(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(B.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d?.create();u&&(o.insert(c,u),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Iy({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),P0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,B0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,z0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,H0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,F0=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",le(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[qn({find:P0,type:this.type}),qn({find:z0,type:this.type})]},addPasteRules(){return[Tn({find:B0,type:this.type}),Tn({find:H0,type:this.type})]}});const U0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",V0="ελ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",Mo="numeric",Ao="ascii",No="alpha",dr="asciinumeric",sr="alphanumeric",_o="domain",ih="emoji",K0="scheme",W0="slashscheme",Gs="whitespace";function j0(n,e){return n in e||(e[n]=[]),e[n]}function pn(n,e,t){e[Mo]&&(e[dr]=!0,e[sr]=!0),e[Ao]&&(e[dr]=!0,e[No]=!0),e[dr]&&(e[sr]=!0),e[No]&&(e[sr]=!0),e[sr]&&(e[_o]=!0),e[ih]&&(e[_o]=!0);for(const r in e){const i=j0(r,t);i.indexOf(n)<0&&i.push(n)}}function q0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ke(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ke.groups={};Ke.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],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return 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||Ke.groups;let i;return e&&e.j?i=e:(i=new Ke(e),t&&r&&pn(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||Ke.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new Ke,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ke,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(q0(o.t,r),t);pn(s,l,r)}else t&&pn(s,t,r);o.t=s}return i.j[n]=o,o}};const W=(n,e,t,r,i)=>n.ta(e,t,r,i),de=(n,e,t,r,i)=>n.tr(e,t,r,i),fc=(n,e,t,r,i)=>n.ts(e,t,r,i),T=(n,e,t,r,i)=>n.tt(e,t,r,i),Mt="WORD",Oo="UWORD",sh="ASCIINUMERICAL",oh="ALPHANUMERICAL",Mr="LOCALHOST",Io="TLD",Lo="UTLD",ai="SCHEME",$n="SLASH_SCHEME",ya="NUM",Ro="WS",ka="NL",ur="OPENBRACE",hr="CLOSEBRACE",wi="OPENBRACKET",Ti="CLOSEBRACKET",Ci="OPENPAREN",Mi="CLOSEPAREN",Ai="OPENANGLEBRACKET",Ni="CLOSEANGLEBRACKET",_i="FULLWIDTHLEFTPAREN",Oi="FULLWIDTHRIGHTPAREN",Ii="LEFTCORNERBRACKET",Li="RIGHTCORNERBRACKET",Ri="LEFTWHITECORNERBRACKET",Di="RIGHTWHITECORNERBRACKET",$i="FULLWIDTHLESSTHAN",Pi="FULLWIDTHGREATERTHAN",Bi="AMPERSAND",zi="APOSTROPHE",Hi="ASTERISK",zt="AT",Fi="BACKSLASH",Ui="BACKTICK",Vi="CARET",Ut="COLON",Ea="COMMA",Ki="DOLLAR",pt="DOT",Wi="EQUALS",va="EXCLAMATION",Qe="HYPHEN",fr="PERCENT",ji="PIPE",qi="PLUS",Gi="POUND",pr="QUERY",xa="QUOTE",ah="FULLWIDTHMIDDLEDOT",Sa="SEMI",mt="SLASH",mr="TILDE",Ji="UNDERSCORE",lh="EMOJI",Zi="SYM";var ch=Object.freeze({__proto__:null,ALPHANUMERICAL:oh,AMPERSAND:Bi,APOSTROPHE:zi,ASCIINUMERICAL:sh,ASTERISK:Hi,AT:zt,BACKSLASH:Fi,BACKTICK:Ui,CARET:Vi,CLOSEANGLEBRACKET:Ni,CLOSEBRACE:hr,CLOSEBRACKET:Ti,CLOSEPAREN:Mi,COLON:Ut,COMMA:Ea,DOLLAR:Ki,DOT:pt,EMOJI:lh,EQUALS:Wi,EXCLAMATION:va,FULLWIDTHGREATERTHAN:Pi,FULLWIDTHLEFTPAREN:_i,FULLWIDTHLESSTHAN:$i,FULLWIDTHMIDDLEDOT:ah,FULLWIDTHRIGHTPAREN:Oi,HYPHEN:Qe,LEFTCORNERBRACKET:Ii,LEFTWHITECORNERBRACKET:Ri,LOCALHOST:Mr,NL:ka,NUM:ya,OPENANGLEBRACKET:Ai,OPENBRACE:ur,OPENBRACKET:wi,OPENPAREN:Ci,PERCENT:fr,PIPE:ji,PLUS:qi,POUND:Gi,QUERY:pr,QUOTE:xa,RIGHTCORNERBRACKET:Li,RIGHTWHITECORNERBRACKET:Di,SCHEME:ai,SEMI:Sa,SLASH:mt,SLASH_SCHEME:$n,SYM:Zi,TILDE:mr,TLD:Io,UNDERSCORE:Ji,UTLD:Lo,UWORD:Oo,WORD:Mt,WS:Ro});const Tt=/[a-z]/,er=/\p{L}/u,Js=/\p{Emoji}/u,Ct=/\d/,Zs=/\s/,pc="\r",Ys=`\n`,G0="️",J0="‍",Xs="";let Xr=null,Qr=null;function Z0(n=[]){const e={};Ke.groups=e;const t=new Ke;Xr==null&&(Xr=mc(U0)),Qr==null&&(Qr=mc(V0)),T(t,"'",zi),T(t,"{",ur),T(t,"}",hr),T(t,"[",wi),T(t,"]",Ti),T(t,"(",Ci),T(t,")",Mi),T(t,"<",Ai),T(t,">",Ni),T(t,"(",_i),T(t,")",Oi),T(t,"「",Ii),T(t,"」",Li),T(t,"『",Ri),T(t,"』",Di),T(t,"<",$i),T(t,">",Pi),T(t,"&",Bi),T(t,"*",Hi),T(t,"@",zt),T(t,"`",Ui),T(t,"^",Vi),T(t,":",Ut),T(t,",",Ea),T(t,"$",Ki),T(t,".",pt),T(t,"=",Wi),T(t,"!",va),T(t,"-",Qe),T(t,"%",fr),T(t,"|",ji),T(t,"+",qi),T(t,"#",Gi),T(t,"?",pr),T(t,'"',xa),T(t,"/",mt),T(t,";",Sa),T(t,"~",mr),T(t,"_",Ji),T(t,"\\",Fi),T(t,"・",ah);const r=de(t,Ct,ya,{[Mo]:!0});de(r,Ct,r);const i=de(r,Tt,sh,{[dr]:!0}),s=de(r,er,oh,{[sr]:!0}),o=de(t,Tt,Mt,{[Ao]:!0});de(o,Ct,i),de(o,Tt,o),de(i,Ct,i),de(i,Tt,i);const a=de(t,er,Oo,{[No]:!0});de(a,Tt),de(a,Ct,s),de(a,er,a),de(s,Ct,s),de(s,Tt),de(s,er,s);const l=T(t,Ys,ka,{[Gs]:!0}),c=T(t,pc,Ro,{[Gs]:!0}),d=de(t,Zs,Ro,{[Gs]:!0});T(t,Xs,d),T(c,Ys,l),T(c,Xs,d),de(c,Zs,d),T(d,pc),T(d,Ys),de(d,Zs,d),T(d,Xs,d);const u=de(t,Js,lh,{[ih]:!0});T(u,"#"),de(u,Js,u),T(u,G0,u);const h=T(u,J0);T(h,"#"),de(h,Js,u);const f=[[Tt,o],[Ct,i]],p=[[Tt,null],[er,a],[Ct,s]];for(let m=0;m<Xr.length;m++)$t(t,Xr[m],Io,Mt,f);for(let m=0;m<Qr.length;m++)$t(t,Qr[m],Lo,Oo,p);pn(Io,{tld:!0,ascii:!0},e),pn(Lo,{utld:!0,alpha:!0},e),$t(t,"file",ai,Mt,f),$t(t,"mailto",ai,Mt,f),$t(t,"http",$n,Mt,f),$t(t,"https",$n,Mt,f),$t(t,"ftp",$n,Mt,f),$t(t,"ftps",$n,Mt,f),pn(ai,{scheme:!0,ascii:!0},e),pn($n,{slashscheme:!0,ascii:!0},e),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],k=n[m][1]?{[K0]:!0}:{[W0]:!0};g.indexOf("-")>=0?k[_o]=!0:Tt.test(g)?Ct.test(g)?k[dr]=!0:k[Ao]=!0:k[Mo]=!0,fc(t,g,g,k)}return fc(t,"localhost",Mr,{ascii:!0}),t.jd=new Ke(Zi),{start:t,tokens:Object.assign({groups:e},ch)}}function dh(n,e){const t=Y0(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=t[o].length,h++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=h,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function Y0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function $t(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new Ke(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new Ke(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function mc(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Ar={defaultProtocol:"http",events:null,format:gc,formatHref:gc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wa(n,e=null){let t=Object.assign({},Ar);n&&(t=Object.assign(t,n instanceof wa?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}wa.prototype={o:Ar,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]:Ar[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 gc(n){return n}function uh(n,e){this.t="token",this.v=n,this.tk=e}uh.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=Ar.defaultProtocol){return{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),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function bs(n,e){class t extends uh{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const bc=bs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),yc=bs("text"),X0=bs("nl"),ei=bs("url",{isLink:!0,toHref(n=Ar.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Mr&&n[1].t===Ut}}),Xe=n=>new Ke(n);function Q0({groups:n}){const e=n.domain.concat([Bi,Hi,zt,Fi,Ui,Vi,Ki,Wi,Qe,ya,fr,ji,qi,Gi,mt,Zi,mr,Ji]),t=[zi,Ut,Ea,pt,va,fr,pr,xa,Sa,Ai,Ni,ur,hr,Ti,wi,Ci,Mi,_i,Oi,Ii,Li,Ri,Di,$i,Pi],r=[Bi,zi,Hi,Fi,Ui,Vi,Ki,Wi,Qe,ur,hr,fr,ji,qi,Gi,pr,mt,Zi,mr,Ji],i=Xe(),s=T(i,mr);W(s,r,s),W(s,n.domain,s);const o=Xe(),a=Xe(),l=Xe();W(i,n.domain,o),W(i,n.scheme,a),W(i,n.slashscheme,l),W(o,r,s),W(o,n.domain,o);const c=T(o,zt);T(s,zt,c),T(a,zt,c),T(l,zt,c);const d=T(s,pt);W(d,r,s),W(d,n.domain,s);const u=Xe();W(c,n.domain,u),W(u,n.domain,u);const h=T(u,pt);W(h,n.domain,u);const f=Xe(bc);W(h,n.tld,f),W(h,n.utld,f),T(c,Mr,f);const p=T(u,Qe);T(p,Qe,p),W(p,n.domain,u),W(f,n.domain,u),T(f,pt,h),T(f,Qe,p);const m=T(f,Ut);W(m,n.numeric,bc);const g=T(o,Qe),y=T(o,pt);T(g,Qe,g),W(g,n.domain,o),W(y,r,s),W(y,n.domain,o);const k=Xe(ei);W(y,n.tld,k),W(y,n.utld,k),W(k,n.domain,o),W(k,r,s),T(k,pt,y),T(k,Qe,g),T(k,zt,c);const v=T(k,Ut),x=Xe(ei);W(v,n.numeric,x);const w=Xe(ei),M=Xe();W(w,e,w),W(w,t,M),W(M,e,w),W(M,t,M),T(k,mt,w),T(x,mt,w);const A=T(a,Ut),L=T(l,Ut),F=T(L,mt),se=T(F,mt);W(a,n.domain,o),T(a,pt,y),T(a,Qe,g),W(l,n.domain,o),T(l,pt,y),T(l,Qe,g),W(A,n.domain,w),T(A,mt,w),T(A,pr,w),W(se,n.domain,w),W(se,e,w),T(se,mt,w);const Ie=[[ur,hr],[wi,Ti],[Ci,Mi],[Ai,Ni],[_i,Oi],[Ii,Li],[Ri,Di],[$i,Pi]];for(let Ce=0;Ce<Ie.length;Ce++){const[ze,Z]=Ie[Ce],J=T(w,ze);T(M,ze,J),T(J,Z,w);const me=Xe(ei);W(J,e,me);const st=Xe();W(J,t),W(me,e,me),W(me,t,st),W(st,e,me),W(st,t,st),T(me,Z,w),T(st,Z,w)}return T(i,Mr,k),T(i,ka,X0),{start:i,tokens:ch}}function ek(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Qs(yc,e,o)),o=[]),i-=h,d-=h;const f=u.t,p=t.slice(i-d,i);s.push(Qs(f,e,p))}}return o.length>0&&s.push(Qs(yc,e,o)),s}function Qs(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const tk=typeof console<"u"&&console&&console.warn||(()=>{}),nk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function rk(){return Ke.groups={},oe.scanner=null,oe.parser=null,oe.tokenQueue=[],oe.pluginQueue=[],oe.customSchemes=[],oe.initialized=!1,oe}function kc(n,e=!1){if(oe.initialized&&tk(`linkifyjs: already initialized - will not register custom scheme "${n}" ${nk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat`);oe.customSchemes.push([n,e])}function ik(){oe.scanner=Z0(oe.customSchemes);for(let n=0;n<oe.tokenQueue.length;n++)oe.tokenQueue[n][1]({scanner:oe.scanner});oe.parser=Q0(oe.scanner.tokens);for(let n=0;n<oe.pluginQueue.length;n++)oe.pluginQueue[n][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function Ta(n){return oe.initialized||ik(),ek(oe.parser.start,n,dh(oe.scanner.start,n))}Ta.scan=dh;function hh(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new wa(t),i=Ta(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Ca="[\0-   ᠎ -\u2029  ]",sk=new RegExp(Ca),ok=new RegExp(`${Ca}$`),ak=new RegExp(Ca,"g");function lk(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function ck(n){return new ne({key:new ce("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=vu(t.doc,[...e]);if(Au(a).forEach(({newRange:c})=>{const d=Pb(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!ok.test(f))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const f=h.split(sk).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=u.pos+h.lastIndexOf(p);if(!p)return!1;const g=Ta(p).map(y=>y.toObject(n.defaultProtocol));if(!lk(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{ca(y.from,y.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function dk(n){return new ne({key:new ce("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;o=u.find(h=>h.nodeName==="A")}if(!o)return!1;const a=Mu(e.state,n.type.name),l=(i=o?.href)!=null?i:a.href,c=(s=o?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&l?(window.open(l,c),!0):!1}}})}function uk(n){return new ne({key:new ce("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=hh(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.href)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function ln(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(ak,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fh=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){kc(n);return}kc(n.scheme,n.optionalSlashes)})},onDestroy(){rk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!ln(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!ln(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!ln(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",le(this.options.HTMLAttributes,n),0]:["a",le(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Tn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=hh(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!ln(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(ck({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ln(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(dk({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(uk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),hk=fh,fk=Oe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",le(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),pk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,mk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,gk=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",le(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[qn({find:pk,type:this.type})]},addPasteRules(){return[Tn({find:mk,type:this.type})]}}),bk=Oe.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),yk=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",le(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function kk(n={}){return new ne({view(e){return new Ek(e,n)}})}class Ek{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 s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=u?p.bottom:p.top;u&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"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,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=fd(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends j{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ue.valid(r)?new ue(r):j.near(r)}content(){return O.empty}eq(e){return e instanceof ue&&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 ue(e.resolve(t.pos))}getBookmark(){return new Ma(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!vk(e)||!xk(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&&ue.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(ue.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(ue.valid(a))return a}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;j.jsonID("gapcursor",ue);class Ma{constructor(e){this.pos=e}map(e){return new Ma(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):j.near(t)}}function ph(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function vk(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||ph(i.type))return!0;if(i.inlineContent)return!1}}return!0}function xk(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||ph(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Sk(){return new ne({props:{decorations:Mk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:Tk,handleKeyDown:wk,handleDOMEvents:{beforeinput:Ck}}})}const wk=fu({ArrowLeft:ti("horiz",-1),ArrowRight:ti("horiz",1),ArrowUp:ti("vert",-1),ArrowDown:ti("vert",1)});function ti(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof H){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ue.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new ue(c))),!0):!1}}function Tk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}function Ck(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))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=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new O(i,0,0));return s.setSelection(H.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Mk(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[$e.widget(n.selection.head,e,{key:"gapcursor"})])}var Yi=200,Te=function(){};Te.prototype.append=function(e){return e.length?(e=Te.from(e),!this.length&&e||e.length<Yi&&this.leafAppend(e)||this.length<Yi&&e.leafPrepend(this)||this.appendInner(e)):this};Te.prototype.prepend=function(e){return e.length?Te.from(e).append(this):this};Te.prototype.appendInner=function(e){return new Ak(this,e)};Te.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Te.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Te.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Te.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)};Te.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Te.from=function(e){return e instanceof Te?e:e&&e.length?new mh(e):Te.empty};var mh=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Yi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Yi)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}(Te);Te.empty=new mh([]);var Ak=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,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Te);const Nk=500;class lt{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new gt(u.map));let f=u.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new gt(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(s)):u.selection,l=new lt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new gt(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-r.depth;return c>Ok&&(a=_k(a,c),o-=c),new lt(a.append(s),o)}remapping(e,t){let r=new Er;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new gt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(l+1,f));g&&a++,r.push(new gt(p,m,g))}else r.push(new gt(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new gt(s.maps[h]));let d=this.items.slice(0,i).append(c).append(r),u=new lt(d,a);return u.emptyItemCount()>Nk&&(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=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new gt(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else o.map&&r--},this.items.length,0),new lt(Te.from(i.reverse()),s)}}lt.empty=new lt(Te.empty,0);function _k(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class gt{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 gt(t.getMap().invert(),t,this.selection)}}}class Ht{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Ok=20;function Ik(n,e,t,r){let i=t.getMeta(En),s;if(i)return i.historyState;t.getMeta(Dk)&&(n=new Ht(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(En))return o.getMeta(En).redo?new Ht(n.done.addTransform(t,void 0,r,li(e)),n.undone,Ec(t.mapping.maps),n.prevTime,n.prevComposition):new Ht(n.done,n.undone.addTransform(t,void 0,r,li(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Lk(t,n.prevRanges)),c=o?eo(n.prevRanges,t.mapping):Ec(t.mapping.maps);return new Ht(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,li(e)),lt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Ht(n.done.rebased(t,s),n.undone.rebased(t,s),eo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ht(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),eo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Lk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Ec(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function eo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function Rk(n,e,t){let r=li(e),i=En.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Ht(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(En,{redo:t,historyState:l})}let to=!1,vc=null;function li(n){let e=n.plugins;if(vc!=e){to=!1,vc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){to=!0;break}}return to}const En=new ce("history"),Dk=new ce("closeHistory");function $k(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ne({key:En,state:{init(){return new Ht(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return Ik(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?bh:r=="historyRedo"?yh:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function gh(n,e){return(t,r)=>{let i=En.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Rk(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const bh=gh(!1,!0),yh=gh(!0,!0);ee.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ne({key:new ce("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var Pk=ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[kk(this.options)]}});ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ne({key:new ce("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push($e.node(c,c+l.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var Bk=ee.create({name:"gapCursor",addProseMirrorPlugins(){return[Sk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Q($(n,"allowGapCursor",t)))!=null?e:null}}});ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ne({key:new ce("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&ps(o);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=$e.node(a,a+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ae.create(n,i)}}})]}});ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ne({key:new ce("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Nu(t.selection)||n.view.dragging?null:ae.create(t.doc,[$e.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function xc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var zk=ee.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ce(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new ne({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),u=a.content.size,h=c.nodes[t];if(d)return l.insert(u,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!xc({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!xc({node:o,types:r})}}})]}}),Hk=ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>bh(n,e),redo:()=>({state:n,dispatch:e})=>yh(n,e)}},addProseMirrorPlugins(){return[$k(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Fk=ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(L0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(A0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(pa.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Ku.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Wu.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Gu.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Pk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Bk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(R0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(D0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Hk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push($0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(F0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(ma.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(eh.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(fh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(ba.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(fk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(gk.configure(this.options.strike)),this.options.text!==!1&&i.push(bk.configure(this.options.text)),this.options.underline!==!1&&i.push(yk.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(zk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Uk=Fk;const ci=globalThis,Aa=ci.ShadowRoot&&(ci.ShadyCSS===void 0||ci.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Na=Symbol(),Sc=new WeakMap;let kh=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Na)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Aa&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=Sc.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Sc.set(t,e))}return e}toString(){return this.cssText}};const Eh=n=>new kh(typeof n=="string"?n:n+"",void 0,Na),Et=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new kh(t,n,Na)},Vk=(n,e)=>{if(Aa)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=ci.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},wc=Aa?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return Eh(t)})(n):n;const{is:Kk,defineProperty:Wk,getOwnPropertyDescriptor:jk,getOwnPropertyNames:qk,getOwnPropertySymbols:Gk,getPrototypeOf:Jk}=Object,ys=globalThis,Tc=ys.trustedTypes,Zk=Tc?Tc.emptyScript:"",Yk=ys.reactiveElementPolyfillSupport,gr=(n,e)=>n,Xi={toAttribute(n,e){switch(e){case Boolean:n=n?Zk:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_a=(n,e)=>!Kk(n,e),Cc={attribute:!0,type:String,converter:Xi,reflect:!1,useDefault:!1,hasChanged:_a};Symbol.metadata??=Symbol("metadata"),ys.litPropertyMetadata??=new WeakMap;let Pn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Cc){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Wk(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=jk(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Cc}static _$Ei(){if(this.hasOwnProperty(gr("elementProperties")))return;const e=Jk(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(gr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(gr("properties"))){const t=this.properties,r=[...qk(t),...Gk(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(wc(i))}else e!==void 0&&t.push(wc(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Vk(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const s=(r.converter?.toAttribute!==void 0?r.converter:Xi).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=r.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Xi;this._$Em=i;const a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const i=this.constructor,s=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??_a)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[i,s]of r){const{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Pn.elementStyles=[],Pn.shadowRootOptions={mode:"open"},Pn[gr("elementProperties")]=new Map,Pn[gr("finalized")]=new Map,Yk?.({ReactiveElement:Pn}),(ys.reactiveElementVersions??=[]).push("2.1.1");const Oa=globalThis,Qi=Oa.trustedTypes,Mc=Qi?Qi.createPolicy("lit-html",{createHTML:n=>n}):void 0,vh="$lit$",Vt=`lit$${Math.random().toFixed(9).slice(2)}$`,xh="?"+Vt,Xk=`<${xh}>`,Cn=document,Nr=()=>Cn.createComment(""),_r=n=>n===null||typeof n!="object"&&typeof n!="function",Ia=Array.isArray,Qk=n=>Ia(n)||typeof n?.[Symbol.iterator]=="function",no=`[ \t\n\f\r]`,tr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ac=/-->/g,Nc=/>/g,cn=RegExp(`>|${no}(?:([^\\s"'>=/]+)(${no}*=${no}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),_c=/'/g,Oc=/"/g,Sh=/^(?:script|style|textarea|title)$/i,eE=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),z=eE(1),Mn=Symbol.for("lit-noChange"),he=Symbol.for("lit-nothing"),Ic=new WeakMap,mn=Cn.createTreeWalker(Cn,129);function wh(n,e){if(!Ia(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Mc!==void 0?Mc.createHTML(e):e}const tE=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=tr;for(let a=0;a<t;a++){const l=n[a];let c,d,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,d=o.exec(l),d!==null);)h=o.lastIndex,o===tr?d[1]==="!--"?o=Ac:d[1]!==void 0?o=Nc:d[2]!==void 0?(Sh.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=cn):d[3]!==void 0&&(o=cn):o===cn?d[0]===">"?(o=i??tr,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?cn:d[3]==='"'?Oc:_c):o===Oc||o===_c?o=cn:o===Ac||o===Nc?o=tr:(o=cn,i=void 0);const f=o===cn&&n[a+1].startsWith("/>")?" ":"";s+=o===tr?l+Xk:u>=0?(r.push(c),l.slice(0,u)+vh+l.slice(u)+Vt+f):l+Vt+(u===-2?a:f)}return[wh(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class Or{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[c,d]=tE(e,t);if(this.el=Or.createElement(c,r),mn.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=mn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(vh)){const h=d[o++],f=i.getAttribute(u).split(Vt),p=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:p[2],strings:f,ctor:p[1]==="."?rE:p[1]==="?"?iE:p[1]==="@"?sE:ks}),i.removeAttribute(u)}else u.startsWith(Vt)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Sh.test(i.tagName)){const u=i.textContent.split(Vt),h=u.length-1;if(h>0){i.textContent=Qi?Qi.emptyScript:"";for(let f=0;f<h;f++)i.append(u[f],Nr()),mn.nextNode(),l.push({type:2,index:++s});i.append(u[h],Nr())}}}else if(i.nodeType===8)if(i.data===xh)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Vt,u+1))!==-1;)l.push({type:7,index:s}),u+=Vt.length-1}s++}}static createElement(e,t){const r=Cn.createElement("template");return r.innerHTML=e,r}}function Jn(n,e,t=n,r){if(e===Mn)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl;const s=_r(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Jn(n,i._$AS(n,e.values),i,r)),e}class nE{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Cn).importNode(t,!0);mn.currentNode=i;let s=mn.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new $r(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new oE(s,this,e)),this._$AV.push(c),l=r[++a]}o!==l?.index&&(s=mn.nextNode(),o++)}return mn.currentNode=Cn,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class $r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=he,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Jn(this,e,t),_r(e)?e===he||e==null||e===""?(this._$AH!==he&&this._$AR(),this._$AH=he):e!==this._$AH&&e!==Mn&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Qk(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==he&&_r(this._$AH)?this._$AA.nextSibling.data=e:this.T(Cn.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Or.createElement(wh(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new nE(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Ic.get(e.strings);return t===void 0&&Ic.set(e.strings,t=new Or(e)),t}k(e){Ia(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new $r(this.O(Nr()),this.O(Nr()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class ks{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=he,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=he}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=Jn(this,e,t,0),o=!_r(e)||e!==this._$AH&&e!==Mn,o&&(this._$AH=e);else{const a=e;let l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Jn(this,a[r+l],t,l),c===Mn&&(c=this._$AH[l]),o||=!_r(c)||c!==this._$AH[l],c===he?e=he:e!==he&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===he?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class rE extends ks{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===he?void 0:e}}class iE extends ks{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==he)}}class sE extends ks{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Jn(this,e,t,0)??he)===Mn)return;const r=this._$AH,i=e===he&&r!==he||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==he&&(r===he||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class oE{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Jn(this,e)}}const aE=Oa.litHtmlPolyfillSupport;aE?.(Or,$r),(Oa.litHtmlVersions??=[]).push("3.3.1");const Ze=(n,e,t)=>{const r=t?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const s=t?.renderBefore??null;r._$litPart$=i=new $r(e.insertBefore(Nr(),s),s,void 0,t??{})}return i._$AI(n),i};const La=globalThis;let Yt=class extends Pn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ze(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Mn}};Yt._$litElement$=!0,Yt.finalized=!0,La.litElementHydrateSupport?.({LitElement:Yt});const lE=La.litElementPolyfillSupport;lE?.({LitElement:Yt});(La.litElementVersions??=[]).push("4.2.1");const Es=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const cE={attribute:!0,type:String,converter:Xi,reflect:!1,hasChanged:_a},dE=(n=cE,e,t)=>{const{kind:r,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),s.set(t.name,n),r==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,n)},init(a){return a!==void 0&&this.C(o,void 0,n,a),a}}}if(r==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,n)}}throw Error("Unsupported decorator location: "+r)};function ve(n){return(e,t)=>typeof t=="object"?dE(n,e,t):((r,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,r),o?Object.getOwnPropertyDescriptor(i,s):void 0})(n,e,t)}function vt(n){return ve({...n,state:!0,attribute:!1})}const uE=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function Pr(n,e){return(t,r,i)=>{const s=o=>o.renderRoot?.querySelector(n)??null;return uE(t,r,{get(){return s(this)}})}}const hE=n=>n.strings===void 0;const Th={CHILD:2},Ch=n=>(...e)=>({_$litDirective$:n,values:e});class Mh{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const br=(n,e)=>{const t=n._$AN;if(t===void 0)return!1;for(const r of t)r._$AO?.(e,!1),br(r,e);return!0},es=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},Ah=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),mE(e)}};function fE(n){this._$AN!==void 0?(es(this),this._$AM=n,Ah(this)):this._$AM=n}function pE(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)br(r[s],!1),es(r[s]);else r!=null&&(br(r,!1),es(r));else br(this,n)}const mE=n=>{n.type==Th.CHILD&&(n._$AP??=pE,n._$AQ??=fE)};class gE extends Mh{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Ah(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(br(this,e),es(this))}setValue(e){if(hE(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const ro=new WeakMap,bE=Ch(class extends gE{render(n){return he}update(n,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=n.options?.host,this.rt(this.ct=n.element)),he}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=ro.get(e);t===void 0&&(t=new WeakMap,ro.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?ro.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function yE(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=n.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],y={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],w=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...k,...v,"set","shopt",...x,...w]},contains:[f,n.SHEBANG(),p,u,s,o,y,a,l,c,d,t]}}function kE(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:y.concat([{begin:/\(/,end:/\)/,keywords:g,contains:y.concat(["self"]),relevance:0}]),relevance:0},v={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[n.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(k,v,y,[u,{begin:n.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function EE(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],x={type:m,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},w={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},M=[w,u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:M.concat([{begin:/\(/,end:/\)/,keywords:x,contains:M.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:f,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,L,w,M,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:x,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function vE(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=n.inherit(n.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=n.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=n.inherit(h,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,f]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},g=n.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});h.contains=[m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.C_BLOCK_COMMENT_MODE],f.contains=[g,p,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[c,m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}]}),n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+v+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,l,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},x]}}const xE=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),SE=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],wE=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],TE=[...SE,...wE],CE=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ME=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),AE=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),NE=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _E(n){const e=n.regex,t=xE(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+ME.join("|")+")"},{begin:":(:)?("+AE.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+NE.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:CE.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+TE.join("|")+")\\b"}]}}var Bn="[0-9](_*[0-9])*",ni=`\\.(${Bn})`,ri="[0-9a-fA-F](_*[0-9a-fA-F])*",Lc={className:"number",variants:[{begin:`(\\b(${Bn})((${ni})|\\.)?|(${ni}))[eE][+-]?(${Bn})[fFdD]?\\b`},{begin:`\\b(${Bn})((${ni})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ni})[fFdD]?\\b`},{begin:`\\b(${Bn})[fFdD]\\b`},{begin:`\\b0[xX]((${ri})\\.?|(${ri})?\\.(${ri}))[pP][+-]?(${Bn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ri})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Nh(n,e,t){return t===-1?"":n.replace(e,r=>Nh(n,e,t-1))}function OE(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+Nh("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[d,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,Lc,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Lc,c]}}const Rc="[A-Za-z$_][0-9A-Za-z$_]*",IE=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],LE=["true","false","null","undefined","NaN","Infinity"],_h=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Oh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ih=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],RE=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],DE=[].concat(Ih,_h,Oh);function $E(n){const e=n.regex,t=(Y,{after:He})=>{const qe="</"+Y[0].slice(1);return Y.input.indexOf(qe,He)!==-1},r=Rc,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const qe=Y[0].length+Y.index,ot=Y.input[qe];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:qe})||He.ignoreMatch());let xt;const sn=Y.input.substring(qe);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:Rc,keyword:IE,literal:LE,built_in:DE,"variable.language":RE},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},v=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const x=[].concat(k,h.contains),w=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[..._h,...Oh]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},se={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},Ie={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ce(Y){return e.concat("(?!",Y.join("|"),")")}const ze={match:e.concat(/\b/,Ce([...Ih,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},me="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(me)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:me,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},se,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},ze,Ie,A,J,{match:/\$[(.]/}]}}function PE(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function BE(n){const e=n.regex,t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=n.inherit(c,{contains:[]}),h=n.inherit(d,{contains:[]});c.contains.push(h),d.contains.push(u);let f=[t,l];return[c,d,u,h].forEach(y=>{y.contains=y.contains.concat(f)}),f=f.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},t,s,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function zE(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),s=e.concat(/[A-Z]+/,t),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=n.inherit(n.APOS_STRING_MODE,{illegal:null}),d=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Z,J)=>{J.data._beginMatch=Z[1]||Z[2]},"on:end":(Z,J)=>{J.data._beginMatch!==Z[1]&&J.ignoreMatch()}},h=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ \t\n]`,p={scope:"string",variants:[d,c,u,h]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],k=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:y,literal:(Z=>{const J=[];return Z.forEach(me=>{J.push(me),me.toLowerCase()===me?J.push(me.toUpperCase()):J.push(me.toLowerCase())}),J})(g),built_in:k},w=Z=>Z.map(J=>J.replace(/\|\d+$/,"")),M={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",w(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(r,"\\b(?!\\()"),L={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},F={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},se={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[F,o,L,n.C_BLOCK_COMMENT_MODE,p,m,M]},Ie={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",w(y).join("\\b|"),"|",w(k).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[se]};se.contains.push(Ie);const Ce=[F,L,n.C_BLOCK_COMMENT_MODE,p,m,M],ze={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...Ce]},...Ce,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:x,contains:[ze,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,Ie,L,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},M,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",ze,o,L,n.C_BLOCK_COMMENT_MODE,p,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},p,m]}}function HE(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function FE(n){const e=n.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[n.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,d,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,n.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,y,u]}]}}function UE(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},u={className:"string",contains:[n.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},M=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:t}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=M,m.contains=M;const se=[{begin:/^\s*=>/,starts:{end:"$",contains:M}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:M}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(se).concat(c).concat(M)}}function VE(n){const e=n.regex,t=/(r#)?/,r=e.concat(t,n.UNDERSCORE_IDENT_RE),i=e.concat(t,n.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:n.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.COMMENT("/\\*","\\*/",{contains:["self"]}),n.inherit(n.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:n.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},s]}}function KE(n){const e=n.regex,t=n.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...l].filter(w=>!d.includes(w)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function k(w){return e.concat(/\b/,e.either(...w.map(M=>M.replace(/\s+/,"\\s+"))),/\b/)}const v={scope:"keyword",match:k(h),relevance:0};function x(w,{exceptions:M,when:A}={}){const L=A;return M=M||[],w.map(F=>F.match(/\|\d+$/)||M.includes(F)?F:L(F)?`${F}|0`:F)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(p,{when:w=>w.length<3}),literal:s,type:a,built_in:u},contains:[{scope:"type",match:k(o)},v,y,m,r,i,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,g]}}const ts="[A-Za-z$_][0-9A-Za-z$_]*",Lh=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Rh=["true","false","null","undefined","NaN","Infinity"],Dh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],$h=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ph=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Bh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zh=[].concat(Ph,Dh,$h);function WE(n){const e=n.regex,t=(Y,{after:He})=>{const qe="</"+Y[0].slice(1);return Y.input.indexOf(qe,He)!==-1},r=ts,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const qe=Y[0].length+Y.index,ot=Y.input[qe];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:qe})||He.ignoreMatch());let xt;const sn=Y.input.substring(qe);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:ts,keyword:Lh,literal:Rh,built_in:zh,"variable.language":Bh},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},v=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const x=[].concat(k,h.contains),w=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Dh,...$h]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},se={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},Ie={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ce(Y){return e.concat("(?!",Y.join("|"),")")}const ze={match:e.concat(/\b/,Ce([...Ph,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},me="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(me)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:me,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:w}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},se,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},ze,Ie,A,J,{match:/\$[(.]/}]}}function jE(n){const e=n.regex,t=WE(n),r=ts,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[t.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ts,keyword:Lh.concat(l),literal:Rh,built_in:zh.concat(i),"variable.language":Bh},d={className:"meta",begin:"@"+r},u=(m,g,y)=>{const k=m.contains.findIndex(v=>v.label===g);if(k===-1)throw new Error("can not find mode to replace");m.contains.splice(k,1,y)};Object.assign(t.keywords,c),t.exports.PARAMS_CONTAINS.push(d);const h=t.contains.find(m=>m.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,h,f]),t.contains=t.contains.concat([d,s,o,f]),u(t,"shebang",n.SHEBANG()),u(t,"use_strict",a);const p=t.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}function qE(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),l=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(t,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function GE(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[n.BACKSLASH_ESCAPE,i]},a=n.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:n.C_NUMBER_RE+"\\b",relevance:0},p,m,s,o],y=[...g];return y.pop(),y.push(a),f.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const Dc={},JE="hljs-";function ZE(n){const e=ju.newInstance();return{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,d){const u=d||Dc,h=typeof u.prefix=="string"?u.prefix:JE;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:YE,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,m=p.data;return m.language=f.language,m.relevance=f.relevance,p}function r(l,c){const u=(c||Dc).subset||i();let h=-1,f=0,p;for(;++h<u.length;){const m=u[h];if(!e.getLanguage(m))continue;const g=t(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>f&&(f=g.data.relevance,p=g)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class YE{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Hh=ZE();Hh.register({bash:yE,c:kE,cpp:EE,csharp:vE,css:_E,java:OE,javascript:$E,json:PE,markdown:BE,plaintext:HE,php:zE,python:FE,ruby:UE,rust:VE,sql:KE,typescript:jE,xml:qE,yaml:GE});const XE=[{key:"bash",label:"Bash"},{key:"c",label:"C"},{key:"cpp",label:"C++"},{key:"csharp",label:"C#"},{key:"css",label:"CSS"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"json",label:"JSON"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"plaintext",label:"Plain Text"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"rust",label:"Rust"},{key:"sql",label:"SQL"},{key:"typescript",label:"TypeScript"},{key:"xml",label:"XML"},{key:"yaml",label:"YAML"}];class QE{constructor(e,t,r,i,s){this.node=e,this.editor=t,this.getPos=r,this.dom=document.createElement("div"),this.dom.classList.add("code-block-wrapper"),this.dom.style.position="relative";const o=document.createElement("pre");e.attrs.language&&o.setAttribute("data-language",e.attrs.language),this.contentDOM=document.createElement("code"),e.attrs.language&&(this.contentDOM.className=`language-${e.attrs.language}`),o.appendChild(this.contentDOM),this.dom.appendChild(o),this.selectContainer=document.createElement("div"),this.selectContainer.classList.add("code-block-selector"),this.dom.appendChild(this.selectContainer),this.renderSelector(),this.setupSelectionTracking()}setupSelectionTracking(){this.selectionUpdateHandler=()=>{const e=this.getPos();if(e===void 0)return;const{from:t}=this.editor.state.selection,r=e,i=e+this.node.nodeSize;t>=r&&t<i?this.dom.classList.add("has-focus"):this.dom.classList.remove("has-focus")},this.editor.on("selectionUpdate",this.selectionUpdateHandler),this.editor.on("transaction",this.selectionUpdateHandler),this.selectionUpdateHandler()}renderSelector(){const e=this.node.attrs.language||"plaintext",t=z`
62
2
  <select
63
3
  @change=${r=>this.handleLanguageChange(r)}
64
4
  style="
@@ -70,13 +10,13 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
70
10
  cursor: pointer;
71
11
  "
72
12
  >
73
- ${Zv.map(r=>z`<option value=${r.key} ?selected=${r.key===e}>
13
+ ${XE.map(r=>z`<option value=${r.key} ?selected=${r.key===e}>
74
14
  ${r.label}
75
15
  </option>`)}
76
16
  </select>
77
- `;Ze(t,this.selectContainer)}handleLanguageChange(e){const r=e.target.value,i=this.getPos();i!==void 0&&this.editor.chain().focus().command(({tr:s})=>(s.setNodeMarkup(i,void 0,{...this.node.attrs,language:r}),!0)).run()}update(e){if(e.type.name!=="codeBlock")return!1;this.node=e;const t=this.dom.querySelector("pre");return t&&(e.attrs.language?t.setAttribute("data-language",e.attrs.language):t.removeAttribute("data-language")),this.contentDOM&&(this.contentDOM.className="",e.attrs.language&&this.contentDOM.classList.add(`language-${e.attrs.language}`)),this.renderSelector(),!0}destroy(){this.selectionUpdateHandler&&(this.editor.off("selectionUpdate",this.selectionUpdateHandler),this.editor.off("transaction",this.selectionUpdateHandler)),this.dom.remove()}}const Xv=`pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}`,Qv=Xv.replace(/background:\s*#ffffff/g,"background: transparent").replace(/padding:\s*1em/g,"padding: 0").replace(/padding:\s*3px 5px/g,"padding: 0"),eE=vt`
78
- ${yh(Qv)}
79
- `,tE=ee.create({name:"focusClickHandler",addProseMirrorPlugins(){let n;return[new ne({key:new ce("focusClickHandler"),props:{handleDOMEvents:{focus:()=>(n=Date.now(),!1),blur:()=>(n=void 0,!1)},handleClick(e,t,r){if(n===void 0||Date.now()>n+100)return!1;const s=r.target.tagName.toLowerCase();if(["button","select","option","input","textarea"].includes(s))return!1;const a=e.state.tr.setSelection(H.create(e.state.doc,t));return e.dispatch(a),e.focus(),!0}}})]}});async function zh({service:n,initialValues:e,mode:t,i18n:r}){let i=e.html??"";const s=document.createElement("div");function o(){const u=z`
17
+ `;Ze(t,this.selectContainer)}handleLanguageChange(e){const r=e.target.value,i=this.getPos();i!==void 0&&this.editor.chain().focus().command(({tr:s})=>(s.setNodeMarkup(i,void 0,{...this.node.attrs,language:r}),!0)).run()}update(e){if(e.type.name!=="codeBlock")return!1;this.node=e;const t=this.dom.querySelector("pre");return t&&(e.attrs.language?t.setAttribute("data-language",e.attrs.language):t.removeAttribute("data-language")),this.contentDOM&&(this.contentDOM.className="",e.attrs.language&&this.contentDOM.classList.add(`language-${e.attrs.language}`)),this.renderSelector(),!0}destroy(){this.selectionUpdateHandler&&(this.editor.off("selectionUpdate",this.selectionUpdateHandler),this.editor.off("transaction",this.selectionUpdateHandler)),this.dom.remove()}}const ev="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}",tv=ev.replace(/background:\s*#ffffff/g,"background: transparent").replace(/padding:\s*1em/g,"padding: 0").replace(/padding:\s*3px 5px/g,"padding: 0"),nv=Et`
18
+ ${Eh(tv)}
19
+ `,rv=ee.create({name:"focusClickHandler",addProseMirrorPlugins(){let n;return[new ne({key:new ce("focusClickHandler"),props:{handleDOMEvents:{focus:()=>(n=Date.now(),!1),blur:()=>(n=void 0,!1)},handleClick(e,t,r){if(n===void 0||Date.now()>n+100)return!1;const s=r.target.tagName.toLowerCase();if(["button","select","option","input","textarea"].includes(s))return!1;const a=e.state.tr.setSelection(H.create(e.state.doc,t));return e.dispatch(a),e.focus(),!0}}})]}});async function Fh({service:n,initialValues:e,mode:t,i18n:r}){let i=e.html??"";const s=document.createElement("div");function o(){const u=z`
80
20
  <label class="TpField">
81
21
  <textarea
82
22
  rows="8"
@@ -124,7 +64,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
124
64
  >
125
65
  ${r.t("validate")}
126
66
  </button>
127
- `;Ze(c,l);const d=n.createModalDialog({header:r.t("htmlSnippetNode.htmlSnippet"),content:s,footer:l});return await d.open()}const nE=Oe.create({name:"htmlSnippet",group:"block",atom:!0,draggable:!0,selectable:!1,addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{html:{default:""}}},parseHTML(){return[{tag:'div[data-pa-node="htmlSnippet"]',getAttrs:n=>({html:n.dataset.html||""})}]},renderHTML({node:n}){return["div",{"data-pa-node":"htmlSnippet","data-html":n.attrs.html,role:"button",tabindex:"0",class:"HtmlSnippet"},"<HTML>"]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.i18n;if(!r)throw new Error("HtmlSnippetNode: service not provided in options");if(!i)throw new Error("HtmlSnippetNode: i18n not provided in options");const s=document.createElement("div");s.className="HtmlSnippet",s.setAttribute("data-pa-node","htmlSnippet"),s.setAttribute("data-html",n.attrs.html),s.textContent="<HTML>",s.setAttribute("contenteditable","false"),s.setAttribute("role","button"),s.setAttribute("tabindex","0");async function o(){const l=t();if(typeof l!="number")return;const c=await zh({service:r,initialValues:n.attrs,mode:"update",i18n:i});if(!c){e.commands.setTextSelection(l+n.nodeSize),e.commands.focus();return}if(c.action==="remove")e.commands.deleteRange({from:l,to:l+n.nodeSize});else if(c.action==="update"&&c.values){const{view:d}=e;d.dispatch(d.state.tr.setNodeMarkup(l,void 0,{...n.attrs,...c.values})),e.commands.setTextSelection(l+n.nodeSize),e.commands.focus()}}const a=()=>{o().catch(l=>{r.logger.error("[HtmlSnippetNode] Error handling click:",l)})};return s.addEventListener("click",a),{dom:s,contentDOM:void 0,update:()=>!1,destroy:()=>{s.removeEventListener("click",a)}}}},addCommands(){return{insertHtmlSnippet:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}}),rE=vt`
67
+ `;Ze(c,l);const d=n.createModalDialog({header:r.t("htmlSnippetNode.htmlSnippet"),content:s,footer:l});return await d.open()}const iv=Oe.create({name:"htmlSnippet",group:"block",atom:!0,draggable:!0,selectable:!1,addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{html:{default:""}}},parseHTML(){return[{tag:'div[data-pa-node="htmlSnippet"]',getAttrs:n=>({html:n.dataset.html||""})}]},renderHTML({node:n}){return["div",{"data-pa-node":"htmlSnippet","data-html":n.attrs.html,role:"button",tabindex:"0",class:"HtmlSnippet"},"<HTML>"]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.i18n;if(!r)throw new Error("HtmlSnippetNode: service not provided in options");if(!i)throw new Error("HtmlSnippetNode: i18n not provided in options");const s=document.createElement("div");s.className="HtmlSnippet",s.setAttribute("data-pa-node","htmlSnippet"),s.setAttribute("data-html",n.attrs.html),s.textContent="<HTML>",s.setAttribute("contenteditable","false"),s.setAttribute("role","button"),s.setAttribute("tabindex","0");async function o(){const l=t();if(typeof l!="number")return;const c=await Fh({service:r,initialValues:n.attrs,mode:"update",i18n:i});if(!c){e.commands.setTextSelection(l+n.nodeSize),e.commands.focus();return}if(c.action==="remove")e.commands.deleteRange({from:l,to:l+n.nodeSize});else if(c.action==="update"&&c.values){const{view:d}=e;d.dispatch(d.state.tr.setNodeMarkup(l,void 0,{...n.attrs,...c.values})),e.commands.setTextSelection(l+n.nodeSize),e.commands.focus()}}const a=()=>{o().catch(l=>{r.logger.error("[HtmlSnippetNode] Error handling click:",l)})};return s.addEventListener("click",a),{dom:s,contentDOM:void 0,update:()=>!1,destroy:()=>{s.removeEventListener("click",a)}}}},addCommands(){return{insertHtmlSnippet:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}}),sv=Et`
128
68
  .HtmlSnippet {
129
69
  border: 1px solid #ccc;
130
70
  border-radius: 3px;
@@ -148,7 +88,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
148
88
  padding: 8px 12px;
149
89
  width: fit-content;
150
90
  }
151
- `,iE=Oe.create({name:"internalLink",group:"inline",inline:!0,atom:!0,addOptions(){return{service:void 0,i18n:void 0,internalLinkPluginHook:void 0}},addAttributes(){return{documentId:{default:"",parseHTML:n=>n.dataset.documentId||"",renderHTML:n=>({"data-document-id":n.documentId})}}},parseHTML(){return[{tag:"span[data-internal-link]"}]},renderHTML({HTMLAttributes:n}){return["span",{...n,class:"InternalLink","data-internal-link":"true"}]},addCommands(){return{insertInternalLink:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{documentId:n}})}},addProseMirrorPlugins(){const n=this.options.service,e=this.options.i18n,t=this.options.internalLinkPluginHook;if(!n||!e||!t)return[];function r(s,o,a){const{tr:l}=s.state,c=o+a;l.setSelection(H.create(l.doc,c)),s.dispatch(l),s.focus()}const i=async(s,o,a)=>{if(!a.target.classList.contains("InternalLink"))return!1;const{state:c}=s,d=c.doc.resolve(o),u=d.parent.type.name==="internalLink"?d.parent:d.nodeAfter;if(!u||u.type.name!=="internalLink")return!1;const h=u.attrs.documentId,f=await t.openDialog(h||"",{getLanguage:()=>n.language});let p=o;if(d.parent.type.name==="internalLink"&&(p=d.before()),!f)return r(s,p,u.nodeSize),!0;const{tr:m}=c;return f.documentId?(await sE(s,p,u.nodeSize,f.documentId,t,n),r(s,p,u.nodeSize),!0):(m.delete(p,p+u.nodeSize),s.dispatch(m),!0)};return[new ne({key:new ce("internalLinkClickHandler"),props:{handleClick(s,o,a){return i(s,o,a),!1}}})]},onBeforeCreate(){const n=this.options.internalLinkPluginHook,e=this.options.service;if(!n||!e)return;const t=async r=>{const i=this.editor.view.dom.querySelectorAll("span[data-internal-link]");for(const s of i){const o=s.dataset.documentId;if(o&&!(r&&s.textContent))try{const a=await n.getDocumentTitle(o);a&&(s.textContent=a)}catch(a){e.logger.error("[InternalLinkNode] Error fetching title:",a)}}};this.editor.on("create",()=>{t(!1)}),this.editor.on("update",()=>{t(!0)})}});async function sE(n,e,t,r,i,s){try{if(!await i.getDocumentTitle(r))return;const{tr:a,schema:l}=n.state;a.delete(e,e+t),a.insert(e,l.nodes.internalLink.create({documentId:r})),n.dispatch(a)}catch(o){s.logger.error("[InternalLinkNode] Error fetching title:",o)}}const oE=vt`
91
+ `,ov=Oe.create({name:"internalLink",group:"inline",inline:!0,atom:!0,addOptions(){return{service:void 0,i18n:void 0,internalLinkPluginHook:void 0}},addAttributes(){return{documentId:{default:"",parseHTML:n=>n.dataset.documentId||"",renderHTML:n=>({"data-document-id":n.documentId})}}},parseHTML(){return[{tag:"span[data-internal-link]"}]},renderHTML({HTMLAttributes:n}){return["span",{...n,class:"InternalLink","data-internal-link":"true"}]},addCommands(){return{insertInternalLink:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{documentId:n}})}},addProseMirrorPlugins(){const n=this.options.service,e=this.options.i18n,t=this.options.internalLinkPluginHook;if(!n||!e||!t)return[];function r(s,o,a){const{tr:l}=s.state,c=o+a;l.setSelection(H.create(l.doc,c)),s.dispatch(l),s.focus()}const i=async(s,o,a)=>{if(!a.target.classList.contains("InternalLink"))return!1;const{state:c}=s,d=c.doc.resolve(o),u=d.parent.type.name==="internalLink"?d.parent:d.nodeAfter;if(!u||u.type.name!=="internalLink")return!1;const h=u.attrs.documentId,f=await t.openDialog(h||"",{getLanguage:()=>n.language});let p=o;if(d.parent.type.name==="internalLink"&&(p=d.before()),!f)return r(s,p,u.nodeSize),!0;const{tr:m}=c;return f.documentId?(await av(s,p,u.nodeSize,f.documentId,t,n),r(s,p,u.nodeSize),!0):(m.delete(p,p+u.nodeSize),s.dispatch(m),!0)};return[new ne({key:new ce("internalLinkClickHandler"),props:{handleClick(s,o,a){return i(s,o,a),!1}}})]},onBeforeCreate(){const n=this.options.internalLinkPluginHook,e=this.options.service;if(!n||!e)return;const t=async r=>{const i=this.editor.view.dom.querySelectorAll("span[data-internal-link]");for(const s of i){const o=s.dataset.documentId;if(o&&!(r&&s.textContent))try{const a=await n.getDocumentTitle(o);a&&(s.textContent=a)}catch(a){e.logger.error("[InternalLinkNode] Error fetching title:",a)}}};this.editor.on("create",()=>{t(!1)}),this.editor.on("update",()=>{t(!0)})}});async function av(n,e,t,r,i,s){try{if(!await i.getDocumentTitle(r))return;const{tr:a,schema:l}=n.state;a.delete(e,e+t),a.insert(e,l.nodes.internalLink.create({documentId:r})),n.dispatch(a)}catch(o){s.logger.error("[InternalLinkNode] Error fetching title:",o)}}const lv=Et`
152
92
  .InternalLink {
153
93
  background-color: #e3f2fd;
154
94
  border-bottom: 2px solid #2196f3;
@@ -160,12 +100,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
160
100
  .InternalLink:hover {
161
101
  background-color: #bbdefb;
162
102
  }
163
- `
164
- /**
165
- * @license
166
- * Copyright 2017 Google LLC
167
- * SPDX-License-Identifier: BSD-3-Clause
168
- */;class Do extends Th{constructor(e){if(super(e),this.it=he,e.type!==Sh.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===he||e==null)return this._t=void 0,this.it=e;if(e===Mn)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Do.directiveName="unsafeHTML",Do.resultType=1;const Hh=wh(Do),aE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-external-link-icon lucide-external-link"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>',lE=["pdf","txt"];function Ic(n,e){const t=e.match(/\.([^./?#]+)(?:[?#]|$)/);if(t){const a=t[1].toLowerCase();if(lE.includes(a))return!0}if(e.startsWith("/"))return!1;const r=/^https?:\/\/([^/]+)/,i=e.match(r);if(!i)return!1;const[,s]=i;return s.split(":")[0]!==n}async function Fh({service:n,i18n:e,initialLabel:t="",initialHref:r="",initialTarget:i,mode:s}){let o=t,a=r,l=i==="_blank",c=s==="update";s==="insert"&&a&&!i&&(l=Ic(n.fqdn,a));const d=document.createElement("div");function u(){const m=z`
103
+ `;class Do extends Mh{constructor(e){if(super(e),this.it=he,e.type!==Th.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===he||e==null)return this._t=void 0,this.it=e;if(e===Mn)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Do.directiveName="unsafeHTML",Do.resultType=1;const Uh=Ch(Do),cv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-external-link-icon lucide-external-link"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>',dv=["pdf","txt"];function $c(n,e){const t=e.match(/\.([^./?#]+)(?:[?#]|$)/);if(t){const a=t[1].toLowerCase();if(dv.includes(a))return!0}if(e.startsWith("/"))return!1;const r=/^https?:\/\/([^/]+)/,i=e.match(r);if(!i)return!1;const[,s]=i;return s.split(":")[0]!==n}async function Vh({service:n,i18n:e,initialLabel:t="",initialHref:r="",initialTarget:i,mode:s}){let o=t,a=r,l=i==="_blank",c=s==="update";s==="insert"&&a&&!i&&(l=$c(n.fqdn,a));const d=document.createElement("div");function u(){const m=z`
169
104
  <label class="TpField">
170
105
  <span class="TpField-label">${e.t("linkDialog.label")}</span>
171
106
  <input
@@ -181,7 +116,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
181
116
  <input
182
117
  type="text"
183
118
  .value=${a}
184
- @input=${g=>{a=g.target.value,!c&&a&&(l=Ic(n.fqdn,a)),u()}}
119
+ @input=${g=>{a=g.target.value,!c&&a&&(l=$c(n.fqdn,a)),u()}}
185
120
  />
186
121
  </label>
187
122
  ${a?z`
@@ -193,7 +128,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
193
128
  title=${e.t("linkDialog.openLink")}
194
129
  style="padding: 0.5rem; min-height: 35px; display: flex; align-items: center; justify-content: center;"
195
130
  >
196
- ${Hh(aE)}
131
+ ${Uh(cv)}
197
132
  </a>
198
133
  `:""}
199
134
  </div>
@@ -225,7 +160,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
225
160
  >
226
161
  ${e.t("linkDialog.validate")}
227
162
  </button>
228
- `;Ze(f,h);const p=n.createModalDialog({header:s==="insert"?e.t("linkDialog.insertLink"):e.t("linkDialog.editLink"),content:d,footer:h});return await p.open()}const cE=X0.extend({addOptions(){return{...this.parent?.(),service:void 0,i18n:void 0}},addAttributes(){return{href:{default:void 0,parseHTML:n=>n.getAttribute("href")},target:{default:void 0,parseHTML:n=>n.getAttribute("target"),renderHTML:n=>n.target?{target:n.target}:{}},rel:{default:void 0,parseHTML:()=>{},renderHTML:()=>({})},class:{default:void 0,parseHTML:()=>{},renderHTML:()=>({})}}},addProseMirrorPlugins(){const n=this.parent?.()||[],e=this.options.service,t=this.options.i18n;if(!e||!t)return n;const r=(s,o)=>{const{state:a}=s,l=a.doc.resolve(o),d=l.marks().find(m=>m.type.name==="link");if(!d)return!1;const u=jn(l,d.type);if(!u)return!1;const{from:h,to:f}=u;return!(f-h>1&&(o<=h||o>=f))},i=async(s,o,a)=>{if(!r(s,o))return!1;a.preventDefault(),a.stopPropagation();const{state:l}=s,c=l.doc.resolve(o),u=c.marks().find(k=>k.type.name==="link");if(!u)return!1;const h=jn(c,u.type);if(!h)return!1;const{from:f,to:p}=h,m=u.attrs.href,g=u.attrs.target,b=l.doc.textBetween(f,p,"");try{const k=await Fh({service:e,i18n:t,initialLabel:b,initialHref:m,initialTarget:g,mode:"update"});if(!k)return s.focus(),!0;const{tr:E}=l;if(k.action==="remove")E.removeMark(f,p,u.type);else if(k.action==="update"&&k.values){E.removeMark(f,p,u.type),k.values.label!==b&&E.replaceWith(f,p,l.schema.text(k.values.label));const x=f+k.values.label.length;E.addMark(f,x,u.type.create({href:k.values.href,target:k.values.target}))}return s.dispatch(E),s.focus(),!0}catch(k){return e.logger.error("[CustomLink] Error handling click:",k),s.focus(),!0}};return[...n,new ne({key:new ce("linkClickHandler"),props:{handleClick(s,o,a){return r(s,o)?(i(s,o,a),!0):!1}}})]}});function Uh(n,e){return n.chain().focus().insertContent({type:"media",attrs:e}).run()}function dE(n,e,t,r,i,s){const o=e.clipboardData?.getData("text/plain");if(o&&s){const u=s.recognizeUrl(o);if(u)return e.preventDefault(),t?.chain().focus().insertPlatformVideo(u).run(),!0}const a=e.clipboardData?.items;if(!a)return!1;const l=[];for(const u of Array.from(a))if(u.type.startsWith("image/")){const h=u.getAsFile();h&&l.push(h)}if(l.length===0)return!1;e.preventDefault();const c=10,d=l.slice(0,c);return l.length>c&&r.showToast(i.t("tooManyImages",{count:String(c)}),{severity:"warn"}),Vh(d,t,r,i),!0}function uE(n,e,t,r,i){const s=e.dataTransfer?.files;if(!s||s.length===0)return!1;const o=[];for(const u of Array.from(s))u.type.startsWith("image/")&&o.push(u);if(o.length===0)return!1;e.preventDefault();const a={left:e.clientX,top:e.clientY},l=n.posAtCoords(a);l&&t?.commands.setTextSelection(l.pos);const c=10,d=o.slice(0,c);return o.length>c&&r.showToast(i.t("tooManyImages",{count:String(c)}),{severity:"warn"}),Vh(d,t,r,i),!0}async function Vh(n,e,t,r){for(const i of n)await hE(i,e,t,r)}async function hE(n,e,t,r){if(!t.uploadMedia){t.logger.warn("uploadMedia not available"),t.showToast(r.t("uploadNotAvailable"),{severity:"error"});return}t.showToast(r.t("uploadingImage"),{severity:"info"});try{const i=await t.uploadMedia(n);if(!i||i.kind!=="image"){t.logger.error("Failed to upload image or not an image"),t.showToast(r.t("imageUploadFailed"),{severity:"error"});return}const s=t.themeConf.fTextImageResizeRules[0];if(!e){t.logger.error("Editor not initialized");return}Uh(e,{mediaId:i.mediaId,resizeRule:s,align:"center",zoomable:!0,href:void 0}),t.showToast(r.t("imageUploadSuccess"),{severity:"success"})}catch(i){t.logger.error("Error uploading image:",i),t.showToast(r.t("imageUploadFailed"),{severity:"error"})}}function $o(n){const e=document.createElement("span");return e.className=n?.center?"TpSpinner center":"TpSpinner",e}async function fE({service:n,fetchedOutput:e,initialValues:t,i18n:r}){const{mediaId:i}=t,{themeConf:s}=n;let o=t.resizeRule,a=t.align,l=t.zoomable,c=!!t.href,d=t.href??"",u;const h=s.fTextImageResizeRules.map((E,x)=>({resizeRule:E,label:r.t("mediaNode.variantLabel",{n:String(x+1)})})),f=[{align:"left",label:r.t("mediaNode.left")},{align:"center",label:r.t("mediaNode.center")},{align:"right",label:r.t("mediaNode.right")}],p=document.createElement("div");function m(){const E=z`
163
+ `;Ze(f,h);const p=n.createModalDialog({header:s==="insert"?e.t("linkDialog.insertLink"):e.t("linkDialog.editLink"),content:d,footer:h});return await p.open()}const uv=hk.extend({addOptions(){return{...this.parent?.(),service:void 0,i18n:void 0}},addAttributes(){return{href:{default:null,parseHTML:n=>n.getAttribute("href")},target:{default:null,parseHTML:n=>n.getAttribute("target"),renderHTML:n=>n.target?{target:n.target}:{}},rel:{default:null,parseHTML:()=>null,renderHTML:()=>({})},class:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){const n=this.parent?.()||[],e=this.options.service,t=this.options.i18n;if(!e||!t)return n;const r=(s,o)=>{const{state:a}=s,l=a.doc.resolve(o),d=l.marks().find(m=>m.type.name==="link");if(!d)return!1;const u=jn(l,d.type);if(!u)return!1;const{from:h,to:f}=u;return!(f-h>1&&(o<=h||o>=f))},i=async(s,o,a)=>{if(!r(s,o))return!1;a.preventDefault(),a.stopPropagation();const{state:l}=s,c=l.doc.resolve(o),u=c.marks().find(k=>k.type.name==="link");if(!u)return!1;const h=jn(c,u.type);if(!h)return!1;const{from:f,to:p}=h,m=u.attrs.href,g=u.attrs.target,y=l.doc.textBetween(f,p,"");try{const k=await Vh({service:e,i18n:t,initialLabel:y,initialHref:m,initialTarget:g,mode:"update"});if(!k)return s.focus(),!0;const{tr:v}=l;if(k.action==="remove")v.removeMark(f,p,u.type);else if(k.action==="update"&&k.values){v.removeMark(f,p,u.type),k.values.label!==y&&v.replaceWith(f,p,l.schema.text(k.values.label));const x=f+k.values.label.length;v.addMark(f,x,u.type.create({href:k.values.href,target:k.values.target}))}return s.dispatch(v),s.focus(),!0}catch(k){return e.logger.error("[CustomLink] Error handling click:",k),s.focus(),!0}};return[...n,new ne({key:new ce("linkClickHandler"),props:{handleClick(s,o,a){return r(s,o)?(i(s,o,a),!0):!1}}})]}});function Kh(n,e){return n.chain().focus().insertContent({type:"media",attrs:e}).run()}function hv(n,e,t,r,i,s){const o=e.clipboardData?.getData("text/plain");if(o&&s){const u=s.recognizeUrl(o);if(u)return e.preventDefault(),t?.chain().focus().insertPlatformVideo(u).run(),!0}const a=e.clipboardData?.items;if(!a)return!1;const l=[];for(const u of Array.from(a))if(u.type.startsWith("image/")){const h=u.getAsFile();h&&l.push(h)}if(l.length===0)return!1;e.preventDefault();const c=10,d=l.slice(0,c);return l.length>c&&r.showToast(i.t("tooManyImages",{count:String(c)}),{severity:"warn"}),Wh(d,t,r,i),!0}function fv(n,e,t,r,i){const s=e.dataTransfer?.files;if(!s||s.length===0)return!1;const o=[];for(const u of Array.from(s))u.type.startsWith("image/")&&o.push(u);if(o.length===0)return!1;e.preventDefault();const a={left:e.clientX,top:e.clientY},l=n.posAtCoords(a);l&&t?.commands.setTextSelection(l.pos);const c=10,d=o.slice(0,c);return o.length>c&&r.showToast(i.t("tooManyImages",{count:String(c)}),{severity:"warn"}),Wh(d,t,r,i),!0}async function Wh(n,e,t,r){for(const i of n)await pv(i,e,t,r)}async function pv(n,e,t,r){if(!t.uploadMedia){t.logger.warn("uploadMedia not available"),t.showToast(r.t("uploadNotAvailable"),{severity:"error"});return}t.showToast(r.t("uploadingImage"),{severity:"info"});try{const i=await t.uploadMedia(n);if(!i||i.kind!=="image"){t.logger.error("Failed to upload image or not an image"),t.showToast(r.t("imageUploadFailed"),{severity:"error"});return}const s=t.themeConf.fTextImageResizeRules[0];if(!e){t.logger.error("Editor not initialized");return}Kh(e,{mediaId:i.mediaId,resizeRule:s,align:"center",zoomable:!0,href:void 0}),t.showToast(r.t("imageUploadSuccess"),{severity:"success"})}catch(i){t.logger.error("Error uploading image:",i),t.showToast(r.t("imageUploadFailed"),{severity:"error"})}}function $o(n){const e=document.createElement("span");return e.className=n?.center?"TpSpinner center":"TpSpinner",e}async function mv({service:n,fetchedOutput:e,initialValues:t,i18n:r}){const{mediaId:i}=t,{themeConf:s}=n;let o=t.resizeRule,a=t.align,l=t.zoomable,c=!!t.href,d=t.href??"",u;const h=s.fTextImageResizeRules.map((v,x)=>({resizeRule:v,label:r.t("mediaNode.variantLabel",{n:String(x+1)})})),f=[{align:"left",label:r.t("mediaNode.left")},{align:"center",label:r.t("mediaNode.center")},{align:"right",label:r.t("mediaNode.right")}],p=document.createElement("div");function m(){const v=z`
229
164
  <h2 class="FieldLabel">${r.t("mediaNode.sizes")}</h2>
230
165
  <div class="TpOption">
231
166
  ${h.map(x=>z`
@@ -304,7 +239,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
304
239
  </dd>
305
240
  </dl>
306
241
  </div>
307
- `;Ze(E,p)}async function g(){try{const E=await n.useAdminUiImage(i,{resizeRule:o});E&&(e.source=E.source,u=E,m())}catch(E){n.logger.error("Error fetching media:",E)}}m(),g();const b=document.createElement("div");b.classList.add("TpBar","spaceBetween"),Ze(z`
242
+ `;Ze(v,p)}async function g(){try{const v=await n.useAdminUiImage(i,{resizeRule:o});v&&(e.source=v.source,u=v,m())}catch(v){n.logger.error("Error fetching media:",v)}}m(),g();const y=document.createElement("div");y.classList.add("TpBar","spaceBetween"),Ze(z`
308
243
  <button
309
244
  type="button"
310
245
  class="TpBtn outlined danger"
@@ -320,7 +255,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
320
255
  >
321
256
  ${r.t("validate")}
322
257
  </button>
323
- `,b);const k=n.createModalDialog({header:r.t("mediaNode.imageProperties"),content:p,footer:b});return await k.open()}const pE=Oe.create({name:"media",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,getLanguage:void 0,i18n:void 0}},addAttributes(){return{mediaId:{default:null},resizeRule:{default:null},align:{default:"center"},zoomable:{default:!1},href:{default:null}}},parseHTML(){return[{tag:'figure[data-pa-node="media"]',getAttrs:n=>{const e=n,t=e.dataset.mediaId,r=e.dataset.resize,i=e.dataset.zoomable==="1",s=e.dataset.href||null;let o="center";return e.classList.contains("left")?o="left":e.classList.contains("right")?o="right":e.classList.contains("center")&&(o="center"),{mediaId:t,resizeRule:r,align:o,zoomable:i,href:s}}}]},renderHTML({node:n}){return["figure",{"data-pa-node":"media","data-media-id":n.attrs.mediaId,"data-resize":n.attrs.resizeRule,...n.attrs.zoomable?{"data-zoomable":"1"}:{},"data-href":n.attrs.href||null,class:`MediaNode Fig ${Lc(n.attrs.align)}`}]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.getLanguage,s=this.options.i18n;if(!r)throw new Error("MediaNode: service not provided in options");if(!s)throw new Error("MediaNode: i18n not provided in options");const o=document.createElement("figure");o.setAttribute("data-pa-node","media"),o.setAttribute("contenteditable","false");const a=$o({center:!0});o.appendChild(a);let l,c,d,u;async function h(m){try{if(m.mediaId!==d||m.resizeRule!==u){d=m.mediaId,u=m.resizeRule;const g=await r.useAdminUiImage(m.mediaId,{resizeRule:m.resizeRule});if(!g){r.logger.warn(`Media ${m.mediaId} not found`),o.contains(a)&&o.removeChild(a);return}c=g.source;const{source:b,variant:k}=g,E=o.querySelector("img");E&&E.remove();const x=document.createElement("img");x.className="Fig-media",x.src=k.url,x.width=k.width,x.height=k.height;const w=i?.()??r.language,M=b.attachedData?.[w]?.caption,A=o.querySelector("figcaption");if(A&&A.remove(),M){const L=document.createElement("figcaption");L.className="Fig-caption",L.textContent=M,o.appendChild(L)}o.contains(a)&&o.removeChild(a),o.appendChild(x),l||(l=()=>{p(b).catch(L=>{r.logger.error("[MediaNode] Error handling media click:",L)})},o.addEventListener("click",l))}f(m)}catch(g){r.logger.error("[MediaNode] Error setting up media:",g),o.contains(a)&&o.removeChild(a)}}function f(m){o.className=`MediaNode Fig ${Lc(m.align)}`,o.setAttribute("data-media-id",m.mediaId),o.setAttribute("data-resize",m.resizeRule),m.zoomable?o.setAttribute("data-zoomable","1"):o.removeAttribute("data-zoomable"),m.href?o.setAttribute("data-href",m.href):o.removeAttribute("data-href");const g=o.querySelector(".MediaNode-flags");g&&g.remove(),c&&mE(o,c,m)}async function p(m){const g=t();if(typeof g!="number")return;const b=e.state.doc.nodeAt(g);if(!b)return;const k={source:m},E=await fE({service:r,initialValues:b.attrs,fetchedOutput:k,i18n:s});if(E){if(E.action==="remove")e.commands.deleteRange({from:g,to:g+b.nodeSize});else if(E.action==="update"&&E.values){const{view:x}=e;x.dispatch(x.state.tr.setNodeMarkup(g,void 0,{...b.attrs,...E.values})),e.commands.focus()}}}return h(n.attrs),{dom:o,contentDOM:void 0,update:m=>m.type.name!=="media"?!1:(h(m.attrs),!0),destroy:()=>{l&&o.removeEventListener("click",l)}}}},addCommands(){return{insertMedia:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function Lc(n){return n==="center"?"center":n==="left"?"left":n==="right"?"right":""}function mE(n,e,t){const r=document.createElement("div");if(r.classList.add("MediaNode-flags"),e.pixelRatio!==void 0){const i=document.createElement("span");i.classList.add("MediaNode-flag","Fig-flag--pixelRatio"),i.textContent=`${e.pixelRatio}×`,r.appendChild(i)}if(t.zoomable){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5">\n <circle cx="6.5" cy="6.5" r="5"/>\n <path d="m10.04 10.04 4.46 4.46"/>\n</svg>`,r.appendChild(i)}if(t.href){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="22" height="22" viewBox="0 0 16 16" fill="currentColor">\n <path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>\n <path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243L6.586 4.672z"/>\n</svg>`,r.appendChild(i)}n.appendChild(r)}const gE=vt`
258
+ `,y);const k=n.createModalDialog({header:r.t("mediaNode.imageProperties"),content:p,footer:y});return await k.open()}const gv=Oe.create({name:"media",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,getLanguage:void 0,i18n:void 0}},addAttributes(){return{mediaId:{default:null},resizeRule:{default:null},align:{default:"center"},zoomable:{default:!1},href:{default:null}}},parseHTML(){return[{tag:'figure[data-pa-node="media"]',getAttrs:n=>{const e=n,t=e.dataset.mediaId,r=e.dataset.resize,i=e.dataset.zoomable==="1",s=e.dataset.href||null;let o="center";return e.classList.contains("left")?o="left":e.classList.contains("right")?o="right":e.classList.contains("center")&&(o="center"),{mediaId:t,resizeRule:r,align:o,zoomable:i,href:s}}}]},renderHTML({node:n}){return["figure",{"data-pa-node":"media","data-media-id":n.attrs.mediaId,"data-resize":n.attrs.resizeRule,...n.attrs.zoomable?{"data-zoomable":"1"}:{},"data-href":n.attrs.href||null,class:`MediaNode Fig ${Pc(n.attrs.align)}`}]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.getLanguage,s=this.options.i18n;if(!r)throw new Error("MediaNode: service not provided in options");if(!s)throw new Error("MediaNode: i18n not provided in options");const o=document.createElement("figure");o.setAttribute("data-pa-node","media"),o.setAttribute("contenteditable","false");const a=$o({center:!0});o.appendChild(a);let l,c,d,u;async function h(m){try{if(m.mediaId!==d||m.resizeRule!==u){d=m.mediaId,u=m.resizeRule;const g=await r.useAdminUiImage(m.mediaId,{resizeRule:m.resizeRule});if(!g){r.logger.warn(`Media ${m.mediaId} not found`),o.contains(a)&&o.removeChild(a);return}c=g.source;const{source:y,variant:k}=g,v=o.querySelector("img");v&&v.remove();const x=document.createElement("img");x.className="Fig-media",x.src=k.url,x.width=k.width,x.height=k.height;const w=i?.()??r.language,M=y.attachedData?.[w]?.caption,A=o.querySelector("figcaption");if(A&&A.remove(),M){const L=document.createElement("figcaption");L.className="Fig-caption",L.textContent=M,o.appendChild(L)}o.contains(a)&&o.removeChild(a),o.appendChild(x),l||(l=()=>{p(y).catch(L=>{r.logger.error("[MediaNode] Error handling media click:",L)})},o.addEventListener("click",l))}f(m)}catch(g){r.logger.error("[MediaNode] Error setting up media:",g),o.contains(a)&&o.removeChild(a)}}function f(m){o.className=`MediaNode Fig ${Pc(m.align)}`,o.setAttribute("data-media-id",m.mediaId),o.setAttribute("data-resize",m.resizeRule),m.zoomable?o.setAttribute("data-zoomable","1"):o.removeAttribute("data-zoomable"),m.href?o.setAttribute("data-href",m.href):o.removeAttribute("data-href");const g=o.querySelector(".MediaNode-flags");g&&g.remove(),c&&bv(o,c,m)}async function p(m){const g=t();if(typeof g!="number")return;const y=e.state.doc.nodeAt(g);if(!y)return;const k={source:m},v=await mv({service:r,initialValues:y.attrs,fetchedOutput:k,i18n:s});if(v){if(v.action==="remove")e.commands.deleteRange({from:g,to:g+y.nodeSize});else if(v.action==="update"&&v.values){const{view:x}=e;x.dispatch(x.state.tr.setNodeMarkup(g,void 0,{...y.attrs,...v.values})),e.commands.focus()}}}return h(n.attrs),{dom:o,contentDOM:void 0,update:m=>m.type.name!=="media"?!1:(h(m.attrs),!0),destroy:()=>{l&&o.removeEventListener("click",l)}}}},addCommands(){return{insertMedia:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function Pc(n){return n==="center"?"center":n==="left"?"left":n==="right"?"right":""}function bv(n,e,t){const r=document.createElement("div");if(r.classList.add("MediaNode-flags"),e.pixelRatio!==void 0){const i=document.createElement("span");i.classList.add("MediaNode-flag","Fig-flag--pixelRatio"),i.textContent=`${e.pixelRatio}×`,r.appendChild(i)}if(t.zoomable){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5">\n <circle cx="6.5" cy="6.5" r="5"/>\n <path d="m10.04 10.04 4.46 4.46"/>\n</svg>`,r.appendChild(i)}if(t.href){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="22" height="22" viewBox="0 0 16 16" fill="currentColor">\n <path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>\n <path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243L6.586 4.672z"/>\n</svg>`,r.appendChild(i)}n.appendChild(r)}const yv=Et`
324
259
  .MediaNode {
325
260
  cursor: default;
326
261
  position: relative;
@@ -393,13 +328,13 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
393
328
  opacity: .6;
394
329
  text-align: center;
395
330
  }
396
- `;function Kh(n){return bE(n)||Oa(n)}function Oa(n){return!!n.match(/^[a-zA-Z0-9. _-]+@[a-zA-Z0-9. -]+\.[a-zA-Z]{2,4}$/g)}function bE(n){return!!n.match(/^(\+|00)[1-9][0-9 \-().]{7,32}$/)}function yE(n){return Kh(n)?Oa(n)?"mailto":"tel":"raw"}async function Po({service:n,i18n:e,initialContent:t,initialAsALink:r,mode:i}){let s=t,o=r!=="raw";const a=document.createElement("div");function l(){const h=z`
331
+ `;function jh(n){return kv(n)||Ra(n)}function Ra(n){return!!n.match(/^[a-zA-Z0-9. _-]+@[a-zA-Z0-9. -]+\.[a-zA-Z]{2,4}$/g)}function kv(n){return!!n.match(/^(\+|00)[1-9][0-9 \-().]{7,32}$/)}function Ev(n){return jh(n)?Ra(n)?"mailto":"tel":"raw"}async function Po({service:n,i18n:e,initialContent:t,initialAsALink:r,mode:i}){let s=t,o=r!=="raw";const a=document.createElement("div");function l(){const h=z`
397
332
  <label class="TpField">
398
333
  <span class="TpField-label">${e.t("obfuscateMark.content")}</span>
399
334
  <input
400
335
  type="text"
401
336
  .value=${s}
402
- @input=${f=>{s=f.target.value,Kh(s)?o=!0:o=!1,l()}}
337
+ @input=${f=>{s=f.target.value,jh(s)?o=!0:o=!1,l()}}
403
338
  />
404
339
  </label>
405
340
 
@@ -426,11 +361,11 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
426
361
  <button
427
362
  class="TpBtn"
428
363
  type="button"
429
- @click=${()=>{const h=o?Oa(s)?"mailto":"tel":"raw";u.close({action:i,values:{content:s,asALink:h}})}}
364
+ @click=${()=>{const h=o?Ra(s)?"mailto":"tel":"raw";u.close({action:i,values:{content:s,asALink:h}})}}
430
365
  >
431
366
  ${e.t("obfuscateMark.done")}
432
367
  </button>
433
- `;Ze(d,c);const u=n.createModalDialog({header:e.t("obfuscateMark.obfuscator"),content:a,footer:c});return await u.open()}const kE=it.create({name:"obfuscate",addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{asALink:{default:"raw",parseHTML:n=>n.getAttribute("data-as-a-link")||"raw",renderHTML:n=>({"data-as-a-link":n.asALink})}}},parseHTML(){return[{tag:"span.Obfuscate",getAttrs:n=>({asALink:n.dataset.asALink||"raw"})}]},renderHTML({HTMLAttributes:n}){return["span",{...n,class:"Obfuscate"},0]},addCommands(){return{setObfuscate:n=>({commands:e})=>e.setMark(this.name,{asALink:n}),toggleObfuscate:()=>({commands:n})=>n.toggleMark(this.name),unsetObfuscate:()=>({commands:n})=>n.unsetMark(this.name)}},addProseMirrorPlugins(){const n=this.options.service,e=this.options.i18n;if(!n||!e)return[];const t=async(r,i,s)=>{const o=s.target;if(!o.classList.contains("Obfuscate"))return!1;const{state:a}=r,l=a.doc.resolve(i),d=l.marks().find(f=>f.type.name==="obfuscate");if(!d)return!1;const u=o.textContent||"",h=d.attrs.asALink;try{const f=await Po({service:n,i18n:e,initialContent:u,initialAsALink:h,mode:"update"});if(!f)return!0;const p=jn(l,d.type);if(!p)return!0;const{from:m,to:g}=p,{tr:b}=a;return f.action==="remove"?b.removeMark(m,g,d.type):f.action==="update"&&f.values?.content&&(b.removeMark(m,g,d.type),b.replaceWith(m,g,a.schema.text(f.values.content)),b.addMark(m,m+f.values.content.length,d.type.create({asALink:f.values.asALink}))),r.dispatch(b),!0}catch(f){return n.logger.error("[ObfuscateMark] Error handling click:",f),!0}};return[new ne({key:new ce("obfuscateClickHandler"),props:{handleClick(r,i,s){return t(r,i,s),!1}}})]}}),vE=vt`
368
+ `;Ze(d,c);const u=n.createModalDialog({header:e.t("obfuscateMark.obfuscator"),content:a,footer:c});return await u.open()}const vv=it.create({name:"obfuscate",addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{asALink:{default:"raw",parseHTML:n=>n.getAttribute("data-as-a-link")||"raw",renderHTML:n=>({"data-as-a-link":n.asALink})}}},parseHTML(){return[{tag:"span.Obfuscate",getAttrs:n=>({asALink:n.dataset.asALink||"raw"})}]},renderHTML({HTMLAttributes:n}){return["span",{...n,class:"Obfuscate"},0]},addCommands(){return{setObfuscate:n=>({commands:e})=>e.setMark(this.name,{asALink:n}),toggleObfuscate:()=>({commands:n})=>n.toggleMark(this.name),unsetObfuscate:()=>({commands:n})=>n.unsetMark(this.name)}},addProseMirrorPlugins(){const n=this.options.service,e=this.options.i18n;if(!n||!e)return[];const t=async(r,i,s)=>{const o=s.target;if(!o.classList.contains("Obfuscate"))return!1;const{state:a}=r,l=a.doc.resolve(i),d=l.marks().find(f=>f.type.name==="obfuscate");if(!d)return!1;const u=o.textContent||"",h=d.attrs.asALink;try{const f=await Po({service:n,i18n:e,initialContent:u,initialAsALink:h,mode:"update"});if(!f)return!0;const p=jn(l,d.type);if(!p)return!0;const{from:m,to:g}=p,{tr:y}=a;return f.action==="remove"?y.removeMark(m,g,d.type):f.action==="update"&&f.values?.content&&(y.removeMark(m,g,d.type),y.replaceWith(m,g,a.schema.text(f.values.content)),y.addMark(m,m+f.values.content.length,d.type.create({asALink:f.values.asALink}))),r.dispatch(y),!0}catch(f){return n.logger.error("[ObfuscateMark] Error handling click:",f),!0}};return[new ne({key:new ce("obfuscateClickHandler"),props:{handleClick(r,i,s){return t(r,i,s),!1}}})]}}),xv=Et`
434
369
  .Obfuscate {
435
370
  background-color: #fff3cd;
436
371
  padding: 2px 4px;
@@ -441,7 +376,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
441
376
  .Obfuscate:hover {
442
377
  background-color: #ffe69c;
443
378
  }
444
- `;function EE(n,e){const{state:t}=n,{selection:r}=t,{$from:i}=r;if(!r.empty)return;const s=i.pos;if(s===0)return;const o=t.doc.textBetween(s-1,s);if(o!==" "&&o!==`\n`)return;const a=i.parent;if(a.type.name!=="paragraph"&&a.type.name!=="heading"||i.marks().some(b=>b.type.name==="link"))return;const c=a.textContent,d=i.parentOffset;let u=d-2;for(;u>0&&c[u-1]&&!/\s/.test(c[u-1]);)--u;const h=c.slice(u,d-1);if(!h)return;const f=e.recognizeUrl(h);if(!f)return;const m=i.start()+u,g=s;n.chain().deleteRange({from:m,to:g}).insertPlatformVideo(f).run()}const Wh='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>';async function jh({service:n,i18n:e,mode:t,value:r,videoPluginHook:i}){let s=r;const o=document.createElement("div"),{element:a,dispose:l}=i.createComponent(r,{onChange(h){s=h},getLanguage:()=>n.language});o.appendChild(a);const c=document.createElement("div");c.style.display="flex",c.style.gap="8px",c.style.justifyContent="flex-end";function d(){const h=z`
379
+ `;function Sv(n,e){const{state:t}=n,{selection:r}=t,{$from:i}=r;if(!r.empty)return;const s=i.pos;if(s===0)return;const o=t.doc.textBetween(s-1,s);if(o!==" "&&o!==`\n`)return;const a=i.parent;if(a.type.name!=="paragraph"&&a.type.name!=="heading"||i.marks().some(y=>y.type.name==="link"))return;const c=a.textContent,d=i.parentOffset;let u=d-2;for(;u>0&&c[u-1]&&!/\s/.test(c[u-1]);)--u;const h=c.slice(u,d-1);if(!h)return;const f=e.recognizeUrl(h);if(!f)return;const m=i.start()+u,g=s;n.chain().deleteRange({from:m,to:g}).insertPlatformVideo(f).run()}const qh='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>';async function Gh({service:n,i18n:e,mode:t,value:r,videoPluginHook:i}){let s=r;const o=document.createElement("div"),{element:a,dispose:l}=i.createComponent(r,{onChange(h){s=h},getLanguage:()=>n.language});o.appendChild(a);const c=document.createElement("div");c.style.display="flex",c.style.gap="8px",c.style.justifyContent="flex-end";function d(){const h=z`
445
380
  ${t==="update"?z`
446
381
  <button
447
382
  type="button"
@@ -465,7 +400,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
465
400
  >
466
401
  ${e.t("validate")}
467
402
  </button>
468
- `;Ze(h,c)}d();const u=n.createModalDialog({header:e.t("platformVideo.videoDialog"),content:o,footer:c});return await u.open()}const xE=Oe.create({name:"platformVideo",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,i18n:void 0,videoPluginHook:void 0}},addAttributes(){return{videoId:{default:""},platform:{default:"youtube"}}},parseHTML(){return[{tag:'div[data-pa-node="platformVideo"]',getAttrs:n=>{const e=n,t=e.dataset.videoId||"",r=e.dataset.platform||"youtube";return{videoId:t,platform:r}}}]},renderHTML({node:n}){return["div",{"data-pa-node":"platformVideo","data-video-id":n.attrs.videoId,"data-platform":n.attrs.platform,class:"PlatformVideo"},0]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.i18n,s=this.options.videoPluginHook;if(!r)throw new Error("PlatformVideoNode: service not provided in options");if(!i)throw new Error("PlatformVideoNode: i18n not provided in options");if(!s)throw new Error("PlatformVideoNode: videoPluginHook not provided in options");const o=document.createElement("div");o.className="PlatformVideo",o.setAttribute("data-pa-node","platformVideo"),o.setAttribute("data-video-id",n.attrs.videoId),o.setAttribute("data-platform",n.attrs.platform),o.setAttribute("contenteditable","false");const a=s.getThumbnailUrl({videoId:n.attrs.videoId,platform:n.attrs.platform});o.style.backgroundImage=`url(${a})`;const l=document.createElement("div");l.className="PlatformVideo-playButton",l.innerHTML=Wh;const c=l.querySelector("svg");c&&(c.setAttribute("width","48"),c.setAttribute("height","48"),c.setAttribute("fill","white")),o.appendChild(l);async function d(){const h=await jh({service:r,i18n:i,mode:"update",value:{videoId:n.attrs.videoId,platform:n.attrs.platform},videoPluginHook:s});if(h)if(h.action==="remove"){const f=t();typeof f=="number"&&e.commands.deleteRange({from:f,to:f+n.nodeSize})}else h.action==="update"&&h.value&&typeof t()=="number"&&e.chain().updateAttributes(n.type.name,{videoId:h.value.videoId,platform:h.value.platform}).run()}const u=()=>{d().catch(h=>{r.logger.error("Error handling PlatformVideo click:",h)})};return o.addEventListener("click",u),{dom:o,contentDOM:void 0,update:()=>!1,destroy:()=>{o.removeEventListener("click",u)}}}},addCommands(){return{insertPlatformVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}}),SE=vt`
403
+ `;Ze(h,c)}d();const u=n.createModalDialog({header:e.t("platformVideo.videoDialog"),content:o,footer:c});return await u.open()}const wv=Oe.create({name:"platformVideo",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,i18n:void 0,videoPluginHook:void 0}},addAttributes(){return{videoId:{default:""},platform:{default:"youtube"}}},parseHTML(){return[{tag:'div[data-pa-node="platformVideo"]',getAttrs:n=>{const e=n,t=e.dataset.videoId||"",r=e.dataset.platform||"youtube";return{videoId:t,platform:r}}}]},renderHTML({node:n}){return["div",{"data-pa-node":"platformVideo","data-video-id":n.attrs.videoId,"data-platform":n.attrs.platform,class:"PlatformVideo"},0]},addNodeView(){return({node:n,editor:e,getPos:t})=>{const r=this.options.service,i=this.options.i18n,s=this.options.videoPluginHook;if(!r)throw new Error("PlatformVideoNode: service not provided in options");if(!i)throw new Error("PlatformVideoNode: i18n not provided in options");if(!s)throw new Error("PlatformVideoNode: videoPluginHook not provided in options");const o=document.createElement("div");o.className="PlatformVideo",o.setAttribute("data-pa-node","platformVideo"),o.setAttribute("data-video-id",n.attrs.videoId),o.setAttribute("data-platform",n.attrs.platform),o.setAttribute("contenteditable","false");const a=s.getThumbnailUrl({videoId:n.attrs.videoId,platform:n.attrs.platform});o.style.backgroundImage=`url(${a})`;const l=document.createElement("div");l.className="PlatformVideo-playButton",l.innerHTML=qh;const c=l.querySelector("svg");c&&(c.setAttribute("width","48"),c.setAttribute("height","48"),c.setAttribute("fill","white")),o.appendChild(l);async function d(){const h=await Gh({service:r,i18n:i,mode:"update",value:{videoId:n.attrs.videoId,platform:n.attrs.platform},videoPluginHook:s});if(h)if(h.action==="remove"){const f=t();typeof f=="number"&&e.commands.deleteRange({from:f,to:f+n.nodeSize})}else h.action==="update"&&h.value&&typeof t()=="number"&&e.chain().updateAttributes(n.type.name,{videoId:h.value.videoId,platform:h.value.platform}).run()}const u=()=>{d().catch(h=>{r.logger.error("Error handling PlatformVideo click:",h)})};return o.addEventListener("click",u),{dom:o,contentDOM:void 0,update:()=>!1,destroy:()=>{o.removeEventListener("click",u)}}}},addCommands(){return{insertPlatformVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}}),Tv=Et`
469
404
  .PlatformVideo {
470
405
  background-size: cover;
471
406
  background-position: center;
@@ -495,10 +430,10 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
495
430
  .PlatformVideo:hover .PlatformVideo-playButton {
496
431
  background: rgba(0, 0, 0, 0.9);
497
432
  }
498
- `,wE=it.create({name:"textSize",addAttributes(){return{value:{default:null,parseHTML:n=>n.classList.contains("text-size-small")?"small":n.classList.contains("text-size-large")?"large":n.classList.contains("text-size-huge")?"huge":null,renderHTML:n=>n.value?{class:`text-size-${n.value}`}:{}}}},keepOnSplit:!1,parseHTML(){return[{tag:"span.text-size-small"},{tag:"span.text-size-large"},{tag:"span.text-size-huge"}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}});var TE=Object.defineProperty,CE=Object.getOwnPropertyDescriptor,rn=(n,e,t,r)=>{for(var i=r>1?void 0:r?CE(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&TE(e,t,i),i};let kt=class extends Yt{firstUpdated(){const t=`calc(${this.service.fieldType.adminUi?.editorRows??26}rem + 79px)`;this.style.setProperty("--content-height",t);const r=this.shadowRoot?.querySelector(".tiptap-content");if(!r)return;const i=this.service.configuration.code??!1;this.editor=new Ny({element:r,extensions:[tE,Hk.configure({heading:{levels:[2,3,4]},code:i?!1:void 0,codeBlock:i?!1:void 0,link:!1}),cE.configure({openOnClick:!1,service:this.service,i18n:this.i18n}),i0.configure({types:["heading","paragraph"],defaultAlignment:void 0}),Wu,wE,e0,n0,...this.service.configuration.code?[Fy,(()=>{const s=this.i18n;return Xy.extend({addNodeView(){return({node:o,editor:a,getPos:l,decorations:c})=>new Yv(o,a,l,c,s)}}).configure({lowlight:Bh,defaultLanguage:"plaintext",languageClassPrefix:"language-",HTMLAttributes:{class:"code-block"}})})()]:[],pE.configure({service:this.service,getLanguage:()=>this.service.language,i18n:this.i18n}),nE.configure({service:this.service,i18n:this.i18n}),kE.configure({service:this.service,i18n:this.i18n}),xE.configure({service:this.service,i18n:this.i18n,videoPluginHook:this.videoPluginHook}),iE.configure({service:this.service,i18n:this.i18n,internalLinkPluginHook:this.internalLinkPluginHook})],content:this.initialContent,editable:!0,editorProps:{handlePaste:(s,o)=>dE(s,o,this.editor,this.service,this.i18n,this.videoPluginHook),handleDrop:(s,o)=>uE(s,o,this.editor,this.service,this.i18n)},onCreate:({editor:s})=>{s.view.updateState(s.view.state);const o=s.state.tr,a=H.create(o.doc,1);o.setSelection(a).setMeta("addToHistory",!1),s.view.dispatch(o)},onUpdate:({editor:s,transaction:o})=>{this.onChange&&this.onChange(s.getJSON()),this.toolbarRef?.refresh(),this.videoPluginHook&&o.docChanged&&EE(s,this.videoPluginHook)},onSelectionUpdate:()=>{this.toolbarRef?.refresh()}})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy()}setContent(n){this.editor?.commands.setContent(n)}getJSON(){return this.editor?.getJSON()}updateLanguage(n){this.i18n.setLanguage(n),this.toolbarRef?.refresh()}insertMedia(n,e,t,r,i){this.editor&&this.editor.commands.insertMedia({mediaId:n,resizeRule:e,align:t,zoomable:r,href:i})}insertLink(n,e){this.editor&&this.editor.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:e}}],text:n}).run()}async insertMediaFromGallery(n){if(n.kind==="file"){this.insertLink(n.originalName??n.url,n.url);return}if(n.kind==="image"){const e=this.service.themeConf.fTextImageResizeRules[0];if(!this.editor){this.service.logger.error("Editor not initialized");return}Uh(this.editor,{mediaId:n.mediaId,resizeRule:e,align:"center",zoomable:!0,href:void 0})}}handleContentClick(n){if(!this.editor)return;if(n.target.classList.contains("tiptap-content")){const t=this.editor.state.doc.content.size;this.editor.chain().focus().setTextSelection(t).run()}}render(){return z`
433
+ `,Cv=it.create({name:"textSize",addAttributes(){return{value:{default:null,parseHTML:n=>n.classList.contains("text-size-small")?"small":n.classList.contains("text-size-large")?"large":n.classList.contains("text-size-huge")?"huge":null,renderHTML:n=>n.value?{class:`text-size-${n.value}`}:{}}}},keepOnSplit:!1,parseHTML(){return[{tag:"span.text-size-small"},{tag:"span.text-size-large"},{tag:"span.text-size-huge"}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}});var Mv=Object.defineProperty,Av=Object.getOwnPropertyDescriptor,rn=(n,e,t,r)=>{for(var i=r>1?void 0:r?Av(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Mv(e,t,i),i};const Nv=t0.extend({content:"block*"}),_v=ma.extend({content:"block*"});let kt=class extends Yt{firstUpdated(){const t=`calc(${this.service.fieldType.adminUi?.editorRows??26}rem + 79px)`;this.style.setProperty("--content-height",t);const r=this.shadowRoot?.querySelector(".tiptap-content");if(!r)return;const i=this.service.configuration.code??!1;this.editor=new Oy({element:r,extensions:[Nv,rv,Uk.configure({document:!1,bulletList:!1,orderedList:!1,listItem:!1,heading:{levels:[2,3,4]},code:i?!1:void 0,codeBlock:i?!1:void 0,link:!1}),pa,ba,_v,uv.configure({openOnClick:!1,service:this.service,i18n:this.i18n}),k0.configure({types:["heading","paragraph"]}),rh,Cv,m0,b0,...this.service.configuration.code?[Vy,(()=>{const s=this.i18n;return e0.extend({addNodeView(){return({node:o,editor:a,getPos:l,decorations:c})=>new QE(o,a,l,c,s)}}).configure({lowlight:Hh,defaultLanguage:"plaintext",languageClassPrefix:"language-",HTMLAttributes:{class:"code-block"}})})()]:[],gv.configure({service:this.service,getLanguage:()=>this.service.language,i18n:this.i18n}),iv.configure({service:this.service,i18n:this.i18n}),vv.configure({service:this.service,i18n:this.i18n}),wv.configure({service:this.service,i18n:this.i18n,videoPluginHook:this.videoPluginHook}),ov.configure({service:this.service,i18n:this.i18n,internalLinkPluginHook:this.internalLinkPluginHook})],content:this.initialContent,editable:!0,editorProps:{handlePaste:(s,o)=>hv(s,o,this.editor,this.service,this.i18n,this.videoPluginHook),handleDrop:(s,o)=>fv(s,o,this.editor,this.service,this.i18n)},onCreate:({editor:s})=>{s.view.updateState(s.view.state);const o=s.state.tr,a=H.create(o.doc,1);o.setSelection(a).setMeta("addToHistory",!1),s.view.dispatch(o)},onUpdate:({editor:s,transaction:o})=>{this.onChange&&this.onChange(s.getJSON()),this.toolbarRef?.refresh(),this.videoPluginHook&&o.docChanged&&Sv(s,this.videoPluginHook)},onSelectionUpdate:()=>{this.toolbarRef?.refresh()}})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy()}setContent(n){this.editor?.commands.setContent(n)}getJSON(){return this.editor?.getJSON()}updateLanguage(n){this.i18n.setLanguage(n),this.toolbarRef?.refresh()}insertMedia(n,e,t,r,i){this.editor&&this.editor.commands.insertMedia({mediaId:n,resizeRule:e,align:t,zoomable:r,href:i})}insertLink(n,e){this.editor&&this.editor.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:e}}],text:n}).run()}async insertMediaFromGallery(n){if(n.kind==="file"){this.insertLink(n.originalName??n.url,n.url);return}if(n.kind==="image"){const e=this.service.themeConf.fTextImageResizeRules[0];if(!this.editor){this.service.logger.error("Editor not initialized");return}Kh(this.editor,{mediaId:n.mediaId,resizeRule:e,align:"center",zoomable:!0,href:void 0})}}handleContentClick(n){if(!this.editor)return;if(n.target.classList.contains("tiptap-content")){const t=this.editor.state.doc.content.size;this.editor.chain().focus().setTextSelection(t).run()}}render(){return z`
499
434
  <div class="tiptap-container">
500
435
  <tiptap-toolbar
501
- ${mv(n=>{this.toolbarRef=n})}
436
+ ${bE(n=>{this.toolbarRef=n})}
502
437
  .editor=${this.editor}
503
438
  .service=${this.service}
504
439
  .i18n=${this.i18n}
@@ -507,7 +442,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
507
442
  ></tiptap-toolbar>
508
443
  <div class="tiptap-content" @click=${this.handleContentClick}></div>
509
444
  </div>
510
- `}};kt.styles=[vt`
445
+ `}};kt.styles=[Et`
511
446
  :host {
512
447
  display: block;
513
448
  border: 1px solid #ccc;
@@ -608,7 +543,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
608
543
  white-space: normal;
609
544
  z-index: 10;
610
545
  }
611
- `,eE,gE,rE,vE,SE,oE];rn([Ee({attribute:!1})],kt.prototype,"service",2);rn([Ee({attribute:!1})],kt.prototype,"i18n",2);rn([Ee({attribute:!1})],kt.prototype,"videoPluginHook",2);rn([Ee({attribute:!1})],kt.prototype,"internalLinkPluginHook",2);rn([Ee({attribute:!1})],kt.prototype,"initialContent",2);rn([Ee({attribute:!1})],kt.prototype,"onChange",2);rn([Et()],kt.prototype,"editor",2);kt=rn([vs("tiptap-editor")],kt);async function ME(n,e,t){const r=await zh({service:e,initialValues:{html:""},mode:"insert",i18n:t});if(r&&r.action==="insert"&&r.values){const{from:i}=n.state.selection;n.chain().focus().insertHtmlSnippet(r.values).run();const s=i+1;n.state.doc.resolve(s).nodeAfter?n.commands.setTextSelection(s):n.chain().insertContentAt(s,"<p></p>").setTextSelection(s+1).run()}}async function AE(n,e,t){const{state:r}=n,{from:i}=r.selection,o=r.doc.resolve(i).nodeAfter;if(o?.type.name==="internalLink"&&o){const c=o.attrs.documentId,d=await t.openDialog(c||"",{getLanguage:()=>e.language});if(!d)return;d.documentId?n.chain().focus().deleteRange({from:i,to:i+o.nodeSize}).insertInternalLink(d.documentId).run():n.chain().focus().deleteRange({from:i,to:i+o.nodeSize}).run();return}const l=await t.openDialog("",{getLanguage:()=>e.language});!l||!l.documentId||n.chain().focus().deleteSelection().insertInternalLink(l.documentId).run()}async function NE(n,e,t){const{state:r}=n,{from:i,to:s,empty:o}=r.selection;if(o){e.showToast("Please select text to obfuscate",{severity:"info"});return}if(n.isActive("obfuscate")){const c=r.selection.$from.marks().find(u=>u.type.name==="obfuscate"),d=r.doc.textBetween(i,s);if(c){const u=await Po({service:e,i18n:t,initialContent:d,initialAsALink:c.attrs.asALink,mode:"update"});if(!u)return;u.action==="remove"?n.chain().focus().unsetObfuscate().run():u.action==="update"&&u.values&&n.chain().focus().deleteSelection().insertContent(u.values.content).setTextSelection({from:i,to:i+u.values.content.length}).setObfuscate(u.values.asALink).run()}}else{const l=r.doc.textBetween(i,s),c=yE(l),d=await Po({service:e,i18n:t,initialContent:l,initialAsALink:c,mode:"insert"});if(!d||d.action!=="insert"||!d.values)return;n.chain().focus().deleteSelection().insertContent(d.values.content).setTextSelection({from:i,to:i+d.values.content.length}).setObfuscate(d.values.asALink).run()}}async function _E(n,e,t,r){const i=await jh({service:e,i18n:t,mode:"insert",value:{videoId:"",platform:"youtube"},videoPluginHook:r});i&&i.action==="insert"&&i.value&&n.chain().focus().insertPlatformVideo(i.value).run()}var OE=Object.defineProperty,IE=Object.getOwnPropertyDescriptor,je=(n,e,t,r)=>{for(var i=r>1?void 0:r?IE(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&OE(e,t,i),i};let Pe=class extends Yt{constructor(){super(...arguments),this.options=[],this.buttonTooltip="",this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openUpward=!1,this.submenuOpenLeft=!1,this.handleKeydown=n=>{if(!this.isOpen){(n.key==="Enter"||n.key===" "||n.key==="ArrowDown")&&(n.preventDefault(),this.openDropdown());return}if(this.openSubmenuId!==void 0)switch(n.key){case"ArrowDown":{n.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=(this.highlightedSubmenuIndex+1)%e.length;break}case"ArrowUp":{n.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=this.highlightedSubmenuIndex<=0?e.length-1:this.highlightedSubmenuIndex-1;break}case"ArrowLeft":n.preventDefault(),this.openSubmenuId=void 0,this.highlightedSubmenuIndex=-1;break;case"Enter":case" ":{n.preventDefault();const t=(this.options[this.highlightedIndex]?.children??[])[this.highlightedSubmenuIndex];t&&!t.disabled&&this.handleOptionClick(t);break}case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}else switch(n.key){case"ArrowDown":n.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length;break;case"ArrowUp":n.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1;break;case"ArrowRight":{n.preventDefault();const e=this.options[this.highlightedIndex];e?.children&&e.children.length>0&&(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0);break}case"Enter":case" ":{n.preventDefault();const e=this.options[this.highlightedIndex];e&&(e.children&&e.children.length>0?(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0):e.disabled||this.handleOptionClick(e));break}case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener(),this.clearHoverTimeout()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=-1,this.openSubmenuId=void 0,this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openSubmenuId=void 0,this.openUpward=!1,this.submenuOpenLeft=!1,this.removeClickOutsideListener(),this.clearHoverTimeout()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const n=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-n.bottom;this.openUpward=r<e&&n.top>e}updateSubmenuPositioning(n){if(!this.submenuElement)return;const e=n.getBoundingClientRect(),t=this.submenuElement.offsetWidth,i=window.innerWidth-e.right;this.submenuOpenLeft=i<t&&e.left>t}addClickOutsideListener(){this.clickOutsideHandler=n=>{n.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}clearHoverTimeout(){this.hoverTimeoutId!==void 0&&(window.clearTimeout(this.hoverTimeoutId),this.hoverTimeoutId=void 0)}handleOptionMouseEnter(n,e){this.highlightedIndex=e,n.children&&n.children.length>0?(this.clearHoverTimeout(),this.hoverTimeoutId=window.setTimeout(()=>{this.openSubmenuId=n.id,this.updateComplete.then(()=>{const t=this.panelElement?.querySelector(`.option[data-index="${e}"]`);t&&this.updateSubmenuPositioning(t)})},200)):this.openSubmenuId=void 0}handleOptionMouseLeave(){this.clearHoverTimeout()}handleSubmenuMouseEnter(n){this.highlightedSubmenuIndex=n}async handleOptionClick(n){n.disabled||(n.action&&await n.action(),this.closeDropdown())}renderOption(n,e,t=!1){const r=["option",n.active?"active":"",n.disabled?"disabled":"",n.children?"has-submenu":"",(t?this.highlightedSubmenuIndex:this.highlightedIndex)===e?"highlighted":""].filter(Boolean).join(" ");return z`
546
+ `,nv,yv,sv,xv,Tv,lv];rn([ve({attribute:!1})],kt.prototype,"service",2);rn([ve({attribute:!1})],kt.prototype,"i18n",2);rn([ve({attribute:!1})],kt.prototype,"videoPluginHook",2);rn([ve({attribute:!1})],kt.prototype,"internalLinkPluginHook",2);rn([ve({attribute:!1})],kt.prototype,"initialContent",2);rn([ve({attribute:!1})],kt.prototype,"onChange",2);rn([vt()],kt.prototype,"editor",2);kt=rn([Es("tiptap-editor")],kt);async function Ov(n,e,t){const r=await Fh({service:e,initialValues:{html:""},mode:"insert",i18n:t});if(r&&r.action==="insert"&&r.values){const{from:i}=n.state.selection;n.chain().focus().insertHtmlSnippet(r.values).run();const s=i+1;n.state.doc.resolve(s).nodeAfter?n.commands.setTextSelection(s):n.chain().insertContentAt(s,"<p></p>").setTextSelection(s+1).run()}}async function Iv(n,e,t){const{state:r}=n,{from:i}=r.selection,o=r.doc.resolve(i).nodeAfter;if(o?.type.name==="internalLink"&&o){const c=o.attrs.documentId,d=await t.openDialog(c||"",{getLanguage:()=>e.language});if(!d)return;d.documentId?n.chain().focus().deleteRange({from:i,to:i+o.nodeSize}).insertInternalLink(d.documentId).run():n.chain().focus().deleteRange({from:i,to:i+o.nodeSize}).run();return}const l=await t.openDialog("",{getLanguage:()=>e.language});!l||!l.documentId||n.chain().focus().deleteSelection().insertInternalLink(l.documentId).run()}async function Lv(n,e,t){const{state:r}=n,{from:i,to:s,empty:o}=r.selection;if(o){e.showToast("Please select text to obfuscate",{severity:"info"});return}if(n.isActive("obfuscate")){const c=r.selection.$from.marks().find(u=>u.type.name==="obfuscate"),d=r.doc.textBetween(i,s);if(c){const u=await Po({service:e,i18n:t,initialContent:d,initialAsALink:c.attrs.asALink,mode:"update"});if(!u)return;u.action==="remove"?n.chain().focus().unsetObfuscate().run():u.action==="update"&&u.values&&n.chain().focus().deleteSelection().insertContent(u.values.content).setTextSelection({from:i,to:i+u.values.content.length}).setObfuscate(u.values.asALink).run()}}else{const l=r.doc.textBetween(i,s),c=Ev(l),d=await Po({service:e,i18n:t,initialContent:l,initialAsALink:c,mode:"insert"});if(!d||d.action!=="insert"||!d.values)return;n.chain().focus().deleteSelection().insertContent(d.values.content).setTextSelection({from:i,to:i+d.values.content.length}).setObfuscate(d.values.asALink).run()}}async function Rv(n,e,t,r){const i=await Gh({service:e,i18n:t,mode:"insert",value:{videoId:"",platform:"youtube"},videoPluginHook:r});i&&i.action==="insert"&&i.value&&n.chain().focus().insertPlatformVideo(i.value).run()}var Dv=Object.defineProperty,$v=Object.getOwnPropertyDescriptor,je=(n,e,t,r)=>{for(var i=r>1?void 0:r?$v(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Dv(e,t,i),i};let Pe=class extends Yt{constructor(){super(...arguments),this.options=[],this.buttonTooltip="",this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openUpward=!1,this.submenuOpenLeft=!1,this.handleKeydown=n=>{if(!this.isOpen){(n.key==="Enter"||n.key===" "||n.key==="ArrowDown")&&(n.preventDefault(),this.openDropdown());return}if(this.openSubmenuId!==void 0)switch(n.key){case"ArrowDown":{n.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=(this.highlightedSubmenuIndex+1)%e.length;break}case"ArrowUp":{n.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=this.highlightedSubmenuIndex<=0?e.length-1:this.highlightedSubmenuIndex-1;break}case"ArrowLeft":n.preventDefault(),this.openSubmenuId=void 0,this.highlightedSubmenuIndex=-1;break;case"Enter":case" ":{n.preventDefault();const t=(this.options[this.highlightedIndex]?.children??[])[this.highlightedSubmenuIndex];t&&!t.disabled&&this.handleOptionClick(t);break}case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}else switch(n.key){case"ArrowDown":n.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length;break;case"ArrowUp":n.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1;break;case"ArrowRight":{n.preventDefault();const e=this.options[this.highlightedIndex];e?.children&&e.children.length>0&&(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0);break}case"Enter":case" ":{n.preventDefault();const e=this.options[this.highlightedIndex];e&&(e.children&&e.children.length>0?(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0):e.disabled||this.handleOptionClick(e));break}case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener(),this.clearHoverTimeout()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=-1,this.openSubmenuId=void 0,this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openSubmenuId=void 0,this.openUpward=!1,this.submenuOpenLeft=!1,this.removeClickOutsideListener(),this.clearHoverTimeout()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const n=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-n.bottom;this.openUpward=r<e&&n.top>e}updateSubmenuPositioning(n){if(!this.submenuElement)return;const e=n.getBoundingClientRect(),t=this.submenuElement.offsetWidth,i=window.innerWidth-e.right;this.submenuOpenLeft=i<t&&e.left>t}addClickOutsideListener(){this.clickOutsideHandler=n=>{n.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}clearHoverTimeout(){this.hoverTimeoutId!==void 0&&(window.clearTimeout(this.hoverTimeoutId),this.hoverTimeoutId=void 0)}handleOptionMouseEnter(n,e){this.highlightedIndex=e,n.children&&n.children.length>0?(this.clearHoverTimeout(),this.hoverTimeoutId=window.setTimeout(()=>{this.openSubmenuId=n.id,this.updateComplete.then(()=>{const t=this.panelElement?.querySelector(`.option[data-index="${e}"]`);t&&this.updateSubmenuPositioning(t)})},200)):this.openSubmenuId=void 0}handleOptionMouseLeave(){this.clearHoverTimeout()}handleSubmenuMouseEnter(n){this.highlightedSubmenuIndex=n}async handleOptionClick(n){n.disabled||(n.action&&await n.action(),this.closeDropdown())}renderOption(n,e,t=!1){const r=["option",n.active?"active":"",n.disabled?"disabled":"",n.children?"has-submenu":"",(t?this.highlightedSubmenuIndex:this.highlightedIndex)===e?"highlighted":""].filter(Boolean).join(" ");return z`
612
547
  ${n.separator==="before"?z`<div class="separator"></div>`:""}
613
548
  <div
614
549
  class=${r}
@@ -651,7 +586,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
651
586
  `)}
652
587
  </div>
653
588
  `:""}
654
- `}};Pe.styles=vt`
589
+ `}};Pe.styles=Et`
655
590
  :host {
656
591
  position: relative;
657
592
  display: inline-flex;
@@ -772,7 +707,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
772
707
  padding-left: 16px;
773
708
  }
774
709
  }
775
- `;je([Ee({attribute:!1})],Pe.prototype,"options",2);je([Ee({attribute:!1})],Pe.prototype,"buttonIcon",2);je([Ee({attribute:!1})],Pe.prototype,"buttonTooltip",2);je([Ee({attribute:!1})],Pe.prototype,"i18n",2);je([Et()],Pe.prototype,"isOpen",2);je([Et()],Pe.prototype,"openSubmenuId",2);je([Et()],Pe.prototype,"highlightedIndex",2);je([Et()],Pe.prototype,"highlightedSubmenuIndex",2);je([Et()],Pe.prototype,"openUpward",2);je([Et()],Pe.prototype,"submenuOpenLeft",2);je([Pr("button")],Pe.prototype,"buttonElement",2);je([Pr(".panel")],Pe.prototype,"panelElement",2);je([Pr(".submenu")],Pe.prototype,"submenuElement",2);Pe=je([vs("tiptap-nested-dropdown")],Pe);var LE=Object.defineProperty,RE=Object.getOwnPropertyDescriptor,Lt=(n,e,t,r)=>{for(var i=r>1?void 0:r?RE(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&LE(e,t,i),i};let ut=class extends Yt{constructor(){super(...arguments),this.options=[],this.value="",this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.handleKeydown=n=>{if(!this.isOpen){(n.key==="Enter"||n.key===" "||n.key==="ArrowDown")&&(n.preventDefault(),this.openDropdown());return}switch(n.key){case"ArrowDown":n.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length,this.scrollHighlightedIntoView();break;case"ArrowUp":n.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1,this.scrollHighlightedIntoView();break;case"Enter":case" ":n.preventDefault(),this.highlightedIndex>=0&&this.highlightedIndex<this.options.length&&this.selectOption(this.options[this.highlightedIndex].value);break;case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=this.options.findIndex(n=>n.value===this.value),this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.removeClickOutsideListener()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const n=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-n.bottom;this.openUpward=r<e&&n.top>e}addClickOutsideListener(){this.clickOutsideHandler=n=>{n.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}scrollHighlightedIntoView(){this.updateComplete.then(()=>{const n=this.panelElement?.querySelector(".option.highlighted");n&&n.scrollIntoView({block:"nearest"})})}selectOption(n){this.value=n,this.dispatchEvent(new CustomEvent("change",{detail:{value:n},bubbles:!0,composed:!0})),this.closeDropdown()}render(){const n=this.options.find(e=>e.value===this.value);return z`
710
+ `;je([ve({attribute:!1})],Pe.prototype,"options",2);je([ve({attribute:!1})],Pe.prototype,"buttonIcon",2);je([ve({attribute:!1})],Pe.prototype,"buttonTooltip",2);je([ve({attribute:!1})],Pe.prototype,"i18n",2);je([vt()],Pe.prototype,"isOpen",2);je([vt()],Pe.prototype,"openSubmenuId",2);je([vt()],Pe.prototype,"highlightedIndex",2);je([vt()],Pe.prototype,"highlightedSubmenuIndex",2);je([vt()],Pe.prototype,"openUpward",2);je([vt()],Pe.prototype,"submenuOpenLeft",2);je([Pr("button")],Pe.prototype,"buttonElement",2);je([Pr(".panel")],Pe.prototype,"panelElement",2);je([Pr(".submenu")],Pe.prototype,"submenuElement",2);Pe=je([Es("tiptap-nested-dropdown")],Pe);var Pv=Object.defineProperty,Bv=Object.getOwnPropertyDescriptor,Lt=(n,e,t,r)=>{for(var i=r>1?void 0:r?Bv(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Pv(e,t,i),i};let ut=class extends Yt{constructor(){super(...arguments),this.options=[],this.value="",this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.handleKeydown=n=>{if(!this.isOpen){(n.key==="Enter"||n.key===" "||n.key==="ArrowDown")&&(n.preventDefault(),this.openDropdown());return}switch(n.key){case"ArrowDown":n.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length,this.scrollHighlightedIntoView();break;case"ArrowUp":n.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1,this.scrollHighlightedIntoView();break;case"Enter":case" ":n.preventDefault(),this.highlightedIndex>=0&&this.highlightedIndex<this.options.length&&this.selectOption(this.options[this.highlightedIndex].value);break;case"Escape":n.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=this.options.findIndex(n=>n.value===this.value),this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.removeClickOutsideListener()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const n=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-n.bottom;this.openUpward=r<e&&n.top>e}addClickOutsideListener(){this.clickOutsideHandler=n=>{n.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}scrollHighlightedIntoView(){this.updateComplete.then(()=>{const n=this.panelElement?.querySelector(".option.highlighted");n&&n.scrollIntoView({block:"nearest"})})}selectOption(n){this.value=n,this.dispatchEvent(new CustomEvent("change",{detail:{value:n},bubbles:!0,composed:!0})),this.closeDropdown()}render(){const n=this.options.find(e=>e.value===this.value);return z`
776
711
  <button
777
712
  type="button"
778
713
  role="combobox"
@@ -800,7 +735,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
800
735
  `)}
801
736
  </div>
802
737
  `:""}
803
- `}};ut.styles=vt`
738
+ `}};ut.styles=Et`
804
739
  :host {
805
740
  position: relative;
806
741
  display: inline-flex;
@@ -880,7 +815,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
880
815
  display: block;
881
816
  }
882
817
  }
883
- `;Lt([Ee({attribute:!1})],ut.prototype,"options",2);Lt([Ee()],ut.prototype,"value",2);Lt([Ee({attribute:!1})],ut.prototype,"i18n",2);Lt([Et()],ut.prototype,"isOpen",2);Lt([Et()],ut.prototype,"highlightedIndex",2);Lt([Et()],ut.prototype,"openUpward",2);Lt([Pr("button")],ut.prototype,"buttonElement",2);Lt([Pr(".panel")],ut.prototype,"panelElement",2);ut=Lt([vs("tiptap-styled-dropdown")],ut);const DE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"/></svg>',$E='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg>',PE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0z"/><path d="M8 12h8"/></svg>',BE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis-vertical-icon lucide-ellipsis-vertical"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>',zE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',HE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-symlink-icon lucide-file-symlink"><path d="m10 18 3-3-3-3"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7"/></svg>',FE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" x2="10" y1="4" y2="4"/><line x1="14" x2="5" y1="20" y2="20"/><line x1="15" x2="9" y1="4" y2="20"/></svg>',UE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>',VE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12h11"/><path d="M10 18h11"/><path d="M10 6h11"/><path d="M4 10h2"/><path d="M4 6h1v4"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>',KE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/></svg>',WE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',jE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-quote-icon lucide-quote"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/></svg>',qE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',GE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="m10 10-2 2 2 2"></path><path d="m14 14 2-2-2-2"></path></svg>',JE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" x2="20" y1="12" y2="12"/></svg>',ZE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M6 18h12"/><path d="M3 6h18"/></svg>',YE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M9 18h12"/><path d="M3 6h18"/></svg>',XE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M3 18h12"/><path d="M3 6h18"/></svg>',QE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>';function be(n){return z`${Hh(n)}`}var ex=Object.defineProperty,tx=Object.getOwnPropertyDescriptor,Yn=(n,e,t,r)=>{for(var i=r>1?void 0:r?tx(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ex(e,t,i),i};let en=class extends Yt{refresh(){this.requestUpdate()}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}setHeading(n){n===0?this.editor?.chain().focus().setParagraph().run():this.editor?.chain().focus().setHeading({level:n}).run()}toggleBulletList(){this.editor?.chain().focus().toggleBulletList().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}async setLink(){if(!this.editor||!this.service||!this.i18n)return;const{state:n}=this.editor,{from:e,to:t}=n.selection,r=n.doc.textBetween(e,t,""),i=await Fh({service:this.service,i18n:this.i18n,initialLabel:r,mode:"insert"});!i||!i.values||(r&&r!==i.values.label?this.editor.chain().focus().deleteSelection().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run():r?this.editor.chain().focus().setLink({href:i.values.href,target:i.values.target}).setTextSelection(t).run():this.editor.chain().focus().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run())}setAlignment(n){n===""?this.editor?.chain().focus().unsetTextAlign().run():this.editor?.chain().focus().setTextAlign(n).run()}setTextSize(n){const e=this.editor;e&&(n===""?e.chain().focus().unsetMark("textSize").run():e.chain().focus().setMark("textSize",{value:n}).run())}undo(){this.editor?.chain().focus().undo().run()}redo(){this.editor?.chain().focus().redo().run()}clearFormatting(){this.editor?.chain().focus().clearNodes().unsetAllMarks().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}async handleInsertHtmlSnippet(){!this.editor||!this.service||!this.i18n||await ME(this.editor,this.service,this.i18n)}async handleToggleObfuscate(){!this.editor||!this.service||!this.i18n||await NE(this.editor,this.service,this.i18n)}async handleInsertVideo(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.videoPluginHook){this.service.showToast("Video plugin not available",{severity:"warn"});return}await _E(this.editor,this.service,this.i18n,this.videoPluginHook)}}async handleToggleInternalLink(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.internalLinkPluginHook){this.service.showToast("Internal link plugin not available",{severity:"warn"});return}await AE(this.editor,this.service,this.internalLinkPluginHook)}}render(){if(!this.editor)return z``;const n=[{value:"0",tooltip:this.i18n?.t("toolbar.paragraph")??"Paragraph",content:z`<span style="font-size: 1em; font-weight: normal;">${this.i18n?.t("toolbar.paragraph")??"Paragraph"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.paragraphShort")??"P"}</b>`},{value:"2",tooltip:this.i18n?.t("toolbar.heading2")??"Heading 2",content:z`<span style="font-size: 1.5em; font-weight: bold;">${this.i18n?.t("toolbar.heading2")??"Heading 2"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading2Short")??"H2"}</b>`},{value:"3",tooltip:this.i18n?.t("toolbar.heading3")??"Heading 3",content:z`<span style="font-size: 1.17em; font-weight: bold;">${this.i18n?.t("toolbar.heading3")??"Heading 3"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading3Short")??"H3"}</b>`},{value:"4",tooltip:this.i18n?.t("toolbar.heading4")??"Heading 4",content:z`<span style="font-size: 1em; font-weight: bold;">${this.i18n?.t("toolbar.heading4")??"Heading 4"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading4Short")??"H4"}</b>`}],e=this.editor.isActive("heading",{level:2})?"2":this.editor.isActive("heading",{level:3})?"3":this.editor.isActive("heading",{level:4})?"4":"0",t=[];t.push({id:"obfuscate",label:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",icon:be(WE),tooltip:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",action:()=>this.handleToggleObfuscate(),active:this.editor.isActive("obfuscate"),separator:"after"}),this.service?.configuration?.code&&(t.push({id:"code-block",label:this.i18n?.t("toolbar.codeBlock")??"Code Block",icon:be(GE),tooltip:this.i18n?.t("toolbar.codeBlock")??"Code Block",action:()=>this.toggleCodeBlock(),active:this.editor.isActive("codeBlock")}),t.push({id:"inline-code",label:this.i18n?.t("toolbar.code")??"Inline Code",icon:be($E),tooltip:this.i18n?.t("toolbar.code")??"Inline Code",action:()=>this.toggleCode(),active:this.editor.isActive("code"),separator:"after"})),t.push({id:"html-snippet",label:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",icon:be(PE),tooltip:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",action:()=>this.handleInsertHtmlSnippet()}),this.videoPluginHook&&t.push({id:"video",label:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",icon:be(Wh),tooltip:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",action:()=>this.handleInsertVideo()}),t.length>0&&(t[t.length-1].separator="after");const r=this.editor.isActive("textSize",{value:"small"})?"small":this.editor.isActive("textSize",{value:"large"})?"large":this.editor.isActive("textSize",{value:"huge"})?"huge":"";return t.push({id:"text-size",label:this.i18n?.t("toolbar.textSize")??"Text size",tooltip:this.i18n?.t("toolbar.textSize")??"Text size",children:[{id:"text-size-small",label:this.i18n?.t("toolbar.textSizeSmall")??"Small",content:z`<span style="font-size: 0.5625em;">${this.i18n?.t("toolbar.textSizeSmall")??"Small"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeSmall")??"Small",action:()=>this.setTextSize("small"),active:r==="small"},{id:"text-size-normal",label:this.i18n?.t("toolbar.textSizeNormal")??"Normal",content:z`<span style="font-size: 1em;">${this.i18n?.t("toolbar.textSizeNormal")??"Normal"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeNormal")??"Normal",action:()=>this.setTextSize(""),active:r===""},{id:"text-size-large",label:this.i18n?.t("toolbar.textSizeLarge")??"Large",content:z`<span style="font-size: 2em;">${this.i18n?.t("toolbar.textSizeLarge")??"Large"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeLarge")??"Large",action:()=>this.setTextSize("large"),active:r==="large"},{id:"text-size-huge",label:this.i18n?.t("toolbar.textSizeHuge")??"Huge",content:z`<span style="font-size: 4em;">${this.i18n?.t("toolbar.textSizeHuge")??"Huge"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeHuge")??"Huge",action:()=>this.setTextSize("huge"),active:r==="huge"}]}),t.push({id:"clear-formatting",label:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",icon:be(zE),tooltip:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",action:()=>this.clearFormatting(),separator:"before"}),z`
818
+ `;Lt([ve({attribute:!1})],ut.prototype,"options",2);Lt([ve()],ut.prototype,"value",2);Lt([ve({attribute:!1})],ut.prototype,"i18n",2);Lt([vt()],ut.prototype,"isOpen",2);Lt([vt()],ut.prototype,"highlightedIndex",2);Lt([vt()],ut.prototype,"openUpward",2);Lt([Pr("button")],ut.prototype,"buttonElement",2);Lt([Pr(".panel")],ut.prototype,"panelElement",2);ut=Lt([Es("tiptap-styled-dropdown")],ut);const zv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"/></svg>',Hv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg>',Fv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0z"/><path d="M8 12h8"/></svg>',Uv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis-vertical-icon lucide-ellipsis-vertical"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>',Vv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',Kv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-symlink-icon lucide-file-symlink"><path d="m10 18 3-3-3-3"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7"/></svg>',Wv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" x2="10" y1="4" y2="4"/><line x1="14" x2="5" y1="20" y2="20"/><line x1="15" x2="9" y1="4" y2="20"/></svg>',jv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>',qv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12h11"/><path d="M10 18h11"/><path d="M10 6h11"/><path d="M4 10h2"/><path d="M4 6h1v4"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>',Gv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/></svg>',Jv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',Zv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-quote-icon lucide-quote"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/></svg>',Yv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',Xv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="m10 10-2 2 2 2"></path><path d="m14 14 2-2-2-2"></path></svg>',Qv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" x2="20" y1="12" y2="12"/></svg>',ex='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M6 18h12"/><path d="M3 6h18"/></svg>',tx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M9 18h12"/><path d="M3 6h18"/></svg>',nx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M3 18h12"/><path d="M3 6h18"/></svg>',rx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>';function be(n){return z`${Uh(n)}`}var ix=Object.defineProperty,sx=Object.getOwnPropertyDescriptor,Yn=(n,e,t,r)=>{for(var i=r>1?void 0:r?sx(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ix(e,t,i),i};let en=class extends Yt{refresh(){this.requestUpdate()}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}setHeading(n){n===0?this.editor?.chain().focus().setParagraph().run():this.editor?.chain().focus().setHeading({level:n}).run()}toggleBulletList(){this.editor?.chain().focus().toggleBulletList().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}async setLink(){if(!this.editor||!this.service||!this.i18n)return;const{state:n}=this.editor,{from:e,to:t}=n.selection,r=n.doc.textBetween(e,t,""),i=await Vh({service:this.service,i18n:this.i18n,initialLabel:r,mode:"insert"});!i||!i.values||(r&&r!==i.values.label?this.editor.chain().focus().deleteSelection().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run():r?this.editor.chain().focus().setLink({href:i.values.href,target:i.values.target}).setTextSelection(t).run():this.editor.chain().focus().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run())}setAlignment(n){n===""?this.editor?.chain().focus().unsetTextAlign().run():this.editor?.chain().focus().setTextAlign(n).run()}setTextSize(n){const e=this.editor;e&&(n===""?e.chain().focus().unsetMark("textSize").run():e.chain().focus().setMark("textSize",{value:n}).run())}undo(){this.editor?.chain().focus().undo().run()}redo(){this.editor?.chain().focus().redo().run()}clearFormatting(){this.editor?.chain().focus().clearNodes().unsetAllMarks().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}async handleInsertHtmlSnippet(){!this.editor||!this.service||!this.i18n||await Ov(this.editor,this.service,this.i18n)}async handleToggleObfuscate(){!this.editor||!this.service||!this.i18n||await Lv(this.editor,this.service,this.i18n)}async handleInsertVideo(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.videoPluginHook){this.service.showToast("Video plugin not available",{severity:"warn"});return}await Rv(this.editor,this.service,this.i18n,this.videoPluginHook)}}async handleToggleInternalLink(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.internalLinkPluginHook){this.service.showToast("Internal link plugin not available",{severity:"warn"});return}await Iv(this.editor,this.service,this.internalLinkPluginHook)}}render(){if(!this.editor)return z``;const n=[{value:"0",tooltip:this.i18n?.t("toolbar.paragraph")??"Paragraph",content:z`<span style="font-size: 1em; font-weight: normal;">${this.i18n?.t("toolbar.paragraph")??"Paragraph"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.paragraphShort")??"P"}</b>`},{value:"2",tooltip:this.i18n?.t("toolbar.heading2")??"Heading 2",content:z`<span style="font-size: 1.5em; font-weight: bold;">${this.i18n?.t("toolbar.heading2")??"Heading 2"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading2Short")??"H2"}</b>`},{value:"3",tooltip:this.i18n?.t("toolbar.heading3")??"Heading 3",content:z`<span style="font-size: 1.17em; font-weight: bold;">${this.i18n?.t("toolbar.heading3")??"Heading 3"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading3Short")??"H3"}</b>`},{value:"4",tooltip:this.i18n?.t("toolbar.heading4")??"Heading 4",content:z`<span style="font-size: 1em; font-weight: bold;">${this.i18n?.t("toolbar.heading4")??"Heading 4"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading4Short")??"H4"}</b>`}],e=this.editor.isActive("heading",{level:2})?"2":this.editor.isActive("heading",{level:3})?"3":this.editor.isActive("heading",{level:4})?"4":"0",t=[];t.push({id:"obfuscate",label:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",icon:be(Jv),tooltip:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",action:()=>this.handleToggleObfuscate(),active:this.editor.isActive("obfuscate"),separator:"after"}),this.service?.configuration?.code&&(t.push({id:"code-block",label:this.i18n?.t("toolbar.codeBlock")??"Code Block",icon:be(Xv),tooltip:this.i18n?.t("toolbar.codeBlock")??"Code Block",action:()=>this.toggleCodeBlock(),active:this.editor.isActive("codeBlock")}),t.push({id:"inline-code",label:this.i18n?.t("toolbar.code")??"Inline Code",icon:be(Hv),tooltip:this.i18n?.t("toolbar.code")??"Inline Code",action:()=>this.toggleCode(),active:this.editor.isActive("code"),separator:"after"})),t.push({id:"html-snippet",label:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",icon:be(Fv),tooltip:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",action:()=>this.handleInsertHtmlSnippet()}),this.videoPluginHook&&t.push({id:"video",label:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",icon:be(qh),tooltip:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",action:()=>this.handleInsertVideo()}),t.length>0&&(t[t.length-1].separator="after");const r=this.editor.isActive("textSize",{value:"small"})?"small":this.editor.isActive("textSize",{value:"large"})?"large":this.editor.isActive("textSize",{value:"huge"})?"huge":"";return t.push({id:"text-size",label:this.i18n?.t("toolbar.textSize")??"Text size",tooltip:this.i18n?.t("toolbar.textSize")??"Text size",children:[{id:"text-size-small",label:this.i18n?.t("toolbar.textSizeSmall")??"Small",content:z`<span style="font-size: 0.5625em;">${this.i18n?.t("toolbar.textSizeSmall")??"Small"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeSmall")??"Small",action:()=>this.setTextSize("small"),active:r==="small"},{id:"text-size-normal",label:this.i18n?.t("toolbar.textSizeNormal")??"Normal",content:z`<span style="font-size: 1em;">${this.i18n?.t("toolbar.textSizeNormal")??"Normal"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeNormal")??"Normal",action:()=>this.setTextSize(""),active:r===""},{id:"text-size-large",label:this.i18n?.t("toolbar.textSizeLarge")??"Large",content:z`<span style="font-size: 2em;">${this.i18n?.t("toolbar.textSizeLarge")??"Large"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeLarge")??"Large",action:()=>this.setTextSize("large"),active:r==="large"},{id:"text-size-huge",label:this.i18n?.t("toolbar.textSizeHuge")??"Huge",content:z`<span style="font-size: 4em;">${this.i18n?.t("toolbar.textSizeHuge")??"Huge"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeHuge")??"Huge",action:()=>this.setTextSize("huge"),active:r==="huge"}]}),t.push({id:"clear-formatting",label:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",icon:be(Vv),tooltip:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",action:()=>this.clearFormatting(),separator:"before"}),z`
884
819
  <div class="toolbar">
885
820
  <tiptap-styled-dropdown
886
821
  .options=${n}
@@ -896,28 +831,28 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
896
831
  class=${this.editor.isActive("bold")?"active":""}
897
832
  title=${this.i18n?.t("toolbar.bold")??"Bold"}
898
833
  >
899
- ${be(DE)}
834
+ ${be(zv)}
900
835
  </button>
901
836
  <button
902
837
  @click=${()=>this.toggleItalic()}
903
838
  class=${this.editor.isActive("italic")?"active":""}
904
839
  title=${this.i18n?.t("toolbar.italic")??"Italic"}
905
840
  >
906
- ${be(FE)}
841
+ ${be(Wv)}
907
842
  </button>
908
843
  <button
909
844
  @click=${()=>this.toggleStrike()}
910
845
  class=${this.editor.isActive("strike")?"active":""}
911
846
  title=${this.i18n?.t("toolbar.strikethrough")??"Strikethrough"}
912
847
  >
913
- ${be(JE)}
848
+ ${be(Qv)}
914
849
  </button>
915
850
  <button
916
851
  @click=${()=>this.setLink()}
917
852
  class=${this.editor.isActive("link")?"active":""}
918
853
  title=${this.i18n?.t("toolbar.link")??"Link"}
919
854
  >
920
- ${be(UE)}
855
+ ${be(jv)}
921
856
  </button>
922
857
  ${this.internalLinkPluginHook?z`
923
858
  <button
@@ -925,7 +860,7 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
925
860
  class=${this.editor.isActive("internalLink")?"active":""}
926
861
  title=${this.i18n?.t("internalLinkNode.insertInternalLink")??"Insert Internal Link"}
927
862
  >
928
- ${be(HE)}
863
+ ${be(Kv)}
929
864
  </button>
930
865
  `:""}
931
866
 
@@ -936,27 +871,27 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
936
871
  class=${this.editor.isActive("blockquote")?"active":""}
937
872
  title=${this.i18n?.t("toolbar.blockquote")??"Blockquote"}
938
873
  >
939
- ${be(jE)}
874
+ ${be(Zv)}
940
875
  </button>
941
876
  <button
942
877
  @click=${()=>this.toggleBulletList()}
943
878
  class=${this.editor.isActive("bulletList")?"active":""}
944
879
  title=${this.i18n?.t("toolbar.bulletList")??"Bullet List"}
945
880
  >
946
- ${be(KE)}
881
+ ${be(Gv)}
947
882
  </button>
948
883
  <button
949
884
  @click=${()=>this.toggleOrderedList()}
950
885
  class=${this.editor.isActive("orderedList")?"active":""}
951
886
  title=${this.i18n?.t("toolbar.orderedList")??"Ordered List"}
952
887
  >
953
- ${be(VE)}
888
+ ${be(qv)}
954
889
  </button>
955
890
 
956
891
  <div class="separator"></div>
957
892
 
958
893
  <tiptap-styled-dropdown
959
- .options=${[{value:"",tooltip:this.i18n?.t("toolbar.alignmentDefault")??"Default",content:be(XE)},{value:"center",tooltip:this.i18n?.t("toolbar.alignmentCenter")??"Center",content:be(ZE)},{value:"right",tooltip:this.i18n?.t("toolbar.alignmentRight")??"Right",content:be(YE)}]}
894
+ .options=${[{value:"",tooltip:this.i18n?.t("toolbar.alignmentDefault")??"Default",content:be(nx)},{value:"center",tooltip:this.i18n?.t("toolbar.alignmentCenter")??"Center",content:be(ex)},{value:"right",tooltip:this.i18n?.t("toolbar.alignmentRight")??"Right",content:be(tx)}]}
960
895
  .value=${this.editor.isActive({textAlign:"center"})?"center":this.editor.isActive({textAlign:"right"})?"right":""}
961
896
  .i18n=${this.i18n}
962
897
  @change=${i=>this.setAlignment(i.detail.value)}
@@ -964,17 +899,17 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
964
899
 
965
900
  <div class="separator"></div>
966
901
 
967
- <button @click=${()=>this.undo()} ?disabled=${!this.editor.can().undo()} title=${this.i18n?.t("toolbar.undo")??"Undo"}>${be(QE)}</button>
968
- <button @click=${()=>this.redo()} ?disabled=${!this.editor.can().redo()} title=${this.i18n?.t("toolbar.redo")??"Redo"}>${be(qE)}</button>
902
+ <button @click=${()=>this.undo()} ?disabled=${!this.editor.can().undo()} title=${this.i18n?.t("toolbar.undo")??"Undo"}>${be(rx)}</button>
903
+ <button @click=${()=>this.redo()} ?disabled=${!this.editor.can().redo()} title=${this.i18n?.t("toolbar.redo")??"Redo"}>${be(Yv)}</button>
969
904
 
970
905
  <tiptap-nested-dropdown
971
906
  .options=${t}
972
- .buttonIcon=${be(BE)}
907
+ .buttonIcon=${be(Uv)}
973
908
  .buttonTooltip=${this.i18n?.t("toolbar.more")??"More"}
974
909
  .i18n=${this.i18n}
975
910
  ></tiptap-nested-dropdown>
976
911
  </div>
977
- `}};en.styles=vt`
912
+ `}};en.styles=Et`
978
913
  :host {
979
914
  display: block;
980
915
  border-bottom: 1px solid #ccc;
@@ -1023,4 +958,4 @@ function $c(n){return typeof n=="object"&&n!==null&&"j"in n}const Bf={en:{en:"En
1023
958
  height: 18px;
1024
959
  display: block;
1025
960
  }
1026
- `;Yn([Ee({attribute:!1})],en.prototype,"editor",2);Yn([Ee({attribute:!1})],en.prototype,"service",2);Yn([Ee({attribute:!1})],en.prototype,"i18n",2);Yn([Ee({attribute:!1})],en.prototype,"videoPluginHook",2);Yn([Ee({attribute:!1})],en.prototype,"internalLinkPluginHook",2);en=Yn([vs("tiptap-toolbar")],en);function nx(){const n={videoPlugin:void 0,internalLinkPlugin:void 0};return{get videoPlugin(){return n.videoPlugin},get internalLinkPlugin(){return n.internalLinkPlugin},service:{registerVideoPlugin(e){if(n.videoPlugin)throw new Error("Video plugin already registered");n.videoPlugin=e},registerInternalLinkPlugin(e){if(n.internalLinkPlugin)throw new Error("Internal link plugin already registered");n.internalLinkPlugin=e}}}}const rx="Entfernen",ix="Validieren",sx="Abbrechen",ox="Bild",ax="auto",lx="Bild wird hochgeladen…",cx="Bild erfolgreich hochgeladen",dx="Fehler beim Hochladen des Bildes",ux="Upload-Funktion nicht verfügbar",hx="Zu viele Bilder. Nur die ersten {{ count }} werden verarbeitet.",fx={htmlSnippet:"HTML-Snippet",insertHtmlSnippet:"HTML-Snippet einfügen",confirmDeletion:"Löschung bestätigen",htmlSnippetDeletionConfirm:"Sind Sie sicher, dass Sie dieses HTML-Snippet löschen möchten?"},px={obfuscate:"Verschleiern",obfuscator:"Verschleierer",content:"Inhalt",asALink:"Als Link",doNotObfuscate:"Nicht verschleiern",done:"Fertig"},mx={imageProperties:"Bildeigenschaften",sizes:"Größen",variantLabel:"Größe {{ n }}",alignment:"Ausrichtung",left:"Links",center:"Zentriert",right:"Rechts",options:"Optionen",link:"Link",enableZoom:"Zoom aktivieren",mediaProperties:"Medieneigenschaften",caption:"Bildunterschrift",pixelRatio:"Pixelverhältnis"},gx={insertVideo:"Video einfügen",videoDialog:"Video festlegen"},bx={insertInternalLink:"Internen Link einfügen"},yx={editLink:"Link bearbeiten",insertLink:"Link einfügen",label:"Beschriftung",url:"URL",openInNewTab:"In neuem Tab öffnen",openLink:"Link öffnen",removeLink:"Link entfernen",validate:"Validieren"},kx={paragraph:"Absatz",paragraphShort:"A",heading2:"Überschrift 2",heading2Short:"Ü2",heading3:"Überschrift 3",heading3Short:"Ü3",heading4:"Überschrift 4",heading4Short:"Ü4",bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",obfuscate:"Verschleiern",blockquote:"Zitat",bulletList:"Aufzählungsliste",orderedList:"Nummerierte Liste",link:"Link",code:"Inline-Code",codeBlock:"Codeblock",alignmentDefault:"Standard",alignmentCenter:"Zentriert",alignmentRight:"Rechts",textSize:"Textgröße",textSizeSmall:"Klein",textSizeNormal:"Normal",textSizeLarge:"Groß",textSizeHuge:"Sehr groß",undo:"Rückgängig",redo:"Wiederholen",clearFormatting:"Formatierung löschen",more:"Mehr"},vx={remove:rx,validate:ix,cancel:sx,delete:"Löschen",image:ox,auto:ax,uploadingImage:lx,imageUploadSuccess:cx,imageUploadFailed:dx,uploadNotAvailable:ux,tooManyImages:hx,htmlSnippetNode:fx,obfuscateMark:px,mediaNode:mx,platformVideo:gx,internalLinkNode:bx,linkDialog:yx,toolbar:kx},Ex="Remove",xx="Validate",Sx="Cancel",wx="Image",Tx="Auto",Cx="Uploading image…",Mx="Image uploaded successfully",Ax="Failed to upload image",Nx="Upload functionality not available",_x="Too many images. Only the first {{ count }} will be processed.",Ox={htmlSnippet:"HTML Snippet",insertHtmlSnippet:"Insert HTML Snippet",confirmDeletion:"Confirm Deletion",htmlSnippetDeletionConfirm:"Are you sure you want to delete this HTML Snippet?"},Ix={obfuscate:"Obfuscate",obfuscator:"Obfuscator",content:"Content",asALink:"As a link",doNotObfuscate:"Do not obfuscate",done:"Done"},Lx={imageProperties:"Image Properties",sizes:"Sizes",variantLabel:"Size {{ n }}",alignment:"Alignment",left:"Left",center:"Center",right:"Right",options:"Options",link:"Link",enableZoom:"Enable Zoom",mediaProperties:"Media Properties",caption:"Caption",pixelRatio:"Pixel Ratio"},Rx={insertVideo:"Insert Video",videoDialog:"Set a video"},Dx={insertInternalLink:"Insert Internal Link"},$x={editLink:"Edit Link",insertLink:"Insert Link",label:"Label",url:"URL",openInNewTab:"Open in new tab",openLink:"Open the link",removeLink:"Remove Link",validate:"Validate"},Px={paragraph:"Paragraph",paragraphShort:"P",heading2:"Heading 2",heading2Short:"H2",heading3:"Heading 3",heading3Short:"H3",heading4:"Heading 4",heading4Short:"H4",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",obfuscate:"Obfuscate",blockquote:"Blockquote",bulletList:"Bullet List",orderedList:"Ordered List",link:"Link",code:"Inline Code",codeBlock:"Code Block",alignmentDefault:"Default",alignmentCenter:"Center",alignmentRight:"Right",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",textSizeHuge:"Huge",undo:"Undo",redo:"Redo",clearFormatting:"Clear Formatting",more:"More"},Bx={remove:Ex,validate:xx,cancel:Sx,delete:"Delete",image:wx,auto:Tx,uploadingImage:Cx,imageUploadSuccess:Mx,imageUploadFailed:Ax,uploadNotAvailable:Nx,tooManyImages:_x,htmlSnippetNode:Ox,obfuscateMark:Ix,mediaNode:Lx,platformVideo:Rx,internalLinkNode:Dx,linkDialog:$x,toolbar:Px},zx="Quitar",Hx="Validar",Fx="Cancelar",Ux="Imagen",Vx="auto",Kx="Subiendo imagen…",Wx="Imagen subida con éxito",jx="Error al subir la imagen",qx="Funcionalidad de carga no disponible",Gx="Demasiadas imágenes. Solo se procesarán las primeras {{ count }}.",Jx={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Insertar fragmento HTML",confirmDeletion:"Confirmar eliminación",htmlSnippetDeletionConfirm:"¿Está seguro de que desea eliminar este fragmento HTML?"},Zx={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Contenido",asALink:"Como enlace",doNotObfuscate:"No ofuscar",done:"Hecho"},Yx={imageProperties:"Propiedades de la imagen",sizes:"Tamaños",variantLabel:"Tamaño {{ n }}",alignment:"Alineación",left:"Izquierda",center:"Centro",right:"Derecha",options:"Opciones",link:"Enlace",enableZoom:"Habilitar zoom",mediaProperties:"Propiedades del medio",caption:"Leyenda",pixelRatio:"Proporción de píxeles"},Xx={insertVideo:"Insertar un video",videoDialog:"Configurar un video"},Qx={insertInternalLink:"Insertar un enlace interno"},eS={editLink:"Editar enlace",insertLink:"Insertar enlace",label:"Etiqueta",url:"URL",openInNewTab:"Abrir en nueva pestaña",openLink:"Abrir el enlace",removeLink:"Eliminar enlace",validate:"Validar"},tS={paragraph:"Párrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrita",italic:"Cursiva",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Cita",bulletList:"Lista con viñetas",orderedList:"Lista numerada",link:"Enlace",code:"Código en línea",codeBlock:"Bloque de código",alignmentDefault:"Predeterminado",alignmentCenter:"Centrar",alignmentRight:"A la derecha",textSize:"Tamaño del texto",textSizeSmall:"Pequeño",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muy grande",undo:"Deshacer",redo:"Rehacer",clearFormatting:"Borrar formato",more:"Más"},nS={remove:zx,validate:Hx,cancel:Fx,delete:"Eliminar",image:Ux,auto:Vx,uploadingImage:Kx,imageUploadSuccess:Wx,imageUploadFailed:jx,uploadNotAvailable:qx,tooManyImages:Gx,htmlSnippetNode:Jx,obfuscateMark:Zx,mediaNode:Yx,platformVideo:Xx,internalLinkNode:Qx,linkDialog:eS,toolbar:tS},rS="Retirer",iS="Valider",sS="Annuler",oS="Image",aS="auto",lS="Téléchargement de l'image…",cS="Image téléchargée avec succès",dS="Échec du téléchargement de l'image",uS="Fonctionnalité de téléchargement non disponible",hS="Trop d'images. Seules les {{ count }} premières seront traitées.",fS={htmlSnippet:"Code HTML",insertHtmlSnippet:"Insérer du code HTML",confirmDeletion:"Confirmer la suppression",htmlSnippetDeletionConfirm:"Voulez-vous vraiment supprimer ce code HTML ?"},pS={obfuscate:"Obfusquer",obfusquator:"Obfusqueur",content:"Contenu",asALink:"En tant que lien",doNotObfuscate:"Ne pas obfusquer",done:"Terminé"},mS={imageProperties:"Propriétés de l'image",sizes:"Tailles",variantLabel:"Taille {{ n }}",alignment:"Alignement",left:"À gauche",center:"Centrer",right:"À droite",options:"Options",link:"Lien",enableZoom:"Activer le zoom",mediaProperties:"Propriétés du média",caption:"Légende",pixelRatio:"Pixel ratio"},gS={insertVideo:"Insérer une vidéo",videoDialog:"Définir une vidéo"},bS={insertInternalLink:"Insérer un lien interne"},yS={editLink:"Modifier le lien",insertLink:"Insérer un lien",label:"Libellé",url:"URL",openInNewTab:"Ouvrir dans un nouvel onglet",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",validate:"Valider"},kS={paragraph:"Paragraphe",paragraphShort:"P",heading2:"Titre 2",heading2Short:"T2",heading3:"Titre 3",heading3Short:"T3",heading4:"Titre 4",heading4Short:"T4",bold:"Gras",italic:"Italique",strikethrough:"Barré",obfuscate:"Obfusquer",blockquote:"Citation",bulletList:"Liste à puces",orderedList:"Liste numérotée",link:"Lien",code:"Code en ligne",codeBlock:"Bloc de code",alignmentDefault:"Par défaut",alignmentCenter:"Centrer",alignmentRight:"À droite",textSize:"Taille du texte",textSizeSmall:"Petit",textSizeNormal:"Normal",textSizeLarge:"Grand",textSizeHuge:"Très grand",undo:"Annuler",redo:"Rétablir",clearFormatting:"Effacer la mise en forme",more:"Plus"},vS={remove:rS,validate:iS,cancel:sS,delete:"Supprimer",image:oS,auto:aS,uploadingImage:lS,imageUploadSuccess:cS,imageUploadFailed:dS,uploadNotAvailable:uS,tooManyImages:hS,htmlSnippetNode:fS,obfuscateMark:pS,mediaNode:mS,platformVideo:gS,internalLinkNode:bS,linkDialog:yS,toolbar:kS},ES="Rimuovere",xS="Validare",SS="Annulla",wS="Immagine",TS="auto",CS="Caricamento immagine…",MS="Immagine caricata con successo",AS="Errore nel caricamento dell'immagine",NS="Funzionalità di caricamento non disponibile",_S="Troppe immagini. Verranno elaborate solo le prime {{ count }}.",OS={htmlSnippet:"Frammento HTML",insertHtmlSnippet:"Inserisci frammento HTML",confirmDeletion:"Conferma eliminazione",htmlSnippetDeletionConfirm:"Sei sicuro di voler eliminare questo frammento HTML?"},IS={obfuscate:"Offuscare",obfuscator:"Offuscatore",content:"Contenuto",asALink:"Come link",doNotObfuscate:"Non offuscare",done:"Fatto"},LS={imageProperties:"Proprietà dell'immagine",sizes:"Dimensioni",variantLabel:"Dimensione {{ n }}",alignment:"Allineamento",left:"Sinistra",center:"Centro",right:"Destra",options:"Opzioni",link:"Link",enableZoom:"Abilita zoom",mediaProperties:"Proprietà del media",caption:"Didascalia",pixelRatio:"Rapporto pixel"},RS={insertVideo:"Inserisci un video",videoDialog:"Imposta un video"},DS={insertInternalLink:"Inserisci un link interno"},$S={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",label:"Etichetta",url:"URL",openInNewTab:"Apri in una nuova scheda",openLink:"Apri il collegamento",removeLink:"Rimuovi collegamento",validate:"Validare"},PS={paragraph:"Paragrafo",paragraphShort:"P",heading2:"Titolo 2",heading2Short:"T2",heading3:"Titolo 3",heading3Short:"T3",heading4:"Titolo 4",heading4Short:"T4",bold:"Grassetto",italic:"Corsivo",strikethrough:"Barrato",obfuscate:"Offuscare",blockquote:"Citazione",bulletList:"Elenco puntato",orderedList:"Elenco numerato",link:"Collegamento",code:"Codice in linea",codeBlock:"Blocco di codice",alignmentDefault:"Predefinito",alignmentCenter:"Centra",alignmentRight:"A destra",textSize:"Dimensione del testo",textSizeSmall:"Piccolo",textSizeNormal:"Normale",textSizeLarge:"Grande",textSizeHuge:"Molto grande",undo:"Annulla",redo:"Ripeti",clearFormatting:"Cancella formattazione",more:"Altro"},BS={remove:ES,validate:xS,cancel:SS,delete:"Elimina",image:wS,auto:TS,uploadingImage:CS,imageUploadSuccess:MS,imageUploadFailed:AS,uploadNotAvailable:NS,tooManyImages:_S,htmlSnippetNode:OS,obfuscateMark:IS,mediaNode:LS,platformVideo:RS,internalLinkNode:DS,linkDialog:$S,toolbar:PS},zS="Remover",HS="Validar",FS="Cancelar",US="Imagem",VS="auto",KS="Enviando imagem…",WS="Imagem enviada com sucesso",jS="Falha ao enviar imagem",qS="Funcionalidade de envio não disponível",GS="Muitas imagens. Apenas as primeiras {{ count }} serão processadas.",JS={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Inserir fragmento HTML",confirmDeletion:"Confirmar exclusão",htmlSnippetDeletionConfirm:"Tem certeza de que deseja excluir este fragmento HTML?"},ZS={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Conteúdo",asALink:"Como link",doNotObfuscate:"Não ofuscar",done:"Concluído"},YS={imageProperties:"Propriedades da imagem",sizes:"Tamanhos",variantLabel:"Tamanho {{ n }}",alignment:"Alinhamento",left:"Esquerda",center:"Centro",right:"Direita",options:"Opções",link:"Link",enableZoom:"Ativar zoom",mediaProperties:"Propriedades da mídia",caption:"Legenda",pixelRatio:"Proporção de pixels"},XS={insertVideo:"Inserir um vídeo",videoDialog:"Definir um vídeo"},QS={insertInternalLink:"Inserir um link interno"},ew={editLink:"Editar link",insertLink:"Inserir link",label:"Rótulo",url:"URL",openInNewTab:"Abrir em nova aba",openLink:"Abrir o link",removeLink:"Remover link",validate:"Validar"},tw={paragraph:"Parágrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrito",italic:"Itálico",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Citação",bulletList:"Lista com marcadores",orderedList:"Lista numerada",link:"Link",code:"Código em linha",codeBlock:"Bloco de código",alignmentDefault:"Padrão",alignmentCenter:"Centralizar",alignmentRight:"À direita",textSize:"Tamanho do texto",textSizeSmall:"Pequeno",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muito grande",undo:"Desfazer",redo:"Refazer",clearFormatting:"Limpar formatação",more:"Mais"},nw={remove:zS,validate:HS,cancel:FS,delete:"Excluir",image:US,auto:VS,uploadingImage:KS,imageUploadSuccess:WS,imageUploadFailed:jS,uploadNotAvailable:qS,tooManyImages:GS,htmlSnippetNode:JS,obfuscateMark:ZS,mediaNode:YS,platformVideo:XS,internalLinkNode:QS,linkDialog:ew,toolbar:tw},Rc={en:Bx,fr:vS,es:nS,de:vx,it:BS,pt:nw};class rw{constructor(e){this._ctx={language:"",dict:{}},this.setLanguage(e)}setLanguage(e,t){const r=Object.keys(Rc),i=zf(e,{pluginLanguages:r,siteLanguages:t}),s=i,o={};qh(Rc[s],"",o),this._ctx={language:i,dict:o}}t(e,t){let r=this._ctx.dict[e]??e;if(t)for(const[i,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{\\s*${i}\\s*\\}\\}`,"g"),String(s));return r}}function qh(n,e,t){for(const r in n){const i=n[r],s=e?`${e}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?qh(i,s,t):typeof i=="string"&&(t[s]=i)}}const Bo=nx(),dw={init:iw,create:sw};function iw(n){const e=`${n.pluginBaseUrl}/admin-ui-plugin.css`,t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t),n.registerHook("htmlEditorServiceProvider",()=>Bo.service)}function sw(n){const{fieldType:e}=n;if(e.dataType!=="json")throw new Error(`field type '${e.name}' is incompatible with Tiptap plugin, needs data type 'json'`);if(n.initialValue!==void 0&&!$c(n.initialValue))throw new Error(`field type '${e.name}' is incompatible, should be a json, got '${typeof n.initialValue}'`);const t=Dc(n.initialValue);let r=n.language;const i=new rw(r),s=document.createElement("tiptap-editor");return s.service=n,s.i18n=i,s.videoPluginHook=Bo.videoPlugin,s.internalLinkPluginHook=Bo.internalLinkPlugin,s.initialContent=t,s.onChange=o=>{n.setModifiedValue({j:o})},{element:s,setValue:o=>{s.setContent(Dc(o))},setLanguage:o=>{r=o,i.setLanguage(o),s.updateLanguage(o)},getValue:()=>({j:s.getJSON()}),dispose:()=>{s.remove()},insertMedia:async o=>{await s.insertMediaFromGallery(o)}}}function Dc(n){if(n!==void 0)return $c(n)&&typeof n.j=="object"&&n.j!==null?n.j:void 0}export{dw as default};
961
+ `;Yn([ve({attribute:!1})],en.prototype,"editor",2);Yn([ve({attribute:!1})],en.prototype,"service",2);Yn([ve({attribute:!1})],en.prototype,"i18n",2);Yn([ve({attribute:!1})],en.prototype,"videoPluginHook",2);Yn([ve({attribute:!1})],en.prototype,"internalLinkPluginHook",2);en=Yn([Es("tiptap-toolbar")],en);function ox(){const n={videoPlugin:void 0,internalLinkPlugin:void 0};return{get videoPlugin(){return n.videoPlugin},get internalLinkPlugin(){return n.internalLinkPlugin},service:{registerVideoPlugin(e){if(n.videoPlugin)throw new Error("Video plugin already registered");n.videoPlugin=e},registerInternalLinkPlugin(e){if(n.internalLinkPlugin)throw new Error("Internal link plugin already registered");n.internalLinkPlugin=e}}}}const ax="Entfernen",lx="Validieren",cx="Abbrechen",dx="Bild",ux="auto",hx="Bild wird hochgeladen…",fx="Bild erfolgreich hochgeladen",px="Fehler beim Hochladen des Bildes",mx="Upload-Funktion nicht verfügbar",gx="Zu viele Bilder. Nur die ersten {{ count }} werden verarbeitet.",bx={htmlSnippet:"HTML-Snippet",insertHtmlSnippet:"HTML-Snippet einfügen",confirmDeletion:"Löschung bestätigen",htmlSnippetDeletionConfirm:"Sind Sie sicher, dass Sie dieses HTML-Snippet löschen möchten?"},yx={obfuscate:"Verschleiern",obfuscator:"Verschleierer",content:"Inhalt",asALink:"Als Link",doNotObfuscate:"Nicht verschleiern",done:"Fertig"},kx={imageProperties:"Bildeigenschaften",sizes:"Größen",variantLabel:"Größe {{ n }}",alignment:"Ausrichtung",left:"Links",center:"Zentriert",right:"Rechts",options:"Optionen",link:"Link",enableZoom:"Zoom aktivieren",mediaProperties:"Medieneigenschaften",caption:"Bildunterschrift",pixelRatio:"Pixelverhältnis"},Ex={insertVideo:"Video einfügen",videoDialog:"Video festlegen"},vx={insertInternalLink:"Internen Link einfügen"},xx={editLink:"Link bearbeiten",insertLink:"Link einfügen",label:"Beschriftung",url:"URL",openInNewTab:"In neuem Tab öffnen",openLink:"Link öffnen",removeLink:"Link entfernen",validate:"Validieren"},Sx={paragraph:"Absatz",paragraphShort:"A",heading2:"Überschrift 2",heading2Short:"Ü2",heading3:"Überschrift 3",heading3Short:"Ü3",heading4:"Überschrift 4",heading4Short:"Ü4",bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",obfuscate:"Verschleiern",blockquote:"Zitat",bulletList:"Aufzählungsliste",orderedList:"Nummerierte Liste",link:"Link",code:"Inline-Code",codeBlock:"Codeblock",alignmentDefault:"Standard",alignmentCenter:"Zentriert",alignmentRight:"Rechts",textSize:"Textgröße",textSizeSmall:"Klein",textSizeNormal:"Normal",textSizeLarge:"Groß",textSizeHuge:"Sehr groß",undo:"Rückgängig",redo:"Wiederholen",clearFormatting:"Formatierung löschen",more:"Mehr"},wx={remove:ax,validate:lx,cancel:cx,delete:"Löschen",image:dx,auto:ux,uploadingImage:hx,imageUploadSuccess:fx,imageUploadFailed:px,uploadNotAvailable:mx,tooManyImages:gx,htmlSnippetNode:bx,obfuscateMark:yx,mediaNode:kx,platformVideo:Ex,internalLinkNode:vx,linkDialog:xx,toolbar:Sx},Tx="Remove",Cx="Validate",Mx="Cancel",Ax="Image",Nx="Auto",_x="Uploading image…",Ox="Image uploaded successfully",Ix="Failed to upload image",Lx="Upload functionality not available",Rx="Too many images. Only the first {{ count }} will be processed.",Dx={htmlSnippet:"HTML Snippet",insertHtmlSnippet:"Insert HTML Snippet",confirmDeletion:"Confirm Deletion",htmlSnippetDeletionConfirm:"Are you sure you want to delete this HTML Snippet?"},$x={obfuscate:"Obfuscate",obfuscator:"Obfuscator",content:"Content",asALink:"As a link",doNotObfuscate:"Do not obfuscate",done:"Done"},Px={imageProperties:"Image Properties",sizes:"Sizes",variantLabel:"Size {{ n }}",alignment:"Alignment",left:"Left",center:"Center",right:"Right",options:"Options",link:"Link",enableZoom:"Enable Zoom",mediaProperties:"Media Properties",caption:"Caption",pixelRatio:"Pixel Ratio"},Bx={insertVideo:"Insert Video",videoDialog:"Set a video"},zx={insertInternalLink:"Insert Internal Link"},Hx={editLink:"Edit Link",insertLink:"Insert Link",label:"Label",url:"URL",openInNewTab:"Open in new tab",openLink:"Open the link",removeLink:"Remove Link",validate:"Validate"},Fx={paragraph:"Paragraph",paragraphShort:"P",heading2:"Heading 2",heading2Short:"H2",heading3:"Heading 3",heading3Short:"H3",heading4:"Heading 4",heading4Short:"H4",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",obfuscate:"Obfuscate",blockquote:"Blockquote",bulletList:"Bullet List",orderedList:"Ordered List",link:"Link",code:"Inline Code",codeBlock:"Code Block",alignmentDefault:"Default",alignmentCenter:"Center",alignmentRight:"Right",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",textSizeHuge:"Huge",undo:"Undo",redo:"Redo",clearFormatting:"Clear Formatting",more:"More"},Ux={remove:Tx,validate:Cx,cancel:Mx,delete:"Delete",image:Ax,auto:Nx,uploadingImage:_x,imageUploadSuccess:Ox,imageUploadFailed:Ix,uploadNotAvailable:Lx,tooManyImages:Rx,htmlSnippetNode:Dx,obfuscateMark:$x,mediaNode:Px,platformVideo:Bx,internalLinkNode:zx,linkDialog:Hx,toolbar:Fx},Vx="Quitar",Kx="Validar",Wx="Cancelar",jx="Imagen",qx="auto",Gx="Subiendo imagen…",Jx="Imagen subida con éxito",Zx="Error al subir la imagen",Yx="Funcionalidad de carga no disponible",Xx="Demasiadas imágenes. Solo se procesarán las primeras {{ count }}.",Qx={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Insertar fragmento HTML",confirmDeletion:"Confirmar eliminación",htmlSnippetDeletionConfirm:"¿Está seguro de que desea eliminar este fragmento HTML?"},eS={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Contenido",asALink:"Como enlace",doNotObfuscate:"No ofuscar",done:"Hecho"},tS={imageProperties:"Propiedades de la imagen",sizes:"Tamaños",variantLabel:"Tamaño {{ n }}",alignment:"Alineación",left:"Izquierda",center:"Centro",right:"Derecha",options:"Opciones",link:"Enlace",enableZoom:"Habilitar zoom",mediaProperties:"Propiedades del medio",caption:"Leyenda",pixelRatio:"Proporción de píxeles"},nS={insertVideo:"Insertar un video",videoDialog:"Configurar un video"},rS={insertInternalLink:"Insertar un enlace interno"},iS={editLink:"Editar enlace",insertLink:"Insertar enlace",label:"Etiqueta",url:"URL",openInNewTab:"Abrir en nueva pestaña",openLink:"Abrir el enlace",removeLink:"Eliminar enlace",validate:"Validar"},sS={paragraph:"Párrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrita",italic:"Cursiva",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Cita",bulletList:"Lista con viñetas",orderedList:"Lista numerada",link:"Enlace",code:"Código en línea",codeBlock:"Bloque de código",alignmentDefault:"Predeterminado",alignmentCenter:"Centrar",alignmentRight:"A la derecha",textSize:"Tamaño del texto",textSizeSmall:"Pequeño",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muy grande",undo:"Deshacer",redo:"Rehacer",clearFormatting:"Borrar formato",more:"Más"},oS={remove:Vx,validate:Kx,cancel:Wx,delete:"Eliminar",image:jx,auto:qx,uploadingImage:Gx,imageUploadSuccess:Jx,imageUploadFailed:Zx,uploadNotAvailable:Yx,tooManyImages:Xx,htmlSnippetNode:Qx,obfuscateMark:eS,mediaNode:tS,platformVideo:nS,internalLinkNode:rS,linkDialog:iS,toolbar:sS},aS="Retirer",lS="Valider",cS="Annuler",dS="Image",uS="auto",hS="Téléchargement de l'image…",fS="Image téléchargée avec succès",pS="Échec du téléchargement de l'image",mS="Fonctionnalité de téléchargement non disponible",gS="Trop d'images. Seules les {{ count }} premières seront traitées.",bS={htmlSnippet:"Code HTML",insertHtmlSnippet:"Insérer du code HTML",confirmDeletion:"Confirmer la suppression",htmlSnippetDeletionConfirm:"Voulez-vous vraiment supprimer ce code HTML ?"},yS={obfuscate:"Obfusquer",obfusquator:"Obfusqueur",content:"Contenu",asALink:"En tant que lien",doNotObfuscate:"Ne pas obfusquer",done:"Terminé"},kS={imageProperties:"Propriétés de l'image",sizes:"Tailles",variantLabel:"Taille {{ n }}",alignment:"Alignement",left:"À gauche",center:"Centrer",right:"À droite",options:"Options",link:"Lien",enableZoom:"Activer le zoom",mediaProperties:"Propriétés du média",caption:"Légende",pixelRatio:"Pixel ratio"},ES={insertVideo:"Insérer une vidéo",videoDialog:"Définir une vidéo"},vS={insertInternalLink:"Insérer un lien interne"},xS={editLink:"Modifier le lien",insertLink:"Insérer un lien",label:"Libellé",url:"URL",openInNewTab:"Ouvrir dans un nouvel onglet",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",validate:"Valider"},SS={paragraph:"Paragraphe",paragraphShort:"P",heading2:"Titre 2",heading2Short:"T2",heading3:"Titre 3",heading3Short:"T3",heading4:"Titre 4",heading4Short:"T4",bold:"Gras",italic:"Italique",strikethrough:"Barré",obfuscate:"Obfusquer",blockquote:"Citation",bulletList:"Liste à puces",orderedList:"Liste numérotée",link:"Lien",code:"Code en ligne",codeBlock:"Bloc de code",alignmentDefault:"Par défaut",alignmentCenter:"Centrer",alignmentRight:"À droite",textSize:"Taille du texte",textSizeSmall:"Petit",textSizeNormal:"Normal",textSizeLarge:"Grand",textSizeHuge:"Très grand",undo:"Annuler",redo:"Rétablir",clearFormatting:"Effacer la mise en forme",more:"Plus"},wS={remove:aS,validate:lS,cancel:cS,delete:"Supprimer",image:dS,auto:uS,uploadingImage:hS,imageUploadSuccess:fS,imageUploadFailed:pS,uploadNotAvailable:mS,tooManyImages:gS,htmlSnippetNode:bS,obfuscateMark:yS,mediaNode:kS,platformVideo:ES,internalLinkNode:vS,linkDialog:xS,toolbar:SS},TS="Rimuovere",CS="Validare",MS="Annulla",AS="Immagine",NS="auto",_S="Caricamento immagine…",OS="Immagine caricata con successo",IS="Errore nel caricamento dell'immagine",LS="Funzionalità di caricamento non disponibile",RS="Troppe immagini. Verranno elaborate solo le prime {{ count }}.",DS={htmlSnippet:"Frammento HTML",insertHtmlSnippet:"Inserisci frammento HTML",confirmDeletion:"Conferma eliminazione",htmlSnippetDeletionConfirm:"Sei sicuro di voler eliminare questo frammento HTML?"},$S={obfuscate:"Offuscare",obfuscator:"Offuscatore",content:"Contenuto",asALink:"Come link",doNotObfuscate:"Non offuscare",done:"Fatto"},PS={imageProperties:"Proprietà dell'immagine",sizes:"Dimensioni",variantLabel:"Dimensione {{ n }}",alignment:"Allineamento",left:"Sinistra",center:"Centro",right:"Destra",options:"Opzioni",link:"Link",enableZoom:"Abilita zoom",mediaProperties:"Proprietà del media",caption:"Didascalia",pixelRatio:"Rapporto pixel"},BS={insertVideo:"Inserisci un video",videoDialog:"Imposta un video"},zS={insertInternalLink:"Inserisci un link interno"},HS={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",label:"Etichetta",url:"URL",openInNewTab:"Apri in una nuova scheda",openLink:"Apri il collegamento",removeLink:"Rimuovi collegamento",validate:"Validare"},FS={paragraph:"Paragrafo",paragraphShort:"P",heading2:"Titolo 2",heading2Short:"T2",heading3:"Titolo 3",heading3Short:"T3",heading4:"Titolo 4",heading4Short:"T4",bold:"Grassetto",italic:"Corsivo",strikethrough:"Barrato",obfuscate:"Offuscare",blockquote:"Citazione",bulletList:"Elenco puntato",orderedList:"Elenco numerato",link:"Collegamento",code:"Codice in linea",codeBlock:"Blocco di codice",alignmentDefault:"Predefinito",alignmentCenter:"Centra",alignmentRight:"A destra",textSize:"Dimensione del testo",textSizeSmall:"Piccolo",textSizeNormal:"Normale",textSizeLarge:"Grande",textSizeHuge:"Molto grande",undo:"Annulla",redo:"Ripeti",clearFormatting:"Cancella formattazione",more:"Altro"},US={remove:TS,validate:CS,cancel:MS,delete:"Elimina",image:AS,auto:NS,uploadingImage:_S,imageUploadSuccess:OS,imageUploadFailed:IS,uploadNotAvailable:LS,tooManyImages:RS,htmlSnippetNode:DS,obfuscateMark:$S,mediaNode:PS,platformVideo:BS,internalLinkNode:zS,linkDialog:HS,toolbar:FS},VS="Remover",KS="Validar",WS="Cancelar",jS="Imagem",qS="auto",GS="Enviando imagem…",JS="Imagem enviada com sucesso",ZS="Falha ao enviar imagem",YS="Funcionalidade de envio não disponível",XS="Muitas imagens. Apenas as primeiras {{ count }} serão processadas.",QS={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Inserir fragmento HTML",confirmDeletion:"Confirmar exclusão",htmlSnippetDeletionConfirm:"Tem certeza de que deseja excluir este fragmento HTML?"},ew={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Conteúdo",asALink:"Como link",doNotObfuscate:"Não ofuscar",done:"Concluído"},tw={imageProperties:"Propriedades da imagem",sizes:"Tamanhos",variantLabel:"Tamanho {{ n }}",alignment:"Alinhamento",left:"Esquerda",center:"Centro",right:"Direita",options:"Opções",link:"Link",enableZoom:"Ativar zoom",mediaProperties:"Propriedades da mídia",caption:"Legenda",pixelRatio:"Proporção de pixels"},nw={insertVideo:"Inserir um vídeo",videoDialog:"Definir um vídeo"},rw={insertInternalLink:"Inserir um link interno"},iw={editLink:"Editar link",insertLink:"Inserir link",label:"Rótulo",url:"URL",openInNewTab:"Abrir em nova aba",openLink:"Abrir o link",removeLink:"Remover link",validate:"Validar"},sw={paragraph:"Parágrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrito",italic:"Itálico",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Citação",bulletList:"Lista com marcadores",orderedList:"Lista numerada",link:"Link",code:"Código em linha",codeBlock:"Bloco de código",alignmentDefault:"Padrão",alignmentCenter:"Centralizar",alignmentRight:"À direita",textSize:"Tamanho do texto",textSizeSmall:"Pequeno",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muito grande",undo:"Desfazer",redo:"Refazer",clearFormatting:"Limpar formatação",more:"Mais"},ow={remove:VS,validate:KS,cancel:WS,delete:"Excluir",image:jS,auto:qS,uploadingImage:GS,imageUploadSuccess:JS,imageUploadFailed:ZS,uploadNotAvailable:YS,tooManyImages:XS,htmlSnippetNode:QS,obfuscateMark:ew,mediaNode:tw,platformVideo:nw,internalLinkNode:rw,linkDialog:iw,toolbar:sw},Bc={en:Ux,fr:wS,es:oS,de:wx,it:US,pt:ow};class aw{constructor(e){this._ctx={language:"",dict:{}},this.setLanguage(e)}setLanguage(e,t){const r=Object.keys(Bc),i=Ff(e,{pluginLanguages:r,siteLanguages:t}),s=i,o={};Jh(Bc[s],"",o),this._ctx={language:i,dict:o}}t(e,t){let r=this._ctx.dict[e]??e;if(t)for(const[i,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{\\s*${i}\\s*\\}\\}`,"g"),String(s));return r}}function Jh(n,e,t){for(const r in n){const i=n[r],s=e?`${e}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?Jh(i,s,t):typeof i=="string"&&(t[s]=i)}}const Bo=ox(),pw={init:lw,create:cw};function lw(n){const e=`${n.pluginBaseUrl}/admin-ui-plugin.css`,t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t),n.registerHook("htmlEditorServiceProvider",()=>Bo.service)}function cw(n){const{fieldType:e}=n;if(e.dataType!=="json")throw new Error(`field type '${e.name}' is incompatible with Tiptap plugin, needs data type 'json'`);if(n.initialValue!==void 0&&!Hc(n.initialValue))throw new Error(`field type '${e.name}' is incompatible, should be a json, got '${typeof n.initialValue}'`);const t=zc(n.initialValue);let r=n.language;const i=new aw(r),s=document.createElement("tiptap-editor");return s.service=n,s.i18n=i,s.videoPluginHook=Bo.videoPlugin,s.internalLinkPluginHook=Bo.internalLinkPlugin,s.initialContent=t,s.onChange=o=>{n.setModifiedValue({j:o})},{element:s,setValue:o=>{s.setContent(zc(o))},setLanguage:o=>{r=o,i.setLanguage(o),s.updateLanguage(o)},getValue:()=>({j:s.getJSON()}),dispose:()=>{s.remove()},insertMedia:async o=>{await s.insertMediaFromGallery(o)}}}function zc(n){if(n!==void 0)return Hc(n)&&typeof n.j=="object"&&n.j!==null?n.j:void 0}export{pw as default};