adminizer 4.3.0-build.74 → 4.3.0-build.76

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 (99) hide show
  1. package/assets/add-CCznNk7p.js +1 -0
  2. package/assets/add-form-Cujvebyq.js +1 -0
  3. package/assets/add-group-KxM-aCt4.js +1 -0
  4. package/assets/add-group-form-BrDR-i0l.js +1 -0
  5. package/assets/add-user-form-CrfboTix.js +1 -0
  6. package/assets/add-user-uiWxY8Il.js +1 -0
  7. package/assets/{app-GsYdx39W.css → app-CpGtjhxF.css} +1 -1
  8. package/assets/app-layout-DlouPwk2.js +1 -0
  9. package/assets/{app-shell-DHzMWA1L.js → app-shell-B969C0PB.js} +1 -1
  10. package/assets/app-sidebar-DBaEEAgj.js +1 -0
  11. package/assets/app-sidebar-header-DAKTYE0g.js +1 -0
  12. package/assets/app.js +5817 -1629
  13. package/assets/breadcrumbs-DHQ3AkEO.js +1 -0
  14. package/assets/{catalog-BavcTVb4.js → catalog-Dt5pVGyH.js} +3 -3
  15. package/assets/{dashboard-xr-OyVyG.js → dashboard-SxHpjYT5.js} +2 -2
  16. package/assets/date-picker--zSt9NKp.js +1 -0
  17. package/assets/del-modal-B73-X7Bm.js +1 -0
  18. package/assets/{field-renderer-Sd68OLyc.js → field-renderer-BP9UmRzN.js} +3 -3
  19. package/assets/form-NLJGRnF1.js +1 -0
  20. package/assets/form-lSJpGHTy.js +1 -0
  21. package/assets/{geo-json-CVaNUZbb.js → geo-json-Dq8ViYH4.js} +1 -1
  22. package/assets/home-C5a2kMDP.js +2 -0
  23. package/assets/{icon-ChQBPA5l.js → icon-BbhNOU2o.js} +1 -1
  24. package/assets/init-user--zYviDj5.js +1 -0
  25. package/assets/{input-error-g1h6ps7t.js → input-error-1aQ9bwyz.js} +1 -1
  26. package/assets/list-D-3gH3Qy.js +1 -0
  27. package/assets/{list-table-Br0K3rXg.js → list-table-D6PqwSh1.js} +1 -1
  28. package/assets/login-BQhUl8bB.js +1 -0
  29. package/assets/manifest.json +109 -221
  30. package/assets/{material-icon-BIcI8APG.js → material-icon-8nTeT-mJ.js} +1 -1
  31. package/assets/{media-manager-CTstvyHm.js → media-manager-D1nqMyHv.js} +3 -3
  32. package/assets/module-DvUc6HiL.js +1 -0
  33. package/assets/nav-footer-xpg-_O5z.js +1 -0
  34. package/assets/nav-main-FLS_mh3K.js +1 -0
  35. package/assets/{nav-user-vIwYShwE.js → nav-user-CfXR0Kcu.js} +1 -1
  36. package/assets/notification-DsrY4egH.js +1 -0
  37. package/assets/register-DQ_hsYCS.js +1 -0
  38. package/assets/{tabs-CwgzWt48.js → tabs-DD2mZktY.js} +1 -1
  39. package/assets/theme-switcher-BKpJx2Op.js +1 -0
  40. package/assets/{toast-editor-C0550yms.js → toast-editor-CexR_aza.js} +4 -4
  41. package/assets/{user-info-Db5Y8KeN.js → user-info-obJxhBMF.js} +1 -1
  42. package/assets/user-menu-content-Bs0bmqDB.js +1 -0
  43. package/assets/welcome-DOcJbFZS.js +1 -0
  44. package/controllers/add.js +0 -2
  45. package/controllers/edit.js +3 -3
  46. package/controllers/login.js +21 -56
  47. package/controllers/remove.js +11 -2
  48. package/helpers/diffHelpers.d.ts +1 -1
  49. package/helpers/diffHelpers.js +52 -7
  50. package/index.d.ts +0 -1
  51. package/index.js +0 -1
  52. package/interfaces/types.d.ts +12 -2
  53. package/lib/Adminizer.d.ts +0 -8
  54. package/lib/Adminizer.js +0 -9
  55. package/lib/v4/DataAccessor.d.ts +1 -1
  56. package/lib/v4/model/AbstractModel.js +12 -0
  57. package/lib/v4/model/adapter/sequelize.js +1 -1
  58. package/lib/v4/notifications/AbstractNotificationService.js +1 -0
  59. package/lib/v4/notifications/GeneralNotificationService.js +1 -1
  60. package/lib/v4/notifications/SystemNotificationService.js +4 -3
  61. package/package.json +1 -1
  62. package/assets/VanillaJSONEditor-x8tDbio1.js +0 -3833
  63. package/assets/add-BNb5A_qF.js +0 -1
  64. package/assets/add-form-CGi_qv3J.js +0 -1
  65. package/assets/add-group-RRjHTu93.js +0 -1
  66. package/assets/add-group-form-DSd4UrnU.js +0 -1
  67. package/assets/add-user-DSuvcKp6.js +0 -1
  68. package/assets/add-user-form-BAssKDpI.js +0 -1
  69. package/assets/app-layout-ContoN1K.js +0 -1
  70. package/assets/app-sidebar-D7l5BJPV.js +0 -1
  71. package/assets/app-sidebar-header-CK8t32cm.js +0 -1
  72. package/assets/breadcrumbs-DnNOEnT4.js +0 -1
  73. package/assets/date-picker-DBHnomTY.js +0 -1
  74. package/assets/debounce-D6eaSoDg.js +0 -1
  75. package/assets/del-modal-BeF4r3gk.js +0 -1
  76. package/assets/form-C9P9m_9q.js +0 -1
  77. package/assets/form-DomTBI89.js +0 -1
  78. package/assets/form-state-702tb_BV.js +0 -1
  79. package/assets/handsontable-CZQ5Ietj.js +0 -347
  80. package/assets/home-BWHeZm-1.js +0 -2
  81. package/assets/index-C148XJoK.js +0 -1
  82. package/assets/index-Vcq4gwWv.js +0 -1
  83. package/assets/init-user-DqMDju_E.js +0 -1
  84. package/assets/list-EEgAn-nx.js +0 -1
  85. package/assets/login-CUDpGsHl.js +0 -1
  86. package/assets/module-CpZBs0fN.js +0 -1
  87. package/assets/monaco-editor-XX8Hz76f.js +0 -11
  88. package/assets/multi-select-BFWbEjH-.js +0 -1
  89. package/assets/nav-footer-bO8D-Yir.js +0 -1
  90. package/assets/nav-main-DVgvko8g.js +0 -1
  91. package/assets/notification-BTXEslqa.js +0 -1
  92. package/assets/register-Kfu8zmmu.js +0 -1
  93. package/assets/theme-switcher-fzVA8btX.js +0 -1
  94. package/assets/use-appearance-CXP5cHaQ.js +0 -1
  95. package/assets/use-window-size-DLSEoR6e.js +0 -1
  96. package/assets/user-menu-content-Bc8YNZPf.js +0 -1
  97. package/assets/welcome-MKPFhPtG.js +0 -1
  98. package/lib/v4/model/adapter/typeorm.d.ts +0 -24
  99. package/lib/v4/model/adapter/typeorm.js +0 -88
@@ -1,4 +1,4 @@
1
- import{g as KZ,e as No,c as JZ,r as Cf,j as bv}from"./app.js";import{k as YZ,b as XZ}from"./index-Vcq4gwWv.js";import{u as ZZ}from"./use-window-size-DLSEoR6e.js";import{u as QZ}from"./use-appearance-CXP5cHaQ.js";function Or(r){this.content=r}Or.prototype={constructor:Or,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Or(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Or(t)},addToStart:function(r,e){return new Or([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Or(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Or(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Or.from(r),r.size?new Or(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Or.from(r),r.size?new Or(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Or.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Or.from=function(r){if(r instanceof Or)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Or(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,p=Math.min(o.text.length,s.text.length);for(;f<p&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Oe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let p=s+1;l.nodesBetween(Math.max(0,e-p),Math.min(l.content.size,t-p),n,i+p)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Oe(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Oe(n,i)}cutByIndex(e,t){return e==t?Oe.empty:e==0&&t==this.content.length?this:new Oe(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Oe(i,a)}addToStart(e){return new Oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oe(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,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Al(0,e);if(e==this.size)return Al(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let a=this.child(n),o=i+a.nodeSize;if(o>=e)return o==e||t>0?Al(n+1,o):Al(n,i);i=o}}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 Oe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oe.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Oe(t||e,n)}static from(e){if(!e)return Oe.empty;if(e instanceof Oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oe.empty=new Oe([],0);const Tf={index:0,offset:0};function Al(r,e){return Tf.index=r,Tf.offset=e,Tf}function Zl(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Zl(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Zl(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class fd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zl(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fd.none;if(e instanceof fd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class Ql extends Error{}class Ue{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new Ue(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Ue(Yy(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 Ue.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ue(Oe.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new Ue(e,n,i)}}Ue.empty=new Ue(Oe.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t);return s&&r.replaceChild(i,o.copy(s))}function eQ(r,e,t){if(t.openStart>r.depth)throw new Ql("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Ql("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Ha(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=tQ(t,r);return Ha(a,eb(r,o,s,e,n))}else return Ha(a,eu(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new Ql("Cannot join "+e.type.name+" onto "+r.type.name)}function dd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function qa(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ws(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(qa(r.nodeAfter,n),a++));for(let s=a;s<o;s++)qa(i.child(s),n);e&&e.depth==t&&e.textOffset&&qa(e.nodeBefore,n)}function Ha(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&dd(r,e,i+1),o=n.depth>i&&dd(t,n,i+1),s=[];return ws(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),qa(Ha(a,eb(r,e,t,n,i+1)),s)):(a&&qa(Ha(a,eu(r,e,i+1)),s),ws(e,t,i,s),o&&qa(Ha(o,eu(t,n,i+1)),s)),ws(n,null,i,s),new Oe(s)}function eu(r,e,t){let n=[];if(ws(null,r,t,n),r.depth>t){let i=dd(r,e,t+1);qa(Ha(i,eu(r,e,t+1)),n)}return ws(e,null,t,n),new Oe(n)}function tQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Oe.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Es{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):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 n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new tu(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Es(t,n,a)}static resolveCached(e,t){let n=kv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else kv.set(e,n=new rQ);let i=n.elts[n.i]=Es.resolve(e,t);return n.i=(n.i+1)%nQ,i}}class rQ{constructor(){this.elts=[],this.i=0}}const nQ=12,kv=new WeakMap;class tu{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iQ=Object.create(null);let ra=class hd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,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,n,i){return this.content.textBetween(e,t,n,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,n){return this.type==e&&Zl(this.attrs,t||e.defaultAttrs||iQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new hd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hd(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,n=!1){if(e==t)return Ue.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new Ue(f,i.depth-o,a.depth-o)}replace(e,t,n){return eQ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Es.resolveCached(this,e)}resolveNoCache(e){return Es.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.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()+")"),tb(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,n=Oe.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.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=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.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 n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=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,n)}let i=Oe.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};ra.prototype.text=void 0;class ru extends ra{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(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 ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ua{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new aQ(e,t);if(n.next==null)return Ua.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=dQ(fQ(i));return hQ(a,n),a}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,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Oe.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:k}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(k)==-1){i.push(k);let T=a(k,s.concat(p));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.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(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
1
+ import{an as KZ,ao as JZ,g as YZ,e as No,c as XZ,r as Cf,ap as ZZ,aq as QZ,j as bv}from"./app.js";function Or(r){this.content=r}Or.prototype={constructor:Or,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Or(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Or(t)},addToStart:function(r,e){return new Or([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Or(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Or(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Or.from(r),r.size?new Or(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Or.from(r),r.size?new Or(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Or.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Or.from=function(r){if(r instanceof Or)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Or(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,p=Math.min(o.text.length,s.text.length);for(;f<p&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Oe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let p=s+1;l.nodesBetween(Math.max(0,e-p),Math.min(l.content.size,t-p),n,i+p)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Oe(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Oe(n,i)}cutByIndex(e,t){return e==t?Oe.empty:e==0&&t==this.content.length?this:new Oe(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Oe(i,a)}addToStart(e){return new Oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oe(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,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Al(0,e);if(e==this.size)return Al(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let a=this.child(n),o=i+a.nodeSize;if(o>=e)return o==e||t>0?Al(n+1,o):Al(n,i);i=o}}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 Oe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oe.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Oe(t||e,n)}static from(e){if(!e)return Oe.empty;if(e instanceof Oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oe.empty=new Oe([],0);const Tf={index:0,offset:0};function Al(r,e){return Tf.index=r,Tf.offset=e,Tf}function Zl(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Zl(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Zl(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class fd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zl(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fd.none;if(e instanceof fd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class Ql extends Error{}class Ue{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new Ue(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Ue(Yy(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 Ue.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ue(Oe.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new Ue(e,n,i)}}Ue.empty=new Ue(Oe.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t);return s&&r.replaceChild(i,o.copy(s))}function eQ(r,e,t){if(t.openStart>r.depth)throw new Ql("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Ql("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Ha(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=tQ(t,r);return Ha(a,eb(r,o,s,e,n))}else return Ha(a,eu(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new Ql("Cannot join "+e.type.name+" onto "+r.type.name)}function dd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function qa(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ws(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(qa(r.nodeAfter,n),a++));for(let s=a;s<o;s++)qa(i.child(s),n);e&&e.depth==t&&e.textOffset&&qa(e.nodeBefore,n)}function Ha(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&dd(r,e,i+1),o=n.depth>i&&dd(t,n,i+1),s=[];return ws(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),qa(Ha(a,eb(r,e,t,n,i+1)),s)):(a&&qa(Ha(a,eu(r,e,i+1)),s),ws(e,t,i,s),o&&qa(Ha(o,eu(t,n,i+1)),s)),ws(n,null,i,s),new Oe(s)}function eu(r,e,t){let n=[];if(ws(null,r,t,n),r.depth>t){let i=dd(r,e,t+1);qa(Ha(i,eu(r,e,t+1)),n)}return ws(e,null,t,n),new Oe(n)}function tQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Oe.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Es{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):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 n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new tu(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Es(t,n,a)}static resolveCached(e,t){let n=kv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else kv.set(e,n=new rQ);let i=n.elts[n.i]=Es.resolve(e,t);return n.i=(n.i+1)%nQ,i}}class rQ{constructor(){this.elts=[],this.i=0}}const nQ=12,kv=new WeakMap;class tu{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iQ=Object.create(null);let ra=class hd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,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,n,i){return this.content.textBetween(e,t,n,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,n){return this.type==e&&Zl(this.attrs,t||e.defaultAttrs||iQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new hd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hd(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,n=!1){if(e==t)return Ue.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new Ue(f,i.depth-o,a.depth-o)}replace(e,t,n){return eQ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Es.resolveCached(this,e)}resolveNoCache(e){return Es.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.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()+")"),tb(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,n=Oe.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.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=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.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 n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=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,n)}let i=Oe.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};ra.prototype.text=void 0;class ru extends ra{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(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 ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ua{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new aQ(e,t);if(n.next==null)return Ua.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=dQ(fQ(i));return hQ(a,n),a}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,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Oe.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:k}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(k)==-1){i.push(k);let T=a(k,s.concat(p));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.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(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
2
2
  `)}}Ua.empty=new Ua(!0);class aQ{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function rb(r){let e=[];do e.push(oQ(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oQ(r){let e=[];do e.push(sQ(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sQ(r){let e=cQ(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=lQ(r,e);else break;return e}function wv(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function lQ(r,e){let t=wv(r),n=t;return r.eat(",")&&(r.next!="}"?n=wv(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function uQ(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let a in t){let o=t[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function cQ(r){if(r.eat("(")){let e=rb(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=uQ(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function fQ(r){let e=[[]];return i(a(r,0),t()),e;function t(){return e.push([])-1}function n(o,s,l){let f={term:l,to:s};return e[o].push(f),f}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,f)=>l.concat(a(f,s)),[]);if(o.type=="seq")for(let l=0;;l++){let f=a(o.exprs[l],s);if(l==o.exprs.length-1)return f;i(f,s=t())}else if(o.type=="star"){let l=t();return n(s,l),i(a(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(a(o.expr,s),l),i(a(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let f=0;f<o.min;f++){let p=t();i(a(o.expr,l),p),l=p}if(o.max==-1)i(a(o.expr,l),l);else for(let f=o.min;f<o.max;f++){let p=t();n(l,p),i(a(o.expr,l),p),l=p}return[n(l)]}else{if(o.type=="name")return[n(s,void 0,o.value)];throw new Error("Unknown expr type")}}}}function nb(r,e){return e-r}function Cv(r,e){let t=[];return n(e),t.sort(nb);function n(i){let a=r[i];if(a.length==1&&!a[0].term)return n(a[0].to);t.push(i);for(let o=0;o<a.length;o++){let{term:s,to:l}=a[o];!s&&t.indexOf(l)==-1&&n(l)}}}function dQ(r){let e=Object.create(null);return t(Cv(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:s,to:l})=>{if(!s)return;let f;for(let p=0;p<i.length;p++)i[p][0]==s&&(f=i[p][1]);Cv(r,l).forEach(p=>{f||i.push([s,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let a=e[n.join(",")]=new Ua(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let s=i[o][1].sort(nb);a.next.push({type:i[o][0],next:e[s.join(",")]||t(s)})}return a}}function hQ(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],a=!i.validEnd,o=[];for(let s=0;s<i.next.length;s++){let{type:l,next:f}=i.next[s];o.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),n.indexOf(f)==-1&&n.push(f)}a&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ib(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function ab(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let a=r[n];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function ob(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let a=r[i];a.validate&&a.validate(e[i])}}function sb(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new vQ(r,n,e[n]);return t}let Tv=class lb{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=sb(e,n.attrs),this.defaultAttrs=ib(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ua.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:ab(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ra(this,this.computeAttrs(e),Oe.from(t),Pt.setFrom(n))}createChecked(e=null,t,n){return t=Oe.from(t),this.checkContent(t),new ra(this,this.computeAttrs(e),t,Pt.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Oe.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),a=i&&i.fillBefore(Oe.empty,!0);return a?new ra(this,e,t.append(a),Pt.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).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){ob(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 n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Pt.none:e}static compile(e,t){let n=Object.create(null);e.forEach((a,o)=>n[a]=new lb(a,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function pQ(r,e,t){let n=t.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${a}`)}}class vQ{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?pQ(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Mu{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=sb(e,i.attrs),this.excluded=null;let a=ib(this.attrs);this.instance=a?new Pt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Pt(this,ab(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((a,o)=>n[a]=new Mu(a,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ob(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ub{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=Or.from(e.nodes),t.marks=Or.from(e.marks||{}),this.nodes=Tv.compile(this.spec.nodes,this),this.marks=Mu.compile(this.spec.marks,this);let n=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 a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=n[o]||(n[o]=Ua.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?Sv(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:Sv(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Tv){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,n,i)}text(e,t){let n=this.nodes.text;return new ru(n,n.defaultAttrs,e,Pt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ra.fromJSON(this,e)}markFromJSON(e){return Pt.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Sv(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],a=r.marks[i],o=a;if(a)t.push(a);else for(let s in r.marks){let l=r.marks[s];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function mQ(r){return r.tag!=null}function gQ(r){return r.style!=null}class $a{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(mQ(i))this.tags.push(i);else if(gQ(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,t={}){let n=new Ev(this,t,!1);return n.addAll(e,Pt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ev(this,t,!0);return n.addAll(e,Pt.none,t.from,t.to),Ue.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(kQ(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||t.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(e);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(e,t,n,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let o=this.styles[a],s=o.style;if(!(s.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let a=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let s=t[o];if((s.priority==null?50:s.priority)<a)break}t.splice(o,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Mv(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Mv(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $a(e,$a.schemaRules(e)))}}const cb={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},yQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fb={ol:!0,ul:!0},Ms=1,pd=2,zl=4;function xv(r,e,t){return e!=null?(e?Ms:0)|(e==="full"?pd:0):r&&r.whitespace=="pre"?Ms|pd:t&-5}class Ol{constructor(e,t,n,i,a,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Pt.none,this.match=a||(o&zl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Oe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ms)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let t=Oe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Oe.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&&!cb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ev{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,a,o=xv(null,t.preserveWhitespace,0)|(n?zl:0);i?a=new Ol(i.type,i.attrs,Pt.none,!0,t.topMatch||i.type.contentMatch,o):n?a=new Ol(null,null,Pt.none,!0,null,o):a=new Ol(e.schema.topNodeType,null,Pt.none,!0,null,o),this.nodes=[a],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 n=e.nodeValue,i=this.top,a=i.options&pd?"full":this.localPreserveWS||(i.options&Ms)>0;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(a)a!=="full"?n=n.replace(/\r?\n|\r/g," "):n=n.replace(/\r\n?/g,`
3
3
  `);else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;fb.hasOwnProperty(o)&&this.parser.normalizeLists&&bQ(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:yQ.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let f,p=this.needsBlock;if(cb.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),f=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let k=l&&l.skip?t:this.readStyles(e,t);k&&this.addAll(e,k),f&&this.sync(a),this.needsBlock=p}else{let f=this.readStyles(e,t);f&&this.addElementByRule(e,l,f,l.consuming===!1?s:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
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 n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],o=n.getPropertyValue(a);if(o)for(let s=void 0;;){let l=this.parser.matchStyle(a,o,this,s);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(f=>!l.clearMark(f)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return t}addElementByRule(e,t,n,i){let a,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}a&&this.sync(s)&&this.open--}addAll(e,t,n,i){let a=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=i==null?null:e.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,t);this.findAtPoint(e,a)}findPlace(e,t,n){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],f=l.findWrapping(e);if(f&&(!i||i.length>f.length+s)&&(i=f,a=l,!f.length))break;if(l.solid){if(n)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(t=this.enterInner(a,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let o=Pt.none;for(let s of i.concat(e.marks))(a.type?a.type.allowsMarkType(s.type):Av(s.type,e.type))&&(o=s.addToSet(o));return a.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let a=this.findPlace(e.create(t),n,!1);return a&&(a=this.enterInner(e,t,n,!0,i)),a}enterInner(e,t,n,i=!1,a){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=xv(e,a,o.options);o.options&zl&&o.content.length==0&&(s|=zl);let l=Pt.none;return n=n.filter(f=>(o.type?o.type.allowsMarkType(f.type):Av(f.type,e))?(l=f.addToSet(l),!1):!0),this.nodes.push(new Ol(e,t,l,i,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ms)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){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)&(n?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("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let f=t[s];if(f==""){if(s==t.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let p=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function bQ(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&fb.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function kQ(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Mv(r){let e={};for(let t in r)e[t]=r[t];return e}function Av(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let a=[],o=s=>{a.push(s);for(let l=0;l<s.edgeCount;l++){let{type:f,next:p}=s.edge(l);if(f==e||a.indexOf(p)<0&&o(p))return!0}};if(o(i.contentMatch))return!0}}class Jo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Sf(t).createDocumentFragment());let i=n,a=[];return e.forEach(o=>{if(a.length||o.marks.length){let s=0,l=0;for(;s<a.length&&l<o.marks.length;){let f=o.marks[l];if(!this.marks[f.type.name]){l++;continue}if(!f.eq(a[s][0])||f.type.spec.spanning===!1)break;s++,l++}for(;s<a.length;)i=a.pop()[1];for(;l<o.marks.length;){let f=o.marks[l++],p=this.serializeMark(f,o.isInline,t);p&&(a.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=Vl(Sf(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 n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,t);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Vl(Sf(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return Vl(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Jo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ov(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Ov(e.marks)}}function Ov(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Sf(r){return r.document||window.document}const Nv=new WeakMap;function wQ(r){let e=Nv.get(r);return e===void 0&&Nv.set(r,e=CQ(r)),e}function CQ(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Vl(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=wQ(n))&&a.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 s,l=t?r.createElementNS(t,i):r.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let k in f)if(f[k]!=null){let T=k.indexOf(" ");T>0?l.setAttributeNS(k.slice(0,T),k.slice(T+1),f[k]):l.setAttribute(k,f[k])}}for(let k=p;k<e.length;k++){let T=e[k];if(T===0){if(k<e.length-1||k>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:x,contentDOM:E}=Vl(r,T,t,n);if(l.appendChild(x),E){if(s)throw new RangeError("Multiple content holes");s=E}}}return{dom:l,contentDOM:s}}const db=65535,hb=Math.pow(2,16);function TQ(r,e){return r+e*hb}function Dv(r){return r&db}function SQ(r){return(r-(r&db))/hb}const pb=1,vb=2,Ul=4,mb=8;class vd{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mb)>0}get deletedBefore(){return(this.delInfo&(pb|Ul))>0}get deletedAfter(){return(this.delInfo&(vb|Ul))>0}get deletedAcross(){return(this.delInfo&Ul)>0}}class un{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&un.empty)return un.empty}recover(e){let t=0,n=Dv(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+SQ(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?i:0);if(l>e)break;let f=this.ranges[s+a],p=this.ranges[s+o],k=l+f;if(e<=k){let T=f?e==l?-1:e==k?1:t:t,x=l+i+(T<0?0:p);if(n)return x;let E=e==(t<0?l:k)?null:TQ(s/3,e-l),P=e==l?vb:e==k?pb:Ul;return(t<0?e!=l:e!=k)&&(P|=mb),new vd(x,P,E)}i+=p-f}return n?e+i:new vd(e+i,0,null)}touches(e,t){let n=0,i=Dv(t),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?n:0);if(l>e)break;let f=this.ranges[s+a],p=l+f;if(e<=p&&s==i*3)return!0;n+=this.ranges[s+o]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let o=this.ranges[i],s=o-(this.inverted?a:0),l=o+(this.inverted?0:a),f=this.ranges[i+t],p=this.ranges[i+n];e(s,s+f,l,l+p),a+=p-f}}invert(){return new un(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?un.empty:new un(e<0?[0,-e,0]:[0,0,e])}}un.empty=new un([]);class As{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new As(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,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+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,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new As;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],s=o.mapResult(e,t);if(s.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(s.recover);continue}}i|=s.delInfo,e=s.pos}return n?e:new vd(e,i,null)}}const xf=Object.create(null);class Ur{getMap(){return un.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=xf[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in xf)throw new RangeError("Duplicate use of step JSON ID "+e);return xf[e]=t,t.prototype.jsonID=e,t}}class hr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new hr(e,null)}static fail(e){return new hr(null,e)}static fromReplace(e,t,n,i){try{return hr.ok(e.replace(t,n,i))}catch(a){if(a instanceof Ql)return hr.fail(a.message);throw a}}}function eh(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let a=r.child(i);a.content.size&&(a=a.copy(eh(a.content,e,a))),a.isInline&&(a=e(a,t,i)),n.push(a)}return Oe.fromArray(n)}class Qi extends Ur{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),a=new Ue(eh(t.content,(o,s)=>!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,a)}invert(){return new oi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Qi(t.pos,n.pos,this.mark)}merge(e){return e instanceof Qi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qi(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 Qi(t.from,t.to,e.markFromJSON(t.mark))}}Ur.jsonID("addMark",Qi);class oi extends Ur{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Ue(eh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,n)}invert(){return new Qi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new oi(t.pos,n.pos,this.mark)}merge(e){return e instanceof oi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oi(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 oi(t.from,t.to,e.markFromJSON(t.mark))}}Ur.jsonID("removeMark",oi);class ea extends Ur{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new Ue(Oe.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new ea(this.pos,t.marks[i]);return new ea(this.pos,this.mark)}}return new Wa(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ea(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 ea(t.pos,e.markFromJSON(t.mark))}}Ur.jsonID("addNodeMark",ea);class Wa extends Ur{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new Ue(Oe.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ea(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wa(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 Wa(t.pos,e.markFromJSON(t.mark))}}Ur.jsonID("removeNodeMark",Wa);class _r extends Ur{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&md(e,this.from,this.to)?hr.fail("Structure replace would overwrite content"):hr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new un([this.from,this.to-this.from,this.slice.size])}invert(e){return new _r(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new _r(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _r)||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?Ue.empty:new Ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _r(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?Ue.empty:new Ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _r(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 _r(t.from,t.to,Ue.fromJSON(e,t.slice),!!t.structure)}}Ur.jsonID("replace",_r);class Sr extends Ur{constructor(e,t,n,i,a,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=a,this.insert=o,this.structure=s}apply(e){if(this.structure&&(md(e,this.from,this.gapFrom)||md(e,this.gapTo,this.to)))return hr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return hr.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?hr.fromReplace(e,this.from,this.to,n):hr.fail("Content does not fit in gap")}getMap(){return new un([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 Sr(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||a>n.pos?null:new Sr(t.pos,n.pos,i,a,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 Sr(t.from,t.to,t.gapFrom,t.gapTo,Ue.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ur.jsonID("replaceAround",Sr);function md(r,e,t){let n=r.resolve(e),i=t-e,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function xQ(r,e,t,n){let i=[],a=[],o,s;r.doc.nodesBetween(e,t,(l,f,p)=>{if(!l.isInline)return;let k=l.marks;if(!n.isInSet(k)&&p.type.allowsMarkType(n.type)){let T=Math.max(f,e),x=Math.min(f+l.nodeSize,t),E=n.addToSet(k);for(let P=0;P<k.length;P++)k[P].isInSet(E)||(o&&o.to==T&&o.mark.eq(k[P])?o.to=x:i.push(o=new oi(T,x,k[P])));s&&s.to==T?s.to=x:a.push(s=new Qi(T,x,n))}}),i.forEach(l=>r.step(l)),a.forEach(l=>r.step(l))}function EQ(r,e,t,n){let i=[],a=0;r.doc.nodesBetween(e,t,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(n instanceof Mu){let f=o.marks,p;for(;p=n.isInSet(f);)(l||(l=[])).push(p),f=p.removeFromSet(f)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let f=Math.min(s+o.nodeSize,t);for(let p=0;p<l.length;p++){let k=l[p],T;for(let x=0;x<i.length;x++){let E=i[x];E.step==a-1&&k.eq(i[x].style)&&(T=E)}T?(T.to=f,T.step=a):i.push({style:k,from:Math.max(s,e),to:f,step:a})}}}),i.forEach(o=>r.step(new oi(o.from,o.to,o.style)))}function th(r,e,t,n=t.contentMatch,i=!0){let a=r.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l<a.childCount;l++){let f=a.child(l),p=s+f.nodeSize,k=n.matchType(f.type);if(!k)o.push(new _r(s,p,Ue.empty));else{n=k;for(let T=0;T<f.marks.length;T++)t.allowsMarkType(f.marks[T].type)||r.step(new oi(s,p,f.marks[T]));if(i&&f.isText&&t.whitespace!="pre"){let T,x=/\r?\n|\r/g,E;for(;T=x.exec(f.text);)E||(E=new Ue(Oe.from(t.schema.text(" ",t.allowedMarks(f.marks))),0,0)),o.push(new _r(s+T.index,s+T.index+T[0].length,E))}}s=p}if(!n.validEnd){let l=n.fillBefore(Oe.empty,!0);r.replace(s,s,new Ue(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function MQ(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Au(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),a=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(a,o,t))return n;if(n==0||i.type.spec.isolating||!MQ(i,a,o))break}return null}function AQ(r,e,t){let{$from:n,$to:i,depth:a}=e,o=n.before(a+1),s=i.after(a+1),l=o,f=s,p=Oe.empty,k=0;for(let E=a,P=!1;E>t;E--)P||n.index(E)>0?(P=!0,p=Oe.from(n.node(E).copy(p)),k++):l--;let T=Oe.empty,x=0;for(let E=a,P=!1;E>t;E--)P||i.after(E+1)<i.end(E)?(P=!0,T=Oe.from(i.node(E).copy(T)),x++):f++;r.step(new Sr(l,f,o,s,new Ue(p.append(T),k,x),p.size-k,!0))}function OQ(r,e,t=null,n=r){let i=NQ(r,e),a=i&&DQ(n,e);return a?i.map(Lv).concat({type:e,attrs:t}).concat(a.map(Lv)):null}function Lv(r){return{type:r,attrs:null}}function NQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.contentMatchAt(n).findWrapping(e);if(!a)return null;let o=a.length?a[0]:e;return t.canReplaceWith(n,i,o)?a:null}function DQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.child(n),o=e.contentMatch.findWrapping(a.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let f=n;l&&f<i;f++)l=l.matchType(t.child(f).type);return!l||!l.validEnd?null:o}function LQ(r,e,t){let n=Oe.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let s=t[o].type.contentMatch.matchFragment(n);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Oe.from(t[o].type.create(t[o].attrs,n))}let i=e.start,a=e.end;r.step(new Sr(i,a,i,a,new Ue(n,0,0),t.length,!0))}function RQ(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=r.steps.length;r.doc.nodesBetween(e,t,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&IQ(r.doc,r.mapping.slice(a).map(s),n)){let f=null;if(n.schema.linebreakReplacement){let x=n.whitespace=="pre",E=!!n.contentMatch.matchType(n.schema.linebreakReplacement);x&&!E?f=!1:!x&&E&&(f=!0)}f===!1&&yb(r,o,s,a),th(r,r.mapping.slice(a).map(s,1),n,void 0,f===null);let p=r.mapping.slice(a),k=p.map(s,1),T=p.map(s+o.nodeSize,1);return r.step(new Sr(k,T,k+1,T-1,new Ue(Oe.from(n.create(l,null,o.marks)),0,0),1,!0)),f===!0&&gb(r,o,s,a),!1}})}function gb(r,e,t,n){e.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=r.mapping.slice(n).map(t+1+a+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function yb(r,e,t,n){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+a);r.replaceWith(o,o+1,e.type.schema.text(`
@@ -6,7 +6,7 @@ import{g as KZ,e as No,c as JZ,r as Cf,j as bv}from"./app.js";import{k as YZ,b a
6
6
  `),k&&E==x.nodeValue.length)for(let P=x,F;P;P=P.parentNode){if(F=P.nextSibling){F.nodeName=="BR"&&(s=l={node:F.parentNode,offset:Lr(F)+1});break}let z=P.pmViewDesc;if(z&&z.node&&z.node.isBlock)break}}else{let P=x.childNodes[E-1];k=P&&(P.nodeName=="BR"||P.contentEditable=="false")}}if(Kn&&p.focusNode&&p.focusNode!=l.node&&p.focusNode.nodeType==1){let x=p.focusNode.childNodes[p.focusOffset];x&&x.contentEditable=="false"&&(i=!0)}if(!(i||k&&Kr)&&ja(s.node,s.offset,p.anchorNode,p.anchorOffset)&&ja(l.node,l.offset,p.focusNode,p.focusOffset))return;let T=!1;if((f.extend||e==t)&&!k){f.collapse(s.node,s.offset);try{e!=t&&f.extend(l.node,l.offset),T=!0}catch{}}if(!T){if(e>t){let E=s;s=l,l=E}let x=document.createRange();x.setEnd(l.node,l.offset),x.setStart(s.node,s.offset),f.removeAllRanges(),f.addRange(x)}}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 n=0,i=0;i<this.children.length;i++){let a=this.children[i],o=n+a.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let s=n+a.border,l=o-a.border;if(e>=s&&t<=l){this.dirty=e==n||t==o?Ba:Gv,e==s&&t==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=ci:a.markDirty(e-s,t-s);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ba:ci}n=o}this.dirty=Ba}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ba:Gv;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Pb extends Hs{constructor(e,t,n,i){let a,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!t.type.spec.raw){if(o.nodeType!=1){let s=document.createElement("span");s.appendChild(o),o=s}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,a=this}matchesWidget(e){return this.dirty==qn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Cee extends Hs{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ga extends Hs{constructor(e,t,n,i,a){super(e,[],n,i),this.mark=t,this.spec=a}static create(e,t,n,i){let a=i.nodeViews[t.type.name],o=a&&a(t,i,n);return(!o||!o.dom)&&(o=Jo.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Ga(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ci||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ci&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=qn){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=qn}}slice(e,t,n){let i=Ga.create(this.parent,this.mark,!0,n),a=this.children,o=this.size;t<o&&(a=Cd(a,t,o,n)),e>0&&(a=Cd(a,0,e,n));for(let s=0;s<a.length;s++)a[s].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ia extends Hs{constructor(e,t,n,i,a,o,s,l,f){super(e,[],a,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=s}static create(e,t,n,i,a,o){let s=a.nodeViews[t.type.name],l,f=s&&s(t,a,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),p=f&&f.dom,k=f&&f.contentDOM;if(t.isText){if(!p)p=document.createTextNode(t.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:k}=Jo.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!k&&!t.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),t.type.spec.draggable&&(p.draggable=!0));let T=p;return p=Hb(p,n,t),f?l=new Tee(e,t,n,i,p,k||null,T,f,a,o+1):t.isText?new Du(e,t,n,i,p,T,a):new ia(e,t,n,i,p,k||null,T,a,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 n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Oe.empty)}return e}matchesNode(e,t,n){return this.dirty==qn&&e.eq(this.node)&&nu(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,a=e.composing?this.localCompositionInfo(e,t):null,o=a&&a.pos>-1?a:null,s=a&&a.pos<0,l=new xee(this,o&&o.node,e);Aee(this.node,this.innerDeco,(f,p,k)=>{f.spec.marks?l.syncToMarks(f.spec.marks,n,e):f.type.side>=0&&!k&&l.syncToMarks(p==this.node.childCount?Pt.none:this.node.child(p).marks,n,e),l.placeWidget(f,e,i)},(f,p,k,T)=>{l.syncToMarks(f.marks,n,e);let x;l.findNodeMatch(f,p,k,T)||s&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(x=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(f,p,k,x,e)||l.updateNextNode(f,p,k,e,T,i)||l.addNode(f,p,k,e,i),i+=f.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ba)&&(o&&this.protectLocalComposition(e,o),Fb(this.contentDOM,this.children,e),Bo&&Oee(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof Mt)||n<t||i>t+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,s=Nee(this.node.content,o,n-t,i-t);return s<0?null:{node:a,pos:s,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let a=t;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new Cee(this,a,t,i);e.input.compositionNodes.push(o),this.children=Cd(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==ci||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=qn}updateOuterDeco(e){if(nu(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=qb(this.dom,this.nodeDOM,wd(this.outerDeco,this.node,t),wd(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Kv(r,e,t,n,i){Hb(n,e,r);let a=new ia(void 0,r,e,t,n,n,n,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class Du extends ia{constructor(e,t,n,i,a,o,s){super(e,t,n,i,a,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==ci||this.dirty!=qn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=qn||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=qn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),a=document.createTextNode(i.text);return new Du(this.parent,i,this.outerDeco,this.innerDeco,a,a,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ci)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Bb extends Hs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Tee extends ia{constructor(e,t,n,i,a,o,s,l,f,p){super(e,t,n,i,a,o,s,f,p),this.spec=l}update(e,t,n,i){if(this.dirty==ci)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,t,n);return a&&this.updateInner(e,t,n,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Fb(r,e,t){let n=r.firstChild,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=o.dom;if(s.parentNode==r){for(;s!=n;)n=Jv(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(s,n);if(o instanceof Ga){let l=n?n.previousSibling:r.lastChild;Fb(o.contentDOM,o.children,t),n=l?l.nextSibling:r.firstChild}}for(;n;)n=Jv(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const Cs=function(r){r&&(this.nodeName=r)};Cs.prototype=Object.create(null);const Fa=[new Cs];function wd(r,e,t){if(r.length==0)return Fa;let n=t?Fa[0]:new Cs,i=[n];for(let a=0;a<r.length;a++){let o=r[a].type.attrs;if(o){o.nodeName&&i.push(n=new Cs(o.nodeName));for(let s in o){let l=o[s];l!=null&&(t&&i.length==1&&i.push(n=new Cs(e.isInline?"span":"div")),s=="class"?n.class=(n.class?n.class+" ":"")+l:s=="style"?n.style=(n.style?n.style+";":"")+l:s!="nodeName"&&(n[s]=l))}}}return i}function qb(r,e,t,n){if(t==Fa&&n==Fa)return e;let i=e;for(let a=0;a<n.length;a++){let o=n[a],s=t[a];if(a){let l;s&&s.nodeName==o.nodeName&&i!=r&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),s=Fa[0]),i=l}See(i,s||Fa[0],o)}return i}function See(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)i.indexOf(n[a])==-1&&r.classList.remove(n[a]);for(let a=0;a<i.length;a++)n.indexOf(i[a])==-1&&r.classList.add(i[a]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function Hb(r,e,t){return qb(r,r,Fa,wd(e,t,r.nodeType!=1))}function nu(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function Jv(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class xee{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Eee(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=qn,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let s=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let f=this.top.children[l];if(f.matchesMark(e[a])&&!this.isLocked(f.dom)){s=l;break}}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{let l=Ga.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))a=this.top.children.indexOf(o,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let f=this.top.children[s];if(f.matchesNode(e,t,n)&&!this.preMatch.matched.has(f)){a=s;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,t,n,i,a){let o=this.top.children[i];return o.dirty==ci&&o.dom==o.contentDOM&&(o.dirty=Ba),o.update(e,t,n,a)?(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 n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,a,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof ia){let f=this.preMatch.matched.get(l);if(f!=null&&f!=a)return!1;let p=l.dom,k,T=this.isLocked(p)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ci&&nu(t,l.outerDeco));if(!T&&l.update(e,t,n,i))return this.destroyBetween(this.index,s),l.dom!=p&&(this.changed=!0),this.index++,!0;if(!T&&(k=this.recreateWrapper(l,e,t,n,i,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=k,k.contentDOM&&(k.dirty=Ba,k.updateChildren(i,o+1),k.dirty=qn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,a,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!nu(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let s=ia.create(this.top,t,n,i,a,o);if(s.contentDOM){s.children=e.children,e.children=[];for(let l of s.children)l.parent=s}return e.destroy(),s}addNode(e,t,n,i,a){let o=ia.create(this.top,e,t,n,i,a);o.contentDOM&&o.updateChildren(i,a+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){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 a=new Pb(this.top,e,t,n);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ga;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Du)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Kr||zr)&&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 n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new Bb(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Eee(r,e){let t=e,n=t.children.length,i=r.childCount,a=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let f=t.children[n-1];if(f instanceof Ga)t=f,n=f.children.length;else{s=f,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let l=s.node;if(l){if(l!=r.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function Mee(r,e){return r.type.side-e.type.side}function Aee(r,e,t,n){let i=e.locals(r),a=0;if(i.length==0){for(let f=0;f<r.childCount;f++){let p=r.child(f);n(p,i,e.forChild(a,p),f),a+=p.nodeSize}return}let o=0,s=[],l=null;for(let f=0;;){let p,k;for(;o<i.length&&i[o].to==a;){let F=i[o++];F.widget&&(p?(k||(k=[p])).push(F):p=F)}if(p)if(k){k.sort(Mee);for(let F=0;F<k.length;F++)t(k[F],f,!!l)}else t(p,f,!!l);let T,x;if(l)x=-1,T=l,l=null;else if(f<r.childCount)x=f,T=r.child(f++);else break;for(let F=0;F<s.length;F++)s[F].to<=a&&s.splice(F--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let E=a+T.nodeSize;if(T.isText){let F=E;o<i.length&&i[o].from<F&&(F=i[o].from);for(let z=0;z<s.length;z++)s[z].to<F&&(F=s[z].to);F<E&&(l=T.cut(F-a),T=T.cut(0,F-a),E=F,x=-1)}else for(;o<i.length&&i[o].to<E;)o++;let P=T.isInline&&!T.isLeaf?s.filter(F=>!F.inline):s.slice();n(T,P,e.forChild(a,T),x),a=E}}function Oee(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function Nee(r,e,t,n){for(let i=0,a=0;i<r.childCount&&a<=n;){let o=r.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<r.childCount;){let f=r.child(i++);if(a+=f.nodeSize,!f.isText)break;l+=f.text}if(a>=t){if(a>=n&&l.slice(n-e.length-s,n-s)==e)return n-e.length;let f=s<n?l.lastIndexOf(e,n-s-1):-1;if(f>=0&&f+e.length+s>=t)return s+f;if(t==n&&l.length>=n+e.length-s&&l.slice(n-s,n-s+e.length)==e)return n}}return-1}function Cd(r,e,t,n,i){let a=[];for(let o=0,s=0;o<r.length;o++){let l=r[o],f=s,p=s+=l.size;f>=t||p<=e?a.push(l):(f<e&&a.push(l.slice(0,e-f,n)),i&&(a.push(i),i=void 0),p>t&&a.push(l.slice(t-f,l.size,n)))}return a}function ah(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),a=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let s=n.resolve(o),l,f;if(Nu(t)){for(l=o;i&&!i.node;)i=i.parent;let k=i.node;if(i&&k.isAtom&&ft.isSelectable(k)&&i.parent&&!(k.isInline&&ree(t.focusNode,t.focusOffset,i.dom))){let T=i.posBefore;f=new ft(o==T?s:n.resolve(T))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let k=o,T=o;for(let x=0;x<t.rangeCount;x++){let E=t.getRangeAt(x);k=Math.min(k,r.docView.posFromDOM(E.startContainer,E.startOffset,1)),T=Math.max(T,r.docView.posFromDOM(E.endContainer,E.endOffset,-1))}if(k<0)return null;[l,o]=T==r.state.selection.anchor?[T,k]:[k,T],s=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let p=n.resolve(l);if(!f){let k=e=="pointer"||r.state.selection.head<s.pos&&!a?1:-1;f=oh(r,p,s,k)}return f}function _b(r){return r.editable?r.hasFocus():Vb(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function Li(r,e=!1){let t=r.state.selection;if(zb(r,t),!!_b(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&zr){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&ja(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)Lee(r);else{let{anchor:n,head:i}=t,a,o;Yv&&!(t instanceof Mt)&&(t.$from.parent.inlineContent||(a=Xv(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Xv(r,t.to))),r.docView.setSelection(n,i,r,e),Yv&&(a&&Zv(a),o&&Zv(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Dee(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const Yv=Kr||zr&&Ab<63;function Xv(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,a=n?t.childNodes[n-1]:null;if(Kr&&i&&i.contentEditable=="false")return Lf(i);if((!i||i.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(i)return Lf(i);if(a)return Lf(a)}}function Lf(r){return r.contentEditable="true",Kr&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function Zv(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function Dee(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!_b(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function Lee(r){let e=r.domSelection(),t=document.createRange();if(!e)return;let n=r.cursorWrapper.dom,i=n.nodeName=="IMG";i?t.setStart(n.parentNode,Lr(n)+1):t.setStart(n,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!r.state.selection.visible&&fn&&na<=11&&(n.disabled=!0,n.disabled=!1)}function zb(r,e){if(e instanceof ft){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(Qv(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else Qv(r)}function Qv(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function oh(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||Mt.between(e,t,n)}function em(r){return r.editable&&!r.hasFocus()?!1:Vb(r)}function Vb(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ree(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return ja(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Td(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),a=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return a&&Tt.findFrom(a,e)}function Ji(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function tm(r,e,t){let n=r.state.selection;if(n instanceof Mt)if(t.indexOf("s")>-1){let{$head:i}=n,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Ji(r,new Mt(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Td(r.state,e);return i&&i instanceof ft?Ji(r,i):!1}else if(!(Bn&&t.indexOf("m")>-1)){let i=n.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let s=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=r.docView.descAt(s))&&!o.contentDOM?ft.isSelectable(a)?Ji(r,new ft(e<0?r.state.doc.resolve(i.pos-a.nodeSize):i)):qs?Ji(r,new Mt(r.state.doc.resolve(e<0?s:s+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof ft&&n.node.isInline)return Ji(r,new Mt(e>0?n.$to:n.$from));{let i=Td(r.state,e);return i?Ji(r,i):!1}}}function iu(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ts(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function ko(r,e){return e<0?Iee(r):Pee(r)}function Iee(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,a,o=!1;for(Kn&&t.nodeType==1&&n<iu(t)&&Ts(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let s=t.childNodes[n-1];if(Ts(s,-1))i=t,a=--n;else if(s.nodeType==3)t=s,n=t.nodeValue.length;else break}}else{if(Ub(t))break;{let s=t.previousSibling;for(;s&&Ts(s,-1);)i=t.parentNode,a=Lr(s),s=s.previousSibling;if(s)t=s,n=iu(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Sd(r,t,n):i&&Sd(r,i,a)}function Pee(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=iu(t),a,o;for(;;)if(n<i){if(t.nodeType!=1)break;let s=t.childNodes[n];if(Ts(s,1))a=t,o=++n;else break}else{if(Ub(t))break;{let s=t.nextSibling;for(;s&&Ts(s,1);)a=s.parentNode,o=Lr(s)+1,s=s.nextSibling;if(s)t=s,n=0,i=iu(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}a&&Sd(r,a,o)}function Ub(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function Bee(r,e){for(;r&&e==r.childNodes.length&&!Fs(r);)e=Lr(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function Fee(r,e){for(;r&&!e&&!Fs(r);)e=Lr(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Sd(r,e,t){if(e.nodeType!=3){let a,o;(o=Bee(e,t))?(e=o,t=0):(a=Fee(e,t))&&(e=a,t=a.nodeValue.length)}let n=r.domSelection();if(!n)return;if(Nu(n)){let a=document.createRange();a.setEnd(e,t),a.setStart(e,t),n.removeAllRanges(),n.addRange(a)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&Li(r)},50)}function rm(r,e){let t=r.state.doc.resolve(e);if(!(zr||aee)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let a=r.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(a.left-i.left)>1)return a.left<i.left?"ltr":"rtl"}if(e<t.end()){let a=r.coordsAtPos(e+1),o=(a.top+a.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(a.left-i.left)>1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function nm(r,e,t){let n=r.state.selection;if(n instanceof Mt&&!n.empty||t.indexOf("s")>-1||Bn&&t.indexOf("m")>-1)return!1;let{$from:i,$to:a}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Td(r.state,e);if(o&&o instanceof ft)return Ji(r,o)}if(!i.parent.inlineContent){let o=e<0?i:a,s=n instanceof Gr?Tt.near(o,e):Tt.findFrom(o,e);return s?Ji(r,s):!1}return!1}function im(r,e){if(!(r.state.selection instanceof Mt))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(a&&!a.isText){let o=r.state.tr;return e<0?o.delete(t.pos-a.nodeSize,t.pos):o.delete(t.pos,t.pos+a.nodeSize),r.dispatch(o),!0}return!1}function am(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function qee(r){if(!Kr||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;am(r,n,"true"),setTimeout(()=>am(r,n,"false"),20)}return!1}function Hee(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function _ee(r,e){let t=e.keyCode,n=Hee(e);if(t==8||Bn&&t==72&&n=="c")return im(r,-1)||ko(r,-1);if(t==46&&!e.shiftKey||Bn&&t==68&&n=="c")return im(r,1)||ko(r,1);if(t==13||t==27)return!0;if(t==37||Bn&&t==66&&n=="c"){let i=t==37?rm(r,r.state.selection.from)=="ltr"?-1:1:-1;return tm(r,i,n)||ko(r,i)}else if(t==39||Bn&&t==70&&n=="c"){let i=t==39?rm(r,r.state.selection.from)=="ltr"?1:-1:1;return tm(r,i,n)||ko(r,i)}else{if(t==38||Bn&&t==80&&n=="c")return nm(r,-1,n)||ko(r,-1);if(t==40||Bn&&t==78&&n=="c")return qee(r)||nm(r,1,n)||ko(r,1);if(n==(Bn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function sh(r,e){r.someProp("transformCopied",x=>{e=x(e,r)});let t=[],{content:n,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,a--;let x=n.firstChild;t.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),n=x.content}let o=r.someProp("clipboardSerializer")||Jo.fromSchema(r.state.schema),s=Jb(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let f=l.firstChild,p,k=0;for(;f&&f.nodeType==1&&(p=Kb[f.nodeName.toLowerCase()]);){for(let x=p.length-1;x>=0;x--){let E=s.createElement(p[x]);for(;l.firstChild;)E.appendChild(l.firstChild);l.appendChild(E),k++}f=l.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${a}${k?` -${k}`:""} ${JSON.stringify(t)}`);let T=r.someProp("clipboardTextSerializer",x=>x(e,r))||e.content.textBetween(0,e.content.size,`
7
7
 
8
8
  `);return{dom:l,text:T,slice:e}}function $b(r,e,t,n,i){let a=i.parent.type.spec.code,o,s;if(!t&&!e)return null;let l=e&&(n||a||!t);if(l){if(r.someProp("transformPastedText",T=>{e=T(e,a||n,r)}),a)return e?new Ue(Oe.from(r.state.schema.text(e.replace(/\r\n?/g,`
9
- `))),0,0):Ue.empty;let k=r.someProp("clipboardTextParser",T=>T(e,i,n,r));if(k)s=k;else{let T=i.marks(),{schema:x}=r.state,E=Jo.fromSchema(x);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(P=>{let F=o.appendChild(document.createElement("p"));P&&F.appendChild(E.serializeNode(x.text(P,T)))})}}else r.someProp("transformPastedHTML",k=>{t=k(t,r)}),o=$ee(t),qs&&Wee(o);let f=o&&o.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let k=+p[3];k>0;k--){let T=o.firstChild;for(;T&&T.nodeType!=1;)T=T.nextSibling;if(!T)break;o=T}if(s||(s=(r.someProp("clipboardParser")||r.someProp("domParser")||$a.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||p),context:i,ruleFromNode(T){return T.nodeName=="BR"&&!T.nextSibling&&T.parentNode&&!zee.test(T.parentNode.nodeName)?{ignore:!0}:null}})),p)s=jee(om(s,+p[1],+p[2]),p[4]);else if(s=Ue.maxOpen(Vee(s.content,i),!0),s.openStart||s.openEnd){let k=0,T=0;for(let x=s.content.firstChild;k<s.openStart&&!x.type.spec.isolating;k++,x=x.firstChild);for(let x=s.content.lastChild;T<s.openEnd&&!x.type.spec.isolating;T++,x=x.lastChild);s=om(s,k,T)}return r.someProp("transformPasted",k=>{s=k(s,r)}),s}const zee=/^(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 Vee(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),a,o=[];if(r.forEach(s=>{if(!o)return;let l=i.findWrapping(s.type),f;if(!l)return o=null;if(f=o.length&&a.length&&jb(l,a,s,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=Gb(o[o.length-1],a.length));let p=Wb(s,l);o.push(p),i=i.matchType(p.type),a=l}}),o)return Oe.from(o)}return r}function Wb(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,Oe.from(r));return r}function jb(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let a=jb(r,e,t,n.lastChild,i+1);if(a)return n.copy(n.content.replaceChild(n.childCount-1,a));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(Oe.from(Wb(t,r,i+1))))}}function Gb(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Gb(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(Oe.empty,!0);return r.copy(t.append(n))}function xd(r,e,t,n,i,a){let o=e<0?r.firstChild:r.lastChild,s=o.content;return r.childCount>1&&(a=0),i<n-1&&(s=xd(s,e,t,n,i+1,a)),i>=t&&(s=e<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Oe.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(s))}function om(r,e,t){return e<r.openStart&&(r=new Ue(xd(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new Ue(xd(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Kb={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 sm=null;function Jb(){return sm||(sm=document.implementation.createHTMLDocument("title"))}let Rf=null;function Uee(r){let e=window.trustedTypes;return e?(Rf||(Rf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Rf.createHTML(r)):r}function $ee(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Jb().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Kb[n[1].toLowerCase()])&&(r=i.map(a=>"<"+a+">").join("")+r+i.map(a=>"</"+a+">").reverse().join("")),t.innerHTML=Uee(r),i)for(let a=0;a<i.length;a++)t=t.querySelector(i[a])||t;return t}function Wee(r){let e=r.querySelectorAll(zr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function jee(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:a,openEnd:o}=r;for(let s=n.length-2;s>=0;s-=2){let l=t.nodes[n[s]];if(!l||l.hasRequiredAttrs())break;i=Oe.from(l.create(n[s+1],i)),a++,o++}return new Ue(i,a,o)}const Jr={},Yr={},Gee={touchstart:!0,touchmove:!0};class Kee{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Jee(r){for(let e in Jr){let t=Jr[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Xee(r,n)&&!lh(r,n)&&(r.editable||!(n.type in Yr))&&t(r,n)},Gee[e]?{passive:!0}:void 0)}Kr&&r.dom.addEventListener("input",()=>null),Ed(r)}function ta(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Yee(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Ed(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>lh(r,n))})}function lh(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Xee(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Zee(r,e){!lh(r,e)&&Jr[e.type]&&(r.editable||!(e.type in Yr))&&Jr[e.type](r,e)}Yr.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Xb(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(Ni&&zr&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),Bo&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,Ia(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||_ee(r,t)?t.preventDefault():ta(r,"key")};Yr.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Yr.keypress=(r,e)=>{let t=e;if(Xb(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Bn&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof Mt)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",a=>a(r,n.$from.pos,n.$to.pos,i))&&r.dispatch(r.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Lu(r){return{left:r.clientX,top:r.clientY}}function Qee(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function uh(r,e,t,n,i){if(n==-1)return!1;let a=r.state.doc.resolve(n);for(let o=a.depth+1;o>0;o--)if(r.someProp(e,s=>o>a.depth?s(r,t,a.nodeAfter,a.before(o),i,!0):s(r,t,a.node(o),a.before(o),i,!1)))return!0;return!1}function Ro(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function ete(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ft.isSelectable(n)?(Ro(r,new ft(t)),!0):!1}function tte(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ft&&(n=t.node);let a=r.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let s=o>a.depth?a.nodeAfter:a.node(o);if(ft.isSelectable(s)){n&&t.$from.depth>0&&o>=t.$from.depth&&a.before(t.$from.depth+1)==t.$from.pos?i=a.before(t.$from.depth):i=a.before(o);break}}return i!=null?(Ro(r,ft.create(r.state.doc,i)),!0):!1}function rte(r,e,t,n,i){return uh(r,"handleClickOn",e,t,n)||r.someProp("handleClick",a=>a(r,e,n))||(i?tte(r,t):ete(r,t))}function nte(r,e,t,n){return uh(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function ite(r,e,t,n){return uh(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||ate(r,t,n)}function ate(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Ro(r,Mt.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)Ro(r,Mt.create(n,s+1,s+1+o.content.size));else if(ft.isSelectable(o))Ro(r,ft.create(n,s));else continue;return!0}}function ch(r){return au(r)}const Yb=Bn?"metaKey":"ctrlKey";Jr.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=ch(r),i=Date.now(),a="singleClick";i-r.input.lastClick.time<500&&Qee(t,r.input.lastClick)&&!t[Yb]&&(r.input.lastClick.type=="singleClick"?a="doubleClick":r.input.lastClick.type=="doubleClick"&&(a="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:a};let o=r.posAtCoords(Lu(t));o&&(a=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new ote(r,o,t,!!n)):(a=="doubleClick"?nte:ite)(r,o.pos,o.inside,t)?t.preventDefault():ta(r,"pointer"))};class ote{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Yb],this.allowDefault=n.shiftKey;let a,o;if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),o=t.inside;else{let p=e.state.doc.resolve(t.pos);a=p.parent,o=p.depth?p.before():0}const s=i?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:f}=e.state;(n.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||f instanceof ft&&f.from<=o&&f.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kn&&!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)),ta(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(()=>Li(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(Lu(e))),this.updateAllowDefault(e),this.allowDefault||!t?ta(this.view,"pointer"):rte(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Kr&&this.mightDrag&&!this.mightDrag.node.isAtom||zr&&!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)?(Ro(this.view,Tt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ta(this.view,"pointer")}move(e){this.updateAllowDefault(e),ta(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)}}Jr.touchstart=r=>{r.input.lastTouch=Date.now(),ch(r),ta(r,"pointer")};Jr.touchmove=r=>{r.input.lastTouch=Date.now(),ta(r,"pointer")};Jr.contextmenu=r=>ch(r);function Xb(r,e){return r.composing?!0:Kr&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const ste=Ni?5e3:-1;Yr.compositionstart=Yr.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof Mt&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),au(r,!0),r.markCursor=null;else if(au(r,!e.selection.empty),Kn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,a=n.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let s=r.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}r.input.composing=!0}Zb(r,ste)};Yr.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Zb(r,20))};function Zb(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>au(r),e))}function Qb(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=ute());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function lte(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=eee(e.focusNode,e.focusOffset),n=tee(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,a=r.domObserver.lastChangedTextNode;if(t==a||n==a)return a;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function ute(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function au(r,e=!1){if(!(Ni&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Qb(r),e||r.docView&&r.docView.dirty){let t=ah(r);return t&&!t.eq(r.state.selection)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!r.state.selection.empty?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function cte(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ns=fn&&na<15||Bo&&oee<604;Jr.copy=Yr.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let a=Ns?null:t.clipboardData,o=n.content(),{dom:s,text:l}=sh(r,o);a?(t.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",l)):cte(r,s),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function fte(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function dte(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Ds(r,n.value,null,i,e):Ds(r,n.textContent,n.innerHTML,i,e)},50)}function Ds(r,e,t,n,i){let a=$b(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,a||Ue.empty)))return!0;if(!a)return!1;let o=fte(a),s=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(a);return r.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ek(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Yr.paste=(r,e)=>{let t=e;if(r.composing&&!Ni)return;let n=Ns?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Ds(r,ek(n),n.getData("text/html"),i,t)?t.preventDefault():dte(r,t)};class tk{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const hte=Bn?"altKey":"ctrlKey";function rk(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[hte]}Jr.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,a=i.empty?null:r.posAtCoords(Lu(t)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof ft?i.to-1:i.to))){if(n&&n.mightDrag)o=ft.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let k=r.docView.nearestDesc(t.target,!0);k&&k.node.type.spec.draggable&&k!=r.docView&&(o=ft.create(r.state.doc,k.posBefore))}}let s=(o||r.state.selection).content(),{dom:l,text:f,slice:p}=sh(r,s);(!t.dataTransfer.files.length||!zr||Ab>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ns?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ns||t.dataTransfer.setData("text/plain",f),r.dragging=new tk(p,rk(r,t),o)};Jr.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Yr.dragover=Yr.dragenter=(r,e)=>e.preventDefault();Yr.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(Lu(t));if(!i)return;let a=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",E=>{o=E(o,r)}):o=$b(r,ek(t.dataTransfer),Ns?null:t.dataTransfer.getData("text/html"),!1,a);let s=!!(n&&rk(r,t));if(r.someProp("handleDrop",E=>E(r,t,o||Ue.empty,s))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?zQ(r.state.doc,a.pos,o):a.pos;l==null&&(l=a.pos);let f=r.state.tr;if(s){let{node:E}=n;E?E.replace(f):f.deleteSelection()}let p=f.mapping.map(l),k=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,T=f.doc;if(k?f.replaceRangeWith(p,p,o.content.firstChild):f.replaceRange(p,p,o),f.doc.eq(T))return;let x=f.doc.resolve(p);if(k&&ft.isSelectable(o.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(o.content.firstChild))f.setSelection(new ft(x));else{let E=f.mapping.map(l);f.mapping.maps[f.mapping.maps.length-1].forEach((P,F,z,Y)=>E=Y),f.setSelection(oh(r,x,f.doc.resolve(E)))}r.focus(),r.dispatch(f.setMeta("uiEvent","drop"))};Jr.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&Li(r)},20))};Jr.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};Jr.beforeinput=(r,e)=>{if(zr&&Ni&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",a=>a(r,Ia(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in Yr)Jr[r]=Yr[r];function Ls(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class ou{constructor(e,t){this.toDOM=e,this.spec=t||_a,this.side=this.spec.side||0}map(e,t,n,i){let{pos:a,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new cn(a-n,a-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ou&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ls(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class aa{constructor(e,t){this.attrs=e,this.spec=t||_a}map(e,t,n,i){let a=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return a>=o?null:new cn(a,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof aa&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}static is(e){return e.type instanceof aa}destroy(){}}class fh{constructor(e,t){this.attrs=e,this.spec=t||_a}map(e,t,n,i){let a=e.mapResult(t.from+i,1);if(a.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=a.pos?null:new cn(a.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),a;return i==t.from&&!(a=e.child(n)).isText&&i+a.nodeSize==t.to}eq(e){return this==e||e instanceof fh&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}destroy(){}}class cn{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new cn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new cn(e,e,new ou(t,n))}static inline(e,t,n,i){return new cn(e,t,new aa(n,i))}static node(e,t,n,i){return new cn(e,t,new fh(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof aa}get widget(){return this.type instanceof ou}}const Eo=[],_a={};class sr{constructor(e,t){this.local=e.length?e:Eo,this.children=t.length?t:Eo}static create(e,t){return t.length?su(t,e,0,_a):Hr}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,a){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!a||a(s.spec))&&n.push(s.copy(s.from+i,s.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,i+s,a)}}map(e,t,n){return this==Hr||e.maps.length==0?this:this.mapInner(e,t,0,0,n||_a)}mapInner(e,t,n,i,a){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?pte(this.children,o||[],e,t,n,i,a):o?new sr(o.sort(za),Eo):Hr}add(e,t){return t.length?this==Hr?sr.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,a=0;e.forEach((s,l)=>{let f=l+n,p;if(p=ik(t,s,f)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(s,p,f+1):i.splice(a,0,l,l+s.nodeSize,su(p,s,f+1,_a)),a+=3}});let o=nk(a?ak(t):t,-n);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||o.splice(s--,1);return new sr(o.length?this.local.concat(o).sort(za):this.local,i||this.children)}remove(e){return e.length==0||this==Hr?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let a=0;a<n.length;a+=3){let o,s=n[a]+t,l=n[a+1]+t;for(let p=0,k;p<e.length;p++)(k=e[p])&&k.from>s&&k.to<l&&(e[p]=null,(o||(o=[])).push(k));if(!o)continue;n==this.children&&(n=this.children.slice());let f=n[a+2].removeInner(o,s+1);f!=Hr?n[a+2]=f:(n.splice(a,3),a-=3)}if(i.length){for(let a=0,o;a<e.length;a++)if(o=e[a])for(let s=0;s<i.length;s++)i[s].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(s--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new sr(i,n):Hr}forChild(e,t){if(this==Hr)return this;if(t.isLeaf)return sr.empty;let n,i;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let a=e+1,o=a+t.content.size;for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from<o&&l.to>a&&l.type instanceof aa){let f=Math.max(a,l.from)-a,p=Math.min(o,l.to)-a;f<p&&(i||(i=[])).push(l.copy(f,p))}}if(i){let s=new sr(i.sort(za),Eo);return n?new Xi([s,n]):s}return n||Hr}eq(e){if(this==e)return!0;if(!(e instanceof sr)||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 dh(this.localsInner(e))}localsInner(e){if(this==Hr)return Eo;if(e.inlineContent||!this.local.some(aa.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof aa||t.push(this.local[n]);return t}forEachSet(e){e(this)}}sr.empty=new sr([],[]);sr.removeOverlap=dh;const Hr=sr.empty;class Xi{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,_a));return Xi.from(n)}forChild(e,t){if(t.isLeaf)return sr.empty;let n=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,t);a!=Hr&&(a instanceof Xi?n=n.concat(a.members):n.push(a))}return Xi.from(n)}eq(e){if(!(e instanceof Xi)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!t)t=a;else{n&&(t=t.slice(),n=!1);for(let o=0;o<a.length;o++)t.push(a[o])}}return t?dh(n?t:t.sort(za)):Eo}static from(e){switch(e.length){case 0:return Hr;case 1:return e[0];default:return new Xi(e.every(t=>t instanceof sr)?e:e.reduce((t,n)=>t.concat(n instanceof sr?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function pte(r,e,t,n,i,a,o){let s=r.slice();for(let f=0,p=a;f<t.maps.length;f++){let k=0;t.maps[f].forEach((T,x,E,P)=>{let F=P-E-(x-T);for(let z=0;z<s.length;z+=3){let Y=s[z+1];if(Y<0||T>Y+p-k)continue;let Z=s[z]+p-k;x>=Z?s[z+1]=T<=Z?-2:-1:T>=p&&F&&(s[z]+=F,s[z+1]+=F)}k+=F}),p=t.maps[f].map(p,-1)}let l=!1;for(let f=0;f<s.length;f+=3)if(s[f+1]<0){if(s[f+1]==-2){l=!0,s[f+1]=-1;continue}let p=t.map(r[f]+a),k=p-i;if(k<0||k>=n.content.size){l=!0;continue}let T=t.map(r[f+1]+a,-1),x=T-i,{index:E,offset:P}=n.content.findIndex(k),F=n.maybeChild(E);if(F&&P==k&&P+F.nodeSize==x){let z=s[f+2].mapInner(t,F,p+1,r[f]+a+1,o);z!=Hr?(s[f]=k,s[f+1]=x,s[f+2]=z):(s[f+1]=-2,l=!0)}else l=!0}if(l){let f=vte(s,r,e,t,i,a,o),p=su(f,n,0,o);e=p.local;for(let k=0;k<s.length;k+=3)s[k+1]<0&&(s.splice(k,3),k-=3);for(let k=0,T=0;k<p.children.length;k+=3){let x=p.children[k];for(;T<s.length&&s[T]<x;)T+=3;s.splice(T,0,p.children[k],p.children[k+1],p.children[k+2])}}return new sr(e.sort(za),s)}function nk(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new cn(i.from+e,i.to+e,i.type))}return t}function vte(r,e,t,n,i,a,o){function s(l,f){for(let p=0;p<l.local.length;p++){let k=l.local[p].map(n,i,f);k?t.push(k):o.onRemove&&o.onRemove(l.local[p].spec)}for(let p=0;p<l.children.length;p+=3)s(l.children[p+2],l.children[p]+f+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&s(r[l+2],e[l]+a+1);return t}function ik(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let a=0,o;a<r.length;a++)(o=r[a])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[a]=null);return i}function ak(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function su(r,e,t,n){let i=[],a=!1;e.forEach((s,l)=>{let f=ik(r,s,l+t);if(f){a=!0;let p=su(f,s,t+l+1,n);p!=Hr&&i.push(l,l+s.nodeSize,p)}});let o=nk(a?ak(r):r,-t).sort(za);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||(n.onRemove&&n.onRemove(o[s].spec),o.splice(s--,1));return o.length||i.length?new sr(o,i):Hr}function za(r,e){return r.from-e.from||r.to-e.to}function dh(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let a=e[i];if(a.from==n.from){a.to!=n.to&&(e==r&&(e=r.slice()),e[i]=a.copy(a.from,n.to),lm(e,i+1,a.copy(n.to,a.to)));continue}else{a.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,a.from),lm(e,i,n.copy(a.from,n.to)));break}}}return e}function lm(r,e,t){for(;e<r.length&&za(t,r[e])>0;)e++;r.splice(e,0,t)}function If(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=Hr&&e.push(n)}),r.cursorWrapper&&e.push(sr.create(r.state.doc,[r.cursorWrapper.deco])),Xi.from(e)}const mte={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gte=fn&&na<=11;class yte{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class bte{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new yte,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);fn&&na<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),gte&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,mte)),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(em(this.view)){if(this.suppressingSelectionUpdates)return Li(this.view);if(fn&&na<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ja(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let a=e.focusNode;a;a=Po(a))t.add(a);for(let a=e.anchorNode;a;a=Po(a))if(t.has(a)){n=a;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&em(e)&&!this.ignoreSelectionChange(n),a=-1,o=-1,s=!1,l=[];if(e.editable)for(let p=0;p<t.length;p++){let k=this.registerMutation(t[p],l);k&&(a=a<0?k.from:Math.min(k.from,a),o=o<0?k.to:Math.max(k.to,o),k.typeOver&&(s=!0))}if(Kn&&l.length){let p=l.filter(k=>k.nodeName=="BR");if(p.length==2){let[k,T]=p;k.parentNode&&k.parentNode.parentNode==T.parentNode?T.remove():k.remove()}else{let{focusNode:k}=this.currentSelection;for(let T of p){let x=T.parentNode;x&&x.nodeName=="LI"&&(!k||Cte(e,k)!=x)&&T.remove()}}}let f=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Nu(n)&&(f=ah(e))&&f.eq(Tt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Li(e),this.currentSelection.set(n),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,o),kte(e)),this.handleDOMChange(a,o,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Li(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let k=e.addedNodes[p];t.push(k),k.nodeType==3&&(this.lastChangedTextNode=k)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,a=e.nextSibling;if(fn&&na<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:k,nextSibling:T}=e.addedNodes[p];(!k||Array.prototype.indexOf.call(e.addedNodes,k)<0)&&(i=k),(!T||Array.prototype.indexOf.call(e.addedNodes,T)<0)&&(a=T)}let o=i&&i.parentNode==e.target?Lr(i)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=a&&a.parentNode==e.target?Lr(a):e.target.childNodes.length,f=n.localPosFromDOM(e.target,l,1);return{from:s,to:f}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let um=new WeakMap,cm=!1;function kte(r){if(!um.has(r)&&(um.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Kn,cm)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."),cm=!0}}function fm(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,a=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return ja(o.node,o.offset,i,a)&&([t,n,i,a]=[i,a,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:a}}function wte(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return fm(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?fm(r,t):null}function Cte(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function Tte(r,e,t){let{node:n,fromOffset:i,toOffset:a,from:o,to:s}=r.docView.parseRange(e,t),l=r.domSelectionRange(),f,p=l.anchorNode;if(p&&r.dom.contains(p.nodeType==1?p:p.parentNode)&&(f=[{node:p,offset:l.anchorOffset}],Nu(l)||f.push({node:l.focusNode,offset:l.focusOffset})),zr&&r.input.lastKeyCode===8)for(let F=a;F>i;F--){let z=n.childNodes[F-1],Y=z.pmViewDesc;if(z.nodeName=="BR"&&!Y){a=F;break}if(!Y||Y.size)break}let k=r.state.doc,T=r.someProp("domParser")||$a.fromSchema(r.state.schema),x=k.resolve(o),E=null,P=T.parse(n,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:i,to:a,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:Ste,context:x});if(f&&f[0].pos!=null){let F=f[0].pos,z=f[1]&&f[1].pos;z==null&&(z=F),E={anchor:F+o,head:z+o}}return{doc:P,sel:E,from:o,to:s}}function Ste(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(Kr&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||Kr&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xte=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ete(r,e,t,n,i){let a=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let ye=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,Re=ah(r,ye);if(Re&&!r.state.selection.eq(Re)){if(zr&&Ni&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",Be=>Be(r,Ia(13,"Enter"))))return;let Ze=r.state.tr.setSelection(Re);ye=="pointer"?Ze.setMeta("pointer",!0):ye=="key"&&Ze.scrollIntoView(),a&&Ze.setMeta("composition",a),r.dispatch(Ze)}return}let o=r.state.doc.resolve(e),s=o.sharedDepth(t);e=o.before(s+1),t=r.state.doc.resolve(t).after(s+1);let l=r.state.selection,f=Tte(r,e,t),p=r.state.doc,k=p.slice(f.from,f.to),T,x;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(T=r.state.selection.to,x="end"):(T=r.state.selection.from,x="start"),r.input.lastKeyCode=null;let E=Ote(k.content,f.doc.content,f.from,T,x);if(E&&r.input.domChangeCount++,(Bo&&r.input.lastIOSEnter>Date.now()-225||Ni)&&i.some(ye=>ye.nodeType==1&&!xte.test(ye.nodeName))&&(!E||E.endA>=E.endB)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!E)if(n&&l instanceof Mt&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))E={start:l.from,endA:l.to,endB:l.to};else{if(f.sel){let ye=dm(r,r.state.doc,f.sel);if(ye&&!ye.eq(r.state.selection)){let Re=r.state.tr.setSelection(ye);a&&Re.setMeta("composition",a),r.dispatch(Re)}}return}r.state.selection.from<r.state.selection.to&&E.start==E.endB&&r.state.selection instanceof Mt&&(E.start>r.state.selection.from&&E.start<=r.state.selection.from+2&&r.state.selection.from>=f.from?E.start=r.state.selection.from:E.endA<r.state.selection.to&&E.endA>=r.state.selection.to-2&&r.state.selection.to<=f.to&&(E.endB+=r.state.selection.to-E.endA,E.endA=r.state.selection.to)),fn&&na<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>f.from&&f.doc.textBetween(E.start-f.from-1,E.start-f.from+1)=="  "&&(E.start--,E.endA--,E.endB--);let P=f.doc.resolveNoCache(E.start-f.from),F=f.doc.resolveNoCache(E.endB-f.from),z=p.resolve(E.start),Y=P.sameParent(F)&&P.parent.inlineContent&&z.end()>=E.endA,Z;if((Bo&&r.input.lastIOSEnter>Date.now()-225&&(!Y||i.some(ye=>ye.nodeName=="DIV"||ye.nodeName=="P"))||!Y&&P.pos<f.doc.content.size&&(!P.sameParent(F)||!P.parent.inlineContent)&&!/\S/.test(f.doc.textBetween(P.pos,F.pos,"",""))&&(Z=Tt.findFrom(f.doc.resolve(P.pos+1),1,!0))&&Z.head>P.pos)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>E.start&&Ate(p,E.start,E.endA,P,F)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(8,"Backspace")))){Ni&&zr&&r.domObserver.suppressSelectionUpdates();return}zr&&E.endB==E.start&&(r.input.lastChromeDelete=Date.now()),Ni&&!Y&&P.start()!=F.start()&&F.parentOffset==0&&P.depth==F.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==E.endA&&(E.endB-=2,F=f.doc.resolveNoCache(E.endB-f.from),setTimeout(()=>{r.someProp("handleKeyDown",function(ye){return ye(r,Ia(13,"Enter"))})},20));let oe=E.start,le=E.endA,re,he,ge;if(Y){if(P.pos==F.pos)fn&&na<=11&&P.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>Li(r),20)),re=r.state.tr.delete(oe,le),he=p.resolve(E.start).marksAcross(p.resolve(E.endA));else if(E.endA==E.endB&&(ge=Mte(P.parent.content.cut(P.parentOffset,F.parentOffset),z.parent.content.cut(z.parentOffset,E.endA-z.start()))))re=r.state.tr,ge.type=="add"?re.addMark(oe,le,ge.mark):re.removeMark(oe,le,ge.mark);else if(P.parent.child(P.index()).isText&&P.index()==F.index()-(F.textOffset?0:1)){let ye=P.parent.textBetween(P.parentOffset,F.parentOffset);if(r.someProp("handleTextInput",Re=>Re(r,oe,le,ye)))return;re=r.state.tr.insertText(ye,oe,le)}}if(re||(re=r.state.tr.replace(oe,le,f.doc.slice(E.start-f.from,E.endB-f.from))),f.sel){let ye=dm(r,re.doc,f.sel);ye&&!(zr&&r.composing&&ye.empty&&(E.start!=E.endB||r.input.lastChromeDelete<Date.now()-100)&&(ye.head==oe||ye.head==re.mapping.map(le)-1)||fn&&ye.empty&&ye.head==oe)&&re.setSelection(ye)}he&&re.ensureMarks(he),a&&re.setMeta("composition",a),r.dispatch(re.scrollIntoView())}function dm(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:oh(r,e.resolve(t.anchor),e.resolve(t.head))}function Mte(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,a=n,o,s,l;for(let p=0;p<n.length;p++)i=n[p].removeFromSet(i);for(let p=0;p<t.length;p++)a=t[p].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o="add",l=p=>p.mark(s.addToSet(p.marks));else if(i.length==0&&a.length==1)s=a[0],o="remove",l=p=>p.mark(s.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(l(e.child(p)));if(Oe.from(f).eq(r))return{mark:s,type:o}}function Ate(r,e,t,n,i){if(t-e<=i.pos-n.pos||Pf(n,!0,!1)<i.pos)return!1;let a=r.resolve(e);if(!n.parent.isTextblock){let s=a.nodeAfter;return s!=null&&t==e+s.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=r.resolve(Pf(a,!0,!0));return!o.parent.isTextblock||o.pos>t||Pf(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Pf(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let a=r.node(n).maybeChild(r.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Ote(r,e,t,n,i){let a=r.findDiffStart(e,t);if(a==null)return null;let{a:o,b:s}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,a-Math.min(o,s));n-=o+l-a}if(o<a&&r.size<e.size){let l=n<=a&&n>=o?a-n:0;a-=l,a&&a<e.size&&hm(e.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}else if(s<a){let l=n<=a&&n>=s?a-n:0;a-=l,a&&a<r.size&&hm(r.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function hm(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class hh{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 Kee,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ym),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=mm(this),vm(this),this.nodeViews=gm(this),this.docView=Kv(this.state.doc,pm(this),If(this),this.dom,this),this.domObserver=new bte(this,(n,i,a,o)=>Ete(this,n,i,a,o)),this.domObserver.start(),Jee(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&&Ed(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ym),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(Qb(this),o=!0),this.state=e;let s=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let x=gm(this);Dte(x,this.nodeViews)&&(this.nodeViews=x,a=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ed(this),this.editable=mm(this),vm(this);let l=If(this),f=pm(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",k=a||!this.docView.matchesNode(e.doc,f,l);(k||!e.selection.eq(i.selection))&&(o=!0);let T=p=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uee(this);if(o){this.domObserver.stop();let x=k&&(fn||zr)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Nte(i.selection,e.selection);if(k){let E=zr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lte(this)),(a||!this.docView.update(e.doc,f,l,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=Kv(e.doc,f,l,this.dom,this)),E&&!this.trackWrites&&(x=!0)}x||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ree(this))?Li(this,x):(zb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():T&&cee(T)}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 ft){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Vv(this,t.getBoundingClientRect(),e)}else Vv(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 n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let a=n.from+(this.state.doc.content.size-t.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==n.node&&(i=a)}this.dragging=new tk(e.slice,e.move,i<0?void 0:ft.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let s=this.directPlugins[o].props[e];if(s!=null&&(i=t?t(s):s))return i}let a=this.state.plugins;if(a)for(let o=0;o<a.length;o++){let s=a[o].props[e];if(s!=null&&(i=t?t(s):s))return i}}hasFocus(){if(fn){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&&fee(this.dom),Li(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 mee(this,e)}coordsAtPos(e,t=1){return Rb(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return wee(this,t||this.state,e)}pasteHTML(e,t){return Ds(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ds(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return sh(this,e)}destroy(){this.docView&&(Yee(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],If(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZQ())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Zee(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Kr&&this.root.nodeType===11&&nee(this.dom.ownerDocument)==this.dom&&wte(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function pm(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[cn.node(0,r.state.doc.content.size,e)]}function vm(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:cn.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function mm(r){return!r.someProp("editable",e=>e(r.state)===!1)}function Nte(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function gm(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function Dte(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function ym(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Lte=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Rte(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,a,o;for(let s=0;s<e.length-1;s++){let l=e[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))Lte?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),a&&(t="Shift-"+t),t}function Ite(r){let e=Object.create(null);for(let t in r)e[Rte(t)]=r[t];return e}function Bf(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function Rs(r){return new hn({props:{handleKeyDown:Pte(r)}})}function Pte(r){let e=Ite(r);return function(t,n){let i=YZ(n),a,o=e[Bf(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let s=e[Bf(i,n,!1)];if(s&&s(t.state,t.dispatch,t))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(a=XZ[n.keyCode])&&a!=i){let s=e[Bf(a,n)];if(s&&s(t.state,t.dispatch,t))return!0}}return!1}}const ph=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Bte(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Fte=(r,e,t)=>{let n=Bte(r,t);if(!n)return!1;let i=ok(n);if(!i){let o=n.blockRange(),s=o&&Au(o);return s==null?!1:(e&&e(r.tr.lift(o,s).scrollIntoView()),!0)}let a=i.nodeBefore;if(fk(r,i,e,-1))return!0;if(n.parent.content.size==0&&(Fo(a,"end")||ft.isSelectable(a)))for(let o=n.depth;;o--){let s=rh(r.doc,n.before(o),n.after(o),Ue.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=r.tr.step(s);l.setSelection(Fo(a,"end")?Tt.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ft.create(l.doc,i.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return a.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1};function Fo(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const qte=(r,e,t)=>{let{$head:n,empty:i}=r.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;a=ok(n)}let o=a&&a.nodeBefore;return!o||!ft.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ft.create(r.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function ok(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Hte(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const sk=(r,e,t)=>{let n=Hte(r,t);if(!n)return!1;let i=lk(n);if(!i)return!1;let a=i.nodeAfter;if(fk(r,i,e,1))return!0;if(n.parent.content.size==0&&(Fo(a,"start")||ft.isSelectable(a))){let o=rh(r.doc,n.before(),n.after(),Ue.empty);if(o&&o.slice.size<o.to-o.from){if(e){let s=r.tr.step(o);s.setSelection(Fo(a,"start")?Tt.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):ft.create(s.doc,s.mapping.map(i.pos))),e(s.scrollIntoView())}return!0}}return a.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},_te=(r,e,t)=>{let{$head:n,empty:i}=r.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;a=lk(n)}let o=a&&a.nodeAfter;return!o||!ft.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ft.create(r.doc,a.pos)).scrollIntoView()),!0)};function lk(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const uk=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
9
+ `))),0,0):Ue.empty;let k=r.someProp("clipboardTextParser",T=>T(e,i,n,r));if(k)s=k;else{let T=i.marks(),{schema:x}=r.state,E=Jo.fromSchema(x);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(P=>{let F=o.appendChild(document.createElement("p"));P&&F.appendChild(E.serializeNode(x.text(P,T)))})}}else r.someProp("transformPastedHTML",k=>{t=k(t,r)}),o=$ee(t),qs&&Wee(o);let f=o&&o.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let k=+p[3];k>0;k--){let T=o.firstChild;for(;T&&T.nodeType!=1;)T=T.nextSibling;if(!T)break;o=T}if(s||(s=(r.someProp("clipboardParser")||r.someProp("domParser")||$a.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||p),context:i,ruleFromNode(T){return T.nodeName=="BR"&&!T.nextSibling&&T.parentNode&&!zee.test(T.parentNode.nodeName)?{ignore:!0}:null}})),p)s=jee(om(s,+p[1],+p[2]),p[4]);else if(s=Ue.maxOpen(Vee(s.content,i),!0),s.openStart||s.openEnd){let k=0,T=0;for(let x=s.content.firstChild;k<s.openStart&&!x.type.spec.isolating;k++,x=x.firstChild);for(let x=s.content.lastChild;T<s.openEnd&&!x.type.spec.isolating;T++,x=x.lastChild);s=om(s,k,T)}return r.someProp("transformPasted",k=>{s=k(s,r)}),s}const zee=/^(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 Vee(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),a,o=[];if(r.forEach(s=>{if(!o)return;let l=i.findWrapping(s.type),f;if(!l)return o=null;if(f=o.length&&a.length&&jb(l,a,s,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=Gb(o[o.length-1],a.length));let p=Wb(s,l);o.push(p),i=i.matchType(p.type),a=l}}),o)return Oe.from(o)}return r}function Wb(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,Oe.from(r));return r}function jb(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let a=jb(r,e,t,n.lastChild,i+1);if(a)return n.copy(n.content.replaceChild(n.childCount-1,a));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(Oe.from(Wb(t,r,i+1))))}}function Gb(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Gb(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(Oe.empty,!0);return r.copy(t.append(n))}function xd(r,e,t,n,i,a){let o=e<0?r.firstChild:r.lastChild,s=o.content;return r.childCount>1&&(a=0),i<n-1&&(s=xd(s,e,t,n,i+1,a)),i>=t&&(s=e<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Oe.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(s))}function om(r,e,t){return e<r.openStart&&(r=new Ue(xd(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new Ue(xd(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Kb={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 sm=null;function Jb(){return sm||(sm=document.implementation.createHTMLDocument("title"))}let Rf=null;function Uee(r){let e=window.trustedTypes;return e?(Rf||(Rf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Rf.createHTML(r)):r}function $ee(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Jb().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Kb[n[1].toLowerCase()])&&(r=i.map(a=>"<"+a+">").join("")+r+i.map(a=>"</"+a+">").reverse().join("")),t.innerHTML=Uee(r),i)for(let a=0;a<i.length;a++)t=t.querySelector(i[a])||t;return t}function Wee(r){let e=r.querySelectorAll(zr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function jee(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:a,openEnd:o}=r;for(let s=n.length-2;s>=0;s-=2){let l=t.nodes[n[s]];if(!l||l.hasRequiredAttrs())break;i=Oe.from(l.create(n[s+1],i)),a++,o++}return new Ue(i,a,o)}const Jr={},Yr={},Gee={touchstart:!0,touchmove:!0};class Kee{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Jee(r){for(let e in Jr){let t=Jr[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Xee(r,n)&&!lh(r,n)&&(r.editable||!(n.type in Yr))&&t(r,n)},Gee[e]?{passive:!0}:void 0)}Kr&&r.dom.addEventListener("input",()=>null),Ed(r)}function ta(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Yee(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Ed(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>lh(r,n))})}function lh(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Xee(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Zee(r,e){!lh(r,e)&&Jr[e.type]&&(r.editable||!(e.type in Yr))&&Jr[e.type](r,e)}Yr.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Xb(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(Ni&&zr&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),Bo&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,Ia(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||_ee(r,t)?t.preventDefault():ta(r,"key")};Yr.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Yr.keypress=(r,e)=>{let t=e;if(Xb(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Bn&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof Mt)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",a=>a(r,n.$from.pos,n.$to.pos,i))&&r.dispatch(r.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Lu(r){return{left:r.clientX,top:r.clientY}}function Qee(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function uh(r,e,t,n,i){if(n==-1)return!1;let a=r.state.doc.resolve(n);for(let o=a.depth+1;o>0;o--)if(r.someProp(e,s=>o>a.depth?s(r,t,a.nodeAfter,a.before(o),i,!0):s(r,t,a.node(o),a.before(o),i,!1)))return!0;return!1}function Ro(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function ete(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ft.isSelectable(n)?(Ro(r,new ft(t)),!0):!1}function tte(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ft&&(n=t.node);let a=r.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let s=o>a.depth?a.nodeAfter:a.node(o);if(ft.isSelectable(s)){n&&t.$from.depth>0&&o>=t.$from.depth&&a.before(t.$from.depth+1)==t.$from.pos?i=a.before(t.$from.depth):i=a.before(o);break}}return i!=null?(Ro(r,ft.create(r.state.doc,i)),!0):!1}function rte(r,e,t,n,i){return uh(r,"handleClickOn",e,t,n)||r.someProp("handleClick",a=>a(r,e,n))||(i?tte(r,t):ete(r,t))}function nte(r,e,t,n){return uh(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function ite(r,e,t,n){return uh(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||ate(r,t,n)}function ate(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Ro(r,Mt.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)Ro(r,Mt.create(n,s+1,s+1+o.content.size));else if(ft.isSelectable(o))Ro(r,ft.create(n,s));else continue;return!0}}function ch(r){return au(r)}const Yb=Bn?"metaKey":"ctrlKey";Jr.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=ch(r),i=Date.now(),a="singleClick";i-r.input.lastClick.time<500&&Qee(t,r.input.lastClick)&&!t[Yb]&&(r.input.lastClick.type=="singleClick"?a="doubleClick":r.input.lastClick.type=="doubleClick"&&(a="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:a};let o=r.posAtCoords(Lu(t));o&&(a=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new ote(r,o,t,!!n)):(a=="doubleClick"?nte:ite)(r,o.pos,o.inside,t)?t.preventDefault():ta(r,"pointer"))};class ote{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Yb],this.allowDefault=n.shiftKey;let a,o;if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),o=t.inside;else{let p=e.state.doc.resolve(t.pos);a=p.parent,o=p.depth?p.before():0}const s=i?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:f}=e.state;(n.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||f instanceof ft&&f.from<=o&&f.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kn&&!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)),ta(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(()=>Li(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(Lu(e))),this.updateAllowDefault(e),this.allowDefault||!t?ta(this.view,"pointer"):rte(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Kr&&this.mightDrag&&!this.mightDrag.node.isAtom||zr&&!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)?(Ro(this.view,Tt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ta(this.view,"pointer")}move(e){this.updateAllowDefault(e),ta(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)}}Jr.touchstart=r=>{r.input.lastTouch=Date.now(),ch(r),ta(r,"pointer")};Jr.touchmove=r=>{r.input.lastTouch=Date.now(),ta(r,"pointer")};Jr.contextmenu=r=>ch(r);function Xb(r,e){return r.composing?!0:Kr&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const ste=Ni?5e3:-1;Yr.compositionstart=Yr.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof Mt&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),au(r,!0),r.markCursor=null;else if(au(r,!e.selection.empty),Kn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,a=n.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let s=r.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}r.input.composing=!0}Zb(r,ste)};Yr.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Zb(r,20))};function Zb(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>au(r),e))}function Qb(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=ute());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function lte(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=eee(e.focusNode,e.focusOffset),n=tee(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,a=r.domObserver.lastChangedTextNode;if(t==a||n==a)return a;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function ute(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function au(r,e=!1){if(!(Ni&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Qb(r),e||r.docView&&r.docView.dirty){let t=ah(r);return t&&!t.eq(r.state.selection)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!r.state.selection.empty?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function cte(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ns=fn&&na<15||Bo&&oee<604;Jr.copy=Yr.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let a=Ns?null:t.clipboardData,o=n.content(),{dom:s,text:l}=sh(r,o);a?(t.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",l)):cte(r,s),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function fte(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function dte(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Ds(r,n.value,null,i,e):Ds(r,n.textContent,n.innerHTML,i,e)},50)}function Ds(r,e,t,n,i){let a=$b(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,a||Ue.empty)))return!0;if(!a)return!1;let o=fte(a),s=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(a);return r.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ek(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Yr.paste=(r,e)=>{let t=e;if(r.composing&&!Ni)return;let n=Ns?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Ds(r,ek(n),n.getData("text/html"),i,t)?t.preventDefault():dte(r,t)};class tk{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const hte=Bn?"altKey":"ctrlKey";function rk(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[hte]}Jr.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,a=i.empty?null:r.posAtCoords(Lu(t)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof ft?i.to-1:i.to))){if(n&&n.mightDrag)o=ft.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let k=r.docView.nearestDesc(t.target,!0);k&&k.node.type.spec.draggable&&k!=r.docView&&(o=ft.create(r.state.doc,k.posBefore))}}let s=(o||r.state.selection).content(),{dom:l,text:f,slice:p}=sh(r,s);(!t.dataTransfer.files.length||!zr||Ab>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ns?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ns||t.dataTransfer.setData("text/plain",f),r.dragging=new tk(p,rk(r,t),o)};Jr.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Yr.dragover=Yr.dragenter=(r,e)=>e.preventDefault();Yr.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(Lu(t));if(!i)return;let a=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",E=>{o=E(o,r)}):o=$b(r,ek(t.dataTransfer),Ns?null:t.dataTransfer.getData("text/html"),!1,a);let s=!!(n&&rk(r,t));if(r.someProp("handleDrop",E=>E(r,t,o||Ue.empty,s))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?zQ(r.state.doc,a.pos,o):a.pos;l==null&&(l=a.pos);let f=r.state.tr;if(s){let{node:E}=n;E?E.replace(f):f.deleteSelection()}let p=f.mapping.map(l),k=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,T=f.doc;if(k?f.replaceRangeWith(p,p,o.content.firstChild):f.replaceRange(p,p,o),f.doc.eq(T))return;let x=f.doc.resolve(p);if(k&&ft.isSelectable(o.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(o.content.firstChild))f.setSelection(new ft(x));else{let E=f.mapping.map(l);f.mapping.maps[f.mapping.maps.length-1].forEach((P,F,z,Y)=>E=Y),f.setSelection(oh(r,x,f.doc.resolve(E)))}r.focus(),r.dispatch(f.setMeta("uiEvent","drop"))};Jr.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&Li(r)},20))};Jr.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};Jr.beforeinput=(r,e)=>{if(zr&&Ni&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",a=>a(r,Ia(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in Yr)Jr[r]=Yr[r];function Ls(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class ou{constructor(e,t){this.toDOM=e,this.spec=t||_a,this.side=this.spec.side||0}map(e,t,n,i){let{pos:a,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new cn(a-n,a-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ou&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ls(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class aa{constructor(e,t){this.attrs=e,this.spec=t||_a}map(e,t,n,i){let a=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return a>=o?null:new cn(a,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof aa&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}static is(e){return e.type instanceof aa}destroy(){}}class fh{constructor(e,t){this.attrs=e,this.spec=t||_a}map(e,t,n,i){let a=e.mapResult(t.from+i,1);if(a.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=a.pos?null:new cn(a.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),a;return i==t.from&&!(a=e.child(n)).isText&&i+a.nodeSize==t.to}eq(e){return this==e||e instanceof fh&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}destroy(){}}class cn{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new cn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new cn(e,e,new ou(t,n))}static inline(e,t,n,i){return new cn(e,t,new aa(n,i))}static node(e,t,n,i){return new cn(e,t,new fh(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof aa}get widget(){return this.type instanceof ou}}const Eo=[],_a={};class sr{constructor(e,t){this.local=e.length?e:Eo,this.children=t.length?t:Eo}static create(e,t){return t.length?su(t,e,0,_a):Hr}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,a){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!a||a(s.spec))&&n.push(s.copy(s.from+i,s.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,i+s,a)}}map(e,t,n){return this==Hr||e.maps.length==0?this:this.mapInner(e,t,0,0,n||_a)}mapInner(e,t,n,i,a){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?pte(this.children,o||[],e,t,n,i,a):o?new sr(o.sort(za),Eo):Hr}add(e,t){return t.length?this==Hr?sr.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,a=0;e.forEach((s,l)=>{let f=l+n,p;if(p=ik(t,s,f)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(s,p,f+1):i.splice(a,0,l,l+s.nodeSize,su(p,s,f+1,_a)),a+=3}});let o=nk(a?ak(t):t,-n);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||o.splice(s--,1);return new sr(o.length?this.local.concat(o).sort(za):this.local,i||this.children)}remove(e){return e.length==0||this==Hr?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let a=0;a<n.length;a+=3){let o,s=n[a]+t,l=n[a+1]+t;for(let p=0,k;p<e.length;p++)(k=e[p])&&k.from>s&&k.to<l&&(e[p]=null,(o||(o=[])).push(k));if(!o)continue;n==this.children&&(n=this.children.slice());let f=n[a+2].removeInner(o,s+1);f!=Hr?n[a+2]=f:(n.splice(a,3),a-=3)}if(i.length){for(let a=0,o;a<e.length;a++)if(o=e[a])for(let s=0;s<i.length;s++)i[s].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(s--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new sr(i,n):Hr}forChild(e,t){if(this==Hr)return this;if(t.isLeaf)return sr.empty;let n,i;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let a=e+1,o=a+t.content.size;for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from<o&&l.to>a&&l.type instanceof aa){let f=Math.max(a,l.from)-a,p=Math.min(o,l.to)-a;f<p&&(i||(i=[])).push(l.copy(f,p))}}if(i){let s=new sr(i.sort(za),Eo);return n?new Xi([s,n]):s}return n||Hr}eq(e){if(this==e)return!0;if(!(e instanceof sr)||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 dh(this.localsInner(e))}localsInner(e){if(this==Hr)return Eo;if(e.inlineContent||!this.local.some(aa.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof aa||t.push(this.local[n]);return t}forEachSet(e){e(this)}}sr.empty=new sr([],[]);sr.removeOverlap=dh;const Hr=sr.empty;class Xi{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,_a));return Xi.from(n)}forChild(e,t){if(t.isLeaf)return sr.empty;let n=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,t);a!=Hr&&(a instanceof Xi?n=n.concat(a.members):n.push(a))}return Xi.from(n)}eq(e){if(!(e instanceof Xi)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!t)t=a;else{n&&(t=t.slice(),n=!1);for(let o=0;o<a.length;o++)t.push(a[o])}}return t?dh(n?t:t.sort(za)):Eo}static from(e){switch(e.length){case 0:return Hr;case 1:return e[0];default:return new Xi(e.every(t=>t instanceof sr)?e:e.reduce((t,n)=>t.concat(n instanceof sr?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function pte(r,e,t,n,i,a,o){let s=r.slice();for(let f=0,p=a;f<t.maps.length;f++){let k=0;t.maps[f].forEach((T,x,E,P)=>{let F=P-E-(x-T);for(let z=0;z<s.length;z+=3){let Y=s[z+1];if(Y<0||T>Y+p-k)continue;let Z=s[z]+p-k;x>=Z?s[z+1]=T<=Z?-2:-1:T>=p&&F&&(s[z]+=F,s[z+1]+=F)}k+=F}),p=t.maps[f].map(p,-1)}let l=!1;for(let f=0;f<s.length;f+=3)if(s[f+1]<0){if(s[f+1]==-2){l=!0,s[f+1]=-1;continue}let p=t.map(r[f]+a),k=p-i;if(k<0||k>=n.content.size){l=!0;continue}let T=t.map(r[f+1]+a,-1),x=T-i,{index:E,offset:P}=n.content.findIndex(k),F=n.maybeChild(E);if(F&&P==k&&P+F.nodeSize==x){let z=s[f+2].mapInner(t,F,p+1,r[f]+a+1,o);z!=Hr?(s[f]=k,s[f+1]=x,s[f+2]=z):(s[f+1]=-2,l=!0)}else l=!0}if(l){let f=vte(s,r,e,t,i,a,o),p=su(f,n,0,o);e=p.local;for(let k=0;k<s.length;k+=3)s[k+1]<0&&(s.splice(k,3),k-=3);for(let k=0,T=0;k<p.children.length;k+=3){let x=p.children[k];for(;T<s.length&&s[T]<x;)T+=3;s.splice(T,0,p.children[k],p.children[k+1],p.children[k+2])}}return new sr(e.sort(za),s)}function nk(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new cn(i.from+e,i.to+e,i.type))}return t}function vte(r,e,t,n,i,a,o){function s(l,f){for(let p=0;p<l.local.length;p++){let k=l.local[p].map(n,i,f);k?t.push(k):o.onRemove&&o.onRemove(l.local[p].spec)}for(let p=0;p<l.children.length;p+=3)s(l.children[p+2],l.children[p]+f+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&s(r[l+2],e[l]+a+1);return t}function ik(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let a=0,o;a<r.length;a++)(o=r[a])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[a]=null);return i}function ak(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function su(r,e,t,n){let i=[],a=!1;e.forEach((s,l)=>{let f=ik(r,s,l+t);if(f){a=!0;let p=su(f,s,t+l+1,n);p!=Hr&&i.push(l,l+s.nodeSize,p)}});let o=nk(a?ak(r):r,-t).sort(za);for(let s=0;s<o.length;s++)o[s].type.valid(e,o[s])||(n.onRemove&&n.onRemove(o[s].spec),o.splice(s--,1));return o.length||i.length?new sr(o,i):Hr}function za(r,e){return r.from-e.from||r.to-e.to}function dh(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let a=e[i];if(a.from==n.from){a.to!=n.to&&(e==r&&(e=r.slice()),e[i]=a.copy(a.from,n.to),lm(e,i+1,a.copy(n.to,a.to)));continue}else{a.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,a.from),lm(e,i,n.copy(a.from,n.to)));break}}}return e}function lm(r,e,t){for(;e<r.length&&za(t,r[e])>0;)e++;r.splice(e,0,t)}function If(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=Hr&&e.push(n)}),r.cursorWrapper&&e.push(sr.create(r.state.doc,[r.cursorWrapper.deco])),Xi.from(e)}const mte={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gte=fn&&na<=11;class yte{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class bte{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new yte,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);fn&&na<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),gte&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,mte)),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(em(this.view)){if(this.suppressingSelectionUpdates)return Li(this.view);if(fn&&na<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ja(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let a=e.focusNode;a;a=Po(a))t.add(a);for(let a=e.anchorNode;a;a=Po(a))if(t.has(a)){n=a;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&em(e)&&!this.ignoreSelectionChange(n),a=-1,o=-1,s=!1,l=[];if(e.editable)for(let p=0;p<t.length;p++){let k=this.registerMutation(t[p],l);k&&(a=a<0?k.from:Math.min(k.from,a),o=o<0?k.to:Math.max(k.to,o),k.typeOver&&(s=!0))}if(Kn&&l.length){let p=l.filter(k=>k.nodeName=="BR");if(p.length==2){let[k,T]=p;k.parentNode&&k.parentNode.parentNode==T.parentNode?T.remove():k.remove()}else{let{focusNode:k}=this.currentSelection;for(let T of p){let x=T.parentNode;x&&x.nodeName=="LI"&&(!k||Cte(e,k)!=x)&&T.remove()}}}let f=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Nu(n)&&(f=ah(e))&&f.eq(Tt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Li(e),this.currentSelection.set(n),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,o),kte(e)),this.handleDOMChange(a,o,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Li(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let k=e.addedNodes[p];t.push(k),k.nodeType==3&&(this.lastChangedTextNode=k)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,a=e.nextSibling;if(fn&&na<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:k,nextSibling:T}=e.addedNodes[p];(!k||Array.prototype.indexOf.call(e.addedNodes,k)<0)&&(i=k),(!T||Array.prototype.indexOf.call(e.addedNodes,T)<0)&&(a=T)}let o=i&&i.parentNode==e.target?Lr(i)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=a&&a.parentNode==e.target?Lr(a):e.target.childNodes.length,f=n.localPosFromDOM(e.target,l,1);return{from:s,to:f}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let um=new WeakMap,cm=!1;function kte(r){if(!um.has(r)&&(um.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Kn,cm)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."),cm=!0}}function fm(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,a=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return ja(o.node,o.offset,i,a)&&([t,n,i,a]=[i,a,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:a}}function wte(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return fm(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?fm(r,t):null}function Cte(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function Tte(r,e,t){let{node:n,fromOffset:i,toOffset:a,from:o,to:s}=r.docView.parseRange(e,t),l=r.domSelectionRange(),f,p=l.anchorNode;if(p&&r.dom.contains(p.nodeType==1?p:p.parentNode)&&(f=[{node:p,offset:l.anchorOffset}],Nu(l)||f.push({node:l.focusNode,offset:l.focusOffset})),zr&&r.input.lastKeyCode===8)for(let F=a;F>i;F--){let z=n.childNodes[F-1],Y=z.pmViewDesc;if(z.nodeName=="BR"&&!Y){a=F;break}if(!Y||Y.size)break}let k=r.state.doc,T=r.someProp("domParser")||$a.fromSchema(r.state.schema),x=k.resolve(o),E=null,P=T.parse(n,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:i,to:a,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:Ste,context:x});if(f&&f[0].pos!=null){let F=f[0].pos,z=f[1]&&f[1].pos;z==null&&(z=F),E={anchor:F+o,head:z+o}}return{doc:P,sel:E,from:o,to:s}}function Ste(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(Kr&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||Kr&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xte=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ete(r,e,t,n,i){let a=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let ye=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,Re=ah(r,ye);if(Re&&!r.state.selection.eq(Re)){if(zr&&Ni&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",Be=>Be(r,Ia(13,"Enter"))))return;let Ze=r.state.tr.setSelection(Re);ye=="pointer"?Ze.setMeta("pointer",!0):ye=="key"&&Ze.scrollIntoView(),a&&Ze.setMeta("composition",a),r.dispatch(Ze)}return}let o=r.state.doc.resolve(e),s=o.sharedDepth(t);e=o.before(s+1),t=r.state.doc.resolve(t).after(s+1);let l=r.state.selection,f=Tte(r,e,t),p=r.state.doc,k=p.slice(f.from,f.to),T,x;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(T=r.state.selection.to,x="end"):(T=r.state.selection.from,x="start"),r.input.lastKeyCode=null;let E=Ote(k.content,f.doc.content,f.from,T,x);if(E&&r.input.domChangeCount++,(Bo&&r.input.lastIOSEnter>Date.now()-225||Ni)&&i.some(ye=>ye.nodeType==1&&!xte.test(ye.nodeName))&&(!E||E.endA>=E.endB)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!E)if(n&&l instanceof Mt&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))E={start:l.from,endA:l.to,endB:l.to};else{if(f.sel){let ye=dm(r,r.state.doc,f.sel);if(ye&&!ye.eq(r.state.selection)){let Re=r.state.tr.setSelection(ye);a&&Re.setMeta("composition",a),r.dispatch(Re)}}return}r.state.selection.from<r.state.selection.to&&E.start==E.endB&&r.state.selection instanceof Mt&&(E.start>r.state.selection.from&&E.start<=r.state.selection.from+2&&r.state.selection.from>=f.from?E.start=r.state.selection.from:E.endA<r.state.selection.to&&E.endA>=r.state.selection.to-2&&r.state.selection.to<=f.to&&(E.endB+=r.state.selection.to-E.endA,E.endA=r.state.selection.to)),fn&&na<=11&&E.endB==E.start+1&&E.endA==E.start&&E.start>f.from&&f.doc.textBetween(E.start-f.from-1,E.start-f.from+1)=="  "&&(E.start--,E.endA--,E.endB--);let P=f.doc.resolveNoCache(E.start-f.from),F=f.doc.resolveNoCache(E.endB-f.from),z=p.resolve(E.start),Y=P.sameParent(F)&&P.parent.inlineContent&&z.end()>=E.endA,Z;if((Bo&&r.input.lastIOSEnter>Date.now()-225&&(!Y||i.some(ye=>ye.nodeName=="DIV"||ye.nodeName=="P"))||!Y&&P.pos<f.doc.content.size&&(!P.sameParent(F)||!P.parent.inlineContent)&&!/\S/.test(f.doc.textBetween(P.pos,F.pos,"",""))&&(Z=Tt.findFrom(f.doc.resolve(P.pos+1),1,!0))&&Z.head>P.pos)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>E.start&&Ate(p,E.start,E.endA,P,F)&&r.someProp("handleKeyDown",ye=>ye(r,Ia(8,"Backspace")))){Ni&&zr&&r.domObserver.suppressSelectionUpdates();return}zr&&E.endB==E.start&&(r.input.lastChromeDelete=Date.now()),Ni&&!Y&&P.start()!=F.start()&&F.parentOffset==0&&P.depth==F.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==E.endA&&(E.endB-=2,F=f.doc.resolveNoCache(E.endB-f.from),setTimeout(()=>{r.someProp("handleKeyDown",function(ye){return ye(r,Ia(13,"Enter"))})},20));let oe=E.start,le=E.endA,re,he,ge;if(Y){if(P.pos==F.pos)fn&&na<=11&&P.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>Li(r),20)),re=r.state.tr.delete(oe,le),he=p.resolve(E.start).marksAcross(p.resolve(E.endA));else if(E.endA==E.endB&&(ge=Mte(P.parent.content.cut(P.parentOffset,F.parentOffset),z.parent.content.cut(z.parentOffset,E.endA-z.start()))))re=r.state.tr,ge.type=="add"?re.addMark(oe,le,ge.mark):re.removeMark(oe,le,ge.mark);else if(P.parent.child(P.index()).isText&&P.index()==F.index()-(F.textOffset?0:1)){let ye=P.parent.textBetween(P.parentOffset,F.parentOffset);if(r.someProp("handleTextInput",Re=>Re(r,oe,le,ye)))return;re=r.state.tr.insertText(ye,oe,le)}}if(re||(re=r.state.tr.replace(oe,le,f.doc.slice(E.start-f.from,E.endB-f.from))),f.sel){let ye=dm(r,re.doc,f.sel);ye&&!(zr&&r.composing&&ye.empty&&(E.start!=E.endB||r.input.lastChromeDelete<Date.now()-100)&&(ye.head==oe||ye.head==re.mapping.map(le)-1)||fn&&ye.empty&&ye.head==oe)&&re.setSelection(ye)}he&&re.ensureMarks(he),a&&re.setMeta("composition",a),r.dispatch(re.scrollIntoView())}function dm(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:oh(r,e.resolve(t.anchor),e.resolve(t.head))}function Mte(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,a=n,o,s,l;for(let p=0;p<n.length;p++)i=n[p].removeFromSet(i);for(let p=0;p<t.length;p++)a=t[p].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o="add",l=p=>p.mark(s.addToSet(p.marks));else if(i.length==0&&a.length==1)s=a[0],o="remove",l=p=>p.mark(s.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(l(e.child(p)));if(Oe.from(f).eq(r))return{mark:s,type:o}}function Ate(r,e,t,n,i){if(t-e<=i.pos-n.pos||Pf(n,!0,!1)<i.pos)return!1;let a=r.resolve(e);if(!n.parent.isTextblock){let s=a.nodeAfter;return s!=null&&t==e+s.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=r.resolve(Pf(a,!0,!0));return!o.parent.isTextblock||o.pos>t||Pf(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Pf(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let a=r.node(n).maybeChild(r.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Ote(r,e,t,n,i){let a=r.findDiffStart(e,t);if(a==null)return null;let{a:o,b:s}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,a-Math.min(o,s));n-=o+l-a}if(o<a&&r.size<e.size){let l=n<=a&&n>=o?a-n:0;a-=l,a&&a<e.size&&hm(e.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}else if(s<a){let l=n<=a&&n>=s?a-n:0;a-=l,a&&a<r.size&&hm(r.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function hm(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class hh{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 Kee,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ym),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=mm(this),vm(this),this.nodeViews=gm(this),this.docView=Kv(this.state.doc,pm(this),If(this),this.dom,this),this.domObserver=new bte(this,(n,i,a,o)=>Ete(this,n,i,a,o)),this.domObserver.start(),Jee(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&&Ed(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ym),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(Qb(this),o=!0),this.state=e;let s=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let x=gm(this);Dte(x,this.nodeViews)&&(this.nodeViews=x,a=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ed(this),this.editable=mm(this),vm(this);let l=If(this),f=pm(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",k=a||!this.docView.matchesNode(e.doc,f,l);(k||!e.selection.eq(i.selection))&&(o=!0);let T=p=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uee(this);if(o){this.domObserver.stop();let x=k&&(fn||zr)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Nte(i.selection,e.selection);if(k){let E=zr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lte(this)),(a||!this.docView.update(e.doc,f,l,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=Kv(e.doc,f,l,this.dom,this)),E&&!this.trackWrites&&(x=!0)}x||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ree(this))?Li(this,x):(zb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():T&&cee(T)}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 ft){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Vv(this,t.getBoundingClientRect(),e)}else Vv(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 n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let a=n.from+(this.state.doc.content.size-t.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==n.node&&(i=a)}this.dragging=new tk(e.slice,e.move,i<0?void 0:ft.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let s=this.directPlugins[o].props[e];if(s!=null&&(i=t?t(s):s))return i}let a=this.state.plugins;if(a)for(let o=0;o<a.length;o++){let s=a[o].props[e];if(s!=null&&(i=t?t(s):s))return i}}hasFocus(){if(fn){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&&fee(this.dom),Li(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 mee(this,e)}coordsAtPos(e,t=1){return Rb(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return wee(this,t||this.state,e)}pasteHTML(e,t){return Ds(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ds(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return sh(this,e)}destroy(){this.docView&&(Yee(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],If(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZQ())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Zee(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Kr&&this.root.nodeType===11&&nee(this.dom.ownerDocument)==this.dom&&wte(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function pm(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[cn.node(0,r.state.doc.content.size,e)]}function vm(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:cn.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function mm(r){return!r.someProp("editable",e=>e(r.state)===!1)}function Nte(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function gm(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function Dte(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function ym(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Lte=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Rte(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,a,o;for(let s=0;s<e.length-1;s++){let l=e[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))Lte?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),a&&(t="Shift-"+t),t}function Ite(r){let e=Object.create(null);for(let t in r)e[Rte(t)]=r[t];return e}function Bf(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function Rs(r){return new hn({props:{handleKeyDown:Pte(r)}})}function Pte(r){let e=Ite(r);return function(t,n){let i=KZ(n),a,o=e[Bf(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let s=e[Bf(i,n,!1)];if(s&&s(t.state,t.dispatch,t))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(a=JZ[n.keyCode])&&a!=i){let s=e[Bf(a,n)];if(s&&s(t.state,t.dispatch,t))return!0}}return!1}}const ph=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Bte(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Fte=(r,e,t)=>{let n=Bte(r,t);if(!n)return!1;let i=ok(n);if(!i){let o=n.blockRange(),s=o&&Au(o);return s==null?!1:(e&&e(r.tr.lift(o,s).scrollIntoView()),!0)}let a=i.nodeBefore;if(fk(r,i,e,-1))return!0;if(n.parent.content.size==0&&(Fo(a,"end")||ft.isSelectable(a)))for(let o=n.depth;;o--){let s=rh(r.doc,n.before(o),n.after(o),Ue.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=r.tr.step(s);l.setSelection(Fo(a,"end")?Tt.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ft.create(l.doc,i.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return a.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1};function Fo(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const qte=(r,e,t)=>{let{$head:n,empty:i}=r.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;a=ok(n)}let o=a&&a.nodeBefore;return!o||!ft.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ft.create(r.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function ok(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Hte(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const sk=(r,e,t)=>{let n=Hte(r,t);if(!n)return!1;let i=lk(n);if(!i)return!1;let a=i.nodeAfter;if(fk(r,i,e,1))return!0;if(n.parent.content.size==0&&(Fo(a,"start")||ft.isSelectable(a))){let o=rh(r.doc,n.before(),n.after(),Ue.empty);if(o&&o.slice.size<o.to-o.from){if(e){let s=r.tr.step(o);s.setSelection(Fo(a,"start")?Tt.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):ft.create(s.doc,s.mapping.map(i.pos))),e(s.scrollIntoView())}return!0}}return a.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},_te=(r,e,t)=>{let{$head:n,empty:i}=r.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;a=lk(n)}let o=a&&a.nodeAfter;return!o||!ft.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ft.create(r.doc,a.pos)).scrollIntoView()),!0)};function lk(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const uk=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
10
10
  `).scrollIntoView()),!0)};function vh(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const mh=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),a=t.indexAfter(-1),o=vh(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let s=t.after(),l=r.tr.replaceWith(s,s,o.createAndFill());l.setSelection(Tt.near(l.doc.resolve(s),1)),e(l.scrollIntoView())}return!0},zte=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Gr||n.parent.inlineContent||i.parent.inlineContent)return!1;let a=vh(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,s=r.tr.insert(o,a.createAndFill());s.setSelection(Mt.create(s.doc,o+1)),e(s.scrollIntoView())}return!0},Vte=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let a=t.before();if(Do(r.doc,a))return e&&e(r.tr.split(a).scrollIntoView()),!0}let n=t.blockRange(),i=n&&Au(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function Ute(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof ft&&e.selection.node.isBlock)return!n.parentOffset||!Do(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let a=[],o,s,l=!1,f=!1;for(let x=n.depth;;x--)if(n.node(x).isBlock){l=n.end(x)==n.pos+(n.depth-x),f=n.start(x)==n.pos-(n.depth-x),s=vh(n.node(x-1).contentMatchAt(n.indexAfter(x-1))),a.unshift(l&&s?{type:s}:null),o=x;break}else{if(x==1)return!1;a.unshift(null)}let p=e.tr;(e.selection instanceof Mt||e.selection instanceof Gr)&&p.deleteSelection();let k=p.mapping.map(n.pos),T=Do(p.doc,k,a.length,a);if(T||(a[0]=s?{type:s}:null,T=Do(p.doc,k,a.length,a)),!T)return!1;if(p.split(k,a.length,a),!l&&f&&n.node(o).type!=s){let x=p.mapping.map(n.before(o)),E=p.doc.resolve(x);s&&n.node(o-1).canReplaceWith(E.index(),E.index()+1,s)&&p.setNodeMarkup(p.mapping.map(n.before(o)),s)}return t&&t(p.scrollIntoView()),!0}}const $te=Ute(),ck=(r,e)=>(e&&e(r.tr.setSelection(new Gr(r.doc))),!0);function Wte(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,a=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(a-1,a)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(i.isTextblock||bb(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function fk(r,e,t,n){let i=e.nodeBefore,a=e.nodeAfter,o,s,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&Wte(r,e,t))return!0;let f=!l&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(t){let x=e.pos+a.nodeSize,E=Oe.empty;for(let z=o.length-1;z>=0;z--)E=Oe.from(o[z].create(null,E));E=Oe.from(i.copy(E));let P=r.tr.step(new Sr(e.pos-1,x,e.pos,x,new Ue(E,1,0),o.length,!0)),F=P.doc.resolve(x+2*o.length);F.nodeAfter&&F.nodeAfter.type==i.type&&bb(P.doc,F.pos)&&P.join(F.pos),t(P.scrollIntoView())}return!0}let p=a.type.spec.isolating||n>0&&l?null:Tt.findFrom(e,1),k=p&&p.$from.blockRange(p.$to),T=k&&Au(k);if(T!=null&&T>=e.depth)return t&&t(r.tr.lift(k,T).scrollIntoView()),!0;if(f&&Fo(a,"start",!0)&&Fo(i,"end")){let x=i,E=[];for(;E.push(x),!x.isTextblock;)x=x.lastChild;let P=a,F=1;for(;!P.isTextblock;P=P.firstChild)F++;if(x.canReplace(x.childCount,x.childCount,P.content)){if(t){let z=Oe.empty;for(let Z=E.length-1;Z>=0;Z--)z=Oe.from(E[Z].copy(z));let Y=r.tr.step(new Sr(e.pos-E.length,e.pos+a.nodeSize,e.pos+F,e.pos+a.nodeSize-F,new Ue(z,E.length,0),0,!0));t(Y.scrollIntoView())}return!0}}return!1}function dk(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(t&&t(e.tr.setSelection(Mt.create(e.doc,r<0?i.start(a):i.end(a)))),!0):!1}}const jte=dk(-1),Gte=dk(1);function Kte(r,e=null){return function(t,n){let{$from:i,$to:a}=t.selection,o=i.blockRange(a),s=o&&OQ(o,r,e);return s?(n&&n(t.tr.wrap(o,s).scrollIntoView()),!0):!1}}function gh(r,e=null){return function(t,n){let i=!1;for(let a=0;a<t.selection.ranges.length&&!i;a++){let{$from:{pos:o},$to:{pos:s}}=t.selection.ranges[a];t.doc.nodesBetween(o,s,(l,f)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let p=t.doc.resolve(f),k=p.index();i=p.parent.canReplaceWith(k,k+1,r)}})}if(!i)return!1;if(n){let a=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];a.setBlockType(s,l,r,e)}n(a.scrollIntoView())}return!0}}function Jte(r,e,t,n){for(let i=0;i<e.length;i++){let{$from:a,$to:o}=e[i],s=a.depth==0?r.inlineContent&&r.type.allowsMarkType(t):!1;if(r.nodesBetween(a.pos,o.pos,(l,f)=>{if(s)return!1;s=l.inlineContent&&l.type.allowsMarkType(t)}),s)return!0}return!1}function _s(r,e=null,t){return function(n,i){let{empty:a,$cursor:o,ranges:s}=n.selection;if(a&&!o||!Jte(n.doc,s,r))return!1;if(i)if(o)r.isInSet(n.storedMarks||o.marks())?i(n.tr.removeStoredMark(r)):i(n.tr.addStoredMark(r.create(e)));else{let l,f=n.tr;l=!s.some(p=>n.doc.rangeHasMark(p.$from.pos,p.$to.pos,r));for(let p=0;p<s.length;p++){let{$from:k,$to:T}=s[p];if(!l)f.removeMark(k.pos,T.pos,r);else{let x=k.pos,E=T.pos,P=k.nodeAfter,F=T.nodeBefore,z=P&&P.isText?/^\s*/.exec(P.text)[0].length:0,Y=F&&F.isText?/\s*$/.exec(F.text)[0].length:0;x+z<E&&(x+=z,E-=Y),f.addMark(x,E,r.create(e))}}i(f.scrollIntoView())}return!0}}function Ru(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}let Ff=Ru(ph,Fte,qte),bm=Ru(ph,sk,_te);const Ai={Enter:Ru(uk,zte,Vte,$te),"Mod-Enter":mh,Backspace:Ff,"Mod-Backspace":Ff,"Shift-Backspace":Ff,Delete:bm,"Mod-Delete":bm,"Mod-a":ck},hk={"Ctrl-h":Ai.Backspace,"Alt-Backspace":Ai["Mod-Backspace"],"Ctrl-d":Ai.Delete,"Ctrl-Alt-Backspace":Ai["Mod-Delete"],"Alt-Delete":Ai["Mod-Delete"],"Alt-d":Ai["Mod-Delete"],"Ctrl-a":jte,"Ctrl-e":Gte};for(let r in Ai)hk[r]=Ai[r];const Yte=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,km=Yte?hk:Ai;class fa{constructor(e,t,n={}){this.match=e,this.match=e,this.handler=typeof t=="string"?Xte(t):t,this.undoable=n.undoable!==!1,this.inCode=n.inCode||!1,this.inCodeMark=n.inCodeMark!==!1}}function Xte(r){return function(e,t,n,i){let a=r;if(t[1]){let o=t[0].lastIndexOf(t[1]);a+=t[0].slice(o+t[1].length),n+=o;let s=n-i;s>0&&(a=t[0].slice(o-s,o)+a,n=i)}return e.tr.insertText(a,n,i)}}const Zte=500;function pk({rules:r}){let e=new hn({state:{init(){return null},apply(t,n){let i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:n)}},props:{handleTextInput(t,n,i,a){return wm(t,n,i,a,r,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:n}=t.state.selection;n&&wm(t,n.pos,n.pos,"",r,e)})}}},isInputRules:!0});return e}function wm(r,e,t,n,i,a){if(r.composing)return!1;let o=r.state,s=o.doc.resolve(e),l=s.parent.textBetween(Math.max(0,s.parentOffset-Zte),s.parentOffset,null,"")+n;for(let f=0;f<i.length;f++){let p=i[f];if(!p.inCodeMark&&s.marks().some(x=>x.type.spec.code))continue;if(s.parent.type.spec.code){if(!p.inCode)continue}else if(p.inCode==="only")continue;let k=p.match.exec(l),T=k&&k[0].length>=n.length&&p.handler(o,k,e-(k[0].length-n.length),t);if(T)return p.undoable&&T.setMeta(a,{transform:T,from:e,to:t,text:n}),r.dispatch(T),!0}return!1}const Qte=(r,e)=>{let t=r.plugins;for(let n=0;n<t.length;n++){let i=t[n],a;if(i.spec.isInputRules&&(a=i.getState(r))){if(e){let o=r.tr,s=a.transform;for(let l=s.steps.length-1;l>=0;l--)o.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,r.schema.text(a.text,l))}else o.delete(a.from,a.to);e(o)}return!0}}return!1};new fa(/--$/,"—",{inCodeMark:!1});new fa(/\.\.\.$/,"…",{inCodeMark:!1});new fa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new fa(/"$/,"”",{inCodeMark:!1});new fa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new fa(/'$/,"’",{inCodeMark:!1});var lu=200,xr=function(){};xr.prototype.append=function(e){return e.length?(e=xr.from(e),!this.length&&e||e.length<lu&&this.leafAppend(e)||this.length<lu&&e.leafPrepend(this)||this.appendInner(e)):this};xr.prototype.prepend=function(e){return e.length?xr.from(e).append(this):this};xr.prototype.appendInner=function(e){return new ere(this,e)};xr.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?xr.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};xr.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};xr.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};xr.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(a,o){return i.push(e(a,o))},t,n),i};xr.from=function(e){return e instanceof xr?e:e&&e.length?new vk(e):xr.empty};var vk=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,o,s){for(var l=a;l<o;l++)if(i(this.values[l],s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,o,s){for(var l=a-1;l>=o;l--)if(i(this.values[l],s+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=lu)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=lu)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(xr);xr.empty=new vk([]);var ere=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,a,o){var s=this.left.length;if(i<s&&this.left.forEachInner(n,i,Math.min(a,s),o)===!1||a>s&&this.right.forEachInner(n,Math.max(i-s,0),Math.min(this.length,a)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,a,o){var s=this.left.length;if(i>s&&this.right.forEachInvertedInner(n,i-s,Math.max(a,s)-s,o+s)===!1||a<s&&this.left.forEachInvertedInner(n,Math.min(i,s),a,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(n,i):n>=a?this.right.slice(n-a,i-a):this.left.slice(n,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(xr);const tre=500;class $n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,a;t&&(i=this.remapping(n,this.items.length),a=i.maps.length);let o=e.tr,s,l,f=[],p=[];return this.items.forEach((k,T)=>{if(!k.step){i||(i=this.remapping(n,T+1),a=i.maps.length),a--,p.push(k);return}if(i){p.push(new ai(k.map));let x=k.step.map(i.slice(a)),E;x&&o.maybeStep(x).doc&&(E=o.mapping.maps[o.mapping.maps.length-1],f.push(new ai(E,void 0,void 0,f.length+p.length))),a--,E&&i.appendMap(E,a)}else o.maybeStep(k.step);if(k.selection)return s=i?k.selection.map(i.slice(a)):k.selection,l=new $n(this.items.slice(0,n).append(p.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:s}}addTransform(e,t,n,i){let a=[],o=this.eventCount,s=this.items,l=!i&&s.length?s.get(s.length-1):null;for(let p=0;p<e.steps.length;p++){let k=e.steps[p].invert(e.docs[p]),T=new ai(e.mapping.maps[p],k,t),x;(x=l&&l.merge(T))&&(T=x,p?a.pop():s=s.slice(0,s.length-1)),a.push(T),t&&(o++,t=void 0),i||(l=T)}let f=o-n.depth;return f>nre&&(s=rre(s,f),o-=f),new $n(s.append(a),o)}remapping(e,t){let n=new As;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new $n(this.items.append(e.map(t=>new ai(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),a=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(T=>{T.selection&&s--},i);let l=t;this.items.forEach(T=>{let x=a.getMirror(--l);if(x==null)return;o=Math.min(o,x);let E=a.maps[x];if(T.step){let P=e.steps[x].invert(e.docs[x]),F=T.selection&&T.selection.map(a.slice(l+1,x));F&&s++,n.push(new ai(E,P,F))}else n.push(new ai(E))},i);let f=[];for(let T=t;T<o;T++)f.push(new ai(a.maps[T]));let p=this.items.slice(0,i).append(f).append(n),k=new $n(p,s);return k.emptyItemCount()>tre&&(k=k.compress(this.items.length-n.length)),k}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],a=0;return this.items.forEach((o,s)=>{if(s>=e)i.push(o),o.selection&&a++;else if(o.step){let l=o.step.map(t.slice(n)),f=l&&l.getMap();if(n--,f&&t.appendMap(f,n),l){let p=o.selection&&o.selection.map(t.slice(n));p&&a++;let k=new ai(f.invert(),l,p),T,x=i.length-1;(T=i.length&&i[x].merge(k))?i[x]=T:i.push(k)}}else o.map&&n--},this.items.length,0),new $n(xr.from(i.reverse()),a)}}$n.empty=new $n(xr.empty,0);function rre(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class ai{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ai(t.getMap().invert(),t,this.selection)}}}class Yi{constructor(e,t,n,i,a){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=a}}const nre=20;function ire(r,e,t,n){let i=t.getMeta(oa),a;if(i)return i.historyState;t.getMeta(sre)&&(r=new Yi(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(oa))return o.getMeta(oa).redo?new Yi(r.done.addTransform(t,void 0,n,$l(e)),r.undone,Cm(t.mapping.maps),r.prevTime,r.prevComposition):new Yi(r.done,r.undone.addTransform(t,void 0,n,$l(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let s=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=s&&(r.prevTime<(t.time||0)-n.newGroupDelay||!are(t,r.prevRanges)),f=o?qf(r.prevRanges,t.mapping):Cm(t.mapping.maps);return new Yi(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,$l(e)),$n.empty,f,t.time,s??r.prevComposition)}else return(a=t.getMeta("rebased"))?new Yi(r.done.rebased(t,a),r.undone.rebased(t,a),qf(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Yi(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),qf(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function are(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let a=0;a<e.length;a+=2)n<=e[a+1]&&i>=e[a]&&(t=!0)}),t}function Cm(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,a,o)=>e.push(a,o));return e}function qf(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),a=e.map(r[n+1],-1);i<=a&&t.push(i,a)}return t}function ore(r,e,t){let n=$l(e),i=oa.get(e).spec.config,a=(t?r.undone:r.done).popEvent(e,n);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(t?r.done:r.undone).addTransform(a.transform,e.selection.getBookmark(),i,n),l=new Yi(t?s:a.remaining,t?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(oa,{redo:t,historyState:l})}let Hf=!1,Tm=null;function $l(r){let e=r.plugins;if(Tm!=e){Hf=!1,Tm=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Hf=!0;break}}return Hf}const oa=new Bs("history"),sre=new Bs("closeHistory");function mk(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new hn({key:oa,state:{init(){return new Yi($n.empty,$n.empty,null,0,-1)},apply(e,t,n){return ire(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Ss:n=="historyRedo"?yh:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function gk(r,e){return(t,n)=>{let i=oa.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let a=ore(i,t,r);a&&n(e?a.scrollIntoView():a)}return!0}}const Ss=gk(!1,!0),yh=gk(!0,!0);function lre(r){let e=oa.getState(r);return e?e.done.eventCount:0}/**
11
11
  * @toast-ui/editor
12
12
  * @version 3.2.2 | Fri Feb 17 2023
@@ -714,7 +714,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
714
714
  `&&this.buffer.push(`
715
715
  `)},h.prototype.addOuterNewLine=function(d){d.outerNewLine&&this.addNewLine()},h.prototype.addInnerNewLine=function(d){d.innerNewLine&&this.addNewLine()},h.prototype.renderTextNode=function(d){this.buffer.push(po(d.content))},h.prototype.renderRawHtmlNode=function(d){this.addOuterNewLine(d),this.buffer.push(d.content),this.addOuterNewLine(d)},h.prototype.renderElementNode=function(d){d.type==="openTag"?(this.addOuterNewLine(d),this.generateOpenTagString(d),d.selfClose?this.addOuterNewLine(d):this.addInnerNewLine(d)):(this.addInnerNewLine(d),this.generateCloseTagString(d),this.addOuterNewLine(d))},h}(),wX=f(956),CX=f.n(wX),TX=f(969),Xp=f.n(TX),SX=f(348),Zp=f.n(SX),xX=f(349),Qp=f.n(xX),EX=f(204),ev=f.n(EX),MX=f(462),ff=f.n(MX),AX=f(522),tv=f.n(AX),OX=f(990),NX=f.n(OX),DX=f(322),LX=f.n(DX),RX=f(758),IX=f.n(RX),PX=f(929),xl=f.n(PX),BX=f(714),FX=f.n(BX);f(471);var rv="[A-Za-z][A-Za-z0-9-]*",qX="[a-zA-Z_:][a-zA-Z0-9:._-]*",HX="[^\"'=<>`\\x00-\\x20]+",_X="'[^']*'",zX='"[^"]*"',VX="(?:"+HX+"|"+_X+"|"+zX+")",UX="(?:\\s*=\\s*"+VX+")",nv="(?:\\s+"+qX+UX+"?)",$X="<("+rv+")("+nv+")*\\s*/?>",WX="</("+rv+")\\s*[>]",jX="(?:"+$X+"|"+WX+")",iv=new RegExp("^"+jX,"i");f(934),f(391);function df(h,d){return h.indexOf(d)!==-1}var GX=["rel","target","hreflang","type"];function KX(h){if(!h)return null;var d={};return GX.forEach(function(y){xl()(h[y])||(d[y]=h[y])}),d}function JX(h){return h[h.length-1]}function hf(h){return typeof h=="object"&&h!==null}function pf(h,d){var y=k({},h);return h&&d&&Object.keys(d).forEach(function(S){hf(y[S])?Array.isArray(d[S])?y[S]=vf(d[S]):y.hasOwnProperty(S)?y[S]=pf(y[S],d[S]):y[S]=mf(d[S]):y[S]=d[S]}),y}function vf(h){return h.map(function(d){return hf(d)?Array.isArray(d)?vf(d):mf(d):d})}function mf(h){var d=Object.keys(h);return d.length?d.reduce(function(y,S){return hf(h[S])?y[S]=Array.isArray(h[S])?vf(h[S]):mf(h[S]):y[S]=h[S],y},{}):h}function av(h,d){return d===void 0&&(d={}),Object.keys(d).forEach(function(y){h.hasOwnProperty(y)&&typeof h[y]=="object"?Array.isArray(d[y])?h[y]=d[y]:av(h[y],d[y]):h[y]=d[y]}),h}function ov(h,d){return h>d?[d,h]:[h,d]}function YX(h,d,y){var S=parseInt(h.left,10),L=parseInt(h.top,10),U=parseInt(h.width,10)+parseInt(h.paddingLeft,10)+parseInt(h.paddingRight,10),G=parseInt(h.height,10)+parseInt(h.paddingTop,10)+parseInt(h.paddingBottom,10);return d>=S&&d<=S+U&&y>=L&&y<=L+G}var XX="toastui-editor-";function El(){for(var h=[],d=0;d<arguments.length;d++)h[d]=arguments[d];for(var y=[],S=0,L=h;S<L.length;S++){var U=L[S],G=void 0;Array.isArray(U)?G=U[0]?U[1]:null:G=U,G&&y.push(""+XX+G)}return y.join(" ")}function sv(h){h.parentNode&&h.parentNode.removeChild(h)}function lv(h,d,y){xl()(y)&&(y=!FX()(h,d));var S=y?ev():ff();S(h,d)}function ZX(h,d){var y=document.createElement("div");IX()(h)?y.innerHTML=h:y.appendChild(h);var S=y.firstChild;return S}function QX(h){var d=/<img class="ProseMirror-separator" alt="">/g,y=/ class="ProseMirror-trailingBreak"/g,S=h;return S=S.replace(d,""),S=S.replace(y,""),S}var eZ=f(294),uv=f.n(eZ);function tZ(h){return h.sourcepos[0][1]}function rZ(h){switch(h.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":case"customInline":return!0;default:return!1}}function nZ(h,d,y){for(y===void 0&&(y=!0),h=y?h:h.parent;h&&h.type!=="document";){if(d(h))return h;h=h.parent}return null}function iZ(h){var d=h.firstChild.literal;switch(h.type){case"emph":return"*"+d+"*";case"strong":return"**"+d+"**";case"strike":return"~~"+d+"~~";case"code":return"`"+d+"`";case"link":case"image":var y=h,S=y.destination,L=y.title,U=h.type==="link"?"":"!";return U+"["+d+"]("+S+(L?' "'+L+'"':"")+")";default:return null}}var aZ={},cv=/\$\$widget\d+\s/;function fv(h){var d=h.search(cv);if(d!==-1){var y=h.substring(d),S=y.replace(cv,"").replace("$$","");h=h.substring(0,d),h+=fv(S)}return h}function oZ(h,d){var y=aZ[h],S=y.rule,L=y.toDOM,U=fv(d).match(S);return U&&(d=U[0]),L(d)}function sZ(h){for(var d,y="",S=h.walker();d=S.next();){var L=d.node,U=d.entering;U&&(L!==h&&L.type!=="text"?(y+=iZ(L),S.resumeAt(h,!1),S.next()):L.type==="text"&&(y+=L.literal))}return y}var lZ=f(368),uZ=f.n(lZ),cZ=["iframe","embed"],dv=[];function fZ(h){df(cZ,h)&&dv.push(h.toLowerCase())}function dZ(h,d){return uZ().sanitize(h,k({ADD_TAGS:dv,ADD_ATTR:["rel","target","hreflang","type"],FORBID_TAGS:["input","script","textarea","form","button","select","meta","style","link","title","object","base"]},d))}function hZ(h,d){return h.literal.replace(new RegExp("(<\\s*"+d+"[^>]*>)|(</"+d+"\\s*[>])","ig"),"").trim()}function pZ(h){h=h.match(iv)[0];var d=h.match(new RegExp(nv,"g"));return d?d.reduce(function(y,S){var L=S.trim().split("="),U=L[0],G=L.slice(1);return G.length&&(y[U]=G.join("=").replace(/'|"/g,"").trim()),y},{}):{}}var vZ=/^\s*<\s*\//,mZ={paragraph:function(h,d){var y=d.entering,S=d.origin,L=d.options;return L.nodeId?{type:y?"openTag":"closeTag",outerNewLine:!0,tagName:"p"}:S()},softbreak:function(h){var d=h.prev&&h.prev.type==="htmlInline",y=d&&/<br ?\/?>/.test(h.prev.literal),S=y?`
716
716
  `:`<br>
717
- `;return{type:"html",content:S}},item:function(h,d){var y=d.entering;if(y){var S={},L=[];return h.listData.task&&(S["data-task"]="",L.push("task-list-item"),h.listData.checked&&(L.push("checked"),S["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:L,attributes:S,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(h){var d={"data-backticks":String(h.tickCount)};return[{type:"openTag",tagName:"code",attributes:d},{type:"text",content:h.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(h){var d=h,y=d.fenceLength,S=d.info,L=S?S.split(/\s+/):[],U=[],G={};if(y>3&&(G["data-backticks"]=y),L.length>0&&L[0].length>0){var ee=L[0];U.push("lang-"+ee),G["data-language"]=ee}return[{type:"openTag",tagName:"pre",classNames:U},{type:"openTag",tagName:"code",attributes:G},{type:"text",content:h.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(h,d){var y=d.origin,S=d.entering,L=d.skipChildren,U=h.info;if(U.indexOf("widget")!==-1&&S){L();var G=sZ(h),ee=oZ(U,G).outerHTML;return[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:ee},{type:"closeTag",tagName:"span"}]}return y()}};function gZ(h,d){var y=k({},mZ);return h&&(y.link=function(S,L){var U=L.entering,G=L.origin,ee=G();return U&&(ee.attributes=k(k({},ee.attributes),h)),ee}),d&&Object.keys(d).forEach(function(S){var L=y[S],U=d[S];L&&uv()(U)?y[S]=function(G,ee){var Se=k({},ee);return Se.origin=function(){return L(G,ee)},U(G,Se)}:df(["htmlBlock","htmlInline"],S)&&!uv()(U)?y[S]=function(G,ee){var Se=G.literal.match(iv);if(Se){var Ae=Se[0],Ve=Se[1],je=Se[3],qe=(Ve||je).toLowerCase(),rt=U[qe],et=hZ(G,qe);if(rt){var Lt=k({},G);return Lt.attrs=pZ(Ae),Lt.childrenHTML=et,Lt.type=qe,ee.entering=!vZ.test(G.literal),rt(Lt,ee)}}return ee.origin()}:y[S]=U}),y}var yZ=["UL","OL","BLOCKQUOTE"];function bZ(h,d){for(var y=0;h&&h!==d&&(df(yZ,h.tagName)||(y+=h.offsetTop),h.offsetParent!==d.offsetParent);)h=h.parentElement;return y}function kZ(h,d){for(var y=d,S=null;y;){var L=y.firstElementChild;if(!L)break;var U=hv(L,h,bZ(y,d));S=y,y=U}var G=y||S;return G===d?null:G}function hv(h,d,y){return h&&d>y+h.offsetTop?hv(h.nextElementSibling,d,y)||h:null}var wZ={};function gf(h){h&&(delete wZ[Number(h.getAttribute("data-nodeid"))],NX()(h.children).forEach(function(d){gf(d)}))}var yf=El("md-preview-highlight");function CZ(h,d){for(var y=h.firstChild;y&&y.next&&!(tZ(y.next)>d+1);)y=y.next;return y}var TZ=function(){function h(d,y){var S=document.createElement("div");this.el=S,this.eventEmitter=d,this.isViewer=!!y.isViewer,this.el.className=El("md-preview");var L=y.linkAttributes,U=y.customHTMLRenderer,G=y.sanitizer,ee=y.highlight,Se=ee===void 0?!1:ee;this.renderer=new kX({gfm:!0,nodeId:!0,convertors:gZ(L,U)}),this.cursorNodeId=null,this.sanitizer=G,this.initEvent(Se),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return h.prototype.initContentSection=function(){this.previewContent=ZX('<div class="'+El("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},h.prototype.toggleActive=function(d){lv(this.el,"active",d)},h.prototype.initEvent=function(d){var y=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),!this.isViewer&&(d&&(this.eventEmitter.listen("changeToolbarState",function(S){var L=S.mdNode,U=S.cursorPos;y.updateCursorNode(L,U)}),this.eventEmitter.listen("blur",function(){y.removeHighlight()})),Zp()(this.el,"scroll",function(S){y.eventEmitter.emit("scroll","preview",kZ(S.target.scrollTop,y.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return y.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return y.toggleActive(!1)}))},h.prototype.removeHighlight=function(){if(this.cursorNodeId){var d=this.getElementByNodeId(this.cursorNodeId);d&&ff()(d,yf)}},h.prototype.updateCursorNode=function(d,y){d&&(d=nZ(d,function(G){return!rZ(G)}),d.type==="tableRow"?d=CZ(d,y[1]):d.type==="tableBody"&&(d=null));var S=d?d.id:null;if(this.cursorNodeId!==S){var L=this.getElementByNodeId(this.cursorNodeId),U=this.getElementByNodeId(S);L&&ff()(L,yf),U&&ev()(U,yf),this.cursorNodeId=S}},h.prototype.getElementByNodeId=function(d){return d?this.previewContent.querySelector('[data-nodeid="'+d+'"]'):null},h.prototype.update=function(d){var y=this;d.forEach(function(S){return y.replaceRangeNodes(S)}),this.eventEmitter.emit("afterPreviewRender",this)},h.prototype.replaceRangeNodes=function(d){var y=this,S=d.nodes,L=d.removedNodeRange,U=this.previewContent,G=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(S.map(function(et){return y.renderer.render(et)}).join("")));if(!L)U.insertAdjacentHTML("afterbegin",G);else{var ee=L.id,Se=ee[0],Ae=ee[1],Ve=this.getElementByNodeId(Se),je=this.getElementByNodeId(Ae);if(Ve){Ve.insertAdjacentHTML("beforebegin",G);for(var qe=Ve;qe&&qe!==je;){var rt=qe.nextElementSibling;sv(qe),gf(qe),qe=rt}qe!=null&&qe.parentNode&&(sv(qe),gf(qe))}}},h.prototype.getRenderer=function(){return this.renderer},h.prototype.destroy=function(){Qp()(this.el,"scroll"),this.el=null},h.prototype.getElement=function(){return this.el},h.prototype.getHTML=function(){return QX(this.previewContent.innerHTML)},h.prototype.setHTML=function(d){this.previewContent.innerHTML=d},h.prototype.setHeight=function(d){tv()(this.el,{height:d+"px"})},h.prototype.setMinHeight=function(d){tv()(this.el,{minHeight:d+"px"})},h}(),SZ=TZ,Ml=f(814),bf=f(479),pv=f(311),xZ=f(481),EZ=f(43),MZ=f(928),AZ=f.n(MZ),OZ=function(){function h(){this.keys=[],this.values=[]}return h.prototype.getKeyIndex=function(d){return AZ()(d,this.keys)},h.prototype.get=function(d){return this.values[this.getKeyIndex(d)]},h.prototype.set=function(d,y){var S=this.getKeyIndex(d);return S>-1?this.values[S]=y:(this.keys.push(d),this.values.push(y)),this},h.prototype.has=function(d){return this.getKeyIndex(d)>-1},h.prototype.delete=function(d){var y=this.getKeyIndex(d);return y>-1?(this.keys.splice(y,1),this.values.splice(y,1),!0):!1},h.prototype.forEach=function(d,y){var S=this;y===void 0&&(y=this),this.values.forEach(function(L,U){L&&S.keys[U]&&d.call(y,L,S.keys[U],S)})},h.prototype.clear=function(){this.keys=[],this.values=[]},h}(),vv=OZ,kf="en-US",NZ=function(){function h(){this.code=kf,this.langs=new vv}return h.prototype.setCode=function(d){this.code=d||kf},h.prototype.setLanguage=function(d,y){var S=this;d=[].concat(d),d.forEach(function(L){if(!S.langs.has(L))S.langs.set(L,y);else{var U=S.langs.get(L);S.langs.set(L,Xp()(U,y))}})},h.prototype.get=function(d,y){y||(y=this.code);var S=this.langs.get(y);S||(S=this.langs.get(kf));var L=S[d];if(!L)throw new Error('There is no text key "'+d+'" in '+y);return L},h}(),DZ=new NZ;function LZ(h,d){for(var y=h.depth;y;){var S=h.node(y);if(d(S,y))return{node:S,depth:y,offset:y>0?h.before(y):0};y-=1}return null}var mv=new Map,gv=function(){function h(d,y,S,L){this.table=d,this.tableRows=y,this.tableStartPos=S,this.rowInfo=L}return h.create=function(d){var y=LZ(d,function(et){var Lt=et.type;return Lt.name==="table"});if(y){var S=y.node,L=y.depth,U=y.offset,G=mv.get(S);if((G==null?void 0:G.tableStartPos)===U+1)return G;var ee=[],Se=d.start(L),Ae=S.child(0),Ve=S.child(1),je=wf(Ae,Se),qe=wf(Ve,Se+Ae.nodeSize);Ae.forEach(function(et){return ee.push(et)}),Ve.forEach(function(et){return ee.push(et)});var rt=new h(S,ee,Se,je.concat(qe));return mv.set(S,rt),rt}return null},Object.defineProperty(h.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),h.prototype.getCellInfo=function(d,y){return this.rowInfo[d][y]},h.prototype.posAt=function(d,y){for(var S=0,L=this.tableStartPos;;S+=1){var U=L+this.tableRows[S].nodeSize;if(S===d){for(var G=y;G<this.totalColumnCount&&this.rowInfo[S][G].offset<L;)G+=1;return G===this.totalColumnCount?U:this.rowInfo[S][G].offset}L=U}},h.prototype.getNodeAndPos=function(d,y){var S=this.rowInfo[d][y];return{node:this.table.nodeAt(S.offset-this.tableStartOffset),pos:S.offset}},h.prototype.extendedRowspan=function(d,y){return!1},h.prototype.extendedColspan=function(d,y){return!1},h.prototype.getRowspanCount=function(d,y){return 0},h.prototype.getColspanCount=function(d,y){return 0},h.prototype.decreaseColspanCount=function(d,y){return 0},h.prototype.decreaseRowspanCount=function(d,y){return 0},h.prototype.getColspanStartInfo=function(d,y){return null},h.prototype.getRowspanStartInfo=function(d,y){return null},h.prototype.getCellStartOffset=function(d,y){var S=this.rowInfo[d][y].offset;return this.extendedRowspan(d,y)?this.posAt(d,y):S},h.prototype.getCellEndOffset=function(d,y){var S=this.rowInfo[d][y],L=S.offset,U=S.nodeSize;return this.extendedRowspan(d,y)?this.posAt(d,y):L+U},h.prototype.getCellIndex=function(d){for(var y=0;y<this.totalRowCount;y+=1)for(var S=this.rowInfo[y],L=0;L<this.totalColumnCount;L+=1)if(S[L].offset+1>d.pos)return[y,L];return[0,0]},h.prototype.getRectOffsets=function(d,y){var S,L,U;y===void 0&&(y=d),d.pos>y.pos&&(S=[y,d],d=S[0],y=S[1]);var G=this.getCellIndex(d),ee=G[0],Se=G[1],Ae=this.getCellIndex(y),Ve=Ae[0],je=Ae[1];return L=ov(ee,Ve),ee=L[0],Ve=L[1],U=ov(Se,je),Se=U[0],je=U[1],this.getSpannedOffsets({startRowIdx:ee,startColIdx:Se,endRowIdx:Ve,endColIdx:je})},h.prototype.getSpannedOffsets=function(d){return d},h}(),wf=function(h,d){var y=[];return h.forEach(function(S,L){var U={rowspanMap:{},colspanMap:{},length:0};S.forEach(function(G,ee){for(var Se=G.nodeSize,Ae=0;U[Ae];)Ae+=1;U[Ae]={offset:d+L+ee+2,nodeSize:Se},U.length+=1}),y.push(U)}),y};function RZ(h,d){return av(gv.prototype,h),wf=d,gv}function IZ(h){var d=h.plugin,y=h.eventEmitter,S=h.usageStatistics,L=h.instance,U={Plugin:Ml.Plugin,PluginKey:Ml.PluginKey,Selection:Ml.Selection,TextSelection:Ml.TextSelection},G={Decoration:pv.Decoration,DecorationSet:pv.DecorationSet},ee={Fragment:EZ.Fragment},Se={InputRule:bf.InputRule,inputRules:bf.inputRules,undoInputRule:bf.undoInputRule},Ae={keymap:xZ.keymap},Ve={eventEmitter:y,usageStatistics:S,instance:L,pmState:U,pmView:G,pmModel:ee,pmRules:Se,pmKeymap:Ae,i18n:DZ};if(LX()(d)){var je=d[0],qe=d[1],rt=qe===void 0?{}:qe;return je(Ve,rt)}return d(Ve)}function PZ(h){var d=h.plugins,y=h.eventEmitter,S=h.usageStatistics,L=h.instance;return y.listen("mixinTableOffsetMapPrototype",RZ),(d??[]).reduce(function(U,G){var ee=IZ({plugin:G,eventEmitter:y,usageStatistics:S,instance:L});if(!ee)throw new Error("The return value of the executed plugin is empty.");var Se=ee.markdownParsers,Ae=ee.toHTMLRenderers,Ve=ee.toMarkdownRenderers,je=ee.markdownPlugins,qe=ee.wysiwygPlugins,rt=ee.wysiwygNodeViews,et=ee.markdownCommands,Lt=ee.wysiwygCommands,ar=ee.toolbarItems;return Ae&&(U.toHTMLRenderers=pf(U.toHTMLRenderers,Ae)),Ve&&(U.toMarkdownRenderers=pf(U.toMarkdownRenderers,Ve)),je&&(U.mdPlugins=U.mdPlugins.concat(je)),qe&&(U.wwPlugins=U.wwPlugins.concat(qe)),rt&&(U.wwNodeViews=k(k({},U.wwNodeViews),rt)),et&&(U.mdCommands=k(k({},U.mdCommands),et)),Lt&&(U.wwCommands=k(k({},U.wwCommands),Lt)),ar&&(U.toolbarItems=U.toolbarItems.concat(ar)),Se&&(U.markdownParsers=k(k({},U.markdownParsers),Se)),U},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var BZ=f(404),FZ=f.n(BZ),yv=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],qZ=function(){function h(){var d=this;this.events=new vv,this.eventTypes=yv.reduce(function(y,S){return k(k({},y),{type:S})},{}),this.hold=!1,yv.forEach(function(y){d.addEventType(y)})}return h.prototype.listen=function(d,y){var S=this.getTypeInfo(d),L=this.events.get(S.type)||[];if(!this.hasEventType(S.type))throw new Error("There is no event type "+S.type);S.namespace&&(y.namespace=S.namespace),L.push(y),this.events.set(S.type,L)},h.prototype.emit=function(d){for(var y=[],S=1;S<arguments.length;S++)y[S-1]=arguments[S];var L=this.getTypeInfo(d),U=this.events.get(L.type),G=[];return!this.hold&&U&&U.forEach(function(ee){var Se=ee.apply(void 0,y);xl()(Se)||G.push(Se)}),G},h.prototype.emitReduce=function(d,y){for(var S=[],L=2;L<arguments.length;L++)S[L-2]=arguments[L];var U=this.events.get(d);return!this.hold&&U&&U.forEach(function(G){var ee=G.apply(void 0,T([y],S));FZ()(ee)||(y=ee)}),y},h.prototype.getTypeInfo=function(d){var y=d.split(".");return{type:y[0],namespace:y[1]}},h.prototype.hasEventType=function(d){return!xl()(this.eventTypes[this.getTypeInfo(d).type])},h.prototype.addEventType=function(d){if(this.hasEventType(d))throw new Error("There is already have event type "+d);this.eventTypes[d]=d},h.prototype.removeEventHandler=function(d,y){var S=this,L=this.getTypeInfo(d),U=L.type,G=L.namespace;U&&y?this.removeEventHandlerWithHandler(U,y):U&&!G?this.events.delete(U):!U&&G?this.events.forEach(function(ee,Se){S.removeEventHandlerWithTypeInfo(Se,G)}):U&&G&&this.removeEventHandlerWithTypeInfo(U,G)},h.prototype.removeEventHandlerWithHandler=function(d,y){var S=this.events.get(d);if(S){var L=S.indexOf(y);S.indexOf(y)>=0&&S.splice(L,1)}},h.prototype.removeEventHandlerWithTypeInfo=function(d,y){var S=[],L=this.events.get(d);L&&(L.map(function(U){return U.namespace!==y&&S.push(U),null}),this.events.set(d,S))},h.prototype.getEvents=function(){return this.events},h.prototype.holdEventInvoke=function(d){this.hold=!0,d(),this.hold=!1},h}(),HZ=qZ,_Z="data-task",zZ="data-task-disabled",VZ="checked";function UZ(h){["htmlBlock","htmlInline"].forEach(function(d){h[d]&&Object.keys(h[d]).forEach(function(y){return fZ(y)})})}var $Z=function(){function h(d){var y=this;this.options=Xp()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},d),this.eventEmitter=new HZ;var S=KX(this.options.linkAttributes),L=PZ({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this})||{},U=L.toHTMLRenderers,G=L.markdownParsers,ee=this.options,Se=ee.customHTMLRenderer,Ae=ee.extendedAutolinks,Ve=ee.referenceDefinition,je=ee.frontMatter,qe=ee.customHTMLSanitizer,rt={linkAttributes:S,customHTMLRenderer:k(k({},U),Se),extendedAutolinks:Ae,referenceDefinition:Ve,frontMatter:je,sanitizer:qe||dZ};UZ(rt.customHTMLRenderer),this.options.events&&CX()(this.options.events,function(In,Cn){y.on(Cn,In)});var et=this.options,Lt=et.el,ar=et.initialValue,Cr=et.theme,wi=Lt.innerHTML;Cr!=="light"&&Lt.classList.add(El(Cr)),Lt.innerHTML="",this.toastMark=new mX("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:Ae,referenceDefinition:Ve,disallowDeepHeading:!0,frontMatter:je,customParser:G}),this.preview=new SZ(this.eventEmitter,k(k({},rt),{isViewer:!0})),Zp()(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),ar?this.setMarkdown(ar):wi&&this.preview.setHTML(wi),Lt.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return h.prototype.toggleTask=function(d){var y=d.target,S=getComputedStyle(y,":before");!y.hasAttribute(zZ)&&y.hasAttribute(_Z)&&YX(S,d.offsetX,d.offsetY)&&(lv(y,VZ),this.eventEmitter.emit("change",{source:"viewer",date:d}))},h.prototype.setMarkdown=function(d){var y=this.toastMark.getLineTexts(),S=y.length,L=JX(y),U=[S,L.length+1],G=this.toastMark.editMarkdown([1,1],U,d||"");this.eventEmitter.emit("updatePreview",G)},h.prototype.on=function(d,y){this.eventEmitter.listen(d,y)},h.prototype.off=function(d){this.eventEmitter.removeEventHandler(d)},h.prototype.addHook=function(d,y){this.eventEmitter.removeEventHandler(d),this.eventEmitter.listen(d,y)},h.prototype.destroy=function(){Qp()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},h.prototype.isViewer=function(){return!0},h.prototype.isMarkdownMode=function(){return!1},h.prototype.isWysiwygMode=function(){return!1},h}(),WZ=$Z,jZ=WZ}(),p=p.default,p}()})}(ld)),ld.exports}var jJe=WJe();const GJe=KZ(jJe);/**
717
+ `;return{type:"html",content:S}},item:function(h,d){var y=d.entering;if(y){var S={},L=[];return h.listData.task&&(S["data-task"]="",L.push("task-list-item"),h.listData.checked&&(L.push("checked"),S["data-task-checked"]="")),{type:"openTag",tagName:"li",classNames:L,attributes:S,outerNewLine:!0}}return{type:"closeTag",tagName:"li",outerNewLine:!0}},code:function(h){var d={"data-backticks":String(h.tickCount)};return[{type:"openTag",tagName:"code",attributes:d},{type:"text",content:h.literal},{type:"closeTag",tagName:"code"}]},codeBlock:function(h){var d=h,y=d.fenceLength,S=d.info,L=S?S.split(/\s+/):[],U=[],G={};if(y>3&&(G["data-backticks"]=y),L.length>0&&L[0].length>0){var ee=L[0];U.push("lang-"+ee),G["data-language"]=ee}return[{type:"openTag",tagName:"pre",classNames:U},{type:"openTag",tagName:"code",attributes:G},{type:"text",content:h.literal},{type:"closeTag",tagName:"code"},{type:"closeTag",tagName:"pre"}]},customInline:function(h,d){var y=d.origin,S=d.entering,L=d.skipChildren,U=h.info;if(U.indexOf("widget")!==-1&&S){L();var G=sZ(h),ee=oZ(U,G).outerHTML;return[{type:"openTag",tagName:"span",classNames:["tui-widget"]},{type:"html",content:ee},{type:"closeTag",tagName:"span"}]}return y()}};function gZ(h,d){var y=k({},mZ);return h&&(y.link=function(S,L){var U=L.entering,G=L.origin,ee=G();return U&&(ee.attributes=k(k({},ee.attributes),h)),ee}),d&&Object.keys(d).forEach(function(S){var L=y[S],U=d[S];L&&uv()(U)?y[S]=function(G,ee){var Se=k({},ee);return Se.origin=function(){return L(G,ee)},U(G,Se)}:df(["htmlBlock","htmlInline"],S)&&!uv()(U)?y[S]=function(G,ee){var Se=G.literal.match(iv);if(Se){var Ae=Se[0],Ve=Se[1],je=Se[3],qe=(Ve||je).toLowerCase(),rt=U[qe],et=hZ(G,qe);if(rt){var Lt=k({},G);return Lt.attrs=pZ(Ae),Lt.childrenHTML=et,Lt.type=qe,ee.entering=!vZ.test(G.literal),rt(Lt,ee)}}return ee.origin()}:y[S]=U}),y}var yZ=["UL","OL","BLOCKQUOTE"];function bZ(h,d){for(var y=0;h&&h!==d&&(df(yZ,h.tagName)||(y+=h.offsetTop),h.offsetParent!==d.offsetParent);)h=h.parentElement;return y}function kZ(h,d){for(var y=d,S=null;y;){var L=y.firstElementChild;if(!L)break;var U=hv(L,h,bZ(y,d));S=y,y=U}var G=y||S;return G===d?null:G}function hv(h,d,y){return h&&d>y+h.offsetTop?hv(h.nextElementSibling,d,y)||h:null}var wZ={};function gf(h){h&&(delete wZ[Number(h.getAttribute("data-nodeid"))],NX()(h.children).forEach(function(d){gf(d)}))}var yf=El("md-preview-highlight");function CZ(h,d){for(var y=h.firstChild;y&&y.next&&!(tZ(y.next)>d+1);)y=y.next;return y}var TZ=function(){function h(d,y){var S=document.createElement("div");this.el=S,this.eventEmitter=d,this.isViewer=!!y.isViewer,this.el.className=El("md-preview");var L=y.linkAttributes,U=y.customHTMLRenderer,G=y.sanitizer,ee=y.highlight,Se=ee===void 0?!1:ee;this.renderer=new kX({gfm:!0,nodeId:!0,convertors:gZ(L,U)}),this.cursorNodeId=null,this.sanitizer=G,this.initEvent(Se),this.initContentSection(),this.isViewer&&(this.previewContent.style.overflowWrap="break-word")}return h.prototype.initContentSection=function(){this.previewContent=ZX('<div class="'+El("contents")+'"></div>'),this.isViewer||this.el.appendChild(this.previewContent)},h.prototype.toggleActive=function(d){lv(this.el,"active",d)},h.prototype.initEvent=function(d){var y=this;this.eventEmitter.listen("updatePreview",this.update.bind(this)),!this.isViewer&&(d&&(this.eventEmitter.listen("changeToolbarState",function(S){var L=S.mdNode,U=S.cursorPos;y.updateCursorNode(L,U)}),this.eventEmitter.listen("blur",function(){y.removeHighlight()})),Zp()(this.el,"scroll",function(S){y.eventEmitter.emit("scroll","preview",kZ(S.target.scrollTop,y.previewContent))}),this.eventEmitter.listen("changePreviewTabPreview",function(){return y.toggleActive(!0)}),this.eventEmitter.listen("changePreviewTabWrite",function(){return y.toggleActive(!1)}))},h.prototype.removeHighlight=function(){if(this.cursorNodeId){var d=this.getElementByNodeId(this.cursorNodeId);d&&ff()(d,yf)}},h.prototype.updateCursorNode=function(d,y){d&&(d=nZ(d,function(G){return!rZ(G)}),d.type==="tableRow"?d=CZ(d,y[1]):d.type==="tableBody"&&(d=null));var S=d?d.id:null;if(this.cursorNodeId!==S){var L=this.getElementByNodeId(this.cursorNodeId),U=this.getElementByNodeId(S);L&&ff()(L,yf),U&&ev()(U,yf),this.cursorNodeId=S}},h.prototype.getElementByNodeId=function(d){return d?this.previewContent.querySelector('[data-nodeid="'+d+'"]'):null},h.prototype.update=function(d){var y=this;d.forEach(function(S){return y.replaceRangeNodes(S)}),this.eventEmitter.emit("afterPreviewRender",this)},h.prototype.replaceRangeNodes=function(d){var y=this,S=d.nodes,L=d.removedNodeRange,U=this.previewContent,G=this.eventEmitter.emitReduce("beforePreviewRender",this.sanitizer(S.map(function(et){return y.renderer.render(et)}).join("")));if(!L)U.insertAdjacentHTML("afterbegin",G);else{var ee=L.id,Se=ee[0],Ae=ee[1],Ve=this.getElementByNodeId(Se),je=this.getElementByNodeId(Ae);if(Ve){Ve.insertAdjacentHTML("beforebegin",G);for(var qe=Ve;qe&&qe!==je;){var rt=qe.nextElementSibling;sv(qe),gf(qe),qe=rt}qe!=null&&qe.parentNode&&(sv(qe),gf(qe))}}},h.prototype.getRenderer=function(){return this.renderer},h.prototype.destroy=function(){Qp()(this.el,"scroll"),this.el=null},h.prototype.getElement=function(){return this.el},h.prototype.getHTML=function(){return QX(this.previewContent.innerHTML)},h.prototype.setHTML=function(d){this.previewContent.innerHTML=d},h.prototype.setHeight=function(d){tv()(this.el,{height:d+"px"})},h.prototype.setMinHeight=function(d){tv()(this.el,{minHeight:d+"px"})},h}(),SZ=TZ,Ml=f(814),bf=f(479),pv=f(311),xZ=f(481),EZ=f(43),MZ=f(928),AZ=f.n(MZ),OZ=function(){function h(){this.keys=[],this.values=[]}return h.prototype.getKeyIndex=function(d){return AZ()(d,this.keys)},h.prototype.get=function(d){return this.values[this.getKeyIndex(d)]},h.prototype.set=function(d,y){var S=this.getKeyIndex(d);return S>-1?this.values[S]=y:(this.keys.push(d),this.values.push(y)),this},h.prototype.has=function(d){return this.getKeyIndex(d)>-1},h.prototype.delete=function(d){var y=this.getKeyIndex(d);return y>-1?(this.keys.splice(y,1),this.values.splice(y,1),!0):!1},h.prototype.forEach=function(d,y){var S=this;y===void 0&&(y=this),this.values.forEach(function(L,U){L&&S.keys[U]&&d.call(y,L,S.keys[U],S)})},h.prototype.clear=function(){this.keys=[],this.values=[]},h}(),vv=OZ,kf="en-US",NZ=function(){function h(){this.code=kf,this.langs=new vv}return h.prototype.setCode=function(d){this.code=d||kf},h.prototype.setLanguage=function(d,y){var S=this;d=[].concat(d),d.forEach(function(L){if(!S.langs.has(L))S.langs.set(L,y);else{var U=S.langs.get(L);S.langs.set(L,Xp()(U,y))}})},h.prototype.get=function(d,y){y||(y=this.code);var S=this.langs.get(y);S||(S=this.langs.get(kf));var L=S[d];if(!L)throw new Error('There is no text key "'+d+'" in '+y);return L},h}(),DZ=new NZ;function LZ(h,d){for(var y=h.depth;y;){var S=h.node(y);if(d(S,y))return{node:S,depth:y,offset:y>0?h.before(y):0};y-=1}return null}var mv=new Map,gv=function(){function h(d,y,S,L){this.table=d,this.tableRows=y,this.tableStartPos=S,this.rowInfo=L}return h.create=function(d){var y=LZ(d,function(et){var Lt=et.type;return Lt.name==="table"});if(y){var S=y.node,L=y.depth,U=y.offset,G=mv.get(S);if((G==null?void 0:G.tableStartPos)===U+1)return G;var ee=[],Se=d.start(L),Ae=S.child(0),Ve=S.child(1),je=wf(Ae,Se),qe=wf(Ve,Se+Ae.nodeSize);Ae.forEach(function(et){return ee.push(et)}),Ve.forEach(function(et){return ee.push(et)});var rt=new h(S,ee,Se,je.concat(qe));return mv.set(S,rt),rt}return null},Object.defineProperty(h.prototype,"totalRowCount",{get:function(){return this.rowInfo.length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"totalColumnCount",{get:function(){return this.rowInfo[0].length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tableStartOffset",{get:function(){return this.tableStartPos},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tableEndOffset",{get:function(){return this.tableStartPos+this.table.nodeSize-1},enumerable:!1,configurable:!0}),h.prototype.getCellInfo=function(d,y){return this.rowInfo[d][y]},h.prototype.posAt=function(d,y){for(var S=0,L=this.tableStartPos;;S+=1){var U=L+this.tableRows[S].nodeSize;if(S===d){for(var G=y;G<this.totalColumnCount&&this.rowInfo[S][G].offset<L;)G+=1;return G===this.totalColumnCount?U:this.rowInfo[S][G].offset}L=U}},h.prototype.getNodeAndPos=function(d,y){var S=this.rowInfo[d][y];return{node:this.table.nodeAt(S.offset-this.tableStartOffset),pos:S.offset}},h.prototype.extendedRowspan=function(d,y){return!1},h.prototype.extendedColspan=function(d,y){return!1},h.prototype.getRowspanCount=function(d,y){return 0},h.prototype.getColspanCount=function(d,y){return 0},h.prototype.decreaseColspanCount=function(d,y){return 0},h.prototype.decreaseRowspanCount=function(d,y){return 0},h.prototype.getColspanStartInfo=function(d,y){return null},h.prototype.getRowspanStartInfo=function(d,y){return null},h.prototype.getCellStartOffset=function(d,y){var S=this.rowInfo[d][y].offset;return this.extendedRowspan(d,y)?this.posAt(d,y):S},h.prototype.getCellEndOffset=function(d,y){var S=this.rowInfo[d][y],L=S.offset,U=S.nodeSize;return this.extendedRowspan(d,y)?this.posAt(d,y):L+U},h.prototype.getCellIndex=function(d){for(var y=0;y<this.totalRowCount;y+=1)for(var S=this.rowInfo[y],L=0;L<this.totalColumnCount;L+=1)if(S[L].offset+1>d.pos)return[y,L];return[0,0]},h.prototype.getRectOffsets=function(d,y){var S,L,U;y===void 0&&(y=d),d.pos>y.pos&&(S=[y,d],d=S[0],y=S[1]);var G=this.getCellIndex(d),ee=G[0],Se=G[1],Ae=this.getCellIndex(y),Ve=Ae[0],je=Ae[1];return L=ov(ee,Ve),ee=L[0],Ve=L[1],U=ov(Se,je),Se=U[0],je=U[1],this.getSpannedOffsets({startRowIdx:ee,startColIdx:Se,endRowIdx:Ve,endColIdx:je})},h.prototype.getSpannedOffsets=function(d){return d},h}(),wf=function(h,d){var y=[];return h.forEach(function(S,L){var U={rowspanMap:{},colspanMap:{},length:0};S.forEach(function(G,ee){for(var Se=G.nodeSize,Ae=0;U[Ae];)Ae+=1;U[Ae]={offset:d+L+ee+2,nodeSize:Se},U.length+=1}),y.push(U)}),y};function RZ(h,d){return av(gv.prototype,h),wf=d,gv}function IZ(h){var d=h.plugin,y=h.eventEmitter,S=h.usageStatistics,L=h.instance,U={Plugin:Ml.Plugin,PluginKey:Ml.PluginKey,Selection:Ml.Selection,TextSelection:Ml.TextSelection},G={Decoration:pv.Decoration,DecorationSet:pv.DecorationSet},ee={Fragment:EZ.Fragment},Se={InputRule:bf.InputRule,inputRules:bf.inputRules,undoInputRule:bf.undoInputRule},Ae={keymap:xZ.keymap},Ve={eventEmitter:y,usageStatistics:S,instance:L,pmState:U,pmView:G,pmModel:ee,pmRules:Se,pmKeymap:Ae,i18n:DZ};if(LX()(d)){var je=d[0],qe=d[1],rt=qe===void 0?{}:qe;return je(Ve,rt)}return d(Ve)}function PZ(h){var d=h.plugins,y=h.eventEmitter,S=h.usageStatistics,L=h.instance;return y.listen("mixinTableOffsetMapPrototype",RZ),(d??[]).reduce(function(U,G){var ee=IZ({plugin:G,eventEmitter:y,usageStatistics:S,instance:L});if(!ee)throw new Error("The return value of the executed plugin is empty.");var Se=ee.markdownParsers,Ae=ee.toHTMLRenderers,Ve=ee.toMarkdownRenderers,je=ee.markdownPlugins,qe=ee.wysiwygPlugins,rt=ee.wysiwygNodeViews,et=ee.markdownCommands,Lt=ee.wysiwygCommands,ar=ee.toolbarItems;return Ae&&(U.toHTMLRenderers=pf(U.toHTMLRenderers,Ae)),Ve&&(U.toMarkdownRenderers=pf(U.toMarkdownRenderers,Ve)),je&&(U.mdPlugins=U.mdPlugins.concat(je)),qe&&(U.wwPlugins=U.wwPlugins.concat(qe)),rt&&(U.wwNodeViews=k(k({},U.wwNodeViews),rt)),et&&(U.mdCommands=k(k({},U.mdCommands),et)),Lt&&(U.wwCommands=k(k({},U.wwCommands),Lt)),ar&&(U.toolbarItems=U.toolbarItems.concat(ar)),Se&&(U.markdownParsers=k(k({},U.markdownParsers),Se)),U},{toHTMLRenderers:{},toMarkdownRenderers:{},mdPlugins:[],wwPlugins:[],wwNodeViews:{},mdCommands:{},wwCommands:{},toolbarItems:[],markdownParsers:{}})}var BZ=f(404),FZ=f.n(BZ),yv=["afterPreviewRender","updatePreview","changeMode","needChangeMode","command","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","scroll","contextmenu","show","hide","changeLanguage","changeToolbarState","toggleScrollSync","mixinTableOffsetMapPrototype","setFocusedNode","removePopupWidget","query","openPopup","closePopup","addImageBlobHook","beforePreviewRender","beforeConvertWysiwygToMarkdown","load","loadUI","change","caretChange","destroy","focus","blur","keydown","keyup"],qZ=function(){function h(){var d=this;this.events=new vv,this.eventTypes=yv.reduce(function(y,S){return k(k({},y),{type:S})},{}),this.hold=!1,yv.forEach(function(y){d.addEventType(y)})}return h.prototype.listen=function(d,y){var S=this.getTypeInfo(d),L=this.events.get(S.type)||[];if(!this.hasEventType(S.type))throw new Error("There is no event type "+S.type);S.namespace&&(y.namespace=S.namespace),L.push(y),this.events.set(S.type,L)},h.prototype.emit=function(d){for(var y=[],S=1;S<arguments.length;S++)y[S-1]=arguments[S];var L=this.getTypeInfo(d),U=this.events.get(L.type),G=[];return!this.hold&&U&&U.forEach(function(ee){var Se=ee.apply(void 0,y);xl()(Se)||G.push(Se)}),G},h.prototype.emitReduce=function(d,y){for(var S=[],L=2;L<arguments.length;L++)S[L-2]=arguments[L];var U=this.events.get(d);return!this.hold&&U&&U.forEach(function(G){var ee=G.apply(void 0,T([y],S));FZ()(ee)||(y=ee)}),y},h.prototype.getTypeInfo=function(d){var y=d.split(".");return{type:y[0],namespace:y[1]}},h.prototype.hasEventType=function(d){return!xl()(this.eventTypes[this.getTypeInfo(d).type])},h.prototype.addEventType=function(d){if(this.hasEventType(d))throw new Error("There is already have event type "+d);this.eventTypes[d]=d},h.prototype.removeEventHandler=function(d,y){var S=this,L=this.getTypeInfo(d),U=L.type,G=L.namespace;U&&y?this.removeEventHandlerWithHandler(U,y):U&&!G?this.events.delete(U):!U&&G?this.events.forEach(function(ee,Se){S.removeEventHandlerWithTypeInfo(Se,G)}):U&&G&&this.removeEventHandlerWithTypeInfo(U,G)},h.prototype.removeEventHandlerWithHandler=function(d,y){var S=this.events.get(d);if(S){var L=S.indexOf(y);S.indexOf(y)>=0&&S.splice(L,1)}},h.prototype.removeEventHandlerWithTypeInfo=function(d,y){var S=[],L=this.events.get(d);L&&(L.map(function(U){return U.namespace!==y&&S.push(U),null}),this.events.set(d,S))},h.prototype.getEvents=function(){return this.events},h.prototype.holdEventInvoke=function(d){this.hold=!0,d(),this.hold=!1},h}(),HZ=qZ,_Z="data-task",zZ="data-task-disabled",VZ="checked";function UZ(h){["htmlBlock","htmlInline"].forEach(function(d){h[d]&&Object.keys(h[d]).forEach(function(y){return fZ(y)})})}var $Z=function(){function h(d){var y=this;this.options=Xp()({linkAttributes:null,extendedAutolinks:!1,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1,usageStatistics:!0,theme:"light"},d),this.eventEmitter=new HZ;var S=KX(this.options.linkAttributes),L=PZ({plugins:this.options.plugins,eventEmitter:this.eventEmitter,usageStatistics:this.options.usageStatistics,instance:this})||{},U=L.toHTMLRenderers,G=L.markdownParsers,ee=this.options,Se=ee.customHTMLRenderer,Ae=ee.extendedAutolinks,Ve=ee.referenceDefinition,je=ee.frontMatter,qe=ee.customHTMLSanitizer,rt={linkAttributes:S,customHTMLRenderer:k(k({},U),Se),extendedAutolinks:Ae,referenceDefinition:Ve,frontMatter:je,sanitizer:qe||dZ};UZ(rt.customHTMLRenderer),this.options.events&&CX()(this.options.events,function(In,Cn){y.on(Cn,In)});var et=this.options,Lt=et.el,ar=et.initialValue,Cr=et.theme,wi=Lt.innerHTML;Cr!=="light"&&Lt.classList.add(El(Cr)),Lt.innerHTML="",this.toastMark=new mX("",{disallowedHtmlBlockTags:["br","img"],extendedAutolinks:Ae,referenceDefinition:Ve,disallowDeepHeading:!0,frontMatter:je,customParser:G}),this.preview=new SZ(this.eventEmitter,k(k({},rt),{isViewer:!0})),Zp()(this.preview.previewContent,"mousedown",this.toggleTask.bind(this)),ar?this.setMarkdown(ar):wi&&this.preview.setHTML(wi),Lt.appendChild(this.preview.previewContent),this.eventEmitter.emit("load",this)}return h.prototype.toggleTask=function(d){var y=d.target,S=getComputedStyle(y,":before");!y.hasAttribute(zZ)&&y.hasAttribute(_Z)&&YX(S,d.offsetX,d.offsetY)&&(lv(y,VZ),this.eventEmitter.emit("change",{source:"viewer",date:d}))},h.prototype.setMarkdown=function(d){var y=this.toastMark.getLineTexts(),S=y.length,L=JX(y),U=[S,L.length+1],G=this.toastMark.editMarkdown([1,1],U,d||"");this.eventEmitter.emit("updatePreview",G)},h.prototype.on=function(d,y){this.eventEmitter.listen(d,y)},h.prototype.off=function(d){this.eventEmitter.removeEventHandler(d)},h.prototype.addHook=function(d,y){this.eventEmitter.removeEventHandler(d),this.eventEmitter.listen(d,y)},h.prototype.destroy=function(){Qp()(this.preview.el,"mousedown",this.toggleTask.bind(this)),this.preview.destroy(),this.eventEmitter.emit("destroy")},h.prototype.isViewer=function(){return!0},h.prototype.isMarkdownMode=function(){return!1},h.prototype.isWysiwygMode=function(){return!1},h}(),WZ=$Z,jZ=WZ}(),p=p.default,p}()})}(ld)),ld.exports}var jJe=WJe();const GJe=YZ(jJe);/**
718
718
  * TOAST UI Editor : React Wrapper
719
719
  * @version 3.2.3 | Fri Feb 17 2023
720
720
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
@@ -842,4 +842,4 @@ PERFORMANCE OF THIS SOFTWARE.
842
842
  * @version 3.2.2 | Fri Feb 17 2023
843
843
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
844
844
  * @license MIT
845
- */Kt.setLanguage(["uk","uk-UA"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Написати",Preview:"Попередній перегляд",Headings:"Заголовки",Paragraph:"Абзац",Bold:"Жирний",Italic:"Курсив",Strike:"Закреслений",Code:"Вбудований код",Line:"Лінія",Blockquote:"Блок цитування","Unordered list":"Невпорядкований список","Ordered list":"Упорядкований список",Task:"Завдання",Indent:"відступ",Outdent:"застарілий","Insert link":"Вставити посилання","Insert CodeBlock":"Вставити код","Insert table":"Вставити таблицю","Insert image":"Вставити зображення",Heading:"Заголовок","Image URL":"URL зображення","Select image file":"Вибрати файл зображення","Choose a file":"Виберіть файл","No file":"Немає файлу",Description:"Опис",OK:"OK",More:"ще",Cancel:"Скасувати",File:"Файл",URL:"URL","Link text":"Текст посилання","Add row to up":"Додати рядок вгору","Add row to down":"Додати рядок вниз","Add column to left":"Додайте стовпець зліва","Add column to right":"Додайте стовпець праворуч","Remove row":"Видалити ряд","Remove column":"Видалити стовпчик","Align column to left":"Вирівняти по лівому краю","Align column to center":"Вирівняти по центру","Align column to right":"Вирівняти по правому краю","Remove table":"Видалити таблицю","Would you like to paste as table?":"Ви хочете вставити у вигляді таблиці?","Text color":"Колір тексту","Auto scroll enabled":"Автоматична прокрутка включена","Auto scroll disabled":"Автоматична прокрутка відключена","Choose language":"Вибрати мову"});const JJe=["ar","zh","hr","cs","nl","en","fi","fr","gl","de","it","ja","ko","nb","pl","pt","ru","es","sv","tr","uk"],jy=document.documentElement.lang,Gy=JJe.includes(jy)?jy:"en",e8e=r=>{const e=JZ.c(19),{initialValue:t,onChange:n,options:i,disabled:a}=r,o=t===void 0?"":t,s=Cf.useRef(null),{width:l}=ZZ(),{appearance:f}=QZ(),p=f==="dark"?"dark":"light";let k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={height:"600px",initialEditType:"markdown",useCommandShortcut:!0,language:Gy},e[0]=k):k=e[0];const[T,x]=Cf.useState(k);let E;e[1]!==n?(E=()=>{var ge;const re=(ge=s.current)==null?void 0:ge.getInstance(),he=re==null?void 0:re.getMarkdown();n&&he&&n(he)},e[1]=n,e[2]=E):E=e[2];const P=E;let F;e[3]!==i||e[4]!==l?(F=()=>{const re=l<1200;x(he=>({...he,...i,previewStyle:re?"tab":(i==null?void 0:i.previewStyle)||"vertical",height:(i==null?void 0:i.height)||"600px",initialEditType:(i==null?void 0:i.initialEditType)||"markdown",useCommandShortcut:(i==null?void 0:i.useCommandShortcut)!==void 0?i.useCommandShortcut:!0})),s.current&&s.current.getInstance().changePreviewStyle(re?"tab":(i==null?void 0:i.previewStyle)||"vertical")},e[3]=i,e[4]=l,e[5]=F):F=e[5];let z;e[6]!==i||e[7]!==p||e[8]!==l?(z=[l,i,p],e[6]=i,e[7]=p,e[8]=l,e[9]=z):z=e[9],Cf.useEffect(F,z);const Y=`${a?"pointer-events-none opacity-50":""}`,Z=`editor-${p}-${Gy}`;let oe;e[10]!==T||e[11]!==P||e[12]!==o||e[13]!==Z||e[14]!==p?(oe=bv.jsx(KJe,{ref:s,initialValue:o,onChange:P,autofocus:!1,theme:p,...T},Z),e[10]=T,e[11]=P,e[12]=o,e[13]=Z,e[14]=p,e[15]=oe):oe=e[15];let le;return e[16]!==Y||e[17]!==oe?(le=bv.jsx("div",{className:Y,children:oe}),e[16]=Y,e[17]=oe,e[18]=le):le=e[18],le};export{e8e as default};
845
+ */Kt.setLanguage(["uk","uk-UA"],{Markdown:"Markdown",WYSIWYG:"WYSIWYG",Write:"Написати",Preview:"Попередній перегляд",Headings:"Заголовки",Paragraph:"Абзац",Bold:"Жирний",Italic:"Курсив",Strike:"Закреслений",Code:"Вбудований код",Line:"Лінія",Blockquote:"Блок цитування","Unordered list":"Невпорядкований список","Ordered list":"Упорядкований список",Task:"Завдання",Indent:"відступ",Outdent:"застарілий","Insert link":"Вставити посилання","Insert CodeBlock":"Вставити код","Insert table":"Вставити таблицю","Insert image":"Вставити зображення",Heading:"Заголовок","Image URL":"URL зображення","Select image file":"Вибрати файл зображення","Choose a file":"Виберіть файл","No file":"Немає файлу",Description:"Опис",OK:"OK",More:"ще",Cancel:"Скасувати",File:"Файл",URL:"URL","Link text":"Текст посилання","Add row to up":"Додати рядок вгору","Add row to down":"Додати рядок вниз","Add column to left":"Додайте стовпець зліва","Add column to right":"Додайте стовпець праворуч","Remove row":"Видалити ряд","Remove column":"Видалити стовпчик","Align column to left":"Вирівняти по лівому краю","Align column to center":"Вирівняти по центру","Align column to right":"Вирівняти по правому краю","Remove table":"Видалити таблицю","Would you like to paste as table?":"Ви хочете вставити у вигляді таблиці?","Text color":"Колір тексту","Auto scroll enabled":"Автоматична прокрутка включена","Auto scroll disabled":"Автоматична прокрутка відключена","Choose language":"Вибрати мову"});const JJe=["ar","zh","hr","cs","nl","en","fi","fr","gl","de","it","ja","ko","nb","pl","pt","ru","es","sv","tr","uk"],jy=document.documentElement.lang,Gy=JJe.includes(jy)?jy:"en",XJe=r=>{const e=XZ.c(19),{initialValue:t,onChange:n,options:i,disabled:a}=r,o=t===void 0?"":t,s=Cf.useRef(null),{width:l}=ZZ(),{appearance:f}=QZ(),p=f==="dark"?"dark":"light";let k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={height:"600px",initialEditType:"markdown",useCommandShortcut:!0,language:Gy},e[0]=k):k=e[0];const[T,x]=Cf.useState(k);let E;e[1]!==n?(E=()=>{var ge;const re=(ge=s.current)==null?void 0:ge.getInstance(),he=re==null?void 0:re.getMarkdown();n&&he&&n(he)},e[1]=n,e[2]=E):E=e[2];const P=E;let F;e[3]!==i||e[4]!==l?(F=()=>{const re=l<1200;x(he=>({...he,...i,previewStyle:re?"tab":(i==null?void 0:i.previewStyle)||"vertical",height:(i==null?void 0:i.height)||"600px",initialEditType:(i==null?void 0:i.initialEditType)||"markdown",useCommandShortcut:(i==null?void 0:i.useCommandShortcut)!==void 0?i.useCommandShortcut:!0})),s.current&&s.current.getInstance().changePreviewStyle(re?"tab":(i==null?void 0:i.previewStyle)||"vertical")},e[3]=i,e[4]=l,e[5]=F):F=e[5];let z;e[6]!==i||e[7]!==p||e[8]!==l?(z=[l,i,p],e[6]=i,e[7]=p,e[8]=l,e[9]=z):z=e[9],Cf.useEffect(F,z);const Y=`${a?"pointer-events-none opacity-50":""}`,Z=`editor-${p}-${Gy}`;let oe;e[10]!==T||e[11]!==P||e[12]!==o||e[13]!==Z||e[14]!==p?(oe=bv.jsx(KJe,{ref:s,initialValue:o,onChange:P,autofocus:!1,theme:p,...T},Z),e[10]=T,e[11]=P,e[12]=o,e[13]=Z,e[14]=p,e[15]=oe):oe=e[15];let le;return e[16]!==Y||e[17]!==oe?(le=bv.jsx("div",{className:Y,children:oe}),e[16]=Y,e[17]=oe,e[18]=le):le=e[18],le};export{XJe as default};