vue-spear-tip 0.2.3 → 0.2.4

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.
Files changed (53) hide show
  1. package/dist/.vite/manifest.json +37 -26
  2. package/dist/{Button-cbcEkM7_.js → Button-B9kTMsWx.js} +1 -1
  3. package/dist/{Button-DLwCpVMw.cjs → Button-n3ORJB24.cjs} +1 -1
  4. package/dist/{CodeHighlight-S56-Bjb4.cjs → CodeHighlight-DKD4c3o1.cjs} +1 -1
  5. package/dist/{CodeHighlight--bHBm26g.js → CodeHighlight-zWW7mCKo.js} +1 -1
  6. package/dist/{DateField-Bb5PeP-p.cjs → DateField-B15N_Er2.cjs} +1 -1
  7. package/dist/{DateField-DJLkM7rb.js → DateField-CLsz3fl7.js} +2 -2
  8. package/dist/{FieldComponent.vue_vue_type_script_lang-rAazuFFa.cjs → FieldComponent.vue_vue_type_script_lang-CuwGxCct.cjs} +1 -1
  9. package/dist/{FieldComponent.vue_vue_type_script_lang-By0JOopJ.js → FieldComponent.vue_vue_type_script_lang-a0D3sf1R.js} +1 -1
  10. package/dist/{SelectField-BKVqEEnz.cjs → SelectField-C8v92730.cjs} +6 -6
  11. package/dist/{SelectField-BlEqF2q8.js → SelectField-Dg0c03Hn.js} +85 -79
  12. package/dist/{StringField-Byq8Dx1a.js → StringField-CN2J5hnc.js} +32 -32
  13. package/dist/{StringField-DMIQoDmu.cjs → StringField-SQwneDFM.cjs} +1 -1
  14. package/dist/{Tabs-Dg29GD51.js → Tabs-Btq9At3D.js} +1 -1
  15. package/dist/{Tabs-B_D5RI-z.cjs → Tabs-bdR0rIkV.cjs} +1 -1
  16. package/dist/TextField-CEstqDvf.js +19365 -0
  17. package/dist/TextField-DwbNmleH.cjs +149 -0
  18. package/dist/components/Fields/TextField/index.d.ts +2 -0
  19. package/dist/components/LazyComponents.d.ts +3 -6
  20. package/dist/{index-B83tFSld.js → index-Bm3M_ugz.js} +139 -138
  21. package/dist/{index-CGAPrV7s.cjs → index-pJmyVDoY.cjs} +1 -1
  22. package/dist/kit/fields/index.d.ts +2 -1
  23. package/dist/vue-spear-tip.cjs.js +1 -1
  24. package/dist/vue-spear-tip.css +1 -1
  25. package/dist/vue-spear-tip.es.js +10 -9
  26. package/docs/index.html +2 -2
  27. package/docs/static/Button-BUq3qi9I.js +1 -0
  28. package/docs/static/{CodeHighlight-BQ25duXm.js → CodeHighlight-BKaQtkER.js} +1 -1
  29. package/docs/static/DateField-BOXDZRGA.js +31 -0
  30. package/docs/static/FieldComponent.vue_vue_type_script_lang-CKikbrmF.js +1 -0
  31. package/docs/static/{SelectField-Bs98mAKt.js → SelectField-CWS45VNb.js} +7 -7
  32. package/docs/static/{StringField-DFb36eXt.js → StringField-DWX_WNoM.js} +1 -1
  33. package/docs/static/{StringField-DV9336PV.css → StringField-whdxCITB.css} +1 -1
  34. package/docs/static/Tabs-BNDTIJ3z.js +1 -0
  35. package/docs/static/TextField-CXCoqL3z.js +149 -0
  36. package/docs/static/TextField-DInjI1Vp.css +1 -0
  37. package/docs/static/index-D8NZNe9k.js +2 -0
  38. package/docs/static/main-D7RDfHbv.css +1 -0
  39. package/docs/static/main-b2Vu8ssu.js +103 -0
  40. package/package.json +23 -1
  41. package/docs/static/Button-DxJ7h7AA.js +0 -1
  42. package/docs/static/ButtonInherited-DYe32AI3.js +0 -1
  43. package/docs/static/DateField-TKU4XDjB.js +0 -31
  44. package/docs/static/FieldComponent.vue_vue_type_script_lang-WVgJj2LN.js +0 -1
  45. package/docs/static/Tabs-DT8e9al2.js +0 -1
  46. package/docs/static/index-B4WAjdZv.js +0 -2
  47. package/docs/static/index-BKGyjPLC.js +0 -2
  48. package/docs/static/index-BeSPwKX9.js +0 -2
  49. package/docs/static/index-BjKdsJkM.js +0 -2
  50. package/docs/static/index-CLRCgB9R.js +0 -2
  51. package/docs/static/index-D1X50h1O.js +0 -2
  52. package/docs/static/main-C7jrUur6.css +0 -1
  53. package/docs/static/main-CEZk-nhN.js +0 -103
@@ -0,0 +1,149 @@
1
+ "use strict";var sh=Object.defineProperty;var c=(n,e)=>sh(n,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("vue"),oh=require("./_plugin-vue_export-helper-BaHX9ZKS.cjs");function ne(n){this.content=n}c(ne,"OrderedMap");ne.prototype={constructor:ne,find:c(function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},"find"),get:c(function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},"get"),update:c(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 ne(s)},"update"),remove:c(function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ne(t)},"remove"),addToStart:c(function(n,e){return new ne([n,e].concat(this.remove(n).content))},"addToStart"),addToEnd:c(function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ne(t)},"addToEnd"),addBefore:c(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 ne(i)},"addBefore"),forEach:c(function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},"forEach"),prepend:c(function(n){return n=ne.from(n),n.size?new ne(n.content.concat(this.subtract(n).content)):this},"prepend"),append:c(function(n){return n=ne.from(n),n.size?new ne(this.subtract(n).content.concat(n.content)):this},"append"),subtract:c(function(n){var e=this;n=ne.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},"subtract"),toObject:c(function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},"toObject"),get size(){return this.content.length>>1}};ne.from=function(n){if(n instanceof ne)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ne(e)};function hu(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=hu(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}c(hu,"findDiffStart");function pu(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),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let u=0,d=Math.min(o.text.length,l.text.length);for(;u<d&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let u=pu(o.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}c(pu,"findDiffEnd");const te=class te{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,l=0;l<t;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,i+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},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 te(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 l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new te(r,i)}cutByIndex(e,t){return e==t?te.empty:e==0&&t==this.content.length?this:new te(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 te(i,s)}addToStart(e){return new te([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new te(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 hu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return pu(this,e,t,r)}findIndex(e){if(e==0)return Br(0,e);if(e==this.size)return Br(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?Br(t+1,s):Br(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 te.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new te(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return te.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 te(t||e,r)}static from(e){if(!e)return te.empty;if(e instanceof te)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new te([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};c(te,"Fragment");let C=te;C.empty=new C([],0);const Rs={index:0,offset:0};function Br(n,e){return Rs.index=n,Rs.offset=e,Rs}c(Br,"retIndex");function ti(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(!ti(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ti(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}c(ti,"compareDeep");var Ct;let F=(Ct=class{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let 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&&ti(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 Ct.none;if(e instanceof Ct)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}},c(Ct,"Mark"),Ct);F.none=[];const Xl=class Xl extends Error{};c(Xl,"ReplaceError");let Pn=Xl;const pt=class pt{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=gu(this.content,e+this.openStart,t);return r&&new pt(r,this.openStart,this.openEnd)}removeBetween(e,t){return new pt(mu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return pt.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 pt(C.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 pt(e,r,i)}};c(pt,"Slice");let T=pt;T.empty=new T(C.empty,0,0);function mu(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=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(mu(s.content,e-i-1,t-i-1)))}c(mu,"removeRange");function gu(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 l=gu(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}c(gu,"insertInto");function lh(n,e,t){if(t.openStart>n.depth)throw new Pn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Pn("Inconsistent open depths");return yu(n,e,t,0)}c(lh,"replace");function yu(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=yu(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,l=o.content;return _t(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=ah(t,n);return _t(s,ku(n,o,l,e,r))}else return _t(s,ni(n,e,r))}c(yu,"replaceOuter");function bu(n,e){if(!e.type.compatibleContent(n.type))throw new Pn("Cannot join "+e.type.name+" onto "+n.type.name)}c(bu,"checkJoin");function so(n,e,t){let r=n.node(t);return bu(r,e.node(t)),r}c(so,"joinable$1");function Kt(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)}c(Kt,"addNode");function er(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&&(Kt(n.nodeAfter,r),s++));for(let l=s;l<o;l++)Kt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Kt(e.nodeBefore,r)}c(er,"addRange");function _t(n,e){return n.type.checkContent(e),n.copy(e)}c(_t,"close");function ku(n,e,t,r,i){let s=n.depth>i&&so(n,e,i+1),o=r.depth>i&&so(t,r,i+1),l=[];return er(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(bu(s,o),Kt(_t(s,ku(n,e,t,r,i+1)),l)):(s&&Kt(_t(s,ni(n,e,i+1)),l),er(e,t,i,l),o&&Kt(_t(o,ni(t,r,i+1)),l)),er(r,null,i,l),new C(l)}c(ku,"replaceThreeWay");function ni(n,e,t){let r=[];if(er(null,n,t,r),n.depth>t){let i=so(n,e,t+1);Kt(_t(i,ni(n,e,t+1)),r)}return er(e,null,t,r),new C(r)}c(ni,"replaceTwoWay");function ah(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(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}c(ah,"prepareSliceForReplace");const dr=class dr{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 F.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let 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 Ln(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:l,offset:a}=o.content.findIndex(s),u=s-a;if(r.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new dr(t,r,s)}static resolveCached(e,t){let r=Na.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 Na.set(e,r=new oo);let i=r.elts[r.i]=dr.resolve(e,t);return r.i=(r.i+1)%ch,i}};c(dr,"ResolvedPos");let ri=dr;const Ql=class Ql{constructor(){this.elts=[],this.i=0}};c(Ql,"ResolveCache");let oo=Ql;const ch=12,Na=new WeakMap,Zl=class Zl{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)}};c(Zl,"NodeRange");let Ln=Zl;const uh=Object.create(null);var vt;let wt=(vt=class{constructor(e,t,r,i=F.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.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&&ti(this.attrs,t||e.defaultAttrs||uh)&&F.sameSet(this.marks,r||F.none)}copy(e=null){return e==this.content?this:new vt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vt(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 T.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new T(u,i.depth-o,s.depth-o)}replace(e,t,r){return lh(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 ri.resolveCached(this,e)}resolveNoCache(e){return ri.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()+")"),wu(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=C.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let 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=F.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(!F.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=C.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}},c(vt,"Node"),vt);wt.prototype.text=void 0;const fr=class fr extends wt{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):wu(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 fr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new fr(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}};c(fr,"TextNode");let lo=fr;function wu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}c(wu,"wrapMarks");const ss=class ss{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ao(e,t);if(r.next==null)return ss.empty;let i=xu(r);r.next&&r.err("Unexpected trailing text");let s=yh(gh(i));return bh(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,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return C.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return c(s,"search"),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 l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return c(t,"scan"),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(`
2
+ `)}};c(ss,"ContentMatch");let rn=ss;rn.empty=new rn(!0);const ea=class ea{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+"')")}};c(ea,"TokenStream");let ao=ea;function xu(n){let e=[];do e.push(dh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}c(xu,"parseExpr");function dh(n){let e=[];do e.push(fh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}c(dh,"parseExprSeq");function fh(n){let e=mh(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=hh(n,e);else break;return e}c(fh,"parseExprSubscript");function Ia(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}c(Ia,"parseNum");function hh(n,e){let t=Ia(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ia(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}c(hh,"parseExprRange");function ph(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}c(ph,"resolveName");function mh(n){if(n.eat("(")){let e=xu(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=ph(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}}}c(mh,"parseExprAtom");function gh(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}c(t,"node");function r(o,l,a){let u={term:a,to:l};return e[o].push(u),u}c(r,"edge");function i(o,l){o.forEach(a=>a.to=l)}c(i,"connect");function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=s(o.exprs[a],l);if(a==o.exprs.length-1)return u;i(u,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let d=t();r(a,d),i(s(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}c(s,"compile")}c(gh,"nfa");function Su(n,e){return e-n}c(Su,"cmp");function Ra(n,e){let t=[];return r(e),t.sort(Su);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:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}c(r,"scan")}c(Ra,"nullFrom");function yh(n){let e=Object.create(null);return t(Ra(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<i.length;d++)i[d][0]==l&&(u=i[d][1]);Ra(n,a).forEach(d=>{u||i.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new rn(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Su);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}c(yh,"dfa");function bh(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:u}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}c(bh,"checkForDeadEnds");function Cu(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}c(Cu,"defaultAttrs");function vu(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}c(vu,"computeAttrs");function Mu(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])}}c(Mu,"checkAttrs");function Tu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new co(n,r,e[r]);return t}c(Tu,"initAttrs");var Qt;let Da=(Qt=class{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=Tu(e,r.attrs),this.defaultAttrs=Cu(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==rn.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:vu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wt(this,this.computeAttrs(e),C.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new wt(this,this.computeAttrs(e),t,F.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.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(C.empty,!0);return s?new wt(this,e,t.append(s),F.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){Mu(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:F.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Qt(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}},c(Qt,"NodeType"),Qt);function kh(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}`)}}c(kh,"validateType");const ta=class ta{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?kh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}};c(ta,"Attribute");let co=ta;const ls=class ls{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Tu(e,i.attrs),this.excluded=null;let s=Cu(this.attrs);this.instance=s?new F(this,s):null}create(e=null){return!e&&this.instance?this.instance:new F(this,vu(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ls(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){Mu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}};c(ls,"MarkType");let ii=ls;const na=class na{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=ne.from(e.nodes),t.marks=ne.from(e.marks||{}),this.nodes=Da.compile(this.spec.nodes,this),this.marks=ii.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||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=rn.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=l=="_"?null:l?Pa(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Pa(this,o.split(" "))}this.nodeFromJSON=i=>wt.fromJSON(this,i),this.markFromJSON=i=>F.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 Da){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 lo(r,r.defaultAttrs,e,F.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}};c(na,"Schema");let si=na;function Pa(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 l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}c(Pa,"gatherMarks");function wh(n){return n.tag!=null}c(wh,"isTagRule");function xh(n){return n.style!=null}c(xh,"isStyleRule");const hr=class hr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(wh(i))this.tags.push(i);else if(xh(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 oi(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new oi(this,t,!0);return r.addAll(e,F.none,t.from,t.to),T.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(vh(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],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||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 l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}c(r,"insert");for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ba(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=Ba(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new hr(e,hr.schemaRules(e)))}};c(hr,"DOMParser");let qt=hr;const Eu={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},Sh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ou={ol:!0,ul:!0},kr=1,uo=2,tr=4;function La(n,e,t){return e!=null?(e?kr:0)|(e==="full"?uo:0):n&&n.whitespace=="pre"?kr|uo:t&~tr}c(La,"wsOptionsFor");const ra=class ra{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=F.none,this.match=s||(o&tr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.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=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.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&&!Eu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}};c(ra,"NodeContext");let gn=ra;const ia=class ia{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=La(null,t.preserveWhitespace,0)|(r?tr:0);i?s=new gn(i.type,i.attrs,F.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new gn(null,null,F.none,!0,null,o):s=new gn(e.schema.topNodeType,null,F.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&uo?"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,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));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 l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.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(),l;Ou.hasOwnProperty(o)&&this.parser.normalizeLists&&Ch(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Sh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(Eu.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(s),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!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 l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let 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 a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=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(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;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,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=a,!u.length))break;if(a.solid){if(r)break;l+=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=F.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):za(l.type,e.type))&&(o=l.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 l=La(e,s,o.options);o.options&tr&&o.content.length==0&&(l|=tr);let a=F.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):za(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new gn(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;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=c((l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0},"match");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}}};c(ia,"ParseContext");let oi=ia;function Ch(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ou.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}c(Ch,"normalizeList");function vh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}c(vh,"matches");function Ba(n){let e={};for(let t in n)e[t]=n[t];return e}c(Ba,"copy");function za(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=c(l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||s.indexOf(d)<0&&o(d))return!0}},"scan");if(o(i.contentMatch))return!0}}c(za,"markMayApply");const as=class as{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ds(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],d=this.serializeMark(u,o.isInline,t);d&&(s.push([u,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}=Gr(Ds(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&&Gr(Ds(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Gr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new as(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=$a(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return $a(e.marks)}};c(as,"DOMSerializer");let sn=as;function $a(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}c($a,"gatherToDOM");function Ds(n){return n.document||window.document}c(Ds,"doc$1");const Fa=new WeakMap;function Mh(n){let e=Fa.get(n);return e===void 0&&Fa.set(n,e=Th(n)),e}c(Mh,"suspiciousAttributes");function Th(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 c(t,"scan"),t(n),e}c(Th,"suspiciousAttributesInner");function Gr(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=Mh(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 l,a=t?n.createElementNS(t,i):n.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:m}=Gr(n,h,t,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}c(Gr,"renderSpec");const Au=65535,Nu=Math.pow(2,16);function Eh(n,e){return n+e*Nu}c(Eh,"makeRecover");function Ha(n){return n&Au}c(Ha,"recoverIndex");function Oh(n){return(n-(n&Au))/Nu}c(Oh,"recoverOffset");const Iu=1,Ru=2,Yr=4,Du=8,sa=class sa{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Du)>0}get deletedBefore(){return(this.delInfo&(Iu|Yr))>0}get deletedAfter(){return(this.delInfo&(Ru|Yr))>0}get deletedAcross(){return(this.delInfo&Yr)>0}};c(sa,"MapResult");let wr=sa;const mt=class mt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&mt.empty)return mt.empty}recover(e){let t=0,r=Ha(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+Oh(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 l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let u=this.ranges[l+s],d=this.ranges[l+o],f=a+u;if(e<=f){let h=u?e==a?-1:e==f?1:t:t,p=a+i+(h<0?0:d);if(r)return p;let m=e==(t<0?a:f)?null:Eh(l/3,e-a),g=e==a?Ru:e==f?Iu:Yr;return(t<0?e!=a:e!=f)&&(g|=Du),new wr(p,g,m)}i+=d-u}return r?e+i:new wr(e+i,0,null)}touches(e,t){let r=0,i=Ha(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+s],d=a+u;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+o]-u}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],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),u=this.ranges[i+t],d=this.ranges[i+r];e(l,l+u,a,a+d),s+=d-u}}invert(){return new mt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?mt.empty:new mt(e<0?[0,-e,0]:[0,0,e])}};c(mt,"StepMap");let st=mt;st.empty=new st([]);const pr=class pr{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 pr(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 pr;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],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new wr(e,i,null)}};c(pr,"Mapping");let li=pr;const Ps=Object.create(null),oa=class oa{getMap(){return st.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ps[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 Ps)throw new RangeError("Duplicate use of step JSON ID "+e);return Ps[e]=t,t.prototype.jsonID=e,t}};c(oa,"Step");let ee=oa;const Dt=class Dt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Dt(e,null)}static fail(e){return new Dt(null,e)}static fromReplace(e,t,r,i){try{return Dt.ok(e.replace(t,r,i))}catch(s){if(s instanceof Pn)return Dt.fail(s.message);throw s}}};c(Dt,"StepResult");let se=Dt;function tl(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(tl(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}c(tl,"mapFragment");const Pt=class Pt extends ee{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 T(tl(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return se.fromReplace(e,this.from,this.to,s)}invert(){return new Mt(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 Pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(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 Pt(t.from,t.to,e.markFromJSON(t.mark))}};c(Pt,"AddMarkStep");let xr=Pt;ee.jsonID("addMark",xr);const Lt=class Lt extends ee{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 T(tl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return se.fromReplace(e,this.from,this.to,r)}invert(){return new xr(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 Lt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lt(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 Lt(t.from,t.to,e.markFromJSON(t.mark))}};c(Lt,"RemoveMarkStep");let Mt=Lt;ee.jsonID("removeMark",Mt);const Bt=class Bt extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return se.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return se.fromReplace(e,this.pos,this.pos+1,new T(C.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 Bt(this.pos,t.marks[i]);return new Bt(this.pos,this.mark)}}return new Bn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bt(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 Bt(t.pos,e.markFromJSON(t.mark))}};c(Bt,"AddNodeMarkStep");let Sr=Bt;ee.jsonID("addNodeMark",Sr);const mr=class mr extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return se.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return se.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Sr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mr(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 mr(t.pos,e.markFromJSON(t.mark))}};c(mr,"RemoveNodeMarkStep");let Bn=mr;ee.jsonID("removeNodeMark",Bn);const Ze=class Ze extends ee{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&fo(e,this.from,this.to)?se.fail("Structure replace would overwrite content"):se.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new st([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ze(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 Ze(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ze)||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?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ze(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?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ze(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 Ze(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}};c(Ze,"ReplaceStep");let we=Ze;ee.jsonID("replace",we);const yn=class yn extends ee{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(fo(e,this.from,this.gapFrom)||fo(e,this.gapTo,this.to)))return se.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return se.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?se.fromReplace(e,this.from,this.to,r):se.fail("Content does not fit in gap")}getMap(){return new st([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 yn(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 yn(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 yn(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}};c(yn,"ReplaceAroundStep");let ce=yn;ee.jsonID("replaceAround",ce);function fo(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}c(fo,"contentBetween");function Ah(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+a.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[g])?o.to=p:i.push(o=new Mt(h,p,f[g])));l&&l.to==h?l.to=p:s.push(l=new xr(h,p,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}c(Ah,"addMark");function Nh(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof ii){let u=o.marks,d;for(;d=r.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=s):i.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(o=>n.step(new Mt(o.from,o.to,o.style)))}c(Nh,"removeMark");function nl(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let u=s.child(a),d=l+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new we(l,d,T.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new Mt(l,d,u.marks[h]));if(i&&u.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new T(C.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new we(l+h.index,l+h.index+h[0].length,m))}}l=d}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(l,l,new T(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}c(nl,"clearIncompatible");function Ih(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}c(Ih,"canCut");function qn(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||!Ih(i,s,o))break}return null}c(qn,"liftTarget");function Rh(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,u=l,d=C.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,d=C.from(r.node(m).copy(d)),f++):a--;let h=C.empty,p=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=C.from(i.node(m).copy(h)),p++):u++;n.step(new ce(a,u,o,l,new T(d.append(h),f,p),d.size-f,!0))}c(Rh,"lift$2");function rl(n,e,t=null,r=n){let i=Dh(n,e),s=i&&Ph(r,e);return s?i.map(Va).concat({type:e,attrs:t}).concat(s.map(Va)):null}c(rl,"findWrapping");function Va(n){return{type:n,attrs:null}}c(Va,"withAttrs");function Dh(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}c(Dh,"findWrappingOutside");function Ph(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 a=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;a&&u<i;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:o}c(Ph,"findWrappingInside");function Lh(n,e,t){let r=C.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new ce(i,s,i,s,new T(r,0,0),t.length,!0))}c(Lh,"wrap");function Bh(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,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&zh(n.doc,n.mapping.slice(s).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Lu(n,o,l,s),nl(n,n.mapping.slice(s).map(l,1),r,void 0,u===null);let d=n.mapping.slice(s),f=d.map(l,1),h=d.map(l+o.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new T(C.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&Pu(n,o,l,s),!1}})}c(Bh,"setBlockType$1");function Pu(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}c(Pu,"replaceNewlines");function Lu(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(`
5
+ `))}})}c(Lu,"replaceLinebreaks");function zh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}c(zh,"canChangeType");function $h(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 ce(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new T(C.from(o),0,0),1,!0))}c($h,"setNodeMarkup");function rt(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 u=i.depth-1,d=t-2;u>s;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}c(rt,"canSplit");function Fh(n,e,t=1,r){let i=n.doc.resolve(e),s=C.empty,o=C.empty;for(let l=i.depth,a=i.depth-t,u=t-1;l>a;l--,u--){s=C.from(i.node(l).copy(s));let d=r&&r[u];o=C.from(d?d.type.create(d.attrs,o):i.node(l).copy(o))}n.step(new we(e,e,new T(s.append(o),t,t),!0))}c(Fh,"split");function At(n,e){let t=n.resolve(e),r=t.index();return Bu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}c(At,"canJoin");function Hh(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}c(Hh,"canAppendWithSubstitutedLinebreaks");function Bu(n,e){return!!(n&&e&&!n.isLeaf&&Hh(n,e))}c(Bu,"joinable");function ys(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Bu(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}c(ys,"joinPoint");function Vh(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",f=!!o.contentMatch.matchType(i);d&&!f?r=!1:!d&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);Lu(n,d.node(),d.before(),l)}o.inlineContent&&nl(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new we(u,a.map(e+t,-1),T.empty,!0)),r===!0){let d=n.doc.resolve(u);Pu(n,d.node(),d.before(),n.steps.length)}return n}c(Vh,"join");function jh(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}c(jh,"insertPoint");function zu(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 l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),u=r.node(o),d=!1;if(s==1)d=u.canReplace(a,a,i);else{let f=u.contentMatchAt(a).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}c(zu,"dropPoint");function bs(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return $u(i,s,r)?new we(e,t,r):new ho(i,s,r).fit()}c(bs,"replaceStep");function $u(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}c($u,"fitsTrivially");const la=class la{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.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=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):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,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new T(s,o,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new we(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let 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=Ls(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(o?u.matchType(o.type)||(f=u.fillBefore(C.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ls(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(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=Ls(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new T(Xn(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new T(Xn(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 g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(Fu(g.mark(h.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=Qn(this.placed,t,C.from(d)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?T.empty:new T(Xn(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new T(Xn(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Bs(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=Bs(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=Bs(e,l,u,a,!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=Qn(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=Qn(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=Qn(this.placed,this.frontier.length,t))}};c(la,"Fitter");let ho=la;function Xn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Xn(n.firstChild.content,e-1,t)))}c(Xn,"dropFromFragment");function Qn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qn(n.lastChild.content,e-1,t)))}c(Qn,"addToFragment");function Ls(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}c(Ls,"contentAt");function Fu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Fu(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(C.empty,!0)))),n.copy(r)}c(Fu,"closeNodeStart");function Bs(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 l=r.fillBefore(s.content,!0,o);return l&&!Wh(t,s.content,o)?l:null}c(Bs,"contentAfterFits");function Wh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}c(Wh,"invalidMarks");function Uh(n){return n.spec.defining||n.spec.definingForContent}c(Uh,"definesContent");function Kh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if($u(i,s,r))return n.step(new we(e,t,r));let o=Vu(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?l=h:i.before(h)==p&&o.splice(1,0,-h)}let a=o.indexOf(l),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=Uh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<o.length;g++){let y=o[(g+a)%o.length],b=!0;y<0&&(b=!1,y=-y);let k=i.node(y-1),x=i.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(i.before(y),b?s.after(y):t,new T(Hu(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=o[h];p<0||(e=i.before(p),t=s.after(p))}}c(Kh,"replaceRange");function Hu(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Hu(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(C.empty,!0))}return n}c(Hu,"closeFragment");function _h(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=jh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(C.from(r),0,0))}c(_h,"replaceRangeWith");function qh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Vu(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let 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)}c(qh,"deleteRange$1");function Vu(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}c(Vu,"coveredDepths");const bn=class bn extends ee{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 se.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 se.fromReplace(e,this.pos,this.pos+1,new T(C.from(i),0,t.isLeaf?0:1))}getMap(){return st.empty}invert(e){return new bn(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 bn(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 bn(t.pos,t.attr,t.value)}};c(bn,"AttrStep");let ai=bn;ee.jsonID("attr",ai);const gr=class gr extends ee{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 se.ok(r)}getMap(){return st.empty}invert(e){return new gr(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 gr(t.attr,t.value)}};c(gr,"DocAttrStep");let ci=gr;ee.jsonID("docAttr",ci);var Sn;let zn=(Sn=class extends Error{},c(Sn,"TransformError"),Sn);zn=c(function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},"TransformError");zn.prototype=Object.create(Error.prototype);zn.prototype.constructor=zn;zn.prototype.name="TransformError";const aa=class aa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new zn(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=T.empty){let i=bs(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new T(C.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Kh(this,e,t,r),this}replaceRangeWith(e,t,r){return _h(this,e,t,r),this}deleteRange(e,t){return qh(this,e,t),this}lift(e,t){return Rh(this,e,t),this}join(e,t=1){return Vh(this,e,t),this}wrap(e,t){return Lh(this,e,t),this}setBlockType(e,t=e,r,i=null){return Bh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return $h(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new ai(e,t,r)),this}setDocAttribute(e,t){return this.step(new ci(e,t)),this}addNodeMark(e,t){return this.step(new Sr(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 F)t.isInSet(r.marks)&&this.step(new Bn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Bn(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return Fh(this,e,t,r),this}addMark(e,t,r){return Ah(this,e,t,r),this}removeMark(e,t,r){return Nh(this,e,t,r),this}clearIncompatible(e,t,r){return nl(this,e,t,r),this}};c(aa,"Transform");let ui=aa;const zs=Object.create(null),ca=class ca{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new di(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=T.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:u}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(u.pos),l?T.empty:t),l==0&&Ua(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:l}=i[s],a=e.mapping.slice(r),u=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),Ua(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):hn(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?hn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):hn(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 Ie(e.node(0))}static atStart(e){return hn(e,e,0,0,1)||new Ie(e)}static atEnd(e){return hn(e,e,e.content.size,e.childCount,-1)||new Ie(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=zs[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 zs)throw new RangeError("Duplicate use of selection JSON ID "+e);return zs[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}};c(ca,"Selection");let R=ca;R.prototype.visible=!0;const ua=class ua{constructor(e,t){this.$from=e,this.$to=t}};c(ua,"SelectionRange");let di=ua,ja=!1;function Wa(n){!ja&&!n.parent.inlineContent&&(ja=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}c(Wa,"checkTextSelection");const zt=class zt extends R{constructor(e,t=e){Wa(e),Wa(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return R.near(r);let i=e.resolve(t.map(this.anchor));return new zt(i.parent.inlineContent?i:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new fi(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 zt(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=R.findFrom(t,r,!0)||R.findFrom(t,-r,!0);if(s)t=s.$head;else return R.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new zt(e,t)}};c(zt,"TextSelection");let L=zt;R.jsonID("text",L);const cs=class cs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new cs(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}};c(cs,"TextBookmark");let fi=cs;const $t=class $t extends R{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?R.near(s):new $t(s)}content(){return new T(C.from(this.node),0,0)}eq(e){return e instanceof $t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new po(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $t(e.resolve(t.anchor))}static create(e,t){return new $t(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};c($t,"NodeSelection");let I=$t;I.prototype.visible=!1;R.jsonID("node",I);const us=class us{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new fi(r,r):new us(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&I.isSelectable(r)?new I(t):R.near(t)}};c(us,"NodeBookmark");let po=us;const kn=class kn extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let r=R.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new kn(e)}map(e){return new kn(e)}eq(e){return e instanceof kn}getBookmark(){return Jh}};c(kn,"AllSelection");let Ie=kn;R.jsonID("all",Ie);const Jh={map(){return this},resolve(n){return new Ie(n)}};function hn(n,e,t,r,i,s=!1){if(e.inlineContent)return L.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&I.isSelectable(l))return I.create(n,t-(i<0?l.nodeSize:0))}else{let a=hn(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}c(hn,"findSelectionIn");function Ua(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof we||i instanceof ce))return;let s=n.mapping.maps[r],o;s.forEach((l,a,u,d)=>{o==null&&(o=d)}),n.setSelection(R.near(n.doc.resolve(o),t))}c(Ua,"selectionToInsertionEnd$1");const Ka=1,zr=2,_a=4,da=class da extends ui{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|Ka)&~zr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ka)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=zr,this}ensureMarks(e){return F.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&zr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~zr,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)||F.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(R.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_a,this}get scrolledIntoView(){return(this.updated&_a)>0}};c(da,"Transaction");let mo=da;function qa(n,e){return!e||!n?n:n.bind(e)}c(qa,"bind");const fa=class fa{constructor(e,t,r){this.name=e,this.init=qa(t.init,r),this.apply=qa(t.apply,r)}};c(fa,"FieldDesc");let Vt=fa;const Gh=[new Vt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Vt("selection",{init(n,e){return n.selection||R.atStart(e.doc)},apply(n){return n.selection}}),new Vt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Vt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],ha=class ha{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Gh.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 Vt(r.key,r.spec.state,r))})}};c(ha,"Configuration");let nr=ha;const Ft=class Ft{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 l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,u=i?i[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<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 Ft(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 mo(this)}static create(e){let t=new nr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ft(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 nr(this.schema,e.plugins),r=t.fields,i=new Ft(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 nr(e.schema,e.plugins),s=new Ft(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=wt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=R.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 l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=u.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};c(Ft,"EditorState");let go=Ft;function ju(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ju(i,e,{})),t[r]=i}return t}c(ju,"bindProps");const pa=class pa{constructor(e){this.spec=e,this.props={},e.props&&ju(e.props,this,this.props),this.key=e.key?e.key.key:Wu("plugin")}getState(e){return e[this.key]}};c(pa,"Plugin");let V=pa;const $s=Object.create(null);function Wu(n){return n in $s?n+"$"+ ++$s[n]:($s[n]=0,n+"$")}c(Wu,"createKey");const ma=class ma{constructor(e="key"){this.key=Wu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};c(ma,"PluginKey");let U=ma;const il=c((n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0),"deleteSelection$1");function Uu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}c(Uu,"atBlockStart");const Ku=c((n,e,t)=>{let r=Uu(n,t);if(!r)return!1;let i=sl(r);if(!i){let o=r.blockRange(),l=o&&qn(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ed(n,i,e,-1))return!0;if(r.parent.content.size==0&&($n(s,"end")||I.isSelectable(s)))for(let o=r.depth;;o--){let l=bs(n.doc,r.before(o),r.after(o),T.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection($n(s,"end")?R.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):I.create(a.doc,i.pos-s.nodeSize)),e(a.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},"joinBackward$1"),Yh=c((n,e,t)=>{let r=Uu(n,t);if(!r)return!1;let i=sl(r);return i?_u(n,i,e):!1},"joinTextblockBackward$1"),Xh=c((n,e,t)=>{let r=Ju(n,t);if(!r)return!1;let i=ol(r);return i?_u(n,i,e):!1},"joinTextblockForward$1");function _u(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,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=bs(n.doc,s,a,T.empty);if(!u||u.from!=s||u instanceof we&&u.slice.size>=a-s)return!1;if(t){let d=n.tr.step(u);d.setSelection(L.create(d.doc,s)),t(d.scrollIntoView())}return!0}c(_u,"joinTextblocksAround");function $n(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}c($n,"textblockAt");const qu=c((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=sl(r)}let o=s&&s.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)},"selectNodeBackward$1");function sl(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}c(sl,"findCutBefore");function Ju(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}c(Ju,"atBlockEnd");const Gu=c((n,e,t)=>{let r=Ju(n,t);if(!r)return!1;let i=ol(r);if(!i)return!1;let s=i.nodeAfter;if(ed(n,i,e,1))return!0;if(r.parent.content.size==0&&($n(s,"start")||I.isSelectable(s))){let o=bs(n.doc,r.before(),r.after(),T.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection($n(s,"start")?R.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):I.create(l.doc,l.mapping.map(i.pos))),e(l.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},"joinForward$1"),Yu=c((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=ol(r)}let o=s&&s.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,s.pos)).scrollIntoView()),!0)},"selectNodeForward$1");function ol(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}c(ol,"findCutAfter");const Qh=c((n,e)=>{let t=n.selection,r=t instanceof I,i;if(r){if(t.node.isTextblock||!At(n.doc,t.from))return!1;i=t.from}else if(i=ys(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(I.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},"joinUp$1"),Zh=c((n,e)=>{let t=n.selection,r;if(t instanceof I){if(t.node.isTextblock||!At(n.doc,t.to))return!1;r=t.to}else if(r=ys(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},"joinDown$1"),ep=c((n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&qn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},"lift$1"),Xu=c((n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
6
+ `).scrollIntoView()),!0)},"newlineInCode$1");function ll(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}c(ll,"defaultBlockAt$1");const tp=c((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=ll(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(R.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},"exitCode$1"),Qu=c((n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ie||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ll(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,l=n.tr.insert(o,s.createAndFill());l.setSelection(L.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},"createParagraphNear$1"),Zu=c((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(rt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&qn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},"liftEmptyBlock$1");function np(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof I&&e.selection.node.isBlock)return!r.parentOffset||!rt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,u=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),u=r.start(p)==r.pos-(r.depth-p),l=ll(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(a&&l?{type:l}:null),o=p;break}else{if(p==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof L||e.selection instanceof Ie)&&d.deleteSelection();let f=d.mapping.map(r.pos),h=rt(d.doc,f,s.length,s);if(h||(s[0]=l?{type:l}:null,h=rt(d.doc,f,s.length,s)),!h)return!1;if(d.split(f,s.length,s),!a&&u&&r.node(o).type!=l){let p=d.mapping.map(r.before(o)),m=d.doc.resolve(p);l&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(o)),l)}return t&&t(d.scrollIntoView()),!0}}c(np,"splitBlockAs");const rp=np(),ip=c((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(I.create(n.doc,i))),!0)},"selectParentNode$1");function sp(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||At(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}c(sp,"joinMaybeClear");function ed(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&sp(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,m=C.empty;for(let b=o.length-1;b>=0;b--)m=C.from(o[b].create(null,m));m=C.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new T(m,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&At(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&a?null:R.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&qn(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&$n(s,"start",!0)&&$n(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let b=C.empty;for(let x=m.length-1;x>=0;x--)b=C.from(m[x].copy(b));let k=n.tr.step(new ce(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new T(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}c(ed,"deleteBarrier");function td(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(L.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}c(td,"selectTextblockSide");const op=td(-1),lp=td(1);function ap(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&rl(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}c(ap,"wrapIn$1");function Ja(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:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,u)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let d=t.doc.resolve(u),f=d.index();i=d.parent.canReplaceWith(f,f+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:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}c(Ja,"setBlockType");function al(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}c(al,"chainCommands");al(il,Ku,qu);al(il,Gu,Yu);al(Xu,Qu,Zu,rp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function cp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let l=r?t.tr:null;return up(l,o,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}c(cp,"wrapInList$1");function up(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 a=o.resolve(e.start-2);s=new Ln(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ln(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=rl(s,t,r,e);return l?(n&&dp(n,e,l,i,t),!0):!1}c(up,"wrapRangeInList");function dp(n,e,t,r,i){let s=C.empty;for(let d=t.length-1;d>=0;d--)s=C.from(t[d].type.create(t[d].attrs,s));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new T(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 l=t.length-o,a=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&rt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}c(dp,"doWrapInList");function fp(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?hp(e,t,n,s):pp(e,t,s):!0:!1}}c(fp,"liftListItem$1");function hp(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new ce(s-1,o,s,o,new T(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Ln(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=qn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return At(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}c(hp,"liftToOuterList");function pp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+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 l=t.startIndex==0,a=t.endIndex==i.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,o.content.append(a?C.empty:C.from(i))))return!1;let f=s.pos,h=f+o.nodeSize;return r.step(new ce(f-(l?1:0),h+(a?1:0),f+1,h-1,new T((l?C.empty:C.from(i.copy(C.empty))).append(a?C.empty:C.from(i.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}c(pp,"liftOutOfList");function mp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=C.from(u?n.create():null),f=new T(C.from(n.create(null,C.from(l.type.create(null,d)))),u?3:1,0),h=s.start,p=s.end;t(e.tr.step(new ce(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}c(mp,"sinkListItem$1");const re=c(function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},"domIndex"),Fn=c(function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},"parentNode");let yo=null;const Qe=c(function(n,e,t){let r=yo||(yo=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},"textRange"),gp=c(function(){yo=null},"clearReusedRange"),on=c(function(n,e,t,r){return t&&(Ga(n,e,t,r,-1)||Ga(n,e,t,r,1))},"isEquivalentPosition"),yp=/^(img|br|input|textarea|hr)$/i;function Ga(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Me(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Ir(n)||yp.test(n.nodeName)||n.contentEditable=="false")return!1;e=re(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?Me(n):0}else return!1}}c(Ga,"scanFor");function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(Me,"nodeSize");function bp(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=Me(n)}else if(n.parentNode&&!Ir(n))e=re(n),n=n.parentNode;else return null}}c(bp,"textNodeBefore$1");function kp(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=re(n)+1,n=n.parentNode;else return null}}c(kp,"textNodeAfter$1");function wp(n,e,t){for(let r=e==0,i=e==Me(n);r||i;){if(n==t)return!0;let s=re(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Me(n)}}c(wp,"isOnEdge");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)}c(Ir,"hasBlockDesc");const ks=c(function(n){return n.focusNode&&on(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)},"selectionCollapsed");function Rt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}c(Rt,"keyEvent");function xp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}c(xp,"deepActiveElement");function Sp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Me(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Me(r.startContainer),r.startOffset)}}}c(Sp,"caretFromPoint");const Ue=typeof navigator<"u"?navigator:null,Ya=typeof document<"u"?document:null,Nt=Ue&&Ue.userAgent||"",bo=/Edge\/(\d+)/.exec(Nt),nd=/MSIE \d/.exec(Nt),ko=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Nt),ye=!!(nd||ko||bo),xt=nd?document.documentMode:ko?+ko[1]:bo?+bo[1]:0,Te=!ye&&/gecko\/(\d+)/i.test(Nt);Te&&+(/Firefox\/(\d+)/.exec(Nt)||[0,0])[1];const wo=!ye&&/Chrome\/(\d+)/.exec(Nt),ae=!!wo,rd=wo?+wo[1]:0,fe=!ye&&!!Ue&&/Apple Computer/.test(Ue.vendor),Hn=fe&&(/Mobile\/\w+/.test(Nt)||!!Ue&&Ue.maxTouchPoints>2),ve=Hn||(Ue?/Mac/.test(Ue.platform):!1),Cp=Ue?/Win/.test(Ue.platform):!1,tt=/Android \d/.test(Nt),Rr=!!Ya&&"webkitFontSmoothing"in Ya.documentElement.style,vp=Rr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Mp(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}}c(Mp,"windowRect");function Je(n,e){return typeof n=="number"?n:n[e]}c(Je,"getSide$1");function Tp(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}}c(Tp,"clientRect");function Xa(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=Fn(o);continue}let l=o,a=l==s.body,u=a?Mp(s):Tp(l),d=0,f=0;if(e.top<u.top+Je(r,"top")?f=-(u.top-e.top+Je(i,"top")):e.bottom>u.bottom-Je(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Je(i,"top")-u.top:e.bottom-u.bottom+Je(i,"bottom")),e.left<u.left+Je(r,"left")?d=-(u.left-e.left+Je(i,"left")):e.right>u.right-Je(r,"right")&&(d=e.right-u.right+Je(i,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Fn(o)}}c(Xa,"scrollRectIntoView");function Ep(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 l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:id(n.dom)}}c(Ep,"storeScrollPos");function id(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Fn(r));return e}c(id,"scrollStack");function Op({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;sd(t,r==0?0:r-e)}c(Op,"resetScrollPos");function sd(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)}}c(sd,"restoreScrollStack");let dn=null;function Ap(n){if(n.setActive)return n.setActive();if(dn)return n.focus(dn);let e=id(n);n.focus(dn==null?{get preventScroll(){return dn={preventScroll:!0},!0}}:void 0),dn||(dn=!1,sd(e,0))}c(Ap,"focusPreventScroll");function od(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Qe(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=l){o=Math.max(m.bottom,o),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=d,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=u,r=0),t&&t.nodeType==3?Np(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:od(t,i)}c(od,"findOffsetInNode");function Np(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=dt(r,1);if(s.top!=s.bottom&&cl(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}c(Np,"findOffsetInText");function cl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}c(cl,"inRect");function Ip(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}c(Ip,"targetKludge");function Rp(n,e,t){let{node:r,offset:i}=od(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)}c(Rp,"posFromElement");function Dp(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}c(Dp,"posFromCaret");function ld(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 l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(cl(e,u))return ld(o,e,u)}}if((s=(s+1)%r)==i)break}return n}c(ld,"elementFromPoint");function Pp(n,e){let t=n.dom.ownerDocument,r,i=0,s=Sp(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=n.dom.getBoundingClientRect();if(!cl(e,u)||(o=ld(n.dom,e,u),!o))return null}if(fe)for(let u=o;r&&u;u=Fn(u))u.draggable&&(r=void 0);if(o=Ip(o,e),r){if(Te&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;Rr&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Dp(n,r,i,e))}l==null&&(l=Rp(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}c(Pp,"posAtCoords");function Qa(n){return n.top<n.bottom||n.left<n.right}c(Qa,"nonZero");function dt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Qa(r))return r}return Array.prototype.find.call(t,Qa)||n.getBoundingClientRect()}c(dt,"singleRect");const Lp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ad(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Rr||Te;if(r.nodeType==3)if(o&&(Lp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=dt(Qe(r,i,i),t);if(Te&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=dt(Qe(r,i-1,i-1),-1);if(u.top==a.top){let d=dt(Qe(r,i,i+1),-1);if(d.top!=a.top)return Gn(d,d.left<u.left)}}return a}else{let a=i,u=i,d=t<0?1:-1;return t<0&&!i?(u++,d=-1):t>=0&&i==r.nodeValue.length?(a--,d=1):t<0?a--:u++,Gn(dt(Qe(r,a,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Me(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Fs(a.getBoundingClientRect(),!1)}if(s==null&&i<Me(r)){let a=r.childNodes[i];if(a.nodeType==1)return Fs(a.getBoundingClientRect(),!0)}return Fs(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Me(r))){let a=r.childNodes[i-1],u=a.nodeType==3?Qe(a,Me(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Gn(dt(u,1),!1)}if(s==null&&i<Me(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?Qe(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return Gn(dt(u,-1),!0)}return Gn(dt(r.nodeType==3?Qe(r):r,-t),t>=0)}c(ad,"coordsAtPos");function Gn(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}}c(Gn,"flattenV");function Fs(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}}c(Fs,"flattenH");function cd(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()}}c(cd,"withFlushedState");function Bp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return cd(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=ad(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Qe(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];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})}c(Bp,"endOfTextblockVertical");const zp=/[\u0590-\u08ac]/;function $p(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,l=n.domSelection();return l?!zp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:cd(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}c($p,"endOfTextblockHorizontal");let Za=null,ec=null,tc=!1;function Fp(n,e,t){return Za==e&&ec==t?tc:(Za=e,ec=t,tc=t=="up"||t=="down"?Bp(n,e,t):$p(n,e,t))}c(Fp,"endOfTextblock");const Ee=0,nc=1,jt=2,Ke=3,ga=class ga{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Ee,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>re(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 l=i.children[o];if(l.size){i=l;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],l=s+o.size;if(l>e||o instanceof mi){i=e-s;break}s=l}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 hi&&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?re(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?re(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,l=0;;l++){let a=this.children[l],u=o+a.size;if(i==-1&&e<=u){let d=o+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=re(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=re(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}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 p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(s>m&&o<y)return g.setSelection(e-m-g.border,t-m-g.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((Te||fe)&&e==t){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
7
+ `),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:re(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Te&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&fe)&&on(l.node,l.offset,d.anchorNode,d.anchorOffset)&&on(a.node,a.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Te)){u.collapse(l.node,l.offset);try{e!=t&&u.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>t){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,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 l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?jt:nc,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ke:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?jt:Ke}r=o}this.dirty=jt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?jt:nc;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};c(ga,"ViewDesc");let ln=ga;const ya=class ya extends ln{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 l=document.createElement("span");l.appendChild(o),o=l}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==Ee&&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}};c(ya,"WidgetViewDesc");let hi=ya;const ba=class ba extends ln{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}};c(ba,"CompositionViewDesc");let xo=ba;const yr=class yr extends ln{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=sn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new yr(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ke||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ke&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ee){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ee}}slice(e,t,r){let i=yr.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 l=0;l<s.length;l++)s[l].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()}};c(yr,"MarkViewDesc");let Vn=yr;const ds=class ds extends ln{constructor(e,t,r,i,s,o,l,a,u){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,u=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),d=u&&u.dom,f=u&&u.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:f}=sn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!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),u?a=new So(e,t,r,i,d,f||null,h,u,s,o+1):t.isText?new pi(e,t,r,i,d,h,s):new ds(e,t,r,i,d,f||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=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==Ee&&e.eq(this.node)&&gi(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,l=s&&s.pos<0,a=new vo(this,o&&o.node,e);Wp(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?F.none:this.node.child(d).marks,r,e),a.placeWidget(u,e,i)},(u,d,f,h)=>{a.syncToMarks(u.marks,r,e);let p;a.findNodeMatch(u,d,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(u,d,f,p,e)||a.updateNextNode(u,d,f,e,h,i)||a.addNode(u,d,f,e,i),i+=u.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==jt)&&(o&&this.protectLocalComposition(e,o),ud(this.contentDOM,this.children,e),Hn&&Up(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof L)||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,l=Kp(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,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 xo(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==Ke||!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=Ee}updateOuterDeco(e){if(gi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=dd(this.dom,this.nodeDOM,Co(this.outerDeco,this.node,t),Co(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}};c(ds,"NodeViewDesc");let St=ds;function rc(n,e,t,r,i){fd(r,e,n);let s=new St(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}c(rc,"docViewDesc");const fs=class fs extends St{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ke||this.dirty!=Ee&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ee||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=Ee,!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 fs(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=Ke)}get domAtom(){return!1}isText(e){return this.node.text==e}};c(fs,"TextViewDesc");let pi=fs;const ka=class ka extends ln{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ee&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}};c(ka,"TrailingHackViewDesc");let mi=ka;const wa=class wa extends St{constructor(e,t,r,i,s,o,l,a,u,d){super(e,t,r,i,s,o,l,u,d),this.spec=a}update(e,t,r,i){if(this.dirty==Ke)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)}};c(wa,"CustomNodeViewDesc");let So=wa;function ud(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=ic(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof Vn){let a=r?r.previousSibling:n.lastChild;ud(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ic(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}c(ud,"renderDescs");const rr=c(function(n){n&&(this.nodeName=n)},"OuterDecoLevel");rr.prototype=Object.create(null);const Wt=[new rr];function Co(n,e,t){if(n.length==0)return Wt;let r=t?Wt[0]:new rr,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new rr(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new rr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}c(Co,"computeOuterDeco");function dd(n,e,t,r){if(t==Wt&&r==Wt)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Wt[0]),i=a}Hp(i,l||Wt[0],o)}return i}c(dd,"patchOuterDeco");function Hp(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)}}c(Hp,"patchAttributes");function fd(n,e,t){return dd(n,n,Wt,Co(e,t,n.nodeType!=1))}c(fd,"applyOuterDeco");function gi(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}c(gi,"sameOuterDeco");function ic(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}c(ic,"rm");const xa=class xa{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Vp(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=Ee,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let u=this.top.children[a];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Vn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,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 l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){s=l;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==Ke&&o.dom==o.contentDOM&&(o.dirty=jt),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 l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof St){let u=this.preMatch.matched.get(a);if(u!=null&&u!=s)return!1;let d=a.dom,f,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ke&&gi(t,a.outerDeco));if(!h&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,e,t,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=jt,f.updateChildren(i,o+1),f.dirty=Ee),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)||!gi(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=St.create(this.top,t,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,s){let o=St.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 hi(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 Vn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof pi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((fe||ae)&&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 mi(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))}};c(xa,"ViewTreeUpdater");let vo=xa;function Vp(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let u=t.children[r-1];if(u instanceof Vn)t=u,r=u.children.length;else{l=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}c(Vp,"preMatch");function jp(n,e){return n.type.side-e.type.side}c(jp,"compareSide");function Wp(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,i,e.forChild(s,d),u),s+=d.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let d,f;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(jp);for(let y=0;y<f.length;y++)t(f[y],u,!!a)}else t(d,u,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(u<n.childCount)p=u,h=n.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let y=m;o<i.length&&i[o].from<y&&(y=i[o].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=h.cut(y-s),h=h.cut(0,y-s),m=y,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(s,h),p),s=m}}c(Wp,"iterDeco");function Up(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}}c(Up,"iosHacks");function Kp(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<n.childCount;){let u=n.child(i++);if(s+=u.nodeSize,!u.isText)break;a+=u.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?a.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=t)return l+u;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}c(Kp,"findTextInFragment");function Mo(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],u=l,d=l+=a.size;u>=t||d<=e?s.push(a):(u<e&&s.push(a.slice(0,e-u,r)),i&&(s.push(i),i=void 0),d>t&&s.push(a.slice(t-u,a.size,r)))}return s}c(Mo,"replaceNodes");function ul(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 l=r.resolve(o),a,u;if(ks(t)){for(a=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&I.isSelectable(f)&&i.parent&&!(f.isInline&&wp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;u=new I(o==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,o]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;u=dl(n,d,l,f)}return u}c(ul,"selectionFromDOM");function hd(n){return n.editable?n.hasFocus():md(n)&&document.activeElement&&document.activeElement.contains(n.dom)}c(hd,"editorOwnsSelection");function it(n,e=!1){let t=n.state.selection;if(pd(n,t),!!hd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&on(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)qp(n);else{let{anchor:r,head:i}=t,s,o;sc&&!(t instanceof L)&&(t.$from.parent.inlineContent||(s=oc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=oc(n,t.to))),n.docView.setSelection(r,i,n,e),sc&&(s&&lc(s),o&&lc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&_p(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}c(it,"selectionToDOM");const sc=fe||ae&&rd<63;function oc(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 Hs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Hs(i);if(s)return Hs(s)}}c(oc,"temporarilyEditableNear");function Hs(n){return n.contentEditable="true",fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}c(Hs,"setEditable");function lc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}c(lc,"resetEditable");function _p(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(()=>{(!hd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}c(_p,"removeClassOnSelectionChange");function qp(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,re(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&ye&&xt<=11&&(t.disabled=!0,t.disabled=!1)}c(qp,"selectCursorWrapper");function pd(n,e){if(e instanceof I){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ac(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ac(n)}c(pd,"syncNodeSelection");function ac(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}c(ac,"clearNodeSelection");function dl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}c(dl,"selectionBetween");function cc(n){return n.editable&&!n.hasFocus()?!1:md(n)}c(cc,"hasFocusAndSelection");function md(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}}c(md,"hasSelection");function Jp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return on(e.node,e.offset,t.anchorNode,t.anchorOffset)}c(Jp,"anchorInRightPlace");function To(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&&R.findFrom(s,e)}c(To,"moveSelectionBlock");function ft(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}c(ft,"apply");function uc(n,e,t){let r=n.state.selection;if(r instanceof L)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 ft(n,new L(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=To(n.state,e);return i&&i instanceof I?ft(n,i):!1}else if(!(ve&&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 l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?I.isSelectable(s)?ft(n,new I(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Rr?ft(n,new L(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return ft(n,new L(e>0?r.$to:r.$from));{let i=To(n.state,e);return i?ft(n,i):!1}}}c(uc,"selectHorizontally");function yi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}c(yi,"nodeLen");function ir(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}c(ir,"isIgnorable");function fn(n,e){return e<0?Gp(n):Yp(n)}c(fn,"skipIgnoredNodes");function Gp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Te&&t.nodeType==1&&r<yi(t)&&ir(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(ir(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(gd(t))break;{let l=t.previousSibling;for(;l&&ir(l,-1);)i=t.parentNode,s=re(l),l=l.previousSibling;if(l)t=l,r=yi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Eo(n,t,r):i&&Eo(n,i,s)}c(Gp,"skipIgnoredNodesBefore");function Yp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=yi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(ir(l,1))s=t,o=++r;else break}else{if(gd(t))break;{let l=t.nextSibling;for(;l&&ir(l,1);)s=l.parentNode,o=re(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=yi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Eo(n,s,o)}c(Yp,"skipIgnoredNodesAfter");function gd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}c(gd,"isBlockNode");function Xp(n,e){for(;n&&e==n.childNodes.length&&!Ir(n);)e=re(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}}c(Xp,"textNodeAfter");function Qp(n,e){for(;n&&!e&&!Ir(n);)e=re(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}}c(Qp,"textNodeBefore");function Eo(n,e,t){if(e.nodeType!=3){let s,o;(o=Xp(e,t))?(e=o,t=0):(s=Qp(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ks(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&&it(n)},50)}c(Eo,"setSelFocus");function dc(n,e){let t=n.state.doc.resolve(e);if(!(ae||Cp)&&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"}c(dc,"findDirection");function fc(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||ve&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=To(n.state,e);if(o&&o instanceof I)return ft(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Ie?R.near(o,e):R.findFrom(o,e);return l?ft(n,l):!1}return!1}c(fc,"selectVertically");function hc(n,e){if(!(n.state.selection instanceof L))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}c(hc,"stopNativeHorizontalDelete");function pc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}c(pc,"switchEditable");function Zp(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;pc(n,r,"true"),setTimeout(()=>pc(n,r,"false"),20)}return!1}c(Zp,"safariDownArrowBug");function em(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}c(em,"getMods");function tm(n,e){let t=e.keyCode,r=em(e);if(t==8||ve&&t==72&&r=="c")return hc(n,-1)||fn(n,-1);if(t==46&&!e.shiftKey||ve&&t==68&&r=="c")return hc(n,1)||fn(n,1);if(t==13||t==27)return!0;if(t==37||ve&&t==66&&r=="c"){let i=t==37?dc(n,n.state.selection.from)=="ltr"?-1:1:-1;return uc(n,i,r)||fn(n,i)}else if(t==39||ve&&t==70&&r=="c"){let i=t==39?dc(n,n.state.selection.from)=="ltr"?1:-1:1;return uc(n,i,r)||fn(n,i)}else{if(t==38||ve&&t==80&&r=="c")return fc(n,-1,r)||fn(n,-1);if(t==40||ve&&t==78&&r=="c")return Zp(n)||fc(n,1,r)||fn(n,1);if(r==(ve?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}c(tm,"captureKeyDown");function fl(n,e){n.someProp("transformCopied",p=>{e=p(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 p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||sn.fromSchema(n.state.schema),l=Sd(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=xd[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:a,text:h,slice:e}}c(fl,"serializeForClipboard");function yd(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return l=new T(C.from(n.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(f)l=f;else{let h=i.marks(),{schema:p}=n.state,m=sn.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=sm(t),Rr&&om(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||qt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!nm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=lm(mc(l,+d[1],+d[2]),d[4]);else if(l=T.maxOpen(rm(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=mc(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}c(yd,"parseFromClipboard");const nm=/^(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 rm(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(l=>{if(!o)return;let a=i.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&s.length&&kd(a,s,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=wd(o[o.length-1],s.length));let d=bd(l,a);o.push(d),i=i.matchType(d.type),s=a}}),o)return C.from(o)}return n}c(rm,"normalizeSiblings");function bd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}c(bd,"withWrappers");function kd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=kd(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(C.from(bd(t,n,i+1))))}}c(kd,"addToSibling");function wd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,wd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}c(wd,"closeRight");function Oo(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=Oo(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}c(Oo,"closeRange");function mc(n,e,t){return e<n.openStart&&(n=new T(Oo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(Oo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}c(mc,"closeSlice");const xd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let gc=null;function Sd(){return gc||(gc=document.implementation.createHTMLDocument("title"))}c(Sd,"detachedDoc");let Vs=null;function im(n){let e=window.trustedTypes;return e?(Vs||(Vs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:c(t=>t,"createHTML")})),Vs.createHTML(n)):n}c(im,"maybeWrapTrusted");function sm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Sd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&xd[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=im(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}c(sm,"readHTML");function om(n){let e=n.querySelectorAll(ae?"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)}}c(om,"restoreReplacedSpaces");function lm(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 l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=C.from(a.create(r[l+1],i)),s++,o++}return new T(i,s,o)}c(lm,"addContext");const he={},pe={},am={touchstart:!0,touchmove:!0},Sa=class Sa{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}};c(Sa,"InputState");let Ao=Sa;function cm(n){for(let e in he){let t=he[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{dm(n,r)&&!hl(n,r)&&(n.editable||!(r.type in pe))&&t(n,r)},am[e]?{passive:!0}:void 0)}fe&&n.dom.addEventListener("input",()=>null),No(n)}c(cm,"initInput");function kt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}c(kt,"setSelectionOrigin");function um(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)}c(um,"destroyInput");function No(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>hl(n,r))})}c(No,"ensureListeners");function hl(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}c(hl,"runCustomHandler");function dm(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}c(dm,"eventBelongsToView");function fm(n,e){!hl(n,e)&&he[e.type]&&(n.editable||!(e.type in pe))&&he[e.type](n,e)}c(fm,"dispatchEvent");pe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!vd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(tt&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Hn&&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,Rt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||tm(n,t)?t.preventDefault():kt(n,"key")};pe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};pe.keypress=(n,e)=>{let t=e;if(vd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ve&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=c(()=>n.state.tr.insertText(i).scrollIntoView(),"deflt");!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function ws(n){return{left:n.clientX,top:n.clientY}}c(ws,"eventCoords");function hm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}c(hm,"isNear");function pl(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,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}c(pl,"runHandlerOnContext");function wn(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)}c(wn,"updateSelection");function pm(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(wn(n,new I(t)),!0):!1}c(pm,"selectClickedLeaf");function mm(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof I&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(I.isSelectable(l)){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?(wn(n,I.create(n.state.doc,i)),!0):!1}c(mm,"selectClickedNode");function gm(n,e,t,r,i){return pl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?mm(n,t):pm(n,t))}c(gm,"handleSingleClick");function ym(n,e,t,r){return pl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}c(ym,"handleDoubleClick");function bm(n,e,t,r){return pl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||km(n,t,r)}c(bm,"handleTripleClick");function km(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(wn(n,L.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),l=i.before(s);if(o.inlineContent)wn(n,L.create(r,l+1,l+1+o.content.size));else if(I.isSelectable(o))wn(n,I.create(r,l));else continue;return!0}}c(km,"defaultTripleClick");function ml(n){return bi(n)}c(ml,"forceDOMFlush");const Cd=ve?"metaKey":"ctrlKey";he.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=ml(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&hm(t,n.input.lastClick)&&!t[Cd]&&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(ws(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Io(n,o,t,!!r)):(s=="doubleClick"?ym:bm)(n,o.pos,o.inside,t)?t.preventDefault():kt(n,"pointer"))};const Ca=class Ca{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[Cd],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 l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof I&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Te&&!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)),kt(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(()=>it(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(ws(e))),this.updateAllowDefault(e),this.allowDefault||!t?kt(this.view,"pointer"):gm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||fe&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!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)?(wn(this.view,R.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):kt(this.view,"pointer")}move(e){this.updateAllowDefault(e),kt(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)}};c(Ca,"MouseDown");let Io=Ca;he.touchstart=n=>{n.input.lastTouch=Date.now(),ml(n),kt(n,"pointer")};he.touchmove=n=>{n.input.lastTouch=Date.now(),kt(n,"pointer")};he.contextmenu=n=>ml(n);function vd(n,e){return n.composing?!0:fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}c(vd,"inOrNearComposition");const wm=tt?5e3:-1;pe.compositionstart=pe.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(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),Te&&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 l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Md(n,wm)};pe.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++,Md(n,20))};function Md(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>bi(n),e))}c(Md,"scheduleComposeEnd");function Td(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Sm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}c(Td,"clearComposition");function xm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=bp(e.focusNode,e.focusOffset),r=kp(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}c(xm,"findCompositionNode");function Sm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}c(Sm,"timestampFromCustomEvent");function bi(n,e=!1){if(!(tt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Td(n),e||n.docView&&n.docView.dirty){let t=ul(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}}c(bi,"endComposition");function Cm(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)}c(Cm,"captureCopy");const Cr=ye&&xt<15||Hn&&vp<604;he.copy=pe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Cr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=fl(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Cm(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function vm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}c(vm,"sliceSingleNode");function Mm(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?vr(n,r.value,null,i,e):vr(n,r.textContent,r.innerHTML,i,e)},50)}c(Mm,"capturePaste");function vr(n,e,t,r,i){let s=yd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||T.empty)))return!0;if(!s)return!1;let o=vm(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}c(vr,"doPaste");function Ed(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," "):""}c(Ed,"getText$1");pe.paste=(n,e)=>{let t=e;if(n.composing&&!tt)return;let r=Cr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&vr(n,Ed(r),r.getData("text/html"),i,t)?t.preventDefault():Mm(n,t)};const va=class va{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};c(va,"Dragging");let ki=va;const Tm=ve?"altKey":"ctrlKey";function Od(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Tm]}c(Od,"dragMoves");he.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(ws(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof I?i.to-1:i.to))){if(r&&r.mightDrag)o=I.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=I.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:u,slice:d}=fl(n,l);(!t.dataTransfer.files.length||!ae||rd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Cr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Cr||t.dataTransfer.setData("text/plain",u),n.dragging=new ki(d,Od(n,t),o)};he.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};pe.dragover=pe.dragenter=(n,e)=>e.preventDefault();pe.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(ws(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",m=>{o=m(o,n,!1)}):o=yd(n,Ed(t.dataTransfer),Cr?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&Od(n,t));if(n.someProp("handleDrop",m=>m(n,t,o||T.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?zu(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let u=n.state.tr;if(l){let{node:m}=r;m?m.replace(u):u.deleteSelection()}let d=u.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=u.doc;if(f?u.replaceRangeWith(d,d,o.content.firstChild):u.replaceRange(d,d,o),u.doc.eq(h))return;let p=u.doc.resolve(d);if(f&&I.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new I(p));else{let m=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),u.setSelection(dl(n,p,u.doc.resolve(m)))}n.focus(),n.dispatch(u.setMeta("uiEvent","drop"))};he.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())&&it(n)},20))};he.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)};he.beforeinput=(n,e)=>{if(ae&&tt&&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,Rt(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 pe)he[n]=pe[n];function Mr(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}c(Mr,"compareObjs");const hs=class hs{constructor(e,t){this.toDOM=e,this.spec=t||Gt,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 Oe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof hs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Mr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};c(hs,"WidgetType");let wi=hs;const br=class br{constructor(e,t){this.attrs=e,this.spec=t||Gt}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 Oe(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof br&&Mr(this.attrs,e.attrs)&&Mr(this.spec,e.spec)}static is(e){return e.type instanceof br}destroy(){}};c(br,"InlineType");let Jt=br;const ps=class ps{constructor(e,t){this.attrs=e,this.spec=t||Gt}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 Oe(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 ps&&Mr(this.attrs,e.attrs)&&Mr(this.spec,e.spec)}destroy(){}};c(ps,"NodeType");let Ro=ps;const Ht=class Ht{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ht(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 Ht(e,e,new wi(t,r))}static inline(e,t,r,i){return new Ht(e,t,new Jt(r,i))}static node(e,t,r,i){return new Ht(e,t,new Ro(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof wi}};c(Ht,"Decoration");let Oe=Ht;const pn=[],Gt={},$e=class $e{constructor(e,t){this.local=e.length?e:pn,this.children=t.length?t:pn}static create(e,t){return t.length?Si(t,e,0,Gt):le}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 l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==le||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Gt)}mapInner(e,t,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Em(this.children,o||[],e,t,r,i,s):o?new $e(o.sort(Yt),pn):le}add(e,t){return t.length?this==le?$e.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let u=a+r,d;if(d=Nd(t,l,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,d,u+1):i.splice(s,0,a,a+l.nodeSize,Si(d,l,u+1,Gt)),s+=3}});let o=Ad(s?Id(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new $e(o.length?this.local.concat(o).sort(Yt):this.local,i||this.children)}remove(e){return e.length==0||this==le?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,l=r[s]+t,a=r[s+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,l+1);u!=le?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new $e(i,r):le}forChild(e,t){if(this==le)return this;if(t.isLeaf)return $e.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof Jt){let u=Math.max(s,a.from)-s,d=Math.min(o,a.to)-s;u<d&&(i||(i=[])).push(a.copy(u,d))}}if(i){let l=new $e(i.sort(Yt),pn);return r?new xi([l,r]):l}return r||le}eq(e){if(this==e)return!0;if(!(e instanceof $e)||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 gl(this.localsInner(e))}localsInner(e){if(this==le)return pn;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}};c($e,"DecorationSet");let oe=$e;oe.empty=new oe([],[]);oe.removeOverlap=gl;const le=oe.empty,gt=class gt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Gt));return gt.from(r)}forChild(e,t){if(t.isLeaf)return oe.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=le&&(s instanceof gt?r=r.concat(s.members):r.push(s))}return gt.from(r)}eq(e){if(!(e instanceof gt)||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?gl(r?t:t.sort(Yt)):pn}static from(e){switch(e.length){case 0:return le;case 1:return e[0];default:return new gt(e.every(t=>t instanceof oe)?e:e.reduce((t,r)=>t.concat(r instanceof oe?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};c(gt,"DecorationGroup");let xi=gt;function Em(n,e,t,r,i,s,o){let l=n.slice();for(let u=0,d=s;u<t.maps.length;u++){let f=0;t.maps[u].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||h>k+d-f)continue;let x=l[b]+d-f;p>=x?l[b+1]=h<=x?-2:-1:h>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+s),f=d-i;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[u+1]+s,-1),p=h-i,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let b=l[u+2].mapInner(t,y,d+1,n[u]+s+1,o);b!=le?(l[u]=f,l[u+1]=p,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=Om(l,n,e,t,i,s,o),d=Si(u,r,0,o);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new oe(e.sort(Yt),l)}c(Em,"mapChildren");function Ad(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 Oe(i.from+e,i.to+e,i.type))}return t}c(Ad,"moveSpans");function Om(n,e,t,r,i,s,o){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,i,u);f?t.push(f):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}c(l,"gather");for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}c(Om,"mapAndGatherRemainingDecorations");function Nd(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}c(Nd,"takeSpansForNode");function Id(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}c(Id,"withoutNulls");function Si(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let u=Nd(n,l,a+t);if(u){s=!0;let d=Si(u,l,t+a+1,r);d!=le&&i.push(a,a+l.nodeSize,d)}});let o=Ad(s?Id(n):n,-t).sort(Yt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new oe(o,i):le}c(Si,"buildTree");function Yt(n,e){return n.from-e.from||n.to-e.to}c(Yt,"byPos");function gl(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),yc(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),yc(e,i,r.copy(s.from,r.to)));break}}}return e}c(gl,"removeOverlap");function yc(n,e,t){for(;e<n.length&&Yt(t,n[e])>0;)e++;n.splice(e,0,t)}c(yc,"insertAhead");function js(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=le&&e.push(r)}),n.cursorWrapper&&e.push(oe.create(n.state.doc,[n.cursorWrapper.deco])),xi.from(e)}c(js,"viewDecorations");const Am={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Nm=ye&&xt<=11,Ma=class Ma{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}};c(Ma,"SelectionState");let Do=Ma;const Ta=class Ta{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Do,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]);ye&&xt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Nm&&(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,Am)),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(cc(this.view)){if(this.suppressingSelectionUpdates)return it(this.view);if(ye&&xt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&on(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=Fn(s))t.add(s);for(let s=e.anchorNode;s;s=Fn(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)&&cc(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],a);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(l=!0))}if(Te&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Dm(e,f)!=p)&&h.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ks(r)&&(u=ul(e))&&u.eq(R.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,it(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Im(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||it(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 f=e.addedNodes[d];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}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(ye&&xt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?re(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?re(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,a,1);return{from:l,to:u}}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})}};c(Ta,"DOMObserver");let Po=Ta,bc=new WeakMap,kc=!1;function Im(n){if(!bc.has(n)&&(bc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Te,kc)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."),kc=!0}}c(Im,"checkCSS");function wc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return on(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}c(wc,"rangeToSelectionRange");function Rm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return wc(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return c(r,"read"),n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?wc(n,t):null}c(Rm,"safariShadowSelectionRange");function Dm(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}c(Dm,"blockParent");function Pm(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),u,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:a.anchorOffset}],ks(a)||u.push({node:a.focusNode,offset:a.focusOffset})),ae&&n.input.lastKeyCode===8)for(let y=s;y>i;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let f=n.state.doc,h=n.someProp("domParser")||qt.fromSchema(n.state.schema),p=f.resolve(o),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Lm,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),m={anchor:y+o,head:b+o}}return{doc:g,sel:m,from:o,to:l}}c(Pm,"parseBetween");function Lm(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}c(Lm,"ruleFromNode");const Bm=/^(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 zm(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let v=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,N=ul(n,v);if(N&&!n.state.selection.eq(N)){if(ae&&tt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,Rt(13,"Enter"))))return;let P=n.state.tr.setSelection(N);v=="pointer"?P.setMeta("pointer",!0):v=="key"&&P.scrollIntoView(),s&&P.setMeta("composition",s),n.dispatch(P)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,u=Pm(n,e,t),d=n.state.doc,f=d.slice(u.from,u.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=Hm(f.content,u.doc.content,u.from,h,p);if(m&&n.input.domChangeCount++,(Hn&&n.input.lastIOSEnter>Date.now()-225||tt)&&i.some(v=>v.nodeType==1&&!Bm.test(v.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",v=>v(n,Rt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let v=xc(n,n.state.doc,u.sel);if(v&&!v.eq(n.state.selection)){let N=n.state.tr.setSelection(v);s&&N.setMeta("composition",s),n.dispatch(N)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof L&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),ye&&xt<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Hn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!k&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",v=>v(n,Rt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Fm(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",v=>v(n,Rt(8,"Backspace")))){tt&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),tt&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(v){return v(n,Rt(13,"Enter"))})},20));let x=m.start,M=m.endA,w=c(v=>{let N=v||n.state.tr.replace(x,M,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let P=xc(n,N.doc,u.sel);P&&!(ae&&n.composing&&P.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(P.head==x||P.head==N.mapping.map(M)-1)||ye&&P.empty&&P.head==x)&&N.setSelection(P)}return s&&N.setMeta("composition",s),N.scrollIntoView()},"mkTr"),E;if(k)if(g.pos==y.pos){ye&&xt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>it(n),20));let v=w(n.state.tr.delete(x,M)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&v.ensureMarks(N),n.dispatch(v)}else if(m.endA==m.endB&&(E=$m(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let v=w(n.state.tr);E.type=="add"?v.addMark(x,M,E.mark):v.removeMark(x,M,E.mark),n.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,y.parentOffset),N=c(()=>w(n.state.tr.insertText(v,x,M)),"deflt");n.someProp("handleTextInput",P=>P(n,x,M,v,N))||n.dispatch(N())}else n.dispatch(w());else n.dispatch(w())}c(zm,"readDOMChange");function xc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:dl(n,e.resolve(t.anchor),e.resolve(t.head))}c(xc,"resolveSelection");function $m(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;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)l=i[0],o="add",a=c(d=>d.mark(l.addToSet(d.marks)),"update");else if(i.length==0&&s.length==1)l=s[0],o="remove",a=c(d=>d.mark(l.removeFromSet(d.marks)),"update");else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(a(e.child(d)));if(C.from(u).eq(n))return{mark:l,type:o}}c($m,"isMarkChange");function Fm(n,e,t,r,i){if(t-e<=i.pos-r.pos||Ws(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Ws(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Ws(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}c(Fm,"looksLikeBackspace");function Ws(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}c(Ws,"skipClosingAndOpening");function Hm(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&n.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&Sc(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<n.size&&Sc(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}c(Hm,"findDiff");function Sc(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}c(Sc,"isSurrogatePair");const Ea=class Ea{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 Ao,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Ec),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=Mc(this),vc(this),this.nodeViews=Tc(this),this.docView=rc(this.state.doc,Cc(this),js(this),this.dom,this),this.domObserver=new Po(this,(r,i,s,o)=>zm(this,r,i,s,o)),this.domObserver.start(),cm(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&&No(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ec),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&&(Td(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Tc(this);jm(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&No(this),this.editable=Mc(this),vc(this);let a=js(this),u=Cc(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ep(this);if(o){this.domObserver.stop();let p=f&&(ye||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Vm(i.selection,e.selection);if(f){let m=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=xm(this)),(s||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=rc(e.doc,u,a,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Jp(this))?it(this,p):(pd(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&&Op(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 I){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xa(this,t.getBoundingClientRect(),e)}else Xa(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 ki(e.slice,e.move,i<0?void 0:I.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 l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(ye){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&&Ap(this.dom),it(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 Pp(this,e)}coordsAtPos(e,t=1){return ad(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 Fp(this,t||this.state,e)}pasteHTML(e,t){return vr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return fl(this,e)}destroy(){this.docView&&(um(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],js(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return fm(this,e)}domSelectionRange(){let e=this.domSelection();return e?fe&&this.root.nodeType===11&&xp(this.dom.ownerDocument)==this.dom&&Rm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};c(Ea,"EditorView");let Ci=Ea;Ci.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Cc(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"),[Oe.node(0,n.state.doc.content.size,e)]}c(Cc,"computeDocDeco");function vc(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:Oe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}c(vc,"updateCursorWrapper");function Mc(n){return!n.someProp("editable",e=>e(n.state)===!1)}c(Mc,"getEditable");function Vm(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)}c(Vm,"selectionContextChanged");function Tc(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 c(t,"add"),n.someProp("nodeViews",t),n.someProp("markViews",t),e}c(Tc,"buildNodeViews");function jm(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}c(jm,"changedNodeViews");function Ec(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")}c(Ec,"checkStateComponent");var Tt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},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:'"'},Wm=typeof navigator<"u"&&/Mac/.test(navigator.platform),Um=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ie=0;ie<10;ie++)Tt[48+ie]=Tt[96+ie]=String(ie);for(var ie=1;ie<=24;ie++)Tt[ie+111]="F"+ie;for(var ie=65;ie<=90;ie++)Tt[ie]=String.fromCharCode(ie+32),vi[ie]=String.fromCharCode(ie);for(var Us in Tt)vi.hasOwnProperty(Us)||(vi[Us]=Tt[Us]);function Km(n){var e=Wm&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Um&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?vi:Tt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}c(Km,"keyName");const _m=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),qm=typeof navigator<"u"&&/Win/.test(navigator.platform);function Jm(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))_m?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}c(Jm,"normalizeKeyName$1");function Gm(n){let e=Object.create(null);for(let t in n)e[Jm(t)]=n[t];return e}c(Gm,"normalize");function Ks(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}c(Ks,"modifiers");function Ym(n){return new V({props:{handleKeyDown:yl(n)}})}c(Ym,"keymap");function yl(n){let e=Gm(n);return function(t,r){let i=Km(r),s,o=e[Ks(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ks(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(qm&&r.ctrlKey&&r.altKey)&&(s=Tt[r.keyCode])&&s!=i){let l=e[Ks(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}c(yl,"keydownHandler");var Xm=Object.defineProperty,bl=c((n,e)=>{for(var t in e)Xm(n,t,{get:e[t],enumerable:!0})},"__export$1");function xs(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}}}c(xs,"createChainableState");var Cn,Ss=(Cn=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,c((...d)=>{const f=a(...d)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f},"method")]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,u=e||s.tr,d=c(()=>(!a&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),l.every(h=>h===!0)),"run3"),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,c((...g)=>{const y=this.buildProps(u,t),b=p(...g)(y);return l.push(b),f},"chainedCommand")])),run:d};return f}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,u])=>[a,(...d)=>u(...d)({...o,dispatch:void 0})])),chain:c(()=>this.createChain(s,i),"chain")}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:xs({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:c(()=>this.createChain(e,t),"chain"),can:c(()=>this.createCan(e),"can"),get commands(){return Object.fromEntries(Object.entries(r).map(([a,u])=>[a,(...d)=>u(...d)(l)]))}};return l}},c(Cn,"CommandManager"),Cn),Rd={};bl(Rd,{blur:c(()=>Qm,"blur"),clearContent:c(()=>Zm,"clearContent"),clearNodes:c(()=>eg,"clearNodes"),command:c(()=>tg,"command"),createParagraphNear:c(()=>ng,"createParagraphNear"),cut:c(()=>rg,"cut"),deleteCurrentNode:c(()=>ig,"deleteCurrentNode"),deleteNode:c(()=>sg,"deleteNode"),deleteRange:c(()=>og,"deleteRange"),deleteSelection:c(()=>lg,"deleteSelection"),enter:c(()=>ag,"enter"),exitCode:c(()=>cg,"exitCode"),extendMarkRange:c(()=>ug,"extendMarkRange"),first:c(()=>dg,"first"),focus:c(()=>hg,"focus"),forEach:c(()=>pg,"forEach"),insertContent:c(()=>mg,"insertContent"),insertContentAt:c(()=>bg,"insertContentAt"),joinBackward:c(()=>xg,"joinBackward"),joinDown:c(()=>wg,"joinDown"),joinForward:c(()=>Sg,"joinForward"),joinItemBackward:c(()=>Cg,"joinItemBackward"),joinItemForward:c(()=>vg,"joinItemForward"),joinTextblockBackward:c(()=>Mg,"joinTextblockBackward"),joinTextblockForward:c(()=>Tg,"joinTextblockForward"),joinUp:c(()=>kg,"joinUp"),keyboardShortcut:c(()=>Og,"keyboardShortcut"),lift:c(()=>Ag,"lift"),liftEmptyBlock:c(()=>Ng,"liftEmptyBlock"),liftListItem:c(()=>Ig,"liftListItem"),newlineInCode:c(()=>Rg,"newlineInCode"),resetAttributes:c(()=>Dg,"resetAttributes"),scrollIntoView:c(()=>Pg,"scrollIntoView"),selectAll:c(()=>Lg,"selectAll"),selectNodeBackward:c(()=>Bg,"selectNodeBackward"),selectNodeForward:c(()=>zg,"selectNodeForward"),selectParentNode:c(()=>$g,"selectParentNode"),selectTextblockEnd:c(()=>Fg,"selectTextblockEnd"),selectTextblockStart:c(()=>Hg,"selectTextblockStart"),setContent:c(()=>Vg,"setContent"),setMark:c(()=>iy,"setMark"),setMeta:c(()=>sy,"setMeta"),setNode:c(()=>oy,"setNode"),setNodeSelection:c(()=>ly,"setNodeSelection"),setTextSelection:c(()=>ay,"setTextSelection"),sinkListItem:c(()=>cy,"sinkListItem"),splitBlock:c(()=>uy,"splitBlock"),splitListItem:c(()=>dy,"splitListItem"),toggleList:c(()=>fy,"toggleList"),toggleMark:c(()=>hy,"toggleMark"),toggleNode:c(()=>py,"toggleNode"),toggleWrap:c(()=>my,"toggleWrap"),undoInputRule:c(()=>gy,"undoInputRule"),unsetAllMarks:c(()=>yy,"unsetAllMarks"),unsetMark:c(()=>by,"unsetMark"),updateAttributes:c(()=>ky,"updateAttributes"),wrapIn:c(()=>wy,"wrapIn"),wrapInList:c(()=>xy,"wrapInList")});var Qm=c(()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),"blur"),Zm=c((n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),"clearContent"),eg=c(()=>({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,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),h=u.resolve(d.map(a+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=qn(p);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},"clearNodes"),tg=c(n=>e=>n(e),"command"),ng=c(()=>({state:n,dispatch:e})=>Qu(n,e),"createParagraphNear"),rg=c((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 L(r.doc.resolve(Math.max(o-1,0)))),!0},"cut"),ig=c(()=>({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 l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},"deleteCurrentNode");function G(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}c(G,"getNodeType");var sg=c(n=>({tr:e,state:t,dispatch:r})=>{const i=G(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 a=s.before(o),u=s.after(o);e.delete(a,u).scrollIntoView()}return!0}return!1},"deleteNode"),og=c(n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},"deleteRange"),lg=c(()=>({state:n,dispatch:e})=>il(n,e),"deleteSelection"),ag=c(()=>({commands:n})=>n.keyboardShortcut("Enter"),"enter"),cg=c(()=>({state:n,dispatch:e})=>tp(n,e),"exitCode");function kl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}c(kl,"isRegExp");function Mi(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:kl(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}c(Mi,"objectIncludes");function Dd(n,e,t={}){return n.find(r=>r.type===e&&Mi(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}c(Dd,"findMarkInSet");function Oc(n,e,t={}){return!!Dd(n,e,t)}c(Oc,"isMarkInSet");function wl(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),!Dd([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,u=l+i.node.nodeSize;for(;o>0&&Oc([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&Oc([...n.parent.child(a).marks],e,t);)u+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}c(wl,"getMarkRange");function ot(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}c(ot,"getMarkType");var ug=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=ot(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:u,to:d}=l;if(i){const f=wl(a,s,e);if(f&&f.from<=u&&f.to>=d){const h=L.create(o,f.from,f.to);t.setSelection(h)}}return!0},"extendMarkRange"),dg=c(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},"first");function xl(n){return n instanceof L}c(xl,"isTextSelection");function nt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}c(nt,"minMax");function Pd(n,e=null){if(!e)return null;const t=R.atStart(n),r=R.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?L.create(n,nt(0,i,s),nt(n.content.size,i,s)):L.create(n,nt(e,i,s),nt(e,i,s))}c(Pd,"resolveFocusPosition");function fg(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}c(fg,"isAndroid");function Sl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}c(Sl,"isiOS");var hg=c((n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=c(()=>{(Sl()||fg())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})},"delayedFocus");if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!xl(t.state.selection))return o(),!0;const l=Pd(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},"focus"),pg=c((n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),"forEach"),mg=c((n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),"insertContent"),Ld=c(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&&Ld(r)}return n},"removeWhitespaces");function $r(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 Ld(t)}c($r,"elementFromString");function Tr(n,e,t){if(n instanceof wt||n instanceof C)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 C.fromArray(n.map(l=>e.nodeFromJSON(l)));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,l="";const a=new si({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(u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null),"getAttrs")}]}})});if(t.slice?qt.fromSchema(a).parseSlice($r(n),t.parseOptions):qt.fromSchema(a).parse($r(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=qt.fromSchema(e);return t.slice?s.parseSlice($r(n),t.parseOptions).content:s.parse($r(n),t.parseOptions)}return Tr("",e,t)}c(Tr,"createNodeFromContent");function gg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof we||i instanceof ce))return;const s=n.mapping.maps[r];let o=0;s.forEach((l,a,u,d)=>{o===0&&(o=d)}),n.setSelection(R.near(n.doc.resolve(o),t))}c(gg,"selectionToInsertionEnd");var yg=c(n=>!("type"in n),"isFragment"),bg=c((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 l;const a=c(y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:c(()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)},"disableCollaboration")})},"emitContentError"),u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Tr(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Tr(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((yg(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===f&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof C){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,f)}else{g=l;const y=r.doc.resolve(d),b=y.node(),k=y.parentOffset===0,x=b.isText||b.isTextblock,M=b.content.size>0;k&&x&&M&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&gg(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},"insertContentAt"),kg=c(()=>({state:n,dispatch:e})=>Qh(n,e),"joinUp"),wg=c(()=>({state:n,dispatch:e})=>Zh(n,e),"joinDown"),xg=c(()=>({state:n,dispatch:e})=>Ku(n,e),"joinBackward"),Sg=c(()=>({state:n,dispatch:e})=>Gu(n,e),"joinForward"),Cg=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=ys(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemBackward"),vg=c(()=>({state:n,dispatch:e,tr:t})=>{try{const r=ys(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},"joinItemForward"),Mg=c(()=>({state:n,dispatch:e})=>Yh(n,e),"joinTextblockBackward"),Tg=c(()=>({state:n,dispatch:e})=>Xh(n,e),"joinTextblockForward");function Bd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}c(Bd,"isMacOS");function Eg(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Sl()||Bd()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}c(Eg,"normalizeKeyName");var Og=c(n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=Eg(n).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=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}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a?.steps.forEach(u=>{const d=u.map(r.mapping);d&&i&&r.maybeStep(d)}),!0},"keyboardShortcut");function Et(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?G(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const a=i-r,u=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Mi(f.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=a}c(Et,"isNodeActive");var Ag=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return Et(t,i,e)?ep(t,r):!1},"lift"),Ng=c(()=>({state:n,dispatch:e})=>Zu(n,e),"liftEmptyBlock"),Ig=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return fp(r)(e,t)},"liftListItem"),Rg=c(()=>({state:n,dispatch:e})=>Xu(n,e),"newlineInCode");function Cs(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}c(Cs,"getSchemaTypeNameByName");function Ac(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}c(Ac,"deleteProps");var Dg=c((n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Cs(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ot(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(u,d)=>{s&&s===u.type&&t.setNodeMarkup(d,void 0,Ac(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&t.addMark(d,d+u.nodeSize,o.create(Ac(f.attrs,e)))})})}),!0):!1},"resetAttributes"),Pg=c(()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),"scrollIntoView"),Lg=c(()=>({tr:n,dispatch:e})=>{if(e){const t=new Ie(n.doc);n.setSelection(t)}return!0},"selectAll"),Bg=c(()=>({state:n,dispatch:e})=>qu(n,e),"selectNodeBackward"),zg=c(()=>({state:n,dispatch:e})=>Yu(n,e),"selectNodeForward"),$g=c(()=>({state:n,dispatch:e})=>ip(n,e),"selectParentNode"),Fg=c(()=>({state:n,dispatch:e})=>lp(n,e),"selectTextblockEnd"),Hg=c(()=>({state:n,dispatch:e})=>op(n,e),"selectTextblockStart");function Lo(n,e,t={},r={}){return Tr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}c(Lo,"createDocument");var Vg=c((n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const u=Lo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})},"setContent");function zd(n,e){const t=ot(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,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}c(zd,"getMarkAttributes");function $d(n,e){const t=new ui(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}c($d,"combineTransactionSteps");function jg(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}c(jg,"defaultBlockAt");function Wg(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}c(Wg,"findChildrenInRange");function Ug(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}}}c(Ug,"findParentNodeClosestToPos");function Dr(n){return e=>Ug(e.$from,n)}c(Dr,"findParentNode");function A(n,e,t){return n.config[e]===void 0&&n.parent?A(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?A(n.parent,e,t):null}):n.config[e]}c(A,"getExtensionField");function Cl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=A(e,"addExtensions",t);return r?[e,...Cl(r())]:e}).flat(10)}c(Cl,"flattenExtensions");function vl(n,e){const t=sn.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}c(vl,"getHTMLFromFragment");function Fd(n){return typeof n=="function"}c(Fd,"isFunction");function $(n,e=void 0,...t){return Fd(n)?e?n.bind(e)(...t):n(...t):n}c($,"callOrReturn");function Kg(n={}){return Object.keys(n).length===0&&n.constructor===Object}c(Kg,"isEmptyObject");function Er(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}}c(Er,"splitExtensions");function Hd(n){const e=[],{nodeExtensions:t,markExtensions:r}=Er(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 l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=A(o,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=A(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([d,f])=>{const h={...s,...f};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}c(Hd,"getAttributesFromExtensions");function Y(...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 l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],u=l.filter(d=>!a.includes(d));r[i]=[...a,...u].join(" ")}else if(i==="style"){const l=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;a.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),l.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),r[i]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else r[i]=s}),r},{})}c(Y,"mergeAttributes");function Ti(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)=>Y(t,r),{})}c(Ti,"getRenderedAttributes");function _g(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}c(_g,"fromString");function Nc(n,e){return"style"in n?n:{...n,getAttrs:c(t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):_g(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}},"getAttrs")}}c(Nc,"injectExtensionAttributesToParseRule");function Ic(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Kg(t)?!1:t!=null))}c(Ic,"cleanUpSchemaItem");function qg(n,e){var t;const r=Hd(n),{nodeExtensions:i,markExtensions:s}=Er(n),o=(t=i.find(u=>A(u,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(u=>{const d=r.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((b,k)=>{const x=A(k,"extendNodeSchema",f);return{...b,...x?x(u):{}}},{}),p=Ic({...h,content:$(A(u,"content",f)),marks:$(A(u,"marks",f)),group:$(A(u,"group",f)),inline:$(A(u,"inline",f)),atom:$(A(u,"atom",f)),selectable:$(A(u,"selectable",f)),draggable:$(A(u,"draggable",f)),code:$(A(u,"code",f)),whitespace:$(A(u,"whitespace",f)),linebreakReplacement:$(A(u,"linebreakReplacement",f)),defining:$(A(u,"defining",f)),isolating:$(A(u,"isolating",f)),attrs:Object.fromEntries(d.map(b=>{var k,x;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),m=$(A(u,"parseHTML",f));m&&(p.parseDOM=m.map(b=>Nc(b,d)));const g=A(u,"renderHTML",f);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Ti(b,d)}));const y=A(u,"renderText",f);return y&&(p.toText=y),[u.name,p]})),a=Object.fromEntries(s.map(u=>{const d=r.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((y,b)=>{const k=A(b,"extendMarkSchema",f);return{...y,...k?k(u):{}}},{}),p=Ic({...h,inclusive:$(A(u,"inclusive",f)),excludes:$(A(u,"excludes",f)),group:$(A(u,"group",f)),spanning:$(A(u,"spanning",f)),code:$(A(u,"code",f)),attrs:Object.fromEntries(d.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=$(A(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>Nc(y,d)));const g=A(u,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Ti(y,d)})),[u.name,p]}));return new si({topNode:o,nodes:l,marks:a})}c(qg,"getSchemaByResolvedExtensions");function Jg(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}c(Jg,"findDuplicates");function Ml(n){return n.sort((t,r)=>{const i=A(t,"priority")||100,s=A(r,"priority")||100;return i>s?-1:i<s?1:0})}c(Ml,"sortExtensions");function Vd(n){const e=Ml(Cl(n)),t=Jg(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}c(Vd,"resolveExtensions");function jd(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,u,d,f)=>{var h;a.isBlock&&u>r&&(l+=s);const p=o?.[a.type.name];if(p)return d&&(l+=p({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,u)-u,i-u))}),l}c(jd,"getTextBetween");function Wd(n,e){const t={from:0,to:n.content.size};return jd(n,t,e)}c(Wd,"getText");function Tl(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}c(Tl,"getTextSerializersFromSchema");function Gg(n,e){const t=G(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}c(Gg,"getNodeAttributes");function Ud(n,e){const t=Cs(typeof e=="string"?e:e.name,n.schema);return t==="node"?Gg(n,e):t==="mark"?zd(n,e):{}}c(Ud,"getAttributes");function Yg(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})}c(Yg,"removeDuplicates");function Xg(n){const e=Yg(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))}c(Xg,"simplifyChangedRanges");function Kd(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const u=e.slice(s).map(l,-1),d=e.slice(s).map(a),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),Xg(r)}c(Kd,"getChangedRanges");function El(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=wl(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}c(El,"getMarksBetween");var Qg=c((n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]},"getNodeAtPosition");function _s(n,e){return e.nodes[n]||e.marks[n]||null}c(_s,"getSchemaTypeByName");function Xr(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}))}c(Xr,"getSplittedAttributes");var Zg=c((n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,u;const d=((u=(a=i.type.spec).toText)==null?void 0:u.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t},"getTextContentFromNodes");function Bo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?ot(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Mi(f.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;n.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(p,y),k=Math.min(m,y+g.nodeSize),x=k-b;o+=x,l.push(...g.marks.map(M=>({mark:M,from:b,to:k})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Mi(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(a>0?a+u:a)>=o}c(Bo,"isMarkActive");function ey(n,e,t={}){if(!e)return Et(n,null,t)||Bo(n,null,t);const r=Cs(e,n.schema);return r==="node"?Et(n,e,t):r==="mark"?Bo(n,e,t):!1}c(ey,"isActive");var ty=c((n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=Dr(l=>l.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)},"isAtEndOfNode"),ny=c(n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)},"isAtStartOfNode");function Rc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}c(Rc,"isExtensionRulesEnabled");function Dc(n,e){const{nodeExtensions:t}=Er(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=$(A(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}c(Dc,"isList");function vs(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&&(vs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}c(vs,"isNodeEmpty");function _d(n){return n instanceof I}c(_d,"isNodeSelection");function Ol(n,e,t){const i=n.state.doc.content.size,s=nt(e,0,i),o=nt(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),u=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),h=Math.max(l.right,a.right),p=h-f,m=d-u,b={top:u,bottom:d,left:f,right:h,width:p,height:m,x:f,y:u};return{...b,toJSON:c(()=>b,"toJSON")}}c(Ol,"posToDOMRect");function ry(n,e,t){var r;const{selection:i}=e;let s=null;if(xl(i)&&(s=i.$cursor),s){const l=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(u=>u.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=p&&m}return!u}),u})}c(ry,"canSetMark");var iy=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=ot(n,r.schema);if(i)if(o){const u=zd(r,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,f);h.marks.find(b=>b.type===a)?h.marks.forEach(b=>{a===b.type&&t.addMark(m,g,a.create({...b.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return ry(r,t,a)},"setMark"),sy=c((n,e)=>({tr:t})=>(t.setMeta(n,e),!0),"setMeta"),oy=c((n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=G(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>Ja(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Ja(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},"setNode"),ly=c(n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=nt(n,0,r.content.size),s=I.create(r,i);e.setSelection(s)}return!0},"setNodeSelection"),ay=c(n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=L.atStart(r).from,l=L.atEnd(r).to,a=nt(i,o,l),u=nt(s,o,l),d=L.create(r,a,u);e.setSelection(d)}return!0},"setTextSelection"),cy=c(n=>({state:e,dispatch:t})=>{const r=G(n,e.schema);return mp(r)(e,t)},"sinkListItem");function Pc(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)}}c(Pc,"ensureMarks");var uy=c(({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,u=i.extensionManager.attributes,d=Xr(u,l.node().type.name,l.node().attrs);if(s instanceof I&&s.node.isBlock)return!l.parentOffset||!rt(o,l.pos)?!1:(r&&(n&&Pc(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:jg(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=rt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&rt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(m&&(s instanceof L&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}n&&Pc(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},"splitBlock"),dy=c((n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const l=G(n,r.schema),{$from:a,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const h=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let b=C.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let N=a.depth-k;N>=a.depth-3;N-=1)b=C.from(a.node(N).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...Xr(h,a.node().type.name,a.node().attrs),...e},w=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(M))||void 0;b=b.append(C.from(l.createAndFill(null,w)||void 0));const E=a.before(a.depth-(k-1));t.replace(E,a.after(-x),new T(b,4-k,0));let v=-1;t.doc.nodesBetween(E,t.doc.content.size,(N,P)=>{if(v>-1)return!1;N.isTextblock&&N.content.size===0&&(v=P+1)}),v>-1&&t.setSelection(L.near(t.doc.resolve(v))),t.scrollIntoView()}return!0}const p=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...Xr(h,f.type.name,f.attrs),...e},g={...Xr(h,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!rt(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:x}=s.extensionManager,M=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!M||!i)return!0;const w=M.filter(E=>x.includes(E.type.name));t.ensureMarks(w)}return!0},"splitListItem"),qs=c((n,e)=>{const t=Dr(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&&At(n.doc,t.pos)&&n.join(t.pos),!0},"joinListBackwards"),Js=c((n,e)=>{const t=Dr(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&&At(n.doc,r)&&n.join(r),!0},"joinListForwards"),fy=c((n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=G(n,o.schema),m=G(e,o.schema),{selection:g,storedMarks:y}=o,{$from:b,$to:k}=g,x=b.blockRange(k),M=y||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const w=Dr(E=>Dc(E.type.name,f))(g);if(x.depth>=1&&w&&x.depth-w.depth<=1){if(w.node.type===p)return u.liftListItem(m);if(Dc(w.node.type.name,f)&&p.validContent(w.node.content)&&l)return a().command(()=>(s.setNodeMarkup(w.pos,p),!0)).command(()=>qs(s,p)).command(()=>Js(s,p)).run()}return!t||!M||!l?a().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>qs(s,p)).command(()=>Js(s,p)).run():a().command(()=>{const E=d().wrapInList(p,r),v=M.filter(N=>h.includes(N.type.name));return s.ensureMarks(v),E?!0:u.clearNodes()}).wrapInList(p,r).command(()=>qs(s,p)).command(()=>Js(s,p)).run()},"toggleList"),hy=c((n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ot(n,r.schema);return Bo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},"toggleMark"),py=c((n,e,t={})=>({state:r,commands:i})=>{const s=G(n,r.schema),o=G(e,r.schema),l=Et(r,s,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...t})},"toggleNode"),my=c((n,e={})=>({state:t,commands:r})=>{const i=G(n,t.schema);return Et(t,i,e)?r.lift(i):r.wrapIn(i,e)},"toggleWrap"),gy=c(()=>({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,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},"undoInputRule"),yy=c(()=>({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},"unsetAllMarks"),by=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=ot(n,r.schema),{$from:u,empty:d,ranges:f}=l;if(!i)return!0;if(d&&o){let{from:h,to:p}=l;const m=(s=u.marks().find(y=>y.type===a))==null?void 0:s.attrs,g=wl(u,a,m);g&&(h=g.from,p=g.to),t.removeMark(h,p,a)}else f.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,a)});return t.removeStoredMark(a),!0},"unsetMark"),ky=c((n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=Cs(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=G(n,r.schema)),l==="mark"&&(o=ot(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const u=a.$from.pos,d=a.$to.pos;let f,h,p,m;t.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g),y>=u&&y<=d&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(b=>{if(o===b.type){const k=Math.max(y,u),x=Math.min(y+g.nodeSize,d);t.addMark(k,x,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&t.addMark(p,m,o.create({...g.attrs,...e}))}))}),!0):!1},"updateAttributes"),wy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return ap(i,e)(t,r)},"wrapIn"),xy=c((n,e={})=>({state:t,dispatch:r})=>{const i=G(n,t.schema);return cp(i,e)(t,r)},"wrapInList"),vn,Sy=(vn=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=c((...i)=>{this.off(e,r),t.apply(this,i)},"onceFn");return this.on(e,r)}removeAllListeners(){this.callbacks={}}},c(vn,"EventEmitter"),vn),Mn,Ms=(Mn=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},c(Mn,"InputRule"),Mn),Cy=c((n,e)=>{if(kl(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},"inputRuleMatcherHandler");function Fr(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Zg(u)+s;return o.forEach(h=>{if(d)return;const p=Cy(f,h.find);if(!p)return;const m=a.state.tr,g=xs({state:a.state,transaction:m}),y={from:r-(p[0].length-s.length),to:i},{commands:b,chain:k,can:x}=new Ss({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:k,can:x})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:s}),a.dispatch(m),d=!0)}),d}c(Fr,"run$2");function vy(n){const{editor:e,rules:t}=n,r=new V({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=vl(C.from(d),o.schema);const{from:f}=a,h=f+d.length;Fr({editor:e,from:f,to:h,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Fr({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:c(i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Fr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1),"compositionend")},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Fr({editor:e,from:o.pos,to:o.pos,text:`
13
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}c(vy,"inputRulesPlugin");function My(n){return Object.prototype.toString.call(n).slice(8,-1)}c(My,"getType");function Hr(n){return My(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}c(Hr,"isPlainObject");function qd(n,e){const t={...n};return Hr(n)&&Hr(e)&&Object.keys(e).forEach(r=>{Hr(e[r])&&Hr(n[r])?t[r]=qd(n[r],e[r]):t[r]=e[r]}),t}c(qd,"mergeDeep");var Tn,Al=(Tn=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...$(A(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...$(A(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:c(()=>qd(this.options,e),"addOptions")});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},c(Tn,"Extendable"),Tn),Zt,un=(Zt=class extends Al{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Zt(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(u=>u?.type.name===t.name))return!1;const a=o.find(u=>u?.type.name===t.name);return a&&r.removeStoredMark(a),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)}},c(Zt,"_Mark"),Zt);function Ty(n){return typeof n=="number"}c(Ty,"isNumber");var En,Ey=(En=class{constructor(e){this.find=e.find,this.handler=e.handler}},c(En,"PasteRule"),En),Oy=c((n,e,t)=>{if(kl(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}):[]},"pasteRuleMatcherHandler");function Ay(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:u,can:d}=new Ss({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,b,k,x;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const M=(x=(k=(b=p.content)==null?void 0:b.size)!=null?k:p.nodeSize)!=null?x:0,w=Math.max(r,m),E=Math.min(i,m+M);if(w>=E)return;const v=p.isText?p.text||"":p.textBetween(w-m,E-m,void 0,"");Oy(v,s.find,o).forEach(P=>{if(P.index===void 0)return;const D=w+P.index+1,j=D+P[0].length,K={from:t.tr.mapping.map(D),to:t.tr.mapping.map(j)},J=s.handler({state:t,range:K,match:P,commands:a,chain:u,can:d,pasteEvent:o,dropEvent:l});f.push(J)})}),f.every(p=>p!==null)}c(Ay,"run2");var Vr=null,Ny=c(n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t},"createClipboardPasteEvent");function Iy(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=c(({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,y=xs({state:d,transaction:g});if(!(!Ay({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}},"processEvent");return t.map(d=>new V({view(f){const h=c(m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Vr=e)},"handleDragstart"),p=c(()=>{Vr&&(Vr=null)},"handleDragend");return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:c((f,h)=>{if(s=r===f.dom.parentElement,l=h,!s){const p=Vr;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},"drop"),paste:c((f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return o=h,i=!!m?.includes("data-pm-slice"),!1},"paste")}},appendTransaction:c((f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:w}=b;typeof w=="string"?w=w:w=vl(C.from(w),p.schema);const{from:E}=b,v=E+w.length,N=Ny(w);return a({rule:d,state:p,from:E,to:{b:v},pasteEvt:N})}const x=h.doc.content.findDiffStart(p.doc.content),M=h.doc.content.findDiffEnd(p.doc.content);if(!(!Ty(x)||!M||x===M.b))return a({rule:d,state:p,from:x,to:M,pasteEvt:o})},"appendTransaction")}))}c(Iy,"pasteRulesPlugin");var On,Ts=(On=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Vd(e),this.schema=qg(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:_s(t.name,this.schema)},i=A(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this;return Ml([...this.extensions].reverse()).flatMap(i=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:_s(i.name,this.schema)},o=[],l=A(i,"addKeyboardShortcuts",s);let a={};if(i.type==="mark"&&A(i,"exitable",s)&&(a.ArrowRight=()=>un.handleExit({editor:e,mark:i})),l){const p=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:e})]));a={...a,...p}}const u=Ym(a);o.push(u);const d=A(i,"addInputRules",s);if(Rc(i,e.options.enableInputRules)&&d){const p=d();if(p&&p.length){const m=vy({editor:e,rules:p}),g=Array.isArray(m)?m:[m];o.push(...g)}}const f=A(i,"addPasteRules",s);if(Rc(i,e.options.enablePasteRules)&&f){const p=f();if(p&&p.length){const m=Iy({editor:e,rules:p});o.push(...m)}}const h=A(i,"addProseMirrorPlugins",s);if(h){const p=h();o.push(...p)}return o})}get attributes(){return Hd(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Er(this.extensions);return Object.fromEntries(t.filter(r=>!!A(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:G(r.name,this.schema)},o=A(r,"addNodeView",s);if(!o)return[];const l=c((a,u,d,f,h)=>{const p=Ti(a,i);return o()({node:a,view:u,getPos:d,decorations:f,innerDecorations:h,editor:e,extension:r,HTMLAttributes:p})},"nodeview");return[r.name,l]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=Er(this.extensions);return Object.fromEntries(t.filter(r=>!!A(r,"addMarkView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ot(r.name,this.schema)},o=A(r,"addMarkView",s);if(!o)return[];const l=c((a,u,d)=>{const f=Ti(a,i);return o()({mark:a,view:u,inline:d,editor:e,extension:r,HTMLAttributes:f,updateAttributes:c(h=>{Ky(a,e,h)},"updateAttributes")})},"markView");return[r.name,l]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var r;const i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:_s(t.name,this.schema)};t.type==="mark"&&((r=$(A(t,"keepOnSplit",i)))==null||r)&&this.splittableMarks.push(t.name);const s=A(t,"onBeforeCreate",i),o=A(t,"onCreate",i),l=A(t,"onUpdate",i),a=A(t,"onSelectionUpdate",i),u=A(t,"onTransaction",i),d=A(t,"onFocus",i),f=A(t,"onBlur",i),h=A(t,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}},c(On,"ExtensionManager"),On);Ts.resolve=Vd;Ts.sort=Ml;Ts.flatten=Cl;var Ry={};bl(Ry,{ClipboardTextSerializer:c(()=>Jd,"ClipboardTextSerializer"),Commands:c(()=>Gd,"Commands"),Delete:c(()=>Yd,"Delete"),Drop:c(()=>Xd,"Drop"),Editable:c(()=>Qd,"Editable"),FocusEvents:c(()=>ef,"FocusEvents"),Keymap:c(()=>tf,"Keymap"),Paste:c(()=>nf,"Paste"),Tabindex:c(()=>rf,"Tabindex"),focusEventsPluginKey:c(()=>Zd,"focusEventsPluginKey")});var en,q=(en=class extends Al{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new en(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(en,"_Extension"),en),Jd=q.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new V({key:new U("clipboardTextSerializer"),props:{clipboardTextSerializer:c(()=>{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)),l=Math.max(...s.map(d=>d.$to.pos)),a=Tl(t);return jd(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})},"clipboardTextSerializer")}})]}}),Gd=q.create({name:"commands",addCommands(){return{...Rd}}}),Yd=q.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=c(()=>{var o,l,a,u;if((u=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=$d(n.before,[n,...e]);Kd(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof Mt){const b=h.slice(m).map(p.from,-1),k=h.slice(m).map(p.to),x=h.invert().map(b,-1),M=h.invert().map(k),w=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(v=>v.eq(p.mark)),E=(y=d.doc.nodeAt(k))==null?void 0:y.marks.some(v=>v.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:x,to:M},newRange:{from:b,to:k},partial:!!(E||w),editor:this.editor,transaction:n,combinedTransform:d})}})},"callback");(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Xd=q.create({name:"drop",addProseMirrorPlugins(){return[new V({key:new U("tiptapDrop"),props:{handleDrop:c((n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})},"handleDrop")}})]}}),Qd=q.create({name:"editable",addProseMirrorPlugins(){return[new V({key:new U("editable"),props:{editable:c(()=>this.editor.options.editable,"editable")}})]}}),Zd=new U("focusEvents"),ef=q.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new V({key:Zd,props:{handleDOMEvents:{focus:c((e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},"focus"),blur:c((e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},"blur")}}})]}}),tf=q.create({name:"keymap",addKeyboardShortcuts(){const n=c(()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:d,$anchor:f}=a,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:R.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),"handleBackspace"),e=c(()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),"handleDelete"),r={Enter:c(()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"handleEnter"),"Mod-Enter":c(()=>this.editor.commands.exitCode(),"Mod-Enter"),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":c(()=>this.editor.commands.selectAll(),"Mod-a")},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":c(()=>this.editor.commands.selectTextblockStart(),"Ctrl-a"),"Ctrl-e":c(()=>this.editor.commands.selectTextblockEnd(),"Ctrl-e")};return Sl()||Bd()?s:i},addProseMirrorPlugins(){return[new V({key:new U("clearDocument"),appendTransaction:c((n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=R.atStart(e.doc).from,u=R.atEnd(e.doc).to;if(s||!(o===a&&l===u)||!vs(t.doc))return;const h=t.tr,p=xs({state:t,transaction:h}),{commands:m}=new Ss({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h},"appendTransaction")})]}}),nf=q.create({name:"paste",addProseMirrorPlugins(){return[new V({key:new U("tiptapPaste"),props:{handlePaste:c((n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})},"handlePaste")}})]}}),rf=q.create({name:"tabindex",addProseMirrorPlugins(){return[new V({key:new U("tabindex"),props:{attributes:c(()=>this.editor.isEditable?{tabindex:"0"}:{},"attributes")}})]}}),Ne,Dy=(Ne=class{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 Ne(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 Ne(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 Ne(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 l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;const a=new Ne(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Ne(l,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 l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==t[a])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(a=>t[a]===o.node.attrs[a])&&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)}},c(Ne,"_NodePos"),Ne),Py=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function Ly(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}c(Ly,"createStyleTag");var An,By=(An=class extends Sy{constructor(e={}){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:c(()=>null,"onBeforeCreate"),onCreate:c(()=>null,"onCreate"),onMount:c(()=>null,"onMount"),onUnmount:c(()=>null,"onUnmount"),onUpdate:c(()=>null,"onUpdate"),onSelectionUpdate:c(()=>null,"onSelectionUpdate"),onTransaction:c(()=>null,"onTransaction"),onFocus:c(()=>null,"onFocus"),onBlur:c(()=>null,"onBlur"),onDestroy:c(()=>null,"onDestroy"),onContentError:c(({error:i})=>{throw i},"onContentError"),onPaste:c(()=>null,"onPaste"),onDrop:c(()=>null,"onDrop"),onDelete:c(()=>null,"onDelete")},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("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:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Pd(t,this.options.autofocus);this.editorState=go.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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 e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Ly(Py,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:c(e=>{this.editorState=e},"updateState"),dispatch:c(e=>{this.dispatchTransaction(e)},"dispatch"),composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:c((e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)},"get")})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=Fd(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(l=>!l.key.startsWith(o))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[Qd,Jd.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Gd,ef,tf,rf,Xd,nf,Yd].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ts(i,this)}createCommandManager(){this.commandManager=new Ss({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Lo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:c(()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()},"disableCollaboration")}),e=Lo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ci(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const i=this.view.dom;i.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=l?.getMeta("focus"),u=l?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return Ud(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return ey(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return vl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
84
+
85
+ `,textSerializers:r={}}=e||{};return Wd(this.state.doc,{blockSeparator:t,textSerializers:{...Tl(this.schema),...r}})}get isEmpty(){return vs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Dy(t,this)}get $doc(){return this.$pos(0)}},c(An,"Editor"),An);function jn(n){return new Ms({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),u=t.from+l.indexOf(o),d=u+o.length;if(El(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;d<t.to&&s.delete(d,t.to),u>t.from&&s.delete(t.from+a,u);const h=t.from+a+o.length;s.addMark(t.from+a,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},"handler"),undoable:n.undoable})}c(jn,"markInputRule");function zy(n){return new Ms({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=o+u;d>l?d=l:l=d+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(d,l,a)}else if(r[0]){const u=n.type.isInline?o:o-1;s.insert(u,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},"handler"),undoable:n.undoable})}c(zy,"nodeInputRule");function zo(n){return new Ms({find:n.find,handler:c(({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=$(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)},"handler"),undoable:n.undoable})}c(zo,"textblockTypeInputRule");function Wn(n){return new Ms({find:n.find,handler:c(({state:e,range:t,match:r,chain:i})=>{const s=$(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),u=a&&rl(a,n.type,s);if(!u)return null;if(o.wrap(a,u),n.keepMarks&&n.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=n.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&At(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},"handler"),undoable:n.undoable})}c(Wn,"wrappingInputRule");function $y(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof I){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}c($y,"canInsertNode");var Fy={};bl(Fy,{createAtomBlockMarkdownSpec:c(()=>Hy,"createAtomBlockMarkdownSpec"),createBlockMarkdownSpec:c(()=>Vy,"createBlockMarkdownSpec"),createInlineMarkdownSpec:c(()=>Uy,"createInlineMarkdownSpec"),parseAttributes:c(()=>Nl,"parseAttributes"),parseIndentedBlocks:c(()=>$o,"parseIndentedBlocks"),renderNestedMarkdownContent:c(()=>Rl,"renderNestedMarkdownContent"),serializeAttributes:c(()=>Il,"serializeAttributes")});function Nl(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(d=>d.trim().slice(1));e.class=u.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(([,u,d])=>{var f;const h=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[u]=p.slice(1,-1))});const a=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 a&&a.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}c(Nl,"parseAttributes");function Il(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(" ")}c(Il,"serializeAttributes");function Hy(n){const{nodeName:e,name:t,parseAttributes:r=Nl,serializeAttributes:i=Il,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=n,a=t||e,u=c(d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f},"filterAttributes");return{parseMarkdown:c((d,f)=>{const h={...s,...d.attributes};return f.createNode(e,h,[])},"parseMarkdown"),markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){const p=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!o.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:c(d=>{const f=u(d.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${a}${p} :::`},"renderMarkdown")}}c(Hy,"createAtomBlockMarkdownSpec");function Vy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Nl,serializeAttributes:s=Il,defaultAttributes:o={},content:l="block",allowedAttributes:a}=n,u=t||e,d=c(f=>{if(!a)return f;const h={};return a.forEach(p=>{p in f&&(h[p]=f[p])}),h},"filterAttributes");return{parseMarkdown:c((f,h)=>{let p;if(r){const g=r(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...o,...f.attributes};return h.createNode(e,m,p)},"parseMarkdown"),markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${u}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,x=i(k);let M=1;const w=b.length;let E="";const v=/^:::([\w-]*)(\s.*)?/gm,N=f.slice(w);for(v.lastIndex=0;;){const P=v.exec(N);if(P===null)break;const D=P.index,j=P[1];if(!((m=P[2])!=null&&m.endsWith(":::"))){if(j)M+=1;else if(M-=1,M===0){const K=N.slice(0,D);E=K.trim();const J=f.slice(0,w+D+P[0].length);let z=[];if(E)if(l==="block")for(z=p.blockTokens(K),z.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=p.inlineTokens(H.text))});z.length>0;){const H=z[z.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))z.pop();else break}else z=p.inlineTokens(E);return{type:e,raw:J,attributes:x,content:E,tokens:z}}}}}},renderMarkdown:c((f,h)=>{const p=d(f.attrs||{}),m=s(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
86
+
87
+ `);return`:::${u}${g}
88
+
89
+ ${y}
90
+
91
+ :::`},"renderMarkdown")}}c(Vy,"createBlockMarkdownSpec");function jy(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}c(jy,"parseShortcodeAttributes");function Wy(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}c(Wy,"serializeShortcodeAttributes");function Uy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=jy,serializeAttributes:s=Wy,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=c(h=>{if(!a)return h;const p={};return a.forEach(m=>{m in h&&(p[m]=h[m])}),p},"filterAttributes"),f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:c((h,p)=>{const m={...o,...h.attributes};if(l)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},"parseMarkdown"),markdownTokenizer:{name:e,level:"inline",start(h){const p=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),g=m?.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(g);if(!y)return;let b="",k="";if(l){const[,M]=y;k=M}else{const[,M,w]=y;k=M,b=w||""}const x=i(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:x}}},renderMarkdown:c(h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(h.attrs||{}),g=s(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`},"renderMarkdown")}}c(Uy,"createInlineMarkdownSpec");function $o(n,e,t){var r,i,s,o;const l=n.split(`
92
+ `),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const h=l[d],p=h.match(e.itemPattern);if(!p){if(a.length>0)break;if(h.trim()===""){d+=1;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;u=`${u}${h}
93
+ `;const b=[y];for(d+=1;d<l.length;){const w=l[d];if(w.trim()===""){const v=l.slice(d+1).findIndex(D=>D.trim()!=="");if(v===-1)break;if((((i=(r=l[d+1+v].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){b.push(w),u=`${u}${w}
94
+ `,d+=1;continue}else break}if((((o=(s=w.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>g)b.push(w),u=`${u}${w}
95
+ `,d+=1;else break}let k;const x=b.slice(1);if(x.length>0){const w=x.map(E=>E.slice(g+f)).join(`
96
+ `);w.trim()&&(e.customNestedParser?k=e.customNestedParser(w):k=t.blockTokens(w))}const M=e.createToken(m,k);a.push(M)}if(a.length!==0)return{items:a,raw:u.trim()}}c($o,"parseIndentedBlocks");function Rl(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,l=e.renderChildren([s]),a=[`${i}${l}`];return o&&o.length>0&&o.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
97
+ `).map(h=>h?e.indent(h):"").join(`
98
+ `);a.push(f)}}),a.join(`
99
+ `)}c(Rl,"renderNestedMarkdownContent");function Ky(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((l,a)=>{const u=s.mapping.map(a),d=s.mapping.map(a)+l.nodeSize;let f=null;if(l.marks.forEach(p=>{if(p!==o)return!1;f=p}),!f)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==f.attrs[p]&&(h=!0)}),h){const p=n.type.create({...n.attrs,...t});s.removeMark(u,d,n.type),s.addMark(u,d,p)}}),s.docChanged&&e.view.dispatch(s)}c(Ky,"updateMarkViewAttributes");var tn,xe=(tn=class extends Al{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new tn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},c(tn,"_Node"),tn);function an(n){return new Ey({find:n.find,handler:c(({state:e,range:t,match:r,pasteEvent:i})=>{const s=$(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let u=t.to;if(l){const d=a.search(/\S/),f=t.from+a.indexOf(l),h=f+l.length;if(El(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;h<t.to&&o.delete(h,t.to),f>t.from&&o.delete(t.from+d,f),u=t.from+d+l.length,o.addMark(t.from+d,u,n.type.create(s||{})),o.removeStoredMark(n.type)}},"handler")})}c(an,"markPasteRule");var Ei=c((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]},"h"),_y=/^\s*>\s$/,qy=xe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Ei("blockquote",{...Y(this.options.HTMLAttributes,n),children:Ei("slot",{})})},parseMarkdown:c((n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(i=>{const o=e.renderChildren(i).split(`
100
+ `).map(l=>`> ${l}`).join(`
101
+ `);t.push(o)}),t.flatMap(i=>[i,"> "]).slice(0,-1).join(`
102
+ `)},"renderMarkdown"),addCommands(){return{setBlockquote:c(()=>({commands:n})=>n.wrapIn(this.name),"setBlockquote"),toggleBlockquote:c(()=>({commands:n})=>n.toggleWrap(this.name),"toggleBlockquote"),unsetBlockquote:c(()=>({commands:n})=>n.lift(this.name),"unsetBlockquote")}},addKeyboardShortcuts(){return{"Mod-Shift-b":c(()=>this.editor.commands.toggleBlockquote(),"Mod-Shift-b")}},addInputRules(){return[Wn({find:_y,type:this.type})]}}),Jy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Gy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Yy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Xy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Qy=un.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:c(n=>n.style.fontWeight!=="normal"&&null,"getAttrs")},{style:"font-weight=400",clearMark:c(n=>n.type.name===this.name,"clearMark")},{style:"font-weight",getAttrs:c(n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return Ei("strong",{...Y(this.options.HTMLAttributes,n),children:Ei("slot",{})})},markdownTokenName:"strong",parseMarkdown:c((n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`**${e.renderChildren(n)}**`,"renderMarkdown"),addCommands(){return{setBold:c(()=>({commands:n})=>n.setMark(this.name),"setBold"),toggleBold:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleBold"),unsetBold:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetBold")}},addKeyboardShortcuts(){return{"Mod-b":c(()=>this.editor.commands.toggleBold(),"Mod-b"),"Mod-B":c(()=>this.editor.commands.toggleBold(),"Mod-B")}},addInputRules(){return[jn({find:Jy,type:this.type}),jn({find:Yy,type:this.type})]},addPasteRules(){return[an({find:Gy,type:this.type}),an({find:Xy,type:this.type})]}}),Zy=/(^|[^`])`([^`]+)`(?!`)$/,e0=/(^|[^`])`([^`]+)`(?!`)/g,t0=un.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:c((n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"","renderMarkdown"),addCommands(){return{setCode:c(()=>({commands:n})=>n.setMark(this.name),"setCode"),toggleCode:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleCode"),unsetCode:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetCode")}},addKeyboardShortcuts(){return{"Mod-e":c(()=>this.editor.commands.toggleCode(),"Mod-e")}},addInputRules(){return[jn({find:Zy,type:this.type})]},addPasteRules(){return[an({find:e0,type:this.type})]}}),Gs=4,n0=/^```([a-z]+)?[\s\n]$/,r0=/^~~~([a-z]+)?[\s\n]$/,i0=xe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Gs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:c(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},"parseHTML"),rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Y(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:c((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)]:[])},"parseMarkdown"),renderMarkdown:c((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(`
103
+ `):r=`\`\`\`${i}
104
+
105
+ \`\`\``,r},"renderMarkdown"),addCommands(){return{setCodeBlock:c(n=>({commands:e})=>e.setNode(this.name,n),"setCodeBlock"),toggleCodeBlock:c(n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n),"toggleCodeBlock")}},addKeyboardShortcuts(){return{"Mod-Alt-c":c(()=>this.editor.commands.toggleCodeBlock(),"Mod-Alt-c"),Backspace:c(()=>{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},"Backspace"),Tab:c(({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Gs,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(t);return o?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:u,to:d}=i,p=r.doc.textBetween(u,d,`
106
+ `,`
107
+ `).split(`
108
+ `).map(m=>l+m).join(`
109
+ `);return a.replaceWith(u,d,r.schema.text(p)),!0})},"Tab"),"Shift-Tab":c(({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Gs,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:l})=>{var a;const{pos:u}=s,d=s.start(),f=s.end(),p=r.doc.textBetween(d,f,`
110
+ `,`
111
+ `).split(`
112
+ `);let m=0,g=0;const y=u-d;for(let E=0;E<p.length;E+=1){if(g+p[E].length>=y){m=E;break}g+=p[E].length+1}const k=((a=p[m].match(/^ */))==null?void 0:a[0])||"",x=Math.min(k.length,t);if(x===0)return!0;let M=d;for(let E=0;E<m;E+=1)M+=p[E].length+1;return l.delete(M,M+x),u-M<=x&&l.setSelection(L.create(l.doc,M)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:u}=i,h=r.doc.textBetween(a,u,`
113
+ `,`
114
+ `).split(`
115
+ `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return p.slice(y)}).join(`
116
+ `);return l.replaceWith(a,u,r.schema.text(h)),!0})},"Shift-Tab"),Enter:c(({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(`
117
+
118
+ `);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},"Enter"),ArrowDown:c(({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 l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:u})=>(u.setSelection(R.near(r.resolve(l))),!0)):n.commands.exitCode()},"ArrowDown")}},addInputRules(){return[zo({find:n0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")}),zo({find:r0,type:this.type,getAttributes:c(n=>({language:n[1]}),"getAttributes")})]},addProseMirrorPlugins(){return[new V({key:new U("codeBlockVSCodeHandler"),props:{handlePaste:c((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:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
119
+ `));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(L.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0},"handlePaste")}})]}}),s0=xe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
120
+
121
+ `):"","renderMarkdown")}),o0=xe.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",Y(this.options.HTMLAttributes,n)]},renderText(){return`
122
+ `},renderMarkdown:c((n,e)=>e.indent(`
123
+ `),"renderMarkdown"),addCommands(){return{setHardBreak:c(()=>({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:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&a&&o){const f=a.filter(h=>l.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})]),"setHardBreak")}},addKeyboardShortcuts(){return{"Mod-Enter":c(()=>this.editor.commands.setHardBreak(),"Mod-Enter"),"Shift-Enter":c(()=>this.editor.commands.setHardBreak(),"Shift-Enter")}}}),l0=xe.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]}`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown:c((n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((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)}`:""},"renderMarkdown"),addCommands(){return{setHeading:c(n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,"setHeading"),toggleHeading:c(n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1,"toggleHeading")}},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=>zo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),a0=xe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Y(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:c((n,e)=>e.createNode("horizontalRule"),"parseMarkdown"),renderMarkdown:c(()=>"---","renderMarkdown"),addCommands(){return{setHorizontalRule:c(()=>({chain:n,state:e})=>{if(!$y(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return _d(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(L.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(I.create(o.doc,a.pos)):o.setSelection(L.create(o.doc,a.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=d?.create();f&&(o.insert(u,f),o.setSelection(L.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()},"setHorizontalRule")}},addInputRules(){return[zy({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),c0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,u0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,d0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,f0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,h0=un.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:c(n=>n.style.fontStyle!=="normal"&&null,"getAttrs")},{style:"font-style=normal",clearMark:c(n=>n.type.name===this.name,"clearMark")},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Y(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:c(()=>({commands:n})=>n.setMark(this.name),"setItalic"),toggleItalic:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleItalic"),unsetItalic:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetItalic")}},markdownTokenName:"em",parseMarkdown:c((n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`*${e.renderChildren(n)}*`,"renderMarkdown"),addKeyboardShortcuts(){return{"Mod-i":c(()=>this.editor.commands.toggleItalic(),"Mod-i"),"Mod-I":c(()=>this.editor.commands.toggleItalic(),"Mod-I")}},addInputRules(){return[jn({find:c0,type:this.type}),jn({find:d0,type:this.type})]},addPasteRules(){return[an({find:u0,type:this.type}),an({find:f0,type:this.type})]}});const p0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",m0="ελ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",Fo="numeric",Ho="ascii",Vo="alpha",sr="asciinumeric",Zn="alphanumeric",jo="domain",sf="emoji",g0="scheme",y0="slashscheme",Ys="whitespace";function b0(n,e){return n in e||(e[n]=[]),e[n]}c(b0,"registerGroup");function Ut(n,e,t){e[Fo]&&(e[sr]=!0,e[Zn]=!0),e[Ho]&&(e[sr]=!0,e[Vo]=!0),e[sr]&&(e[Zn]=!0),e[Vo]&&(e[Zn]=!0),e[Zn]&&(e[jo]=!0),e[sf]&&(e[jo]=!0);for(const r in e){const i=b0(r,t);i.indexOf(n)<0&&i.push(n)}}c(Ut,"addToGroups");function k0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}c(k0,"flagsForToken");function ge(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}c(ge,"State");ge.groups={};ge.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||ge.groups;let i;return e&&e.j?i=e:(i=new ge(e),t&&r&&Ut(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||ge.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,l=i.go(n);if(l?(o=new ge,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new ge,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(k0(o.t,r),t);Ut(s,a,r)}else t&&Ut(s,t,r);o.t=s}return i.j[n]=o,o}};const B=c((n,e,t,r,i)=>n.ta(e,t,r,i),"ta"),_=c((n,e,t,r,i)=>n.tr(e,t,r,i),"tr"),Lc=c((n,e,t,r,i)=>n.ts(e,t,r,i),"ts"),S=c((n,e,t,r,i)=>n.tt(e,t,r,i),"tt"),Xe="WORD",Wo="UWORD",of="ASCIINUMERICAL",lf="ALPHANUMERICAL",Or="LOCALHOST",Uo="TLD",Ko="UTLD",Qr="SCHEME",mn="SLASH_SCHEME",Dl="NUM",_o="WS",Pl="NL",or="OPENBRACE",lr="CLOSEBRACE",Oi="OPENBRACKET",Ai="CLOSEBRACKET",Ni="OPENPAREN",Ii="CLOSEPAREN",Ri="OPENANGLEBRACKET",Di="CLOSEANGLEBRACKET",Pi="FULLWIDTHLEFTPAREN",Li="FULLWIDTHRIGHTPAREN",Bi="LEFTCORNERBRACKET",zi="RIGHTCORNERBRACKET",$i="LEFTWHITECORNERBRACKET",Fi="RIGHTWHITECORNERBRACKET",Hi="FULLWIDTHLESSTHAN",Vi="FULLWIDTHGREATERTHAN",ji="AMPERSAND",Wi="APOSTROPHE",Ui="ASTERISK",ht="AT",Ki="BACKSLASH",_i="BACKTICK",qi="CARET",bt="COLON",Ll="COMMA",Ji="DOLLAR",Le="DOT",Gi="EQUALS",Bl="EXCLAMATION",Ce="HYPHEN",ar="PERCENT",Yi="PIPE",Xi="PLUS",Qi="POUND",cr="QUERY",zl="QUOTE",af="FULLWIDTHMIDDLEDOT",$l="SEMI",Be="SLASH",ur="TILDE",Zi="UNDERSCORE",cf="EMOJI",es="SYM";var uf=Object.freeze({__proto__:null,ALPHANUMERICAL:lf,AMPERSAND:ji,APOSTROPHE:Wi,ASCIINUMERICAL:of,ASTERISK:Ui,AT:ht,BACKSLASH:Ki,BACKTICK:_i,CARET:qi,CLOSEANGLEBRACKET:Di,CLOSEBRACE:lr,CLOSEBRACKET:Ai,CLOSEPAREN:Ii,COLON:bt,COMMA:Ll,DOLLAR:Ji,DOT:Le,EMOJI:cf,EQUALS:Gi,EXCLAMATION:Bl,FULLWIDTHGREATERTHAN:Vi,FULLWIDTHLEFTPAREN:Pi,FULLWIDTHLESSTHAN:Hi,FULLWIDTHMIDDLEDOT:af,FULLWIDTHRIGHTPAREN:Li,HYPHEN:Ce,LEFTCORNERBRACKET:Bi,LEFTWHITECORNERBRACKET:$i,LOCALHOST:Or,NL:Pl,NUM:Dl,OPENANGLEBRACKET:Ri,OPENBRACE:or,OPENBRACKET:Oi,OPENPAREN:Ni,PERCENT:ar,PIPE:Yi,PLUS:Xi,POUND:Qi,QUERY:cr,QUOTE:zl,RIGHTCORNERBRACKET:zi,RIGHTWHITECORNERBRACKET:Fi,SCHEME:Qr,SEMI:$l,SLASH:Be,SLASH_SCHEME:mn,SYM:es,TILDE:ur,TLD:Uo,UNDERSCORE:Zi,UTLD:Ko,UWORD:Wo,WORD:Xe,WS:_o});const Ge=/[a-z]/,Yn=new RegExp("\\p{L}","u"),Xs=new RegExp("\\p{Emoji}","u"),Ye=/\d/,Qs=/\s/,Bc="\r",Zs=`
124
+ `,w0="️",x0="‍",eo="";let jr=null,Wr=null;function S0(n=[]){const e={};ge.groups=e;const t=new ge;jr==null&&(jr=zc(p0)),Wr==null&&(Wr=zc(m0)),S(t,"'",Wi),S(t,"{",or),S(t,"}",lr),S(t,"[",Oi),S(t,"]",Ai),S(t,"(",Ni),S(t,")",Ii),S(t,"<",Ri),S(t,">",Di),S(t,"(",Pi),S(t,")",Li),S(t,"「",Bi),S(t,"」",zi),S(t,"『",$i),S(t,"』",Fi),S(t,"<",Hi),S(t,">",Vi),S(t,"&",ji),S(t,"*",Ui),S(t,"@",ht),S(t,"`",_i),S(t,"^",qi),S(t,":",bt),S(t,",",Ll),S(t,"$",Ji),S(t,".",Le),S(t,"=",Gi),S(t,"!",Bl),S(t,"-",Ce),S(t,"%",ar),S(t,"|",Yi),S(t,"+",Xi),S(t,"#",Qi),S(t,"?",cr),S(t,'"',zl),S(t,"/",Be),S(t,";",$l),S(t,"~",ur),S(t,"_",Zi),S(t,"\\",Ki),S(t,"・",af);const r=_(t,Ye,Dl,{[Fo]:!0});_(r,Ye,r);const i=_(r,Ge,of,{[sr]:!0}),s=_(r,Yn,lf,{[Zn]:!0}),o=_(t,Ge,Xe,{[Ho]:!0});_(o,Ye,i),_(o,Ge,o),_(i,Ye,i),_(i,Ge,i);const l=_(t,Yn,Wo,{[Vo]:!0});_(l,Ge),_(l,Ye,s),_(l,Yn,l),_(s,Ye,s),_(s,Ge),_(s,Yn,s);const a=S(t,Zs,Pl,{[Ys]:!0}),u=S(t,Bc,_o,{[Ys]:!0}),d=_(t,Qs,_o,{[Ys]:!0});S(t,eo,d),S(u,Zs,a),S(u,eo,d),_(u,Qs,d),S(d,Bc),S(d,Zs),_(d,Qs,d),S(d,eo,d);const f=_(t,Xs,cf,{[sf]:!0});S(f,"#"),_(f,Xs,f),S(f,w0,f);const h=S(f,x0);S(h,"#"),_(h,Xs,f);const p=[[Ge,o],[Ye,i]],m=[[Ge,null],[Yn,l],[Ye,s]];for(let g=0;g<jr.length;g++)ut(t,jr[g],Uo,Xe,p);for(let g=0;g<Wr.length;g++)ut(t,Wr[g],Ko,Wo,m);Ut(Uo,{tld:!0,ascii:!0},e),Ut(Ko,{utld:!0,alpha:!0},e),ut(t,"file",Qr,Xe,p),ut(t,"mailto",Qr,Xe,p),ut(t,"http",mn,Xe,p),ut(t,"https",mn,Xe,p),ut(t,"ftp",mn,Xe,p),ut(t,"ftps",mn,Xe,p),Ut(Qr,{scheme:!0,ascii:!0},e),Ut(mn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[g0]:!0}:{[y0]:!0};y.indexOf("-")>=0?k[jo]=!0:Ge.test(y)?Ye.test(y)?k[sr]=!0:k[Ho]=!0:k[Fo]=!0,Lc(t,y,y,k)}return Lc(t,"localhost",Or,{ascii:!0}),t.jd=new ge(es),{start:t,tokens:Object.assign({groups:e},uf)}}c(S0,"init$2");function df(n,e){const t=C0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,u=0,d=null,f=-1,h=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(f=0,h=0,d=l):f>=0&&(f+=t[o].length,h++),u+=t[o].length,s+=t[o].length,o++;s-=f,o-=h,u-=f,i.push({t:d.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}c(df,"run$1");function C0(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}c(C0,"stringToArray");function ut(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new ge(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new ge(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}c(ut,"fastts");function zc(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}c(zc,"decodeTlds");const Ar={defaultProtocol:"http",events:null,format:$c,formatHref:$c,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Fl(n,e=null){let t=Object.assign({},Ar);n&&(t=Object.assign(t,n instanceof Fl?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}c(Fl,"Options");Fl.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 $c(n){return n}c($c,"noop");function ff(n,e){this.t="token",this.v=n,this.tk=e}c(ff,"MultiToken");ff.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={},l=n.get("className",t,e),a=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:f}}};function Es(n,e){const r=class r extends ff{constructor(s,o){super(s,o),this.t=n}};c(r,"Token");let t=r;for(const i in e)t.prototype[i]=e[i];return t.t=n,t}c(Es,"createTokenClass");const Fc=Es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Hc=Es("text"),v0=Es("nl"),Ur=Es("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!==Or&&n[1].t===bt}}),Se=c(n=>new ge(n),"makeState");function M0({groups:n}){const e=n.domain.concat([ji,Ui,ht,Ki,_i,qi,Ji,Gi,Ce,Dl,ar,Yi,Xi,Qi,Be,es,ur,Zi]),t=[Wi,bt,Ll,Le,Bl,ar,cr,zl,$l,Ri,Di,or,lr,Ai,Oi,Ni,Ii,Pi,Li,Bi,zi,$i,Fi,Hi,Vi],r=[ji,Wi,Ui,Ki,_i,qi,Ji,Gi,Ce,or,lr,ar,Yi,Xi,Qi,cr,Be,es,ur,Zi],i=Se(),s=S(i,ur);B(s,r,s),B(s,n.domain,s);const o=Se(),l=Se(),a=Se();B(i,n.domain,o),B(i,n.scheme,l),B(i,n.slashscheme,a),B(o,r,s),B(o,n.domain,o);const u=S(o,ht);S(s,ht,u),S(l,ht,u),S(a,ht,u);const d=S(s,Le);B(d,r,s),B(d,n.domain,s);const f=Se();B(u,n.domain,f),B(f,n.domain,f);const h=S(f,Le);B(h,n.domain,f);const p=Se(Fc);B(h,n.tld,p),B(h,n.utld,p),S(u,Or,p);const m=S(f,Ce);S(m,Ce,m),B(m,n.domain,f),B(p,n.domain,f),S(p,Le,h),S(p,Ce,m);const g=S(p,bt);B(g,n.numeric,Fc);const y=S(o,Ce),b=S(o,Le);S(y,Ce,y),B(y,n.domain,o),B(b,r,s),B(b,n.domain,o);const k=Se(Ur);B(b,n.tld,k),B(b,n.utld,k),B(k,n.domain,o),B(k,r,s),S(k,Le,b),S(k,Ce,y),S(k,ht,u);const x=S(k,bt),M=Se(Ur);B(x,n.numeric,M);const w=Se(Ur),E=Se();B(w,e,w),B(w,t,E),B(E,e,w),B(E,t,E),S(k,Be,w),S(M,Be,w);const v=S(l,bt),N=S(a,bt),P=S(N,Be),D=S(P,Be);B(l,n.domain,o),S(l,Le,b),S(l,Ce,y),B(a,n.domain,o),S(a,Le,b),S(a,Ce,y),B(v,n.domain,w),S(v,Be,w),S(v,cr,w),B(D,n.domain,w),B(D,e,w),S(D,Be,w);const j=[[or,lr],[Oi,Ai],[Ni,Ii],[Ri,Di],[Pi,Li],[Bi,zi],[$i,Fi],[Hi,Vi]];for(let K=0;K<j.length;K++){const[J,z]=j[K],H=S(w,J);S(E,J,H),S(H,z,w);const X=Se(Ur);B(H,e,X);const Q=Se();B(H,t),B(X,e,X),B(X,t,Q),B(Q,e,X),B(Q,t,Q),S(X,z,w),S(Q,z,w)}return S(i,Or,k),S(i,Pl,v0),{start:i,tokens:uf}}c(M0,"init$1");function T0(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,u=null,d=0,f=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(u=a||l.go(t[i].t));)a=null,l=u,l.accepts()?(h=0,f=l):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(to(Hc,e,o)),o=[]),i-=h,d-=h;const p=f.t,m=t.slice(i-d,i);s.push(to(p,e,m))}}return o.length>0&&s.push(to(Hc,e,o)),s}c(T0,"run");function to(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}c(to,"initMultiToken");const E0=typeof console<"u"&&console&&console.warn||(()=>{}),O0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",W={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function A0(){return ge.groups={},W.scanner=null,W.parser=null,W.tokenQueue=[],W.pluginQueue=[],W.customSchemes=[],W.initialized=!1,W}c(A0,"reset");function Vc(n,e=!1){if(W.initialized&&E0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${O0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
125
+ 1. Must only contain digits, lowercase ASCII letters or "-"
126
+ 2. Cannot start or end with "-"
127
+ 3. "-" cannot repeat`);W.customSchemes.push([n,e])}c(Vc,"registerCustomProtocol");function N0(){W.scanner=S0(W.customSchemes);for(let n=0;n<W.tokenQueue.length;n++)W.tokenQueue[n][1]({scanner:W.scanner});W.parser=M0(W.scanner.tokens);for(let n=0;n<W.pluginQueue.length;n++)W.pluginQueue[n][1]({scanner:W.scanner,parser:W.parser});return W.initialized=!0,W}c(N0,"init");function Hl(n){return W.initialized||N0(),T0(W.parser.start,n,df(W.scanner.start,n))}c(Hl,"tokenize");Hl.scan=df;function hf(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 Fl(t),i=Hl(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}c(hf,"find");var Vl="[\0-   ᠎ -\u2029  ]",I0=new RegExp(Vl),R0=new RegExp(`${Vl}$`),D0=new RegExp(Vl,"g");function P0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}c(P0,"isValidLinkStructure");function L0(n){return new V({key:new U("autolink"),appendTransaction:c((e,t,r)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=$d(t.doc,[...e]);if(Kd(l).forEach(({newRange:u})=>{const d=Wg(r.doc,u,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!R0.test(p))return;f=d[0],h=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&h){const p=h.split(I0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Hl(m).map(b=>b.toObject(n.defaultProtocol));if(!P0(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+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=>{El(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},"appendTransaction")})}c(L0,"autolink");function B0(n){return new V({key:new U("handleClickLink"),props:{handleClick:c((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 f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;o=f.find(h=>h.nodeName==="A")}if(!o)return!1;const l=Ud(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,u=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,u),!0):!1},"handleClick")}})}c(B0,"clickHandler");function z0(n){return new V({key:new U("handlePasteLink"),props:{handlePaste:c((e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const u=hf(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!u||i!==void 0&&!i(u.href)?!1:n.editor.commands.setMark(n.type,{href:u.href})},"handlePaste")}})}c(z0,"pasteHandler");function It(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(D0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}c(It,"isAllowedUri");var $0=un.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"){Vc(n);return}Vc(n.scheme,n.optionalSlashes)})},onDestroy(){A0()},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:c((n,e)=>!!It(n,e.protocols),"isAllowedUri"),validate:c(n=>!!n,"validate"),shouldAutoLink:c(n=>!!n,"shouldAutoLink")}},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:c(n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:c(t=>!!It(t,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null},"getAttrs")}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:c(e=>!!It(e,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Y(this.options.HTMLAttributes,n),0]:["a",Y(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:c((n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},"renderMarkdown"),addCommands(){return{setLink:c(n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:c(r=>!!It(r,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},"setLink"),toggleLink:c(n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:c(r=>!!It(r,this.options.protocols),"defaultValidate"),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},"toggleLink"),unsetLink:c(()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),"unsetLink")}},addPasteRules(){return[an({find:c(n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=hf(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:c(o=>!!It(o,t),"defaultValidate"),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},"find"),type:this.type,getAttributes:c(n=>{var e;return{href:(e=n.data)==null?void 0:e.href}},"getAttributes")})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(L0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:c(r=>this.options.isAllowedUri(r,{defaultValidate:c(i=>!!It(i,e),"defaultValidate"),protocols:e,defaultProtocol:t}),"validate"),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(B0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(z0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),F0=Object.defineProperty,H0=c((n,e)=>{for(var t in e)F0(n,t,{get:e[t],enumerable:!0})},"__export"),V0="listItem",jc="textStyle",Wc=/^\s*([-+*])\s$/,pf=xe.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",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:c((n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
128
+ `):"","renderMarkdown"),markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:c(()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V0,this.editor.getAttributes(jc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),"toggleBulletList")}},addKeyboardShortcuts(){return{"Mod-Shift-8":c(()=>this.editor.commands.toggleBulletList(),"Mod-Shift-8")}},addInputRules(){let n=Wn({find:Wc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Wn({find:Wc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(()=>this.editor.getAttributes(jc),"getAttributes"),editor:this.editor})),[n]}}),mf=xe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:c((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),l=e.parseChildren(o);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},"parseMarkdown"),renderMarkdown:c((n,e,t)=>Rl(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),"renderMarkdown"),addKeyboardShortcuts(){return{Enter:c(()=>this.editor.commands.splitListItem(this.name),"Enter"),Tab:c(()=>this.editor.commands.sinkListItem(this.name),"Tab"),"Shift-Tab":c(()=>this.editor.commands.liftListItem(this.name),"Shift-Tab")}}}),j0={};H0(j0,{findListItemPos:c(()=>Pr,"findListItemPos"),getNextListDepth:c(()=>jl,"getNextListDepth"),handleBackspace:c(()=>qo,"handleBackspace"),handleDelete:c(()=>Jo,"handleDelete"),hasListBefore:c(()=>gf,"hasListBefore"),hasListItemAfter:c(()=>W0,"hasListItemAfter"),hasListItemBefore:c(()=>yf,"hasListItemBefore"),listItemHasSubList:c(()=>bf,"listItemHasSubList"),nextListIsDeeper:c(()=>kf,"nextListIsDeeper"),nextListIsHigher:c(()=>wf,"nextListIsHigher")});var Pr=c((n,e)=>{const{$from:t}=e.selection,r=G(n,e.schema);let i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},"findListItemPos"),jl=c((n,e)=>{const t=Pr(n,e);if(!t)return!1;const[,r]=Qg(e,n,t.$pos.pos+4);return r},"getNextListDepth"),gf=c((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))},"hasListBefore"),yf=c((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)},"hasListItemBefore"),bf=c((n,e,t)=>{if(!t)return!1;const r=G(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},"listItemHasSubList"),qo=c((n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Et(n.state,e)&&gf(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),u=[];a.node().descendants((h,p)=>{h.type.name===e&&u.push({node:h,pos:p})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Et(n.state,e)||!ny(n.state))return!1;const r=Pr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=bf(e,n.state,s);return yf(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},"handleBackspace"),kf=c((n,e)=>{const t=jl(n,e),r=Pr(n,e);return!r||!t?!1:t>r.depth},"nextListIsDeeper"),wf=c((n,e)=>{const t=jl(n,e),r=Pr(n,e);return!r||!t?!1:t<r.depth},"nextListIsHigher"),Jo=c((n,e)=>{if(!Et(n.state,e)||!ty(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:kf(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():wf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},"handleDelete"),W0=c((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)},"hasListItemAfter"),xf=q.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Jo(n,t)&&(e=!0)}),e},"Delete"),"Mod-Delete":c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Jo(n,t)&&(e=!0)}),e},"Mod-Delete"),Backspace:c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&qo(n,t,r)&&(e=!0)}),e},"Backspace"),"Mod-Backspace":c(({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&qo(n,t,r)&&(e=!0)}),e},"Mod-Backspace")}}}),Uc=/^(\s*)(\d+)\.\s+(.*)$/,U0=/^\s/;function K0(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(Uc);if(!s)break;const[,o,l,a]=s,u=o.length;let d=a,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(Uc))break;if(p.trim()==="")h.push(p),d+=`
129
+ `,f+=1;else if(p.match(U0))h.push(p),d+=`
130
+ ${p.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:h.join(`
131
+ `)}),r=f,t=f}return[e,r]}c(K0,"collectOrderedListItems");function Sf(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const l=o.content.split(`
132
+ `),a=((r=l[0])==null?void 0:r.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
133
+ `).trim();if(d){const p=t.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<n.length&&n[f].indent>e;)h.push(n[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=Sf(h,p,t);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
134
+ `)})}i.push({type:"list_item",raw:o.raw,tokens:u}),s=f}else s+=1}return i}c(Sf,"buildNestedStructure");function _0(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}})}c(_0,"parseListItems");var q0="listItem",Kc="textStyle",_c=/^(\d+)\.\s$/,Cf=xe.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:c(n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1,"parseHTML")},type:{default:null,parseHTML:c(n=>n.getAttribute("type"),"parseHTML")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Y(this.options.HTMLAttributes,t),0]:["ol",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:c((n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?_0(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
135
+ `):"","renderMarkdown"),markdownTokenizer:{name:"orderedList",level:"block",start:c(n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},"start"),tokenize:c((n,e,t)=>{var r;const i=n.split(`
136
+ `),[s,o]=K0(i);if(s.length===0)return;const l=Sf(s,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,o).join(`
137
+ `)}},"tokenize")},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:c(()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(q0,this.editor.getAttributes(Kc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),"toggleOrderedList")}},addKeyboardShortcuts(){return{"Mod-Shift-7":c(()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-7")}},addInputRules(){let n=Wn({find:_c,type:this.type,getAttributes:c(e=>({start:+e[1]}),"getAttributes"),joinPredicate:c((e,t)=>t.childCount+t.attrs.start===+e[1],"joinPredicate")});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Wn({find:_c,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:c(e=>({start:+e[1],...this.editor.getAttributes(Kc)}),"getAttributes"),joinPredicate:c((e,t)=>t.childCount+t.attrs.start===+e[1],"joinPredicate"),editor:this.editor})),[n]}}),J0=/^\s*(\[([( |x])?\])\s$/,G0=xe.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:c(n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},"parseHTML"),renderHTML:c(n=>({"data-checked":n.checked}),"renderHTML")}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Y(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:c((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)},"parseMarkdown"),renderMarkdown:c((n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Rl(n,e,i)},"renderMarkdown"),addKeyboardShortcuts(){const n={Enter:c(()=>this.editor.commands.splitListItem(this.name),"Enter"),"Shift-Tab":c(()=>this.editor.commands.liftListItem(this.name),"Shift-Tab")};return this.options.nested?{...n,Tab:c(()=>this.editor.commands.sinkListItem(this.name),"Tab")}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=c(d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`},"updateA11Y");return u(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)}),{dom:i,contentDOM:a,update:c(d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d),!0),"update")}}},addInputRules(){return[Wn({find:J0,type:this.type,getAttributes:c(n=>({checked:n[n.length-1]==="x"}),"getAttributes")})]}}),Y0=xe.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",Y(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:c((n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>n.content?e.renderChildren(n.content,`
138
+ `):"","renderMarkdown"),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=c(s=>{const o=$o(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c(l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),"extractItemData"),createToken:c((l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),"createToken"),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},"parseTaskListContent"),i=$o(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c(s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),"extractItemData"),createToken:c((s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),"createToken"),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:c(()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName),"toggleTaskList")}},addKeyboardShortcuts(){return{"Mod-Shift-9":c(()=>this.editor.commands.toggleTaskList(),"Mod-Shift-9")}}});q.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(pf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(mf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(xf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Cf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(G0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Y0.configure(this.options.taskList)),n}});var X0=xe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Y(this.options.HTMLAttributes,n),0]},parseMarkdown:c((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))},"parseMarkdown"),renderMarkdown:c((n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),"renderMarkdown"),addCommands(){return{setParagraph:c(()=>({commands:n})=>n.setNode(this.name),"setParagraph")}},addKeyboardShortcuts(){return{"Mod-Alt-0":c(()=>this.editor.commands.setParagraph(),"Mod-Alt-0")}}}),Q0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Z0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,eb=un.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:c(n=>n.includes("line-through")?{}:!1,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return["s",Y(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:c((n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),"parseMarkdown"),renderMarkdown:c((n,e)=>`~~${e.renderChildren(n)}~~`,"renderMarkdown"),addCommands(){return{setStrike:c(()=>({commands:n})=>n.setMark(this.name),"setStrike"),toggleStrike:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleStrike"),unsetStrike:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetStrike")}},addKeyboardShortcuts(){return{"Mod-Shift-s":c(()=>this.editor.commands.toggleStrike(),"Mod-Shift-s")}},addInputRules(){return[jn({find:Q0,type:this.type})]},addPasteRules(){return[an({find:Z0,type:this.type})]}}),tb=xe.create({name:"text",group:"inline",parseMarkdown:c(n=>({type:"text",text:n.text||""}),"parseMarkdown"),renderMarkdown:c(n=>n.text||"","renderMarkdown")}),nb=un.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:c(n=>n.includes("underline")?{}:!1,"getAttrs")}]},renderHTML({HTMLAttributes:n}){return["u",Y(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:c(()=>({commands:n})=>n.setMark(this.name),"setUnderline"),toggleUnderline:c(()=>({commands:n})=>n.toggleMark(this.name),"toggleUnderline"),unsetUnderline:c(()=>({commands:n})=>n.unsetMark(this.name),"unsetUnderline")}},addKeyboardShortcuts(){return{"Mod-u":c(()=>this.editor.commands.toggleUnderline(),"Mod-u"),"Mod-U":c(()=>this.editor.commands.toggleUnderline(),"Mod-U")}}});function rb(n={}){return new V({view(e){return new Go(e,n)}})}c(rb,"dropCursor");const Oa=class Oa{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=c(o=>{this[i](o)},"handler");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,l=s.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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 u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;u=f.left-a.scrollLeft*h,d=f.top-a.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"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 l=zu(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}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)}};c(Oa,"DropCursorView");let Go=Oa;const Fe=class Fe extends R{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):R.near(r)}content(){return T.empty}eq(e){return e instanceof Fe&&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 Fe(e.resolve(t.pos))}getBookmark(){return new Yo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ib(e)||!sb(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&&Fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(Fe.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!I.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(Fe.valid(l))return l}return null}}};c(Fe,"GapCursor");let ue=Fe;ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;R.jsonID("gapcursor",ue);const ms=class ms{constructor(e){this.pos=e}map(e){return new ms(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):R.near(t)}};c(ms,"GapBookmark");let Yo=ms;function vf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}c(vf,"needsGap");function ib(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||vf(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(ib,"closedBefore");function sb(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||vf(i.type))return!0;if(i.inlineContent)return!1}}return!0}c(sb,"closedAfter");function ob(){return new V({props:{decorations:ub,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:ab,handleKeyDown:lb,handleDOMEvents:{beforeinput:cb}}})}c(ob,"gapCursor");const lb=yl({ArrowLeft:Kr("horiz",-1),ArrowRight:Kr("horiz",1),ArrowUp:Kr("vert",-1),ArrowDown:Kr("vert",1)});function Kr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof L){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ue.findGapCursorFrom(l,e,a);return u?(i&&i(r.tr.setSelection(new ue(u))),!0):!1}}c(Kr,"arrow$3");function ab(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&&I.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}c(ab,"handleClick");function cb(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=C.empty;for(let o=r.length-1;o>=0;o--)i=C.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new T(i,0,0));return s.setSelection(L.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}c(cb,"beforeinput");function ub(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",oe.create(n.doc,[Oe.widget(n.selection.head,e,{key:"gapcursor"})])}c(ub,"drawGapCursor");var ts=200,Z=c(function(){},"RopeSequence");Z.prototype.append=c(function(e){return e.length?(e=Z.from(e),!this.length&&e||e.length<ts&&this.leafAppend(e)||this.length<ts&&e.leafPrepend(this)||this.appendInner(e)):this},"append");Z.prototype.prepend=c(function(e){return e.length?Z.from(e).append(this):this},"prepend");Z.prototype.appendInner=c(function(e){return new db(this,e)},"appendInner");Z.prototype.slice=c(function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Z.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},"slice");Z.prototype.get=c(function(e){if(!(e<0||e>=this.length))return this.getInner(e)},"get");Z.prototype.forEach=c(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)},"forEach");Z.prototype.map=c(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},"map");Z.from=c(function(e){return e instanceof Z?e:e&&e.length?new Mf(e):Z.empty},"from");var Mf=(function(n){function e(r){n.call(this),this.values=r}c(e,"Leaf"),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=c(function(){return this.values},"flatten"),e.prototype.sliceInner=c(function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},"sliceInner"),e.prototype.getInner=c(function(i){return this.values[i]},"getInner"),e.prototype.forEachInner=c(function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},"forEachInner"),e.prototype.forEachInvertedInner=c(function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},"forEachInvertedInner"),e.prototype.leafAppend=c(function(i){if(this.length+i.length<=ts)return new e(this.values.concat(i.flatten()))},"leafAppend"),e.prototype.leafPrepend=c(function(i){if(this.length+i.length<=ts)return new e(i.flatten().concat(this.values))},"leafPrepend"),t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Z);Z.empty=new Mf([]);var db=(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 c(e,"Append"),n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=c(function(){return this.left.flatten().concat(this.right.flatten())},"flatten"),e.prototype.getInner=c(function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},"getInner"),e.prototype.forEachInner=c(function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},"forEachInner"),e.prototype.forEachInvertedInner=c(function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},"forEachInvertedInner"),e.prototype.sliceInner=c(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))},"sliceInner"),e.prototype.leafAppend=c(function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},"leafAppend"),e.prototype.leafPrepend=c(function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},"leafPrepend"),e.prototype.appendInner=c(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)},"appendInner"),e})(Z);const fb=500,yt=class yt{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,l,a,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(f);return}if(i){d.push(new ze(f.map));let p=f.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new ze(m,void 0,void 0,u.length+d.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,a=new yt(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new ze(e.mapping.maps[d],f,t),p;(p=a&&a.merge(h))&&(h=p,d?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),i||(a=h)}let u=o-r.depth;return u>pb&&(l=hb(l,u),o-=u),new yt(l.append(s),o)}remapping(e,t){let r=new li;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 yt(this.items.append(e.map(t=>new ze(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let p=s.getMirror(--a);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(s.slice(a+1,p));y&&l++,r.push(new ze(m,g,y))}else r.push(new ze(m))},i);let u=[];for(let h=t;h<o;h++)u.push(new ze(s.maps[h]));let d=this.items.slice(0,i).append(u).append(r),f=new yt(d,l);return f.emptyItemCount()>fb&&(f=f.compress(this.items.length-r.length)),f}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,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),u=a&&a.getMap();if(r--,u&&t.appendMap(u,r),a){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let f=new ze(u.invert(),a,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&r--},this.items.length,0),new yt(Z.from(i.reverse()),s)}};c(yt,"Branch");let cn=yt;cn.empty=new cn(Z.empty,0);function hb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}c(hb,"cutOffEvents");const gs=class gs{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 gs(t.getMap().invert(),t,this.selection)}}};c(gs,"Item");let ze=gs;const Aa=class Aa{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}};c(Aa,"HistoryState");let He=Aa;const pb=20;function mb(n,e,t,r){let i=t.getMeta(Xt),s;if(i)return i.historyState;t.getMeta(bb)&&(n=new He(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Xt))return o.getMeta(Xt).redo?new He(n.done.addTransform(t,void 0,r,Zr(e)),n.undone,qc(t.mapping.maps),n.prevTime,n.prevComposition):new He(n.done,n.undone.addTransform(t,void 0,r,Zr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!gb(t,n.prevRanges)),u=o?no(n.prevRanges,t.mapping):qc(t.mapping.maps);return new He(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Zr(e)),cn.empty,u,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new He(n.done.rebased(t,s),n.undone.rebased(t,s),no(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new He(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),no(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}c(mb,"applyTransaction");function gb(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}c(gb,"isAdjacentTo");function qc(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}c(qc,"rangesFor");function no(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}c(no,"mapRanges");function yb(n,e,t){let r=Zr(e),i=Xt.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),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new He(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Xt,{redo:t,historyState:a})}c(yb,"histTransaction");let ro=!1,Jc=null;function Zr(n){let e=n.plugins;if(Jc!=e){ro=!1,Jc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ro=!0;break}}return ro}c(Zr,"mustPreserveItems");const Xt=new U("history"),bb=new U("closeHistory");function kb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new V({key:Xt,state:{init(){return new He(cn.empty,cn.empty,null,0,-1)},apply(e,t,r){return mb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Ef:r=="historyRedo"?Of:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}c(kb,"history");function Tf(n,e){return(t,r)=>{let i=Xt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=yb(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}c(Tf,"buildCommand");const Ef=Tf(!1,!0),Of=Tf(!0,!0);q.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:c(n=>n.length,"textCounter"),wordCounter:c(n=>n.split(" ").filter(e=>e!=="").length,"wordCounter")}},addStorage(){return{characters:c(()=>0,"characters"),words:c(()=>0,"words")}},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 V({key:new U("characterCount"),appendTransaction:c((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,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,a);return n=!0,u}n=!0},"appendTransaction"),filterTransaction:c((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 l=e.selection.$head.pos,a=s-r,u=l-a,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)},"filterTransaction")})]}});var wb=q.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rb(this.options)]}});q.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new V({key:new U("focus"),props:{decorations:c(({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return oe.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(a.isText)return;if(!(i>=u&&i<=u+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,u)=>{if(a.isText||!(i>=u&&i<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Oe.node(u,u+a.nodeSize,{class:this.options.className}))}),oe.create(n,s)},"decorations")}})]}});var xb=q.create({name:"gapCursor",addProseMirrorPlugins(){return[ob()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=$(A(n,"allowGapCursor",t)))!=null?e:null}}});q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new V({key:new U("placeholder"),props:{decorations:c(({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,l)=>{const a=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&vs(o);if((a||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=Oe.node(l,l+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),oe.create(n,i)},"decorations")}})]}});q.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new V({key:new U("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||_d(t.selection)||n.view.dragging?null:oe.create(t.doc,[Oe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Gc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}c(Gc,"nodeEqualsType");var Sb=q.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new U(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 V({key:e,appendTransaction:c((i,s,o)=>{const{doc:l,tr:a,schema:u}=o,d=e.getState(o),f=l.content.size,h=u.nodes[t];if(d)return a.insert(f,h.create())},"appendTransaction"),state:{init:c((i,s)=>{const o=s.tr.doc.lastChild;return!Gc({node:o,types:r})},"init"),apply:c((i,s)=>{if(!i.docChanged)return s;const o=i.doc.lastChild;return!Gc({node:o,types:r})},"apply")}})]}}),Cb=q.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:c(()=>({state:n,dispatch:e})=>Ef(n,e),"undo"),redo:c(()=>({state:n,dispatch:e})=>Of(n,e),"redo")}},addProseMirrorPlugins(){return[kb(this.options)]},addKeyboardShortcuts(){return{"Mod-z":c(()=>this.editor.commands.undo(),"Mod-z"),"Shift-Mod-z":c(()=>this.editor.commands.redo(),"Shift-Mod-z"),"Mod-y":c(()=>this.editor.commands.redo(),"Mod-y"),"Mod-я":c(()=>this.editor.commands.undo(),"Mod-я"),"Shift-Mod-я":c(()=>this.editor.commands.redo(),"Shift-Mod-я")}}}),vb=q.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(Qy.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(qy.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(pf.configure(this.options.bulletList)),this.options.code!==!1&&i.push(t0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(i0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(s0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(wb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(xb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(o0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(l0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Cb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(a0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(h0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(mf.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(xf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push($0.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Cf.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(X0.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(eb.configure(this.options.strike)),this.options.text!==!1&&i.push(tb.configure(this.options.text)),this.options.underline!==!1&&i.push(nb.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Sb.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Mb=vb;function Yc(n){return O.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}c(Yc,"useDebouncedRef");var Nn,Tb=(Nn=class extends By{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Yc(this.view.state),this.reactiveExtensionStorage=Yc(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),O.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const r=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},c(Nn,"Editor"),Nn),Eb=O.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=O.ref(),t=O.getCurrentInstance();return O.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&O.nextTick(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.firstChild))return;const s=O.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),O.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return O.h("div",{ref:c(n=>{this.rootEl=n},"ref")})}});O.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return O.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});O.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return O.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});O.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return O.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});const Af=["top","right","bottom","left"],Xc=["start","end"],Qc=Af.reduce((n,e)=>n.concat(e,e+"-"+Xc[0],e+"-"+Xc[1]),[]),_e=Math.min,de=Math.max,ns=Math.round,je=c(n=>({x:n,y:n}),"createCoords"),Ob={left:"right",right:"left",bottom:"top",top:"bottom"},Ab={start:"end",end:"start"};function Xo(n,e,t){return de(n,_e(e,t))}c(Xo,"clamp");function lt(n,e){return typeof n=="function"?n(e):n}c(lt,"evaluate");function Ae(n){return n.split("-")[0]}c(Ae,"getSide");function Re(n){return n.split("-")[1]}c(Re,"getAlignment");function Nf(n){return n==="x"?"y":"x"}c(Nf,"getOppositeAxis");function Wl(n){return n==="y"?"height":"width"}c(Wl,"getAxisLength");const Nb=new Set(["top","bottom"]);function Ve(n){return Nb.has(Ae(n))?"y":"x"}c(Ve,"getSideAxis");function Ul(n){return Nf(Ve(n))}c(Ul,"getAlignmentAxis");function If(n,e,t){t===void 0&&(t=!1);const r=Re(n),i=Ul(n),s=Wl(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=is(o)),[o,is(o)]}c(If,"getAlignmentSides");function Ib(n){const e=is(n);return[rs(n),e,rs(e)]}c(Ib,"getExpandedPlacements");function rs(n){return n.replace(/start|end/g,e=>Ab[e])}c(rs,"getOppositeAlignmentPlacement");const Zc=["left","right"],eu=["right","left"],Rb=["top","bottom"],Db=["bottom","top"];function Pb(n,e,t){switch(n){case"top":case"bottom":return t?e?eu:Zc:e?Zc:eu;case"left":case"right":return e?Rb:Db;default:return[]}}c(Pb,"getSideList");function Lb(n,e,t,r){const i=Re(n);let s=Pb(Ae(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(rs)))),s}c(Lb,"getOppositeAxisPlacements");function is(n){return n.replace(/left|right|bottom|top/g,e=>Ob[e])}c(is,"getOppositePlacement");function Bb(n){return{top:0,right:0,bottom:0,left:0,...n}}c(Bb,"expandPaddingObject");function Kl(n){return typeof n!="number"?Bb(n):{top:n,right:n,bottom:n,left:n}}c(Kl,"getPaddingObject");function Un(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}c(Un,"rectToClientRect");function tu(n,e,t){let{reference:r,floating:i}=n;const s=Ve(e),o=Ul(e),l=Wl(o),a=Ae(e),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Re(e)){case"start":p[o]-=h*(t&&u?-1:1);break;case"end":p[o]+=h*(t&&u?-1:1);break}return p}c(tu,"computeCoordsFromPlacement");const zb=c(async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:f}=tu(u,r,a),h=r,p={},m=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x:k,y:x,data:M,reset:w}=await b({x:d,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:o,elements:{reference:n,floating:e}});d=k??d,f=x??f,p={...p,[y]:{...p[y],...M}},w&&m<=50&&(m++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(u=w.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):w.rects),{x:d,y:f}=tu(u,h,a)),g=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}},"computePosition$1");async function Kn(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=lt(e,n),m=Kl(p),y=l[h?f==="floating"?"reference":"floating":f],b=Un(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:a})),k=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},w=Un(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:x,strategy:a}):k);return{top:(b.top-w.top+m.top)/M.y,bottom:(w.bottom-b.bottom+m.bottom)/M.y,left:(b.left-w.left+m.left)/M.x,right:(w.right-b.right+m.right)/M.x}}c(Kn,"detectOverflow");const $b=c(n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:a}=e,{element:u,padding:d=0}=lt(n,e)||{};if(u==null)return{};const f=Kl(d),h={x:t,y:r},p=Ul(i),m=Wl(p),g=await o.getDimensions(u),y=p==="y",b=y?"top":"left",k=y?"bottom":"right",x=y?"clientHeight":"clientWidth",M=s.reference[m]+s.reference[p]-h[p]-s.floating[m],w=h[p]-s.reference[p],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let v=E?E[x]:0;(!v||!await(o.isElement==null?void 0:o.isElement(E)))&&(v=l.floating[x]||s.floating[m]);const N=M/2-w/2,P=v/2-g[m]/2-1,D=_e(f[b],P),j=_e(f[k],P),K=D,J=v-g[m]-j,z=v/2-g[m]/2+N,H=Xo(K,z,J),X=!a.arrow&&Re(i)!=null&&z!==H&&s.reference[m]/2-(z<K?D:j)-g[m]/2<0,Q=X?z<K?z-K:z-J:0;return{[p]:h[p]+Q,data:{[p]:H,centerOffset:z-H-Q,...X&&{alignmentOffset:Q}},reset:X}}}),"arrow$2");function Fb(n,e,t){return(n?[...t.filter(i=>Re(i)===n),...t.filter(i=>Re(i)!==n)]:t.filter(i=>Ae(i)===i)).filter(i=>n?Re(i)===n||(e?rs(i)!==i:!1):!0)}c(Fb,"getPlacementList");const Hb=c(function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:s,middlewareData:o,placement:l,platform:a,elements:u}=e,{crossAxis:d=!1,alignment:f,allowedPlacements:h=Qc,autoAlignment:p=!0,...m}=lt(n,e),g=f!==void 0||h===Qc?Fb(f||null,p,h):h,y=await Kn(e,m),b=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[b];if(k==null)return{};const x=If(k,s,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==k)return{reset:{placement:g[0]}};const M=[y[Ae(k)],y[x[0]],y[x[1]]],w=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:M}],E=g[b+1];if(E)return{data:{index:b+1,overflows:w},reset:{placement:E}};const v=w.map(D=>{const j=Re(D.placement);return[D.placement,j&&d?D.overflows.slice(0,2).reduce((K,J)=>K+J,0):D.overflows[0],D.overflows]}).sort((D,j)=>D[1]-j[1]),P=((i=v.filter(D=>D[2].slice(0,Re(D[0])?2:3).every(j=>j<=0))[0])==null?void 0:i[0])||v[0][0];return P!==l?{data:{index:b+1,overflows:w},reset:{placement:P}}:{}}}},"autoPlacement$1"),Vb=c(function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=lt(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=Ae(i),k=Ve(l),x=Ae(l)===l,M=await(a.isRTL==null?void 0:a.isRTL(u.floating)),w=h||(x||!g?[is(l)]:Ib(l)),E=m!=="none";!h&&E&&w.push(...Lb(l,g,m,M));const v=[l,...w],N=await Kn(e,y),P=[];let D=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&P.push(N[b]),f){const z=If(i,o,M);P.push(N[z[0]],N[z[1]])}if(D=[...D,{placement:i,overflows:P}],!P.every(z=>z<=0)){var j,K;const z=(((j=s.flip)==null?void 0:j.index)||0)+1,H=v[z];if(H&&(!(f==="alignment"?k!==Ve(H):!1)||D.every(be=>Ve(be.placement)===k?be.overflows[0]>0:!0)))return{data:{index:z,overflows:D},reset:{placement:H}};let X=(K=D.filter(Q=>Q.overflows[0]<=0).sort((Q,be)=>Q.overflows[1]-be.overflows[1])[0])==null?void 0:K.placement;if(!X)switch(p){case"bestFit":{var J;const Q=(J=D.filter(be=>{if(E){const ct=Ve(be.placement);return ct===k||ct==="y"}return!0}).map(be=>[be.placement,be.overflows.filter(ct=>ct>0).reduce((ct,ih)=>ct+ih,0)]).sort((be,ct)=>be[1]-ct[1])[0])==null?void 0:J[0];Q&&(X=Q);break}case"initialPlacement":X=l;break}if(i!==X)return{reset:{placement:X}}}return{}}}},"flip$1");function nu(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}c(nu,"getSideOffsets");function ru(n){return Af.some(e=>n[e]>=0)}c(ru,"isAnySideFullyClipped");const jb=c(function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=lt(n,e);switch(r){case"referenceHidden":{const s=await Kn(e,{...i,elementContext:"reference"}),o=nu(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:ru(o)}}}case"escaped":{const s=await Kn(e,{...i,altBoundary:!0}),o=nu(s,t.floating);return{data:{escapedOffsets:o,escaped:ru(o)}}}default:return{}}}}},"hide$1");function Rf(n){const e=_e(...n.map(s=>s.left)),t=_e(...n.map(s=>s.top)),r=de(...n.map(s=>s.right)),i=de(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}c(Rf,"getBoundingRect");function Wb(n){const e=n.slice().sort((i,s)=>i.y-s.y),t=[];let r=null;for(let i=0;i<e.length;i++){const s=e[i];!r||s.y-r.y>r.height/2?t.push([s]):t[t.length-1].push(s),r=s}return t.map(i=>Un(Rf(i)))}c(Wb,"getRectsByLine");const Ub=c(function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:s,strategy:o}=e,{padding:l=2,x:a,y:u}=lt(n,e),d=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),f=Wb(d),h=Un(Rf(d)),p=Kl(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&u!=null)return f.find(y=>a>y.left-p.left&&a<y.right+p.right&&u>y.top-p.top&&u<y.bottom+p.bottom)||h;if(f.length>=2){if(Ve(t)==="y"){const D=f[0],j=f[f.length-1],K=Ae(t)==="top",J=D.top,z=j.bottom,H=K?D.left:j.left,X=K?D.right:j.right,Q=X-H,be=z-J;return{top:J,bottom:z,left:H,right:X,width:Q,height:be,x:H,y:J}}const y=Ae(t)==="left",b=de(...f.map(D=>D.right)),k=_e(...f.map(D=>D.left)),x=f.filter(D=>y?D.left===k:D.right===b),M=x[0].top,w=x[x.length-1].bottom,E=k,v=b,N=v-E,P=w-M;return{top:M,bottom:w,left:E,right:v,width:N,height:P,x:E,y:M}}return h}c(m,"getBoundingClientRect");const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},"inline$1"),Kb=new Set(["left","top"]);async function _b(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ae(t),l=Re(t),a=Ve(t)==="y",u=Kb.has(o)?-1:1,d=s&&a?-1:1,f=lt(e,n);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),a?{x:p*d,y:h*u}:{x:h*u,y:p*d}}c(_b,"convertValueToCoords");const qb=c(function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await _b(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},"offset$1"),Jb=c(function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:c(y=>{let{x:b,y:k}=y;return{x:b,y:k}},"fn")},...a}=lt(n,e),u={x:t,y:r},d=await Kn(e,a),f=Ve(Ae(i)),h=Nf(f);let p=u[h],m=u[f];if(s){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",k=p+d[y],x=p-d[b];p=Xo(k,p,x)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=m+d[y],x=m-d[b];m=Xo(k,m,x)}const g=l.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[h]:s,[f]:o}}}}}},"shift$1"),Gb=c(function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:a=c(()=>{},"apply"),...u}=lt(n,e),d=await Kn(e,u),f=Ae(i),h=Re(i),p=Ve(i)==="y",{width:m,height:g}=s.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const k=g-d.top-d.bottom,x=m-d.left-d.right,M=_e(g-d[y],k),w=_e(m-d[b],x),E=!e.middlewareData.shift;let v=M,N=w;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(N=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(v=k),E&&!h){const D=de(d.left,0),j=de(d.right,0),K=de(d.top,0),J=de(d.bottom,0);p?N=m-2*(D!==0||j!==0?D+j:de(d.left,d.right)):v=g-2*(K!==0||J!==0?K+J:de(d.top,d.bottom))}await a({...e,availableWidth:N,availableHeight:v});const P=await o.getDimensions(l.floating);return m!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}},"size$1");function Os(){return typeof window<"u"}c(Os,"hasWindow");function Jn(n){return Df(n)?(n.nodeName||"").toLowerCase():"#document"}c(Jn,"getNodeName");function ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}c(ke,"getWindow");function at(n){var e;return(e=(Df(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}c(at,"getDocumentElement");function Df(n){return Os()?n instanceof Node||n instanceof ke(n).Node:!1}c(Df,"isNode");function De(n){return Os()?n instanceof Element||n instanceof ke(n).Element:!1}c(De,"isElement");function qe(n){return Os()?n instanceof HTMLElement||n instanceof ke(n).HTMLElement:!1}c(qe,"isHTMLElement");function iu(n){return!Os()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ke(n).ShadowRoot}c(iu,"isShadowRoot");const Yb=new Set(["inline","contents"]);function Lr(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Pe(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Yb.has(i)}c(Lr,"isOverflowElement");const Xb=new Set(["table","td","th"]);function Qb(n){return Xb.has(Jn(n))}c(Qb,"isTableElement");const Zb=[":popover-open",":modal"];function As(n){return Zb.some(e=>{try{return n.matches(e)}catch{return!1}})}c(As,"isTopLayer");const ek=["transform","translate","scale","rotate","perspective"],tk=["transform","translate","scale","rotate","perspective","filter"],nk=["paint","layout","strict","content"];function _l(n){const e=ql(),t=De(n)?Pe(n):n;return ek.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||tk.some(r=>(t.willChange||"").includes(r))||nk.some(r=>(t.contain||"").includes(r))}c(_l,"isContainingBlock");function rk(n){let e=Ot(n);for(;qe(e)&&!_n(e);){if(_l(e))return e;if(As(e))return null;e=Ot(e)}return null}c(rk,"getContainingBlock");function ql(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}c(ql,"isWebKit");const ik=new Set(["html","body","#document"]);function _n(n){return ik.has(Jn(n))}c(_n,"isLastTraversableNode");function Pe(n){return ke(n).getComputedStyle(n)}c(Pe,"getComputedStyle$1");function Ns(n){return De(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}c(Ns,"getNodeScroll");function Ot(n){if(Jn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iu(n)&&n.host||at(n);return iu(e)?e.host:e}c(Ot,"getParentNode");function Pf(n){const e=Ot(n);return _n(e)?n.ownerDocument?n.ownerDocument.body:n.body:qe(e)&&Lr(e)?e:Pf(e)}c(Pf,"getNearestOverflowAncestor");function Lf(n,e,t){var r;e===void 0&&(e=[]);const i=Pf(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=ke(i);return s?(Qo(o),e.concat(o,o.visualViewport||[],Lr(i)?i:[],[])):e.concat(i,Lf(i,[]))}c(Lf,"getOverflowAncestors");function Qo(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}c(Qo,"getFrameElement");function Bf(n){const e=Pe(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=qe(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=ns(t)!==s||ns(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}c(Bf,"getCssDimensions");function zf(n){return De(n)?n:n.contextElement}c(zf,"unwrapElement");function xn(n){const e=zf(n);if(!qe(e))return je(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Bf(e);let o=(s?ns(t.width):t.width)/r,l=(s?ns(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}c(xn,"getScale");const sk=je(0);function $f(n){const e=ke(n);return!ql()||!e.visualViewport?sk:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}c($f,"getVisualOffsets");function ok(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==ke(n)?!1:e}c(ok,"shouldAddVisualOffsets");function Nr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=zf(n);let o=je(1);e&&(r?De(r)&&(o=xn(r)):o=xn(n));const l=ok(s,t,r)?$f(s):je(0);let a=(i.left+l.x)/o.x,u=(i.top+l.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(s){const h=ke(s),p=r&&De(r)?ke(r):r;let m=h,g=Qo(m);for(;g&&r&&p!==m;){const y=xn(g),b=g.getBoundingClientRect(),k=Pe(g),x=b.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,M=b.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,u*=y.y,d*=y.x,f*=y.y,a+=x,u+=M,m=ke(g),g=Qo(m)}}return Un({width:d,height:f,x:a,y:u})}c(Nr,"getBoundingClientRect");function Is(n,e){const t=Ns(n).scrollLeft;return e?e.left+t:Nr(at(n)).left+t}c(Is,"getWindowScrollBarX");function Ff(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-Is(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}c(Ff,"getHTMLOffset");function lk(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=at(r),l=e?As(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},u=je(1);const d=je(0),f=qe(r);if((f||!f&&!s)&&((Jn(r)!=="body"||Lr(o))&&(a=Ns(r)),qe(r))){const p=Nr(r);u=xn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=o&&!f&&!s?Ff(o,a):je(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+d.x+h.x,y:t.y*u.y-a.scrollTop*u.y+d.y+h.y}}c(lk,"convertOffsetParentRelativeRectToViewportRelativeRect");function ak(n){return Array.from(n.getClientRects())}c(ak,"getClientRects");function ck(n){const e=at(n),t=Ns(n),r=n.ownerDocument.body,i=de(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=de(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Is(n);const l=-t.scrollTop;return Pe(r).direction==="rtl"&&(o+=de(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}c(ck,"getDocumentRect");const su=25;function uk(n,e){const t=ke(n),r=at(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const d=ql();(!d||d&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const u=Is(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=su&&(s-=m)}else u<=su&&(s+=u);return{width:s,height:o,x:l,y:a}}c(uk,"getViewportRect");const dk=new Set(["absolute","fixed"]);function fk(n,e){const t=Nr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=qe(n)?xn(n):je(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,u=r*s.y;return{width:o,height:l,x:a,y:u}}c(fk,"getInnerBoundingClientRect");function ou(n,e,t){let r;if(e==="viewport")r=uk(n,t);else if(e==="document")r=ck(at(n));else if(De(e))r=fk(e,t);else{const i=$f(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Un(r)}c(ou,"getClientRectFromClippingAncestor");function Hf(n,e){const t=Ot(n);return t===e||!De(t)||_n(t)?!1:Pe(t).position==="fixed"||Hf(t,e)}c(Hf,"hasFixedPositionAncestor");function hk(n,e){const t=e.get(n);if(t)return t;let r=Lf(n,[]).filter(l=>De(l)&&Jn(l)!=="body"),i=null;const s=Pe(n).position==="fixed";let o=s?Ot(n):n;for(;De(o)&&!_n(o);){const l=Pe(o),a=_l(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&dk.has(i.position)||Lr(o)&&!a&&Hf(n,o))?r=r.filter(d=>d!==o):i=l,o=Ot(o)}return e.set(n,r),r}c(hk,"getClippingElementAncestors");function pk(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?As(e)?[]:hk(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((u,d)=>{const f=ou(e,d,i);return u.top=de(f.top,u.top),u.right=_e(f.right,u.right),u.bottom=_e(f.bottom,u.bottom),u.left=de(f.left,u.left),u},ou(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}c(pk,"getClippingRect");function mk(n){const{width:e,height:t}=Bf(n);return{width:e,height:t}}c(mk,"getDimensions");function gk(n,e,t){const r=qe(e),i=at(e),s=t==="fixed",o=Nr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=je(0);function u(){a.x=Is(i)}if(c(u,"setLeftRTLScrollbarOffset"),r||!r&&!s)if((Jn(e)!=="body"||Lr(i))&&(l=Ns(e)),r){const p=Nr(e,!0,s,e);a.x=p.x+e.clientLeft,a.y=p.y+e.clientTop}else i&&u();s&&!r&&i&&u();const d=i&&!r&&!s?Ff(i,l):je(0),f=o.left+l.scrollLeft-a.x-d.x,h=o.top+l.scrollTop-a.y-d.y;return{x:f,y:h,width:o.width,height:o.height}}c(gk,"getRectRelativeToOffsetParent");function io(n){return Pe(n).position==="static"}c(io,"isStaticPositioned");function lu(n,e){if(!qe(n)||Pe(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return at(n)===t&&(t=t.ownerDocument.body),t}c(lu,"getTrueOffsetParent");function Vf(n,e){const t=ke(n);if(As(n))return t;if(!qe(n)){let i=Ot(n);for(;i&&!_n(i);){if(De(i)&&!io(i))return i;i=Ot(i)}return t}let r=lu(n,e);for(;r&&Qb(r)&&io(r);)r=lu(r,e);return r&&_n(r)&&io(r)&&!_l(r)?t:r||rk(n)||t}c(Vf,"getOffsetParent");const yk=c(async function(n){const e=this.getOffsetParent||Vf,t=this.getDimensions,r=await t(n.floating);return{reference:gk(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},"getElementRects");function bk(n){return Pe(n).direction==="rtl"}c(bk,"isRTL");const kk={convertOffsetParentRelativeRectToViewportRelativeRect:lk,getDocumentElement:at,getClippingRect:pk,getOffsetParent:Vf,getElementRects:yk,getClientRects:ak,getDimensions:mk,getScale:xn,isElement:De,isRTL:bk},jf=qb,Wf=Hb,Uf=Jb,Kf=Vb,_f=Gb,qf=jb,Jf=$b,Gf=Ub,Yf=c((n,e,t)=>{const r=new Map,i={platform:kk,...t},s={...i.platform,_c:r};return zb(n,e,{...i,platform:s})},"computePosition");var Zo,el;if(typeof WeakMap<"u"){let n=new WeakMap;Zo=c(e=>n.get(e),"readFromCache"),el=c((e,t)=>(n.set(e,t),t),"addToCache")}else{const n=[];let t=0;Zo=c(r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},"readFromCache"),el=c((r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i),"addToCache")}var In,et=(In=class{constructor(e,t,r,i){this.width=e,this.height=t,this.map=r,this.problems=i}findCell(e){for(let t=0;t<this.map.length;t++){const r=this.map[t];if(r!=e)continue;const i=t%this.width,s=t/this.width|0;let o=i+1,l=s+1;for(let a=1;o<this.width&&this.map[t+a]==r;a++)o++;for(let a=1;l<this.height&&this.map[t+this.width*a]==r;a++)l++;return{left:i,top:s,right:o,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){const{left:i,right:s,top:o,bottom:l}=this.findCell(e);return t=="horiz"?(r<0?i==0:s==this.width)?null:this.map[o*this.width+(r<0?i-1:s)]:(r<0?o==0:l==this.height)?null:this.map[i+this.width*(r<0?o-1:l)]}rectBetween(e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(e),{left:l,right:a,top:u,bottom:d}=this.findCell(t);return{left:Math.min(r,l),top:Math.min(s,u),right:Math.max(i,a),bottom:Math.max(o,d)}}cellsInRect(e){const t=[],r={};for(let i=e.top;i<e.bottom;i++)for(let s=e.left;s<e.right;s++){const o=i*this.width+s,l=this.map[o];r[l]||(r[l]=!0,!(s==e.left&&s&&this.map[o-1]==l||i==e.top&&i&&this.map[o-this.width]==l)&&t.push(l))}return t}positionAt(e,t,r){for(let i=0,s=0;;i++){const o=s+r.child(i).nodeSize;if(i==e){let l=t+e*this.width;const a=(e+1)*this.width;for(;l<a&&this.map[l]<s;)l++;return l==a?o-1:this.map[l]}s=o}}static get(e){return Zo(e)||el(e,wk(e))}},c(In,"TableMap"),In);function wk(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=xk(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,d=e*t;u<d;u++)r[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;i<r.length&&r[i]!=0;)i++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let x=0;x<b;x++){if(x+u>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:b-x});break}const M=i+x*e;for(let w=0;w<y;w++){r[M+w]==0?r[M+w]=d:(s||(s=[])).push({type:"collision",row:u,pos:d,n:y-w});const E=k&&k[w];if(E){const v=(M+w)%e*2,N=o[v];N==null||N!=E&&o[v+1]==1?(o[v]=E,o[v+1]=1):N==E&&o[v+1]++}}}i+=y,d+=g.nodeSize}const h=(u+1)*e;let p=0;for(;i<h;)r[i++]==0&&p++;p&&(s||(s=[])).push({type:"missing",row:u,n:p}),d++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new et(e,t,r,s);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<t&&(a=!0);return a&&Sk(l,o,n),l}c(wk,"computeMap");function xk(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}c(xk,"findWidth");function Sk(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const d=(i+u)%n.width,f=e[d*2];f!=null&&(!a.colwidth||a.colwidth[u]!=f)&&((l||(l=Ck(a)))[u]=f)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}c(Sk,"findBadColWidths");function Ck(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}c(Ck,"freshColWidth");function Jl(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}c(Jl,"tableNodeTypes");new U("selectingCells");function vk(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}c(vk,"cellAround");function Xf(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}c(Xf,"isInTable");function Mk(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=vk(e.$head)||Tk(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}c(Mk,"selectionCell");function Tk(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}c(Tk,"cellNear");function au(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}c(au,"pointsAtCell");function Qf(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}c(Qf,"inSameTable");function Zf(n,e,t){const r=n.node(-1),i=et.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}c(Zf,"nextCell");function cu(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}c(cu,"removeColSpan");var me,We=(me=class extends R{constructor(e,t=e){const r=e.node(-1),i=et.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const u=a.map(d=>{const f=r.nodeAt(d);if(!f)throw RangeError(`No cell with offset ${d} found`);const h=s+d+1;return new di(l.resolve(h),l.resolve(h+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(au(r)&&au(i)&&Qf(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?me.rowSelection(r,i):s&&this.isColSelection()?me.colSelection(r,i):new me(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=et.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const u=[];for(let d=a*t.width+i.left,f=i.left;f<i.right;f++,d++){const h=t.map[d];if(s[h])continue;s[h]=!0;const p=t.findCell(h);let m=e.nodeAt(h);if(!m)throw RangeError(`No cell with offset ${h} found`);const g=i.left-p.left,y=p.right-i.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=cu(b,0,g)),y>0&&(b=cu(b,b.colspan-y,y)),p.left<i.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<i.top||p.bottom>i.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}o.push(e.child(a).copy(C.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new T(C.from(l),1,1)}replace(e,t=T.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(a.pos),o?T.empty:t)}const s=R.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new T(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=et.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=et.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new me(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=et.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof me&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=et.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new me(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new me(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new me(e.resolve(t),e.resolve(r))}getBookmark(){return new Ek(this.$anchorCell.pos,this.$headCell.pos)}},c(me,"_CellSelection"),me);We.prototype.visible=!1;R.jsonID("cell",We);var nn,Ek=(nn=class{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nn(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Qf(t,r)?new We(t,r):R.near(r,1)}},c(nn,"_CellBookmark"),nn);new U("fix-tables");function eh(n){const e=n.selection,t=Mk(n),r=t.node(-1),i=t.start(-1),s=et.get(r);return{...e instanceof We?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}c(eh,"selectedRect");function Ok(n){return function(e,t){if(!Xf(e))return!1;if(t){const r=Jl(e.schema),i=eh(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}c(Ok,"deprecated_toggleHeader");function uu(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}c(uu,"isHeaderEnabledByType");function Gl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Ok(n):function(t,r){if(!Xf(t))return!1;if(r){const i=Jl(t.schema),s=eh(t),o=t.tr,l=uu("row",s,i),a=uu("column",s,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,f=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,h=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(f).forEach(p=>{const m=p+s.tableStart,g=o.doc.nodeAt(m);g&&o.setNodeMarkup(m,h,g.attrs)}),r(o)}return!0}}c(Gl,"toggleHeader");Gl("row",{useDeprecatedLogic:!0});Gl("column",{useDeprecatedLogic:!0});Gl("cell",{useDeprecatedLogic:!0});function _r(n,e){const t=n.selection;if(!(t instanceof We))return!1;if(e){const r=n.tr,i=Jl(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new T(i,0,0))}),r.docChanged&&e(r)}return!0}c(_r,"deleteCellSelection");yl({ArrowLeft:qr("horiz",-1),ArrowRight:qr("horiz",1),ArrowUp:qr("vert",-1),ArrowDown:qr("vert",1),"Shift-ArrowLeft":Jr("horiz",-1),"Shift-ArrowRight":Jr("horiz",1),"Shift-ArrowUp":Jr("vert",-1),"Shift-ArrowDown":Jr("vert",1),Backspace:_r,"Mod-Backspace":_r,Delete:_r,"Mod-Delete":_r});function ei(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}c(ei,"maybeSetSelection");function qr(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof We)return ei(t,r,R.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=th(i,n,e);if(o==null)return!1;if(n=="horiz")return ei(t,r,R.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=Zf(l,n,e);let u;return a?u=R.near(a,1):e<0?u=R.near(t.doc.resolve(l.before(-1)),-1):u=R.near(t.doc.resolve(l.after(-1)),1),ei(t,r,u)}}}c(qr,"arrow");function Jr(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof We)o=s;else{const a=th(i,n,e);if(a==null)return!1;o=new We(t.doc.resolve(a))}const l=Zf(o.$headCell,n,e);return l?ei(t,r,new We(o.$anchorCell,l)):!1}}c(Jr,"shiftArrow");function th(n,e,t){if(!(n.state.selection instanceof L))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}c(th,"atEndOfCell");new U("tableColumnResizing");function Ak(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,l=r-t,a=i,u=t;return new DOMRect(a,u,o,l)}c(Ak,"combineDOMRects");var Rn,Nk=(Rn=class{constructor({editor:e,element:t,view:r,updateDelay:i=250,resizeDelay:s=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:a,options:u}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:f,state:h,from:p,to:m})=>{const{doc:g,selection:y}=h,{empty:b}=y,k=!g.textBetween(p,m).length&&xl(h.selection),x=this.element.contains(document.activeElement);return!(!(f.hasFocus()||x)||b||k||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:f})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}f?.relatedTarget&&((h=this.element.parentNode)!=null&&h.contains(f.relatedTarget))||f?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(f,h)=>{const p=!h?.selection.eq(f.state.selection),m=!h?.doc.eq(f.state.doc);!p&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(f,p,m,h)},this.updateDelay))},this.updateHandler=(f,h,p,m)=>{const{composing:g}=f;if(g||!h&&!p)return;if(!this.getShouldShow(m)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:f})=>{f.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var d;this.editor=e,this.element=t,this.view=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=(d=u?.scrollTarget)!=null?d:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...u},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(r,r.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Kf(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Uf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(jf(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Jf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(_f(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Wf(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(qf(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Gf(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e;const{selection:t}=this.editor.state,r=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(r)return r;const i=Ol(this.view,t.from,t.to);let s={getBoundingClientRect:c(()=>i,"getBoundingClientRect"),getClientRects:c(()=>[i],"getClientRects")};if(t instanceof I){let o=this.view.nodeDOM(t.from);const l=o.dataset.nodeViewWrapper?o:o.querySelector("[data-node-view-wrapper]");l&&(o=l),o&&(s={getBoundingClientRect:c(()=>o.getBoundingClientRect(),"getBoundingClientRect"),getClientRects:c(()=>[o.getBoundingClientRect()],"getClientRects")})}if(t instanceof We){const{$anchorCell:o,$headCell:l}=t,a=o?o.pos:l.pos,u=l?l.pos:o.pos,d=this.view.nodeDOM(a),f=this.view.nodeDOM(u);if(!d||!f)return;const h=d===f?d.getBoundingClientRect():Ak(d.getBoundingClientRect(),f.getBoundingClientRect());s={getBoundingClientRect:c(()=>h,"getBoundingClientRect"),getClientRects:c(()=>[h],"getClientRects")}}return s}updatePosition(){const e=this.virtualElement;e&&Yf(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:r,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${t}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,s,o,t)}getShouldShow(e){var t;const{state:r}=this.view,{selection:i}=r,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:r,oldState:e,from:o,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},c(Rn,"BubbleMenuView"),Rn),nh=c(n=>new V({key:typeof n.pluginKey=="string"?new U(n.pluginKey):n.pluginKey,view:c(e=>new Nk({view:e,...n}),"view")}),"BubbleMenuPlugin");q.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[nh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Ik=O.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:c(()=>({}),"default")},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=document.createElement("div");return O.onMounted(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}=n;r.style.visibility="hidden",r.style.position="absolute",r.remove(),O.nextTick(()=>{i.registerPlugin(nh({editor:i,element:r,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}))})}),O.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return O.h(O.Teleport,{to:r},O.h("div",{...t,ref:"root"},(i=e.default)==null?void 0:i.call(e)))}}}),Dn,Rk=(Dn=class{constructor({editor:e,element:t,view:r,options:i,appendTo:s,shouldShow:o}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:l,state:a})=>{const{selection:u}=a,{$anchor:d,empty:f}=u,h=d.depth===1,p=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent&&d.parent.childCount===0&&!this.getTextContent(d.parent);return!(!l.hasFocus()||!f||!h||!p||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(l,a,u,d)=>{const{composing:f}=l;if(f||!a&&!u)return;if(!this.getShouldShow(d)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=e,this.element=t,this.view=r,this.appendTo=s,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(r,r.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Wd(e,{textSerializers:Tl(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Kf(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Uf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(jf(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Jf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(_f(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Wf(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(qf(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Gf(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:r}=this.view,{selection:i}=r,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:r,oldState:e,from:o,to:l})}updatePosition(){const{selection:e}=this.editor.state,t=Ol(this.view,e.from,e.to);Yf({getBoundingClientRect:c(()=>t,"getBoundingClientRect"),getClientRects:c(()=>[t],"getClientRects")},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:i,y:s,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${i}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const r=!t?.selection.eq(e.state.selection),i=!t?.doc.eq(e.state.doc);this.updateHandler(e,r,i,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},c(Dn,"FloatingMenuView"),Dn),rh=c(n=>new V({key:typeof n.pluginKey=="string"?new U(n.pluginKey):n.pluginKey,view:c(e=>new Rk({view:e,...n}),"view")}),"FloatingMenuPlugin");q.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[rh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});O.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:c(()=>({}),"default")},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=document.createElement("div"),i=O.ref(null);return O.onMounted(()=>{const{pluginKey:s,editor:o,options:l,appendTo:a,shouldShow:u}=n;i.value&&(r.style.visibility="hidden",r.style.position="absolute",r.remove(),o.registerPlugin(rh({pluginKey:s,editor:o,element:r,options:l,appendTo:a,shouldShow:u})))}),O.onBeforeUnmount(()=>{const{pluginKey:s,editor:o}=n;o.unregisterPlugin(s)}),()=>{var s;return O.h(O.Teleport,{to:r},O.h("div",{...t,ref:i},(s=e.default)==null?void 0:s.call(e)))}}});const Yl={components:{EditorContent:Eb,BubbleMenu:Ik},data(){return{editor:null,isEditable:!0,showMenu:!0}},watch:{isEditable(n){this.editor.setEditable(n)}},mounted(){this.editor=new Tb({extensions:[Mb],content:`
139
+ <p>
140
+ Hey, try to select some text here. There will popup a menu for selecting some inline styles. Remember: you have full control about content and styling of this menu.
141
+ </p>
142
+ <ul>
143
+ <li>Select any item to display a global menu</li>
144
+ <li>Item 1</li>
145
+ <li>Item 2</li>
146
+ <li>Item 3</li>
147
+ <li>Item 4</li>
148
+ </ul>
149
+ `})},methods:{getListVirtualElement(){const n=this.editor,e=Dr(t=>t.type.name==="bulletList"||t.type.name==="orderedList")(n.state.selection);if(e){const t=Ol(n.view,e.start,e.start+e.node.nodeSize);return{getBoundingClientRect:c(()=>t,"getBoundingClientRect"),getClientRects:c(()=>[t],"getClientRects")}}return null},toggleListType(){const n=this.editor,e=n.chain().focus();n.isActive("bulletList")?e.toggleOrderedList():e.toggleBulletList(),e.run()}},beforeUnmount(){this.editor.destroy()}},du=c(()=>{O.useCssVars(n=>({v64474709:n.height||"100px",d1a284e0:n.maxHeight}))},"__injectCSSVars__"),fu=Yl.setup;Yl.setup=fu?(n,e)=>(du(),fu(n,e)):du;const Dk={class:"container"},Pk={class:"control-group"},Lk=["checked"],Bk={class:"bubble-menu"},zk={class:"bubble-menu"};function $k(n,e,t,r,i,s){const o=O.resolveComponent("bubble-menu"),l=O.resolveComponent("editor-content");return O.openBlock(),O.createElementBlock("div",Dk,[O.createElementVNode("button",{type:"button",onClick:e[0]||(e[0]=()=>{i.showMenu=!i.showMenu,i.editor&&i.editor.commands.focus()})}," Toggle menu "),O.createElementVNode("div",Pk,[O.createElementVNode("label",null,[O.createElementVNode("input",{type:"checkbox",checked:i.isEditable,onChange:e[1]||(e[1]=()=>i.isEditable=!i.isEditable)},null,40,Lk),e[6]||(e[6]=O.createTextVNode(" Editable ",-1))])]),i.editor&&i.showMenu?(O.openBlock(),O.createBlock(o,{key:0,editor:i.editor,options:{placement:"bottom",offset:8}},{default:O.withCtx(()=>[O.createElementVNode("div",Bk,[O.createElementVNode("button",{onClick:e[2]||(e[2]=a=>i.editor.chain().focus().toggleBold().run()),class:O.normalizeClass({"is-active":i.editor.isActive("bold")})}," Bold ",2),O.createElementVNode("button",{onClick:e[3]||(e[3]=a=>i.editor.chain().focus().toggleItalic().run()),class:O.normalizeClass({"is-active":i.editor.isActive("italic")})}," Italic ",2),O.createElementVNode("button",{onClick:e[4]||(e[4]=a=>i.editor.chain().focus().toggleStrike().run()),class:O.normalizeClass({"is-active":i.editor.isActive("strike")})}," Strike ",2)])]),_:1},8,["editor"])):O.createCommentVNode("",!0),i.editor&&i.showMenu?(O.openBlock(),O.createBlock(o,{key:1,editor:i.editor,"should-show":c(()=>i.editor.isActive("bulletList")||i.editor.isActive("orderedList"),"should-show"),"get-referenced-virtual-element":s.getListVirtualElement,options:{placement:"top-start",offset:8}},{default:O.withCtx(()=>[O.createElementVNode("div",zk,[O.createElementVNode("button",{type:"button",onClick:e[5]||(e[5]=(...a)=>s.toggleListType&&s.toggleListType(...a))},"Toggle list type")])]),_:1},8,["editor","should-show","get-referenced-virtual-element"])):O.createCommentVNode("",!0),O.createVNode(l,{editor:i.editor},null,8,["editor"])])}c($k,"_sfc_render");const Fk=oh._export_sfc(Yl,[["render",$k]]);exports.default=Fk;