ocean-brain 0.2.1 → 0.3.0

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 (100) hide show
  1. package/dist/index.js +73 -41
  2. package/dist/mcp.js +587 -26
  3. package/package.json +6 -1
  4. package/scripts/postinstall-prisma.mjs +41 -0
  5. package/server/client/dist/assets/Calendar-DRv2aEl8.js +28 -0
  6. package/server/client/dist/assets/Callout-B2kPcDrq.js +1 -0
  7. package/server/client/dist/assets/Graph-DotbTrZR.js +1 -0
  8. package/server/client/dist/assets/Image-B5R7gF2P.js +1 -0
  9. package/server/client/dist/assets/Image.es-Dld9r9MJ.js +1 -0
  10. package/server/client/dist/assets/ModalActionRow-CES9L_Gy.js +1 -0
  11. package/server/client/dist/assets/Note-SK4hDhEM.css +1 -0
  12. package/server/client/dist/assets/Note-cIbXJc1v.js +1 -0
  13. package/server/client/dist/assets/Reminders-4LunlZRb.js +1 -0
  14. package/server/client/dist/assets/Search-Cp17DGR6.js +1 -0
  15. package/server/client/dist/assets/SurfaceCard-yzVU4Qkx.js +1 -0
  16. package/server/client/dist/assets/Tag-CwmuMPmo.js +1 -0
  17. package/server/client/dist/assets/TagNotes-gGroWMtT.js +1 -0
  18. package/server/client/dist/assets/Trash.es-B3KWD8_C.js +1 -0
  19. package/server/client/dist/assets/color-wpu7wT_s.js +1 -0
  20. package/server/client/dist/assets/graph-vendor-CUxe67Lr.js +46 -0
  21. package/server/client/dist/assets/image.api-DJgOBt8S.js +17 -0
  22. package/server/client/dist/assets/index-40Y2UsVr.js +205 -0
  23. package/server/client/dist/assets/index-BnxpTwtL.css +1 -0
  24. package/server/client/dist/assets/index-DYUg2N-6.js +1 -0
  25. package/server/client/dist/assets/manage-image-ByY1mRZx.js +1 -0
  26. package/server/client/dist/assets/manage-image-detail-BVaDZHRu.js +1 -0
  27. package/server/client/dist/assets/mcp-Jj3061aI.js +1 -0
  28. package/server/client/dist/assets/{note-core-DTIu0anW.js → note-core-BCgMq5QA.js} +7 -7
  29. package/server/client/dist/assets/note-vendor-BofYbzmZ.js +54 -0
  30. package/server/client/dist/assets/placeholder-4P_GK7fV.js +34 -0
  31. package/server/client/dist/assets/trash-CPBwY07S.js +1 -0
  32. package/server/client/dist/assets/useReminderMutate-1YVndM2T.js +82 -0
  33. package/server/client/dist/index.html +5 -4
  34. package/server/dist/app.js +97 -9
  35. package/server/dist/app.js.map +1 -1
  36. package/server/dist/main.js +16 -2
  37. package/server/dist/main.js.map +1 -1
  38. package/server/dist/modules/auth-guard.js +73 -0
  39. package/server/dist/modules/auth-guard.js.map +1 -0
  40. package/server/dist/modules/auth-mode.js +51 -0
  41. package/server/dist/modules/auth-mode.js.map +1 -0
  42. package/server/dist/modules/auth.js +9 -0
  43. package/server/dist/modules/auth.js.map +1 -1
  44. package/server/dist/modules/blocknote.js +7 -1
  45. package/server/dist/modules/blocknote.js.map +1 -1
  46. package/server/dist/modules/error-handler.js +41 -0
  47. package/server/dist/modules/error-handler.js.map +1 -0
  48. package/server/dist/modules/image-upload.js +114 -0
  49. package/server/dist/modules/image-upload.js.map +1 -0
  50. package/server/dist/modules/mcp-admin.js +88 -0
  51. package/server/dist/modules/mcp-admin.js.map +1 -0
  52. package/server/dist/modules/mcp-auth.js +71 -0
  53. package/server/dist/modules/mcp-auth.js.map +1 -0
  54. package/server/dist/modules/mcp-token.js +28 -0
  55. package/server/dist/modules/mcp-token.js.map +1 -0
  56. package/server/dist/modules/note-authoring.js +140 -0
  57. package/server/dist/modules/note-authoring.js.map +1 -0
  58. package/server/dist/modules/note-cleanup.js +207 -0
  59. package/server/dist/modules/note-cleanup.js.map +1 -0
  60. package/server/dist/modules/note-snapshot.js +223 -0
  61. package/server/dist/modules/note-snapshot.js.map +1 -0
  62. package/server/dist/modules/note-trash.js +262 -0
  63. package/server/dist/modules/note-trash.js.map +1 -0
  64. package/server/dist/modules/prisma-runtime.js +46 -0
  65. package/server/dist/modules/prisma-runtime.js.map +1 -0
  66. package/server/dist/modules/recovery-retention.js +26 -0
  67. package/server/dist/modules/recovery-retention.js.map +1 -0
  68. package/server/dist/modules/remote-image.js +176 -0
  69. package/server/dist/modules/remote-image.js.map +1 -0
  70. package/server/dist/modules/tag-organization.js +66 -0
  71. package/server/dist/modules/tag-organization.js.map +1 -0
  72. package/server/dist/modules/use-async.js +2 -4
  73. package/server/dist/modules/use-async.js.map +1 -1
  74. package/server/dist/schema/note/index.js +150 -6
  75. package/server/dist/schema/note/index.js.map +1 -1
  76. package/server/dist/start.js +11 -0
  77. package/server/dist/start.js.map +1 -0
  78. package/server/dist/types/index.js.map +1 -1
  79. package/server/dist/urls.js +3 -2
  80. package/server/dist/urls.js.map +1 -1
  81. package/server/dist/views/auth.js +305 -0
  82. package/server/dist/views/auth.js.map +1 -0
  83. package/server/dist/views/image.js +24 -81
  84. package/server/dist/views/image.js.map +1 -1
  85. package/server/dist/views/index.js +4 -0
  86. package/server/dist/views/index.js.map +1 -1
  87. package/server/dist/views/mcp-admin.js +42 -0
  88. package/server/dist/views/mcp-admin.js.map +1 -0
  89. package/server/dist/views/note.js +124 -0
  90. package/server/dist/views/note.js.map +1 -0
  91. package/server/dist/views/tag.js +23 -0
  92. package/server/dist/views/tag.js.map +1 -0
  93. package/server/prisma/migrations/20260331183000_0010_note_snapshot/migration.sql +13 -0
  94. package/server/prisma/migrations/20260331195000_0011_note_trash_entities/migration.sql +35 -0
  95. package/server/prisma/migrations/20260331213000_0012_image_hash_unique/migration.sql +49 -0
  96. package/server/prisma/migrations/20260404000000_0013_mcp_admin_control/migration.sql +9 -0
  97. package/server/prisma/schema.prisma +66 -1
  98. package/server/client/dist/assets/index-BJgBFWwL.css +0 -1
  99. package/server/client/dist/assets/index-DvNRv9YC.js +0 -391
  100. package/server/client/dist/assets/note-vendor-CUVHa9LU.js +0 -54
@@ -1,4 +1,4 @@
1
- function M1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new rt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new rt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function D1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=D1(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function v1(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=v1(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return D1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return v1(this,e,n,r)}findIndex(e){if(e==0)return Ca(0,e);if(e==this.size)return Ca(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Ca(n+1,s):Ca(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Nu={index:0,offset:0};function Ca(t,e){return Nu.index=t,Nu.offset=e,Nu}function Tl(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Tl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Tl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Se=class Ud{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Tl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ud.none;if(e instanceof Ud)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Se.none=[];class Cl extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=R1(this.content,e+this.openStart,n);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(L1(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(M.empty,0,0);function L1(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(L1(s.content,e-i-1,n-i-1)))}function R1(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=R1(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function Xw(t,e,n){if(n.openStart>t.depth)throw new Cl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Cl("Inconsistent open depths");return P1(t,e,n,0)}function P1(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=P1(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return si(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Zw(n,t);return si(s,F1(t,o,a,e,r))}else return si(s,Sl(t,e,r))}function B1(t,e){if(!e.type.compatibleContent(t.type))throw new Cl("Cannot join "+e.type.name+" onto "+t.type.name)}function $d(t,e,n){let r=t.node(n);return B1(r,e.node(n)),r}function ii(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function io(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ii(t.nodeAfter,r),s++));for(let a=s;a<o;a++)ii(i.child(a),r);e&&e.depth==n&&e.textOffset&&ii(e.nodeBefore,r)}function si(t,e){return t.type.checkContent(e),t.copy(e)}function F1(t,e,n,r,i){let s=t.depth>i&&$d(t,e,i+1),o=r.depth>i&&$d(n,r,i+1),a=[];return io(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(B1(s,o),ii(si(s,F1(t,e,n,r,i+1)),a)):(s&&ii(si(s,Sl(t,e,i+1)),a),io(e,n,i,a),o&&ii(si(o,Sl(n,r,i+1)),a)),io(r,null,i,a),new M(a)}function Sl(t,e,n){let r=[];if(io(null,t,n,r),t.depth>n){let i=$d(t,e,n+1);ii(si(i,Sl(t,e,n+1)),r)}return io(e,null,n,r),new M(r)}function Zw(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ao{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new wl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Ao(n,r,s)}static resolveCached(e,n){let r=Sm.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Sm.set(e,r=new ex);let i=r.elts[r.i]=Ao.resolve(e,n);return r.i=(r.i+1)%tx,i}}class ex{constructor(){this.elts=[],this.i=0}}const tx=12,Sm=new WeakMap;class wl{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nx=Object.create(null);class Zt{constructor(e,n,r,i=Se.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Tl(this.attrs,n||e.defaultAttrs||nx)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new Zt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Zt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return F.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new F(c,i.depth-o,s.depth-o)}replace(e,n,r){return Xw(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Ao.resolveCached(this,e)}resolveNoCache(e){return Ao.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),H1(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);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=Se.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Zt.prototype.text=void 0;class xl extends Zt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):H1(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xl(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function H1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rx(e,n);if(r.next==null)return fi.empty;let i=U1(r);r.next&&r.err("Unexpected trailing text");let s=ux(cx(i));return dx(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
1
+ import{g as M1}from"./graph-vendor-CUxe67Lr.js";function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new rt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new rt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function D1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=D1(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function v1(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=v1(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return D1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return v1(this,e,n,r)}findIndex(e){if(e==0)return Ca(0,e);if(e==this.size)return Ca(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Ca(n+1,s):Ca(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Nu={index:0,offset:0};function Ca(t,e){return Nu.index=t,Nu.offset=e,Nu}function Tl(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Tl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Tl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Se=class Ud{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Tl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ud.none;if(e instanceof Ud)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Se.none=[];class Cl extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=R1(this.content,e+this.openStart,n);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(L1(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(M.empty,0,0);function L1(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(L1(s.content,e-i-1,n-i-1)))}function R1(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=R1(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function Xw(t,e,n){if(n.openStart>t.depth)throw new Cl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Cl("Inconsistent open depths");return P1(t,e,n,0)}function P1(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=P1(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return si(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Zw(n,t);return si(s,F1(t,o,a,e,r))}else return si(s,Sl(t,e,r))}function B1(t,e){if(!e.type.compatibleContent(t.type))throw new Cl("Cannot join "+e.type.name+" onto "+t.type.name)}function $d(t,e,n){let r=t.node(n);return B1(r,e.node(n)),r}function ii(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function io(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ii(t.nodeAfter,r),s++));for(let a=s;a<o;a++)ii(i.child(a),r);e&&e.depth==n&&e.textOffset&&ii(e.nodeBefore,r)}function si(t,e){return t.type.checkContent(e),t.copy(e)}function F1(t,e,n,r,i){let s=t.depth>i&&$d(t,e,i+1),o=r.depth>i&&$d(n,r,i+1),a=[];return io(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(B1(s,o),ii(si(s,F1(t,e,n,r,i+1)),a)):(s&&ii(si(s,Sl(t,e,i+1)),a),io(e,n,i,a),o&&ii(si(o,Sl(n,r,i+1)),a)),io(r,null,i,a),new M(a)}function Sl(t,e,n){let r=[];if(io(null,t,n,r),t.depth>n){let i=$d(t,e,n+1);ii(si(i,Sl(t,e,n+1)),r)}return io(e,null,n,r),new M(r)}function Zw(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ao{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new wl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Ao(n,r,s)}static resolveCached(e,n){let r=Sm.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Sm.set(e,r=new ex);let i=r.elts[r.i]=Ao.resolve(e,n);return r.i=(r.i+1)%tx,i}}class ex{constructor(){this.elts=[],this.i=0}}const tx=12,Sm=new WeakMap;class wl{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nx=Object.create(null);class Zt{constructor(e,n,r,i=Se.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Tl(this.attrs,n||e.defaultAttrs||nx)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new Zt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Zt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return F.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new F(c,i.depth-o,s.depth-o)}replace(e,n,r){return Xw(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Ao.resolveCached(this,e)}resolveNoCache(e){return Ao.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),H1(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);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=Se.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Zt.prototype.text=void 0;class xl extends Zt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):H1(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xl(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function H1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rx(e,n);if(r.next==null)return fi.empty;let i=U1(r);r.next&&r.err("Unexpected trailing text");let s=ux(cx(i));return dx(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
2
  `)}}fi.empty=new fi(!0);class rx{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function U1(t){let e=[];do e.push(ix(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ix(t){let e=[];do e.push(sx(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sx(t){let e=lx(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=ox(t,e);else break;return e}function wm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ox(t,e){let n=wm(t),r=n;return t.eat(",")&&(t.next!="}"?r=wm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function ax(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function lx(t){if(t.eat("(")){let e=U1(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=ax(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function cx(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function $1(t,e){return e-t}function xm(t,e){let n=[];return r(e),n.sort($1);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function ux(t){let e=Object.create(null);return n(xm(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);xm(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new fi(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort($1);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function dx(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function z1(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function V1(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function j1(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function q1(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new fx(t,r,e[r]);return n}let Am=class W1{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=q1(e,r.attrs),this.defaultAttrs=z1(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==fi.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:V1(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Zt(this,this.computeAttrs(e),M.from(n),Se.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new Zt(this,this.computeAttrs(e),n,Se.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(M.empty,!0);return s?new Zt(this,e,n.append(s),Se.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){j1(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Se.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new W1(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function hx(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class fx{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hx(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Lc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=q1(e,i.attrs),this.excluded=null;let s=z1(this.attrs);this.instance=s?new Se(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,V1(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Lc(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){j1(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Y1=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=Am.compile(this.spec.nodes,this),this.marks=Lc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=fi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?_m(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:_m(this,o.split(" "))}this.nodeFromJSON=i=>Zt.fromJSON(this,i),this.markFromJSON=i=>Se.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Am){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new xl(r,r.defaultAttrs,e,Se.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function _m(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function px(t){return t.tag!=null}function mx(t){return t.style!=null}let mn=class zd{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(px(i))this.tags.push(i);else if(mx(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Im(this,n,!1);return r.addAll(e,Se.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Im(this,n,!0);return r.addAll(e,Se.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(yx(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Om(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Om(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zd(e,zd.schemaRules(e)))}};const K1={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},gx={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},G1={ol:!0,ul:!0},_o=1,Vd=2,so=4;function Nm(t,e,n){return e!=null?(e?_o:0)|(e==="full"?Vd:0):t&&t.whitespace=="pre"?_o|Vd:n&~so}class Sa{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Se.none,this.match=s||(o&so?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&_o)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!K1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Im{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Nm(null,n.preserveWhitespace,0)|(r?so:0);i?s=new Sa(i.type,i.attrs,Se.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Sa(null,null,Se.none,!0,null,o):s=new Sa(e.schema.topNodeType,null,Se.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Vd?"full":this.localPreserveWS||(i.options&_o)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;G1.hasOwnProperty(o)&&this.parser.normalizeLists&&bx(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:gx.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(K1.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Se.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Mm(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Nm(e,s,o.options);o.options&so&&o.content.length==0&&(a|=so);let l=Se.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Mm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Sa(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=_o)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function bx(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&G1.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function yx(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Om(t){let e={};for(let n in t)e[n]=t[n];return e}function Mm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class zt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Iu(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=tl(Iu(n),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,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&tl(Iu(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return tl(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new zt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Dm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Dm(e.marks)}}function Dm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Iu(t){return t.document||window.document}const vm=new WeakMap;function Ex(t){let e=vm.get(t);return e===void 0&&vm.set(t,e=kx(t)),e}function kx(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function tl(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Ex(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=tl(t,h,n,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Q1=65535,J1=Math.pow(2,16);function Tx(t,e){return t+e*J1}function Lm(t){return t&Q1}function Cx(t){return(t-(t&Q1))/J1}const X1=1,Z1=2,nl=4,ey=8;class jd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ey)>0}get deletedBefore(){return(this.delInfo&(X1|nl))>0}get deletedAfter(){return(this.delInfo&(Z1|nl))>0}get deletedAcross(){return(this.delInfo&nl)>0}}class Ft{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ft.empty)return Ft.empty}recover(e){let n=0,r=Lm(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Cx(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,f=l+i+(h<0?0:u);if(r)return f;let p=e==(n<0?l:d)?null:Tx(a/3,e-l),g=e==l?Z1:e==d?X1:nl;return(n<0?e!=l:e!=d)&&(g|=ey),new jd(f,g,p)}i+=u-c}return r?e+i:new jd(e+i,0,null)}touches(e,n){let r=0,i=Lm(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new Ft(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ft.empty:new Ft(e<0?[0,-e,0]:[0,0,e])}}Ft.empty=new Ft([]);class ds{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ds(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new ds;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new jd(e,i,null)}}const Ou=Object.create(null);class pt{getMap(){return Ft.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ou[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ou)throw new RangeError("Duplicate use of step JSON ID "+e);return Ou[e]=n,n.prototype.jsonID=e,n}}class Ve{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ve(e,null)}static fail(e){return new Ve(null,e)}static fromReplace(e,n,r,i){try{return Ve.ok(e.replace(n,r,i))}catch(s){if(s instanceof Cl)return Ve.fail(s.message);throw s}}}function mf(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(mf(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return M.fromArray(r)}class wr extends pt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new F(mf(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Ve.fromReplace(e,this.from,this.to,s)}invert(){return new fn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new wr(n.pos,r.pos,this.mark)}merge(e){return e instanceof wr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new wr(n.from,n.to,e.markFromJSON(n.mark))}}pt.jsonID("addMark",wr);class fn extends pt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new F(mf(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ve.fromReplace(e,this.from,this.to,r)}invert(){return new wr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fn(n.pos,r.pos,this.mark)}merge(e){return e instanceof fn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fn(n.from,n.to,e.markFromJSON(n.mark))}}pt.jsonID("removeMark",fn);class xr extends pt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ve.fromReplace(e,this.pos,this.pos+1,new F(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new xr(this.pos,n.marks[i]);return new xr(this.pos,this.mark)}}return new pi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xr(n.pos,e.markFromJSON(n.mark))}}pt.jsonID("addNodeMark",xr);class pi extends pt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ve.fromReplace(e,this.pos,this.pos+1,new F(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pi(n.pos,e.markFromJSON(n.mark))}}pt.jsonID("removeNodeMark",pi);class ze extends pt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&qd(e,this.from,this.to)?Ve.fail("Structure replace would overwrite content"):Ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ft([this.from,this.to-this.from,this.slice.size])}invert(e){return new ze(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ze(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ze)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ze(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ze(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ze(n.from,n.to,F.fromJSON(e,n.slice),!!n.structure)}}pt.jsonID("replace",ze);class Fe extends pt{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(qd(e,this.from,this.gapFrom)||qd(e,this.gapTo,this.to)))return Ve.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ve.fromReplace(e,this.from,this.to,r):Ve.fail("Content does not fit in gap")}getMap(){return new Ft([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Fe(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Fe(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}pt.jsonID("replaceAround",Fe);function qd(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Sx(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=f:i.push(o=new fn(h,f,d[g])));a&&a.to==h?a.to=f:s.push(a=new wr(h,f,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function wx(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Lc){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new fn(o.from,o.to,o.style)))}function gf(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new ze(a,u,F.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new fn(a,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new F(M.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new ze(a+h.index,a+h.index+h[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(M.empty,!0);t.replace(a,a,new F(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function xx(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ns(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!xx(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Ax(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=M.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=M.from(r.node(p).copy(u)),d++):l--;let h=M.empty,f=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=M.from(i.node(p).copy(h)),f++):c++;t.step(new Fe(l,c,o,a,new F(u.append(h),d,f),u.size-d,!0))}function ty(t,e,n=null,r=t){let i=_x(t,e),s=i&&Nx(r,e);return s?i.map(Rm).concat({type:e,attrs:n}).concat(s.map(Rm)):null}function Rm(t){return{type:t,attrs:null}}function _x(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Nx(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function Ix(t,e,n){let r=M.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Fe(i,s,i,s,new F(r,0,0),n.length,!0))}function Ox(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Mx(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&ry(t,o,a,s),gf(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return t.step(new Fe(d,h,d+1,h-1,new F(M.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&ny(t,o,a,s),!1}})}function ny(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ry(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
@@ -97,7 +97,7 @@ ${b}
97
97
  `);I.trim()&&(e.customNestedParser?T=e.customNestedParser(I):T=n.blockTokens(I))}const D=e.createToken(p,T);l.push(D)}if(l.length!==0)return{items:l,raw:c}}function GN(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
98
98
  `).map(h=>h?e.indent(h):"").join(`
99
99
  `);l.push(d)}}),l.join(`
100
- `)}function QN(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var Cn=class HE extends zf{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new HE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},wj=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,s,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const T=this.dom.getBoundingClientRect(),S=u.getBoundingClientRect(),D=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,I=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=S.x-T.x+D,h=S.y-T.y+I}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=W.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=W.isSelectable(this.node),d=t.type==="copy",h=t.type==="paste",f=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&i&&t.target===this.dom&&t.preventDefault(),c&&i&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||h||f||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Do()||nh())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function bi(t){return new vN({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Te(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(Uf(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(b=>b===t.type&&b!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}var Oa,JN=new Uint8Array(16);function XN(){if(!Oa&&(Oa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Oa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oa(JN)}const ZN=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function eI(t){return typeof t=="string"&&ZN.test(t)}var nt=[];for(var qu=0;qu<256;++qu)nt.push((qu+256).toString(16).substr(1));function tI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(nt[t[e+0]]+nt[t[e+1]]+nt[t[e+2]]+nt[t[e+3]]+"-"+nt[t[e+4]]+nt[t[e+5]]+"-"+nt[t[e+6]]+nt[t[e+7]]+"-"+nt[t[e+8]]+nt[t[e+9]]+"-"+nt[t[e+10]]+nt[t[e+11]]+nt[t[e+12]]+nt[t[e+13]]+nt[t[e+14]]+nt[t[e+15]]).toLowerCase();if(!eI(n))throw TypeError("Stringified UUID is invalid");return n}function UE(t,e,n){t=t||{};var r=t.random||(t.rng||XN)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,tI(r)}function nI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function rI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return nI(e)}const Kc=Le.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const t=window.__TEST_OPTIONS;return t.mockID===void 0?t.mockID=0:t.mockID++,t.mockID.toString()}return UE()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>{const e={[`data-${this.options.attributeName}`]:t[this.options.attributeName]};return this.options.setIdAttribute?{...e,id:t[this.options.attributeName]}:e}}}}]},addProseMirrorPlugins(){let t=null,e=!1;return[new te({key:new me("uniqueID"),appendTransaction:(n,r,i)=>{const s=n.some(f=>f.docChanged)&&!r.doc.eq(i.doc),o=this.options.filterTransaction&&n.some(f=>{var p,g;return!((g=(p=this.options).filterTransaction)!=null&&g.call(p,f))});if(!s||o)return;const{tr:a}=i,{types:l,attributeName:c,generateID:u}=this.options,d=qc(r.doc,n),{mapping:h}=d;if(Hf(d).forEach(({newRange:f})=>{const p=mE(i.doc,f,y=>l.includes(y.type.name)),g=p.map(({node:y})=>y.attrs[c]).filter(y=>y!==null),b=rI(g);p.forEach(({node:y,pos:T})=>{var S;const D=(S=a.doc.nodeAt(T))==null?void 0:S.attrs[c];if(D===null){const A=r.doc.type.createAndFill().content;if(r.doc.content.findDiffStart(A)===null){const v=JSON.parse(JSON.stringify(i.doc.toJSON()));if(v.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(v.content)===JSON.stringify(A.toJSON())){a.setNodeMarkup(T,void 0,{...y.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(T,void 0,{...y.attrs,[c]:u()});return}const{deleted:I}=h.invert().mapResult(T);I&&b.includes(D)&&a.setNodeMarkup(T,void 0,{...y.attrs,[c]:u()})})}),!!a.steps.length)return a.setMeta("uniqueID",!0),a},view(n){const r=i=>{let s;t=!((s=n.dom.parentElement)===null||s===void 0)&&s.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{let i;return t!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy"?e=!0:e=!1,t=null,!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:i}=this.options,s=o=>{const a=[];return o.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(s(l.content)));return}const c=l.type.create({...l.attrs,[i]:null},s(l.content),l.marks);a.push(c)}),M.from(a)};return e=!1,new F(s(n.content),n.openStart,n.openEnd)}}})]}});function Mg(t){return t.type==="link"}function $E(t){return typeof t!="string"&&t.type==="link"}function yi(t){return typeof t!="string"&&t.type==="text"}function ih(t){var e,n,r,i,s;return qf(t)?{...t}:Ro(t)?{type:"tableCell",content:[].concat(t.content),props:{backgroundColor:((e=t.props)==null?void 0:e.backgroundColor)??"default",textColor:((n=t.props)==null?void 0:n.textColor)??"default",textAlignment:((r=t.props)==null?void 0:r.textAlignment)??"left",colspan:((i=t.props)==null?void 0:i.colspan)??1,rowspan:((s=t.props)==null?void 0:s.rowspan)??1}}:{type:"tableCell",content:[].concat(t),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function Ro(t){return t!=null&&typeof t!="string"&&!Array.isArray(t)&&t.type==="tableCell"}function qf(t){return Ro(t)&&t.props!==void 0&&t.content!==void 0}function Po(t){return qf(t)?t.props.colspan??1:1}function sh(t){return qf(t)?t.props.rowspan??1:1}class Pn extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function xj(t,e=!0){const{"data-test":n,...r}=t;if(Object.keys(r).length>0&&e)throw new Error("Object must be empty "+JSON.stringify(t))}function Rr(t,e){const n=t.resolve(e);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,i=n.node(r);for(;r>0;){if(i.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:i};r--,i=n.node(r)}const s=[];t.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&s.push(l)}),console.warn(`Position ${e} is not within a blockContainer node.`);const o=t.resolve(s.find(a=>a>=e)||s[s.length-1]);return{posBeforeNode:o.pos,node:o.nodeAfter}}function Wf(t,e){if(!t.type.isInGroup("bnBlock"))throw new Error(`Attempted to get bnBlock node at position but found node of different type ${t.type.name}`);const n=t,r=e,i=r+n.nodeSize,s={node:n,beforePos:r,afterPos:i};if(n.type.name==="blockContainer"){let o,a;if(n.forEach((l,c)=>{if(l.type.spec.group==="blockContent"){const u=l,d=r+c+1,h=d+l.nodeSize;o={node:u,beforePos:d,afterPos:h}}else if(l.type.name==="blockGroup"){const u=l,d=r+c+1,h=d+l.nodeSize;a={node:u,beforePos:d,afterPos:h}}}),!o)throw new Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:s,blockContent:o,childContainer:a,blockNoteType:o.node.type.name}}else{if(!s.node.type.isInGroup("childContainer"))throw new Error(`bnBlock node is not in the childContainer group: ${s.node}`);return{isBlockContainer:!1,bnBlock:s,childContainer:s,blockNoteType:s.node.type.name}}}function Pr(t){return Wf(t.node,t.posBeforeNode)}function Gc(t){if(!t.nodeAfter)throw new Error(`Attempted to get blockContainer node at position ${t.pos} but a node at this position does not exist`);return Wf(t.nodeAfter,t.pos)}function xt(t){const e=Rr(t.doc,t.selection.anchor);return Pr(e)}function sa(t){const e=Rr(t.doc,t.selection.anchor);return Pr(e)}function He(t){return"doc"in t?t.doc.type.schema:t.type.schema}function zE(t){return t.cached.blockNoteEditor}function oa(t){return zE(t).schema}function Yf(t){return oa(t).blockSchema}function Kf(t){return oa(t).inlineContentSchema}function Is(t){return oa(t).styleSchema}function Gf(t){return zE(t).blockCache}function VE(t,e,n){var r,i;const s={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},o=[];t.content.forEach((a,l,c)=>{const u={cells:[]};c===0&&a.content.forEach(d=>{let h=d.attrs.colwidth;h==null&&(h=new Array(d.attrs.colspan??1).fill(void 0)),s.columnWidths.push(...h)}),u.cells=a.content.content.map((d,h)=>(o[c]||(o[c]=[]),o[c][h]=d.type.name==="tableHeader",{type:"tableCell",content:d.content.content.map(f=>Qc(f,e,n)).reduce((f,p)=>{if(!f.length)return p;const g=f[f.length-1],b=p[0];return b&&yi(g)&&yi(b)&&JSON.stringify(g.styles)===JSON.stringify(b.styles)?(g.text+=`
100
+ `)}function QN(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var Cn=class HE extends zf{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new HE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},xj=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,s,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const T=this.dom.getBoundingClientRect(),S=u.getBoundingClientRect(),D=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,I=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=S.x-T.x+D,h=S.y-T.y+I}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=W.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=W.isSelectable(this.node),d=t.type==="copy",h=t.type==="paste",f=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&i&&t.target===this.dom&&t.preventDefault(),c&&i&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||h||f||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Do()||nh())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function bi(t){return new vN({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Te(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(Uf(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(b=>b===t.type&&b!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}var Oa,JN=new Uint8Array(16);function XN(){if(!Oa&&(Oa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Oa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oa(JN)}const ZN=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function eI(t){return typeof t=="string"&&ZN.test(t)}var nt=[];for(var qu=0;qu<256;++qu)nt.push((qu+256).toString(16).substr(1));function tI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(nt[t[e+0]]+nt[t[e+1]]+nt[t[e+2]]+nt[t[e+3]]+"-"+nt[t[e+4]]+nt[t[e+5]]+"-"+nt[t[e+6]]+nt[t[e+7]]+"-"+nt[t[e+8]]+nt[t[e+9]]+"-"+nt[t[e+10]]+nt[t[e+11]]+nt[t[e+12]]+nt[t[e+13]]+nt[t[e+14]]+nt[t[e+15]]).toLowerCase();if(!eI(n))throw TypeError("Stringified UUID is invalid");return n}function UE(t,e,n){t=t||{};var r=t.random||(t.rng||XN)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,tI(r)}function nI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function rI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return nI(e)}const Kc=Le.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const t=window.__TEST_OPTIONS;return t.mockID===void 0?t.mockID=0:t.mockID++,t.mockID.toString()}return UE()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>{const e={[`data-${this.options.attributeName}`]:t[this.options.attributeName]};return this.options.setIdAttribute?{...e,id:t[this.options.attributeName]}:e}}}}]},addProseMirrorPlugins(){let t=null,e=!1;return[new te({key:new me("uniqueID"),appendTransaction:(n,r,i)=>{const s=n.some(f=>f.docChanged)&&!r.doc.eq(i.doc),o=this.options.filterTransaction&&n.some(f=>{var p,g;return!((g=(p=this.options).filterTransaction)!=null&&g.call(p,f))});if(!s||o)return;const{tr:a}=i,{types:l,attributeName:c,generateID:u}=this.options,d=qc(r.doc,n),{mapping:h}=d;if(Hf(d).forEach(({newRange:f})=>{const p=mE(i.doc,f,y=>l.includes(y.type.name)),g=p.map(({node:y})=>y.attrs[c]).filter(y=>y!==null),b=rI(g);p.forEach(({node:y,pos:T})=>{var S;const D=(S=a.doc.nodeAt(T))==null?void 0:S.attrs[c];if(D===null){const A=r.doc.type.createAndFill().content;if(r.doc.content.findDiffStart(A)===null){const v=JSON.parse(JSON.stringify(i.doc.toJSON()));if(v.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(v.content)===JSON.stringify(A.toJSON())){a.setNodeMarkup(T,void 0,{...y.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(T,void 0,{...y.attrs,[c]:u()});return}const{deleted:I}=h.invert().mapResult(T);I&&b.includes(D)&&a.setNodeMarkup(T,void 0,{...y.attrs,[c]:u()})})}),!!a.steps.length)return a.setMeta("uniqueID",!0),a},view(n){const r=i=>{let s;t=!((s=n.dom.parentElement)===null||s===void 0)&&s.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{let i;return t!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy"?e=!0:e=!1,t=null,!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:i}=this.options,s=o=>{const a=[];return o.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(s(l.content)));return}const c=l.type.create({...l.attrs,[i]:null},s(l.content),l.marks);a.push(c)}),M.from(a)};return e=!1,new F(s(n.content),n.openStart,n.openEnd)}}})]}});function Mg(t){return t.type==="link"}function $E(t){return typeof t!="string"&&t.type==="link"}function yi(t){return typeof t!="string"&&t.type==="text"}function ih(t){var e,n,r,i,s;return qf(t)?{...t}:Ro(t)?{type:"tableCell",content:[].concat(t.content),props:{backgroundColor:((e=t.props)==null?void 0:e.backgroundColor)??"default",textColor:((n=t.props)==null?void 0:n.textColor)??"default",textAlignment:((r=t.props)==null?void 0:r.textAlignment)??"left",colspan:((i=t.props)==null?void 0:i.colspan)??1,rowspan:((s=t.props)==null?void 0:s.rowspan)??1}}:{type:"tableCell",content:[].concat(t),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function Ro(t){return t!=null&&typeof t!="string"&&!Array.isArray(t)&&t.type==="tableCell"}function qf(t){return Ro(t)&&t.props!==void 0&&t.content!==void 0}function Po(t){return qf(t)?t.props.colspan??1:1}function sh(t){return qf(t)?t.props.rowspan??1:1}class Pn extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Aj(t,e=!0){const{"data-test":n,...r}=t;if(Object.keys(r).length>0&&e)throw new Error("Object must be empty "+JSON.stringify(t))}function Rr(t,e){const n=t.resolve(e);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,i=n.node(r);for(;r>0;){if(i.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:i};r--,i=n.node(r)}const s=[];t.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&s.push(l)}),console.warn(`Position ${e} is not within a blockContainer node.`);const o=t.resolve(s.find(a=>a>=e)||s[s.length-1]);return{posBeforeNode:o.pos,node:o.nodeAfter}}function Wf(t,e){if(!t.type.isInGroup("bnBlock"))throw new Error(`Attempted to get bnBlock node at position but found node of different type ${t.type.name}`);const n=t,r=e,i=r+n.nodeSize,s={node:n,beforePos:r,afterPos:i};if(n.type.name==="blockContainer"){let o,a;if(n.forEach((l,c)=>{if(l.type.spec.group==="blockContent"){const u=l,d=r+c+1,h=d+l.nodeSize;o={node:u,beforePos:d,afterPos:h}}else if(l.type.name==="blockGroup"){const u=l,d=r+c+1,h=d+l.nodeSize;a={node:u,beforePos:d,afterPos:h}}}),!o)throw new Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:s,blockContent:o,childContainer:a,blockNoteType:o.node.type.name}}else{if(!s.node.type.isInGroup("childContainer"))throw new Error(`bnBlock node is not in the childContainer group: ${s.node}`);return{isBlockContainer:!1,bnBlock:s,childContainer:s,blockNoteType:s.node.type.name}}}function Pr(t){return Wf(t.node,t.posBeforeNode)}function Gc(t){if(!t.nodeAfter)throw new Error(`Attempted to get blockContainer node at position ${t.pos} but a node at this position does not exist`);return Wf(t.nodeAfter,t.pos)}function xt(t){const e=Rr(t.doc,t.selection.anchor);return Pr(e)}function sa(t){const e=Rr(t.doc,t.selection.anchor);return Pr(e)}function He(t){return"doc"in t?t.doc.type.schema:t.type.schema}function zE(t){return t.cached.blockNoteEditor}function oa(t){return zE(t).schema}function Yf(t){return oa(t).blockSchema}function Kf(t){return oa(t).inlineContentSchema}function Is(t){return oa(t).styleSchema}function Gf(t){return zE(t).blockCache}function VE(t,e,n){var r,i;const s={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},o=[];t.content.forEach((a,l,c)=>{const u={cells:[]};c===0&&a.content.forEach(d=>{let h=d.attrs.colwidth;h==null&&(h=new Array(d.attrs.colspan??1).fill(void 0)),s.columnWidths.push(...h)}),u.cells=a.content.content.map((d,h)=>(o[c]||(o[c]=[]),o[c][h]=d.type.name==="tableHeader",{type:"tableCell",content:d.content.content.map(f=>Qc(f,e,n)).reduce((f,p)=>{if(!f.length)return p;const g=f[f.length-1],b=p[0];return b&&yi(g)&&yi(b)&&JSON.stringify(g.styles)===JSON.stringify(b.styles)?(g.text+=`
101
101
  `+b.text,f.push(...p.slice(1)),f):(f.push(...p),f)},[]),props:{colspan:d.attrs.colspan,rowspan:d.attrs.rowspan,backgroundColor:d.attrs.backgroundColor,textColor:d.attrs.textColor,textAlignment:d.attrs.textAlignment}})),s.rows.push(u)});for(let a=0;a<o.length;a++)(r=o[a])!=null&&r.every(l=>l)&&(s.headerRows=(s.headerRows??0)+1);for(let a=0;a<((i=o[0])==null?void 0:i.length);a++)o!=null&&o.every(l=>l[a])&&(s.headerCols=(s.headerCols??0)+1);return s}function Qc(t,e,n){const r=[];let i;return t.content.forEach(s=>{if(s.type.name==="hardBreak"){if(i)if(yi(i))i.text+=`
102
102
  `;else if(Mg(i))i.content[i.content.length-1].text+=`
103
103
  `;else throw new Error("unexpected");else i={type:"text",text:`
@@ -106,11 +106,11 @@ ${b}
106
106
  `)}}const kh=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[$o]?uk(t,e):ys(t)?tp(t,n=>np(e,r=>kh(n,r))):XO(t)?Ms(t,(n,r)=>kh(n,e[r])):!1;let Tt=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),kh(n,r)}equals(e){return this.constructor===e.constructor&&cl(this.shape,e.shape)}[EM](){return!0}[$o](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){rn()}get nullable(){return Ds(this,su)}get optional(){return new Ek(this)}cast(e){return t0(e,this),e}expect(e){return t0(e,this),e}};class up extends Tt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const qe=(t,e=null)=>new up(t,e);qe(up);class dp extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const et=t=>new dp(t);qe(dp);class tu extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const nu=(...t)=>new tu(t),bk=qe(tu),TM=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),yk=t=>{if(Cs.check(t))return[TM(t)];if(bk.check(t))return t.shape.map(e=>e+"");if(Nk.check(t))return["[+-]?\\d+.?\\d*"];if(Ik.check(t))return[".*"];if(Hl.check(t))return t.shape.map(yk).flat(1);kt()};class CM extends Tt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(yk).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}qe(CM);const SM=Symbol("optional");class Ek extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[SM](){return!0}}const wM=qe(Ek);class xM extends Tt{check(e,n){return n?.extend(null,"never",typeof e),!1}}qe(xM);class ru extends Tt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new ru(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Ms(this.shape,(r,i)=>{const s=this._isPartial&&!ap(e,i)||r.check(e[i],n);return!s&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const AM=t=>new ru(t),_M=qe(ru),NM=et(t=>t!=null&&(t.constructor===Object||t.constructor==null));class kk extends Tt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Ms(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&n?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,n)})}}const Tk=(t,e)=>new kk(t,e),IM=qe(kk);class Ck extends Tt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Ms(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&n?.extend(i.toString(),"Tuple",typeof r),s})}}const OM=(...t)=>new Ck(t);qe(Ck);class Sk extends Tt{constructor(e){super(),this.shape=e.length===1?e[0]:new hp(e)}check(e,n){const r=ys(e)&&tp(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const wk=(...t)=>new Sk(t),MM=qe(Sk),DM=et(t=>ys(t));class xk extends Tt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const vM=(t,e=null)=>new xk(t,e);qe(xk);const LM=vM(Tt);class RM extends Tt{constructor(e){super(),this.len=e.length-1,this.args=OM(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const PM=qe(RM),BM=et(t=>typeof t=="function");class FM extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=tp(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}qe(FM,t=>t.shape.length>0);class hp extends Tt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=np(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const Ds=(...t)=>t.findIndex(e=>Hl.check(e))>=0?Ds(...t.map(e=>zo(e)).map(e=>Hl.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new hp(t),Hl=qe(hp),Ak=()=>!0,Ul=et(Ak),HM=qe(dp,t=>t.shape===Ak),fp=et(t=>typeof t=="bigint"),UM=et(t=>t===fp),_k=et(t=>typeof t=="symbol");et(t=>t===_k);const ns=et(t=>typeof t=="number"),Nk=et(t=>t===ns),Cs=et(t=>typeof t=="string"),Ik=et(t=>t===Cs),iu=et(t=>typeof t=="boolean"),$M=et(t=>t===iu),Ok=nu(void 0);qe(tu,t=>t.shape.length===1&&t.shape[0]===void 0);nu(void 0);const su=nu(null),zM=qe(tu,t=>t.shape.length===1&&t.shape[0]===null);qe(Uint8Array);qe(up,t=>t.shape===Uint8Array);const VM=Ds(ns,Cs,su,Ok,fp,iu,_k);(()=>{const t=wk(Ul),e=Tk(Cs,Ul),n=Ds(ns,Cs,su,iu,t,e);return t.shape=n,e.shape.values=n,n})();const zo=t=>{if(LM.check(t))return t;if(NM.check(t)){const e={};for(const n in t)e[n]=zo(t[n]);return AM(e)}else{if(DM.check(t))return Ds(...t.map(zo));if(VM.check(t))return nu(t);if(BM.check(t))return qe(t)}kt()},t0=aM?()=>{}:(t,e)=>{const n=new kM;if(!e.check(t,n))throw Bn(`Expected value to be of type ${e.constructor.name}.
107
107
  ${n.toString()}`)};class jM{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:zo(e),h:n}),this}else(e){return this.if(Ul,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw Bn("Unhandled pattern")}}}const qM=t=>new jM(t),Mk=qM(Ul).if(Nk,(t,e)=>Xu(e,qg,Pl)).if(Ik,(t,e)=>yM(e)).if($M,(t,e)=>e0(e)).if(UM,(t,e)=>BigInt(Xu(e,qg,Pl))).if(Hl,(t,e)=>$i(e,Zu(e,t.shape))).if(_M,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(wM.check(i)){if(e0(e))continue;i=i.shape}n[r]=Mk(i,e)}return n}).if(MM,(t,e)=>{const n=[],r=gk(e,0,42);for(let i=0;i<r;i++)n.push($i(e,t.shape));return n}).if(bk,(t,e)=>Zu(e,t.shape)).if(zM,(t,e)=>null).if(PM,(t,e)=>{const n=$i(e,t.res);return()=>n}).if(HM,(t,e)=>$i(e,Zu(e,[ns,Cs,su,Ok,fp,iu,wk(ns),Tk(Ds("a","b","c"),ns)]))).if(IM,(t,e)=>{const n={},r=Xu(e,0,3);for(let i=0;i<r;i++){const s=$i(e,t.shape.keys),o=$i(e,t.shape.values);n[s]=o}return n}).done(),$i=(t,e)=>Mk(zo(e),t),ca=typeof document<"u"?document:{};et(t=>t.nodeType===QM);typeof DOMParser<"u"&&new DOMParser;et(t=>t.nodeType===YM);et(t=>t.nodeType===KM);const WM=t=>lO(t,(e,n)=>`${n}:${e};`).join(""),YM=ca.ELEMENT_NODE,KM=ca.TEXT_NODE,GM=ca.DOCUMENT_NODE,QM=ca.DOCUMENT_FRAGMENT_NODE;et(t=>t.nodeType===GM);const JM=t=>class{constructor(n){this._=n}destroy(){t(this._)}},XM=JM(clearTimeout),pp=(t,e)=>new XM(setTimeout(e,t)),lr=Symbol,Dk=lr(),vk=lr(),ZM=lr(),e3=lr(),t3=lr(),Lk=lr(),n3=lr(),mp=lr(),r3=lr(),i3=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},s3={[Dk]:Yn("font-weight","bold"),[vk]:Yn("font-weight","normal"),[ZM]:Yn("color","blue"),[t3]:Yn("color","green"),[e3]:Yn("color","grey"),[Lk]:Yn("color","red"),[n3]:Yn("color","purple"),[mp]:Yn("color","orange"),[r3]:Yn("color","black")},o3=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=nn();let i=[],s=0;for(;s<t.length;s++){const o=t[s],a=s3[o];if(a!==void 0)r.set(a.left,a.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const l=WM(r);s>0||l.length>0?(e.push("%c"+o),n.push(l)):e.push(o)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const o=t[s];o instanceof Symbol||i.push(o)}return i},Rk=cM?o3:i3,a3=(...t)=>{console.log(...Rk(t)),Bk.forEach(e=>e.print(t))},Pk=(...t)=>{console.warn(...Rk(t)),t.unshift(mp),Bk.forEach(e=>e.print(t))},Bk=Ci(),Fk=t=>({[Symbol.iterator](){return this},next:t}),l3=(t,e)=>Fk(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),ed=(t,e)=>Fk(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class gp{constructor(e,n){this.clock=e,this.len=n}}class vs{constructor(){this.clients=new Map}}const Fr=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],a=o.id.clock+o.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])Xk(t,s,c.clock,c.len,n)}}),c3=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=yn((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},Ls=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&c3(n,e.clock)!==null},bp=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?i.len=En(i.len,s.clock+s.len-i.clock):(r<n&&(e[r]=s),r++)}e.length=r})},Th=t=>{const e=new vs;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=n+1;o<t.length;o++)uO(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return bp(e),e},Vo=(t,e,n,r)=>{Un(t.clients,e,()=>[]).push(new gp(n,r))},Hk=()=>new vs,Uk=t=>{const e=Hk();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<n.length)for(let c=n[s+1];s+1<n.length&&c.deleted;c=n[++s+1])l+=c.length;i.push(new gp(a,l))}}i.length>0&&e.clients.set(r,i)}),e},Rs=(t,e)=>{ae(t.restEncoder,e.clients.size),Br(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),ae(t.restEncoder,n);const i=r.length;ae(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},yp=t=>{const e=new vs,n=ie(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=ie(t.restDecoder),s=ie(t.restDecoder);if(s>0){const o=Un(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new gp(t.readDsClock(),t.readDsLen()))}}return e},n0=(t,e,n)=>{const r=new vs,i=ie(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=ie(t.restDecoder),a=ie(t.restDecoder),l=n.clients.get(o)||[],c=Be(n,o);for(let u=0;u<a;u++){const d=t.readDsClock(),h=d+t.readDsLen();if(d<c){c<h&&Vo(r,o,c,h-c);let f=on(l,d),p=l[f];for(!p.deleted&&p.id.clock<d&&(l.splice(f+1,0,Yl(e,p,d-p.id.clock)),f++);f<l.length&&(p=l[f++],p.id.clock<h);)p.deleted||(h<p.id.clock+p.length&&l.splice(f,0,Yl(e,p,h-p.id.clock)),p.delete(e))}else Vo(r,o,d,h-d)}}if(r.clients.size>0){const s=new Si;return ae(s.restEncoder,0),Rs(s,r),s.toUint8Array()}return null},$k=lk;class jr extends rk{constructor({guid:e=YO(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=$k(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Qk,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Xg(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>Xg(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Ce(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Br(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Ce(this,e,n)}get(e,n=Je){const r=Un(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==Je&&i!==n)if(i===Je){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,ss)}getText(e=""){return this.get(e,Hr)}getMap(e=""){return this.get(e,ws)}getXmlElement(e=""){return this.get(e,at)}getXmlFragment(e=""){return this.get(e,wi)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Br(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new jr({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Ce(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class zk{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return ie(this.restDecoder)}readDsLen(){return ie(this.restDecoder)}}class Vk extends zk{readLeftID(){return X(ie(this.restDecoder),ie(this.restDecoder))}readRightID(){return X(ie(this.restDecoder),ie(this.restDecoder))}readClient(){return ie(this.restDecoder)}readInfo(){return ks(this.restDecoder)}readString(){return ts(this.restDecoder)}readParentInfo(){return ie(this.restDecoder)===1}readTypeRef(){return ie(this.restDecoder)}readLen(){return ie(this.restDecoder)}readAny(){return Uo(this.restDecoder)}readBuf(){return pM(Bt(this.restDecoder))}readJSON(){return JSON.parse(ts(this.restDecoder))}readKey(){return ts(this.restDecoder)}}class u3{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=ie(this.restDecoder),this.dsCurrVal}readDsLen(){const e=ie(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ss extends u3{constructor(e){super(e),this.keys=[],ie(e),this.keyClockDecoder=new Ju(Bt(e)),this.clientDecoder=new ll(Bt(e)),this.leftClockDecoder=new Ju(Bt(e)),this.rightClockDecoder=new Ju(Bt(e)),this.infoDecoder=new Jg(Bt(e),ks),this.stringDecoder=new zO(Bt(e)),this.parentInfoDecoder=new Jg(Bt(e),ks),this.typeRefDecoder=new ll(Bt(e)),this.lenDecoder=new ll(Bt(e))}readLeftID(){return new rs(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new rs(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Uo(this.restDecoder)}readBuf(){return Bt(this.restDecoder)}readJSON(){return Uo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class jk{constructor(){this.restEncoder=la()}toUint8Array(){return pn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ae(this.restEncoder,e)}writeDsLen(e){ae(this.restEncoder,e)}}class ua extends jk{writeLeftID(e){ae(this.restEncoder,e.client),ae(this.restEncoder,e.clock)}writeRightID(e){ae(this.restEncoder,e.client),ae(this.restEncoder,e.clock)}writeClient(e){ae(this.restEncoder,e)}writeInfo(e){bh(this.restEncoder,e)}writeString(e){es(this.restEncoder,e)}writeParentInfo(e){ae(this.restEncoder,e?1:0)}writeTypeRef(e){ae(this.restEncoder,e)}writeLen(e){ae(this.restEncoder,e)}writeAny(e){Es(this.restEncoder,e)}writeBuf(e){Pt(this.restEncoder,e)}writeJSON(e){es(this.restEncoder,JSON.stringify(e))}writeKey(e){es(this.restEncoder,e)}}class qk{constructor(){this.restEncoder=la(),this.dsCurrVal=0}toUint8Array(){return pn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,ae(this.restEncoder,n)}writeDsLen(e){e===0&&kt(),ae(this.restEncoder,e-1),this.dsCurrVal+=e}}class Si extends qk{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Qu,this.clientEncoder=new al,this.leftClockEncoder=new Qu,this.rightClockEncoder=new Qu,this.infoEncoder=new Kg(bh),this.stringEncoder=new vO,this.parentInfoEncoder=new Kg(bh),this.typeRefEncoder=new al,this.lenEncoder=new al}toUint8Array(){const e=la();return ae(e,0),Pt(e,this.keyClockEncoder.toUint8Array()),Pt(e,this.clientEncoder.toUint8Array()),Pt(e,this.leftClockEncoder.toUint8Array()),Pt(e,this.rightClockEncoder.toUint8Array()),Pt(e,pn(this.infoEncoder)),Pt(e,this.stringEncoder.toUint8Array()),Pt(e,pn(this.parentInfoEncoder)),Pt(e,this.typeRefEncoder.toUint8Array()),Pt(e,this.lenEncoder.toUint8Array()),Zc(e,pn(this.restEncoder)),pn(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Es(this.restEncoder,e)}writeBuf(e){Pt(this.restEncoder,e)}writeJSON(e){Es(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const d3=(t,e,n,r)=>{r=En(r,e[0].id.clock);const i=on(e,r);ae(t.restEncoder,e.length-i),t.writeClient(n),ae(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},Ep=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Be(e,s)>i&&r.set(s,i)}),da(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),ae(t.restEncoder,r.size),Br(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{d3(t,e.clients.get(i),i,s)})},h3=(t,e)=>{const n=nn(),r=ie(t.restDecoder);for(let i=0;i<r;i++){const s=ie(t.restDecoder),o=new Array(s),a=t.readClient();let l=ie(t.restDecoder);n.set(a,{i:0,refs:o});for(let c=0;c<s;c++){const u=t.readInfo();switch(Xc&u){case 0:{const d=t.readLen();o[c]=new Jt(X(a,l),d),l+=d;break}case 10:{const d=ie(t.restDecoder);o[c]=new Xt(X(a,l),d),l+=d;break}default:{const d=(u&(or|bt))===0,h=new _e(X(a,l),null,(u&bt)===bt?t.readLeftID():null,null,(u&or)===or?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&Fo)===Fo?t.readString():null,kT(t,u));o[c]=h,l+=h.length}}}}return n},f3=(t,e,n)=>{const r=[];let i=Br(n.keys()).sort((f,p)=>f-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let f=n.get(i[i.length-1]);for(;f.refs.length===f.i;)if(i.pop(),i.length>0)f=n.get(i[i.length-1]);else return null;return f};let o=s();if(o===null)return null;const a=new Qk,l=new Map,c=(f,p)=>{const g=l.get(f);(g==null||g>p)&&l.set(f,p)};let u=o.refs[o.i++];const d=new Map,h=()=>{for(const f of r){const p=f.id.client,g=n.get(p);g?(g.i--,a.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):a.clients.set(p,[f]),i=i.filter(b=>b!==p)}r.length=0};for(;;){if(u.constructor!==Xt){const p=Un(d,u.id.client,()=>Be(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),h();else{const g=u.getMissing(t,e);if(g!==null){r.push(u);const b=n.get(g)||{refs:[],i:0};if(b.refs.length===b.i)c(g,Be(e,g)),h();else{u=b.refs[b.i++];continue}}else(p===0||p<u.length)&&(u.integrate(t,p),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=s(),o===null)break;u=o.refs[o.i++]}}if(a.clients.size>0){const f=new Si;return Ep(f,a,new Map),ae(f.restEncoder,0),{missing:l,update:f.toUint8Array()}}return null},p3=(t,e)=>Ep(t,e.doc.store,e.beforeState),m3=(t,e,n,r=new Ss(t))=>Ce(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=h3(r,o),c=f3(i,a,l),u=a.pendingStructs;if(u){for(const[h,f]of u.missing)if(f<Be(a,h)){s=!0;break}if(c){for(const[h,f]of c.missing){const p=u.missing.get(h);(p==null||p>f)&&u.missing.set(h,f)}u.update=zl([u.update,c.update])}}else a.pendingStructs=c;const d=n0(r,i,a);if(a.pendingDs){const h=new Ss(Os(a.pendingDs));ie(h.restDecoder);const f=n0(h,i,a);d&&f?a.pendingDs=zl([d,f]):a.pendingDs=d||f}else a.pendingDs=d;if(s){const h=a.pendingStructs.update;a.pendingStructs=null,$l(i.doc,h)}},n,!1),$l=(t,e,n,r=Ss)=>{const i=Os(e);m3(i,t,n,new r(i))},r0=(t,e,n)=>$l(t,e,n,Vk),g3=(t,e,n=new Map)=>{Ep(t,e.store,n),Rs(t,Uk(e.store))},b3=(t,e=new Uint8Array([0]),n=new Si)=>{const r=Wk(e);g3(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(P3(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===ua)return L3(i.map((s,o)=>o===0?s:F3(s)));if(n.constructor===Si)return zl(i)}return i[0]},i0=(t,e)=>b3(t,e,new ua),y3=t=>{const e=new Map,n=ie(t.restDecoder);for(let r=0;r<n;r++){const i=ie(t.restDecoder),s=ie(t.restDecoder);e.set(i,s)}return e},Wk=t=>y3(new zk(Os(t))),Yk=(t,e)=>(ae(t.restEncoder,e.size),Br(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{ae(t.restEncoder,n),ae(t.restEncoder,r)}),t),E3=(t,e)=>Yk(t,da(e.store)),k3=(t,e=new qk)=>(t instanceof Map?Yk(e,t):E3(e,t),e.toUint8Array()),T3=t=>k3(t,new jk);class C3{constructor(){this.l=[]}}const s0=()=>new C3,o0=(t,e)=>t.l.push(e),a0=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Kk=(t,e,n)=>lp(t.l,[e,n]);class rs{constructor(e,n){this.client=e,this.clock=n}}const Qi=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,X=(t,e)=>new rs(t,e),jo=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw kt()},qo=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Wo{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const co=t=>new Wo(t.type==null?null:X(t.type.client,t.type.clock),t.tname??null,t.item==null?null:X(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class S3{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const w3=(t,e,n=0)=>new S3(t,e,n),La=(t,e,n)=>{let r=null,i=null;return t._item===null?i=jo(t):r=X(t._item.id.client,t._item.id.clock),new Wo(r,i,e,n)},td=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return La(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return La(t,X(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return La(t,r.lastId,n);r=r.right}return La(t,null,n)},x3=(t,e)=>{const n=is(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},A3=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,a=t.assoc;let l=null,c=0;if(i!==null){if(Be(r,i.client)<=i.clock)return null;const u=n?xh(r,i):x3(r,i),d=u.item;if(!(d instanceof _e))return null;if(l=d.parent,l._item===null||!l._item.deleted){c=d.deleted||!d.countable?0:u.diff+(a>=0?0:1);let h=d.left;for(;h!==null;)!h.deleted&&h.countable&&(c+=h.length),h=h.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(Be(r,s.client)<=s.clock)return null;const{item:u}=n?xh(r,s):{item:is(r,s)};if(u instanceof _e&&u.content instanceof Sn)l=u.content.type;else return null}else throw kt();a>=0?c=l._length:c=0}return w3(l,c,t.assoc)},l0=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Qi(t.item,e.item)&&Qi(t.type,e.type)&&t.assoc===e.assoc;class kp{constructor(e,n){this.ds=e,this.sv=n}}const Gk=(t,e)=>new kp(t,e),nd=t=>Gk(Uk(t.store),da(t.store)),Zr=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Ls(e.ds,t.id),Ch=(t,e)=>{const n=Un(t.meta,Ch,Ci),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Be(r,s)&&Nt(t,X(s,i))}),Fr(t,e.ds,i=>{}),n.add(e))};class Qk{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const da=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},Be=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},Jk=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw kt()}n.push(e)},on=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=yn(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=yn((n+r)/2)}throw kt()},_3=(t,e)=>{const n=t.clients.get(e.client);return n[on(n,e.clock)]},is=_3,Sh=(t,e,n)=>{const r=on(e,n),i=e[r];return i.id.clock<n&&i instanceof _e?(e.splice(r+1,0,Yl(t,i,n-i.id.clock)),r+1):r},Nt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Sh(t,n,e.clock)]},c0=(t,e,n)=>{const r=e.clients.get(n.client),i=on(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Jt&&r.splice(i+1,0,Yl(t,s,n.clock-s.id.clock+1)),s},N3=(t,e,n)=>{const r=t.clients.get(e.id.client);r[on(r,e.id.clock)]=n},Xk=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=Sh(t,e,n),a;do a=e[o++],s<a.id.clock+a.length&&Sh(t,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class I3{constructor(e,n,r){this.doc=e,this.deleteSet=new vs,this.beforeState=da(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const u0=(t,e)=>e.deleteSet.clients.size===0&&!cO(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(bp(e.deleteSet),p3(t,e),Rs(t,e.deleteSet),!0),d0=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Un(t.changed,e,Ci).add(n)},ul=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof _e&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},O3=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let c=on(s,a.clock),u=s[c];c<s.length&&u.id.clock<l;u=s[++c]){const d=s[c];if(a.clock+a.len<=d.id.clock)break;d instanceof _e&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},M3=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=sr(i.length-1,1+on(i,o.clock+o.len-1));for(let l=a,c=i[l];l>0&&c.id.clock>=o.clock;c=i[l])l-=1+ul(i,l)}})},Zk=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{bp(s),n.afterState=da(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(u=>u.target._item===null||!u.target._item.deleted),l.forEach(u=>{u.currentTarget=c,u._path=null}),l.sort((u,d)=>u.path.length-d.path.length),a.push(()=>{Kk(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&X3(n)})}),lp(a,[])}finally{r.gc&&O3(s,i,r.gcFilter),M3(s,i),n.afterState.forEach((u,d)=>{const h=n.beforeState.get(d)||0;if(h!==u){const f=i.clients.get(d),p=En(on(f,h),1);for(let g=f.length-1;g>=p;)g-=1+ul(f,g)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:h}=o[u].id,f=i.clients.get(d),p=on(f,h);p+1<f.length&&ul(f,p+1)>1||p>0&&ul(f,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(a3(mp,Dk,"[yjs] ",vk,Lk,"Changed the client-id because another client seems to be using it."),r.clientID=$k()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new ua;u0(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new Si;u0(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Zk(t,e+1)}}},Ce=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new I3(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const a=t._transaction===i[0];t._transaction=null,a&&Zk(i,0)}}return o};class D3{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const h0=(t,e,n)=>{Fr(t,n.deletions,r=>{r instanceof _e&&e.scope.some(i=>i===t.doc||qo(i,r))&&Np(r,!1)})},f0=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;Ce(i,a=>{for(;e.length>0&&t.currStackItem===null;){const l=i.store,c=e.pop(),u=new Set,d=[];let h=!1;Fr(a,c.insertions,f=>{if(f instanceof _e){if(f.redone!==null){let{item:p,diff:g}=xh(l,f.id);g>0&&(p=Nt(a,X(p.id.client,p.id.clock+g))),f=p}!f.deleted&&s.some(p=>p===a.doc||qo(p,f))&&d.push(f)}}),Fr(a,c.deletions,f=>{f instanceof _e&&s.some(p=>p===a.doc||qo(p,f))&&!Ls(c.insertions,f.id)&&u.add(f)}),u.forEach(f=>{h=ET(a,f,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||h});for(let f=d.length-1;f>=0;f--){const p=d[f];t.deleteFilter(p)&&(p.delete(a),h=!0)}t.currStackItem=h?c:null}a.changed.forEach((l,c)=>{l.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class eT extends rk{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=ys(e)?e[0].doc:e instanceof jr?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(b=>l.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const c=this.undoing,u=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);const h=new vs;l.afterState.forEach((b,y)=>{const T=l.beforeState.get(y)||0,S=b-T;S>0&&Vo(h,y,T,S)});const f=KO();let p=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){const b=d[d.length-1];b.deletions=Th([b.deletions,l.deleteSet]),b.insertions=Th([b.insertions,h])}else d.push(new D3(l.deleteSet,h)),p=!0;!c&&!u&&(this.lastChange=f),Fr(l,l.deleteSet,b=>{b instanceof _e&&this.scope.some(y=>y===l.doc||qo(y,b))&&Np(b,!0)});const g=[{stackItem:d[d.length-1],origin:l.origin,type:c?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=ys(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Je?r.doc!==this.doc:r!==this.doc)&&Pk("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>h0(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>h0(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=f0(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=f0(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*v3(t){const e=ie(t.restDecoder);for(let n=0;n<e;n++){const r=ie(t.restDecoder),i=t.readClient();let s=ie(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=ie(t.restDecoder);yield new Xt(X(i,s),l),s+=l}else if((Xc&a)!==0){const l=(a&(or|bt))===0,c=new _e(X(i,s),null,(a&bt)===bt?t.readLeftID():null,null,(a&or)===or?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&Fo)===Fo?t.readString():null,kT(t,a));yield c,s+=c.length}else{const l=t.readLen();yield new Jt(X(i,s),l),s+=l}}}}class Tp{constructor(e,n){this.gen=v3(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Xt);return this.curr}}class Cp{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const L3=t=>zl(t,Vk,ua),R3=(t,e)=>{if(t.constructor===Jt){const{client:n,clock:r}=t.id;return new Jt(X(n,r+e),t.length-e)}else if(t.constructor===Xt){const{client:n,clock:r}=t.id;return new Xt(X(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new _e(X(r,i+e),null,X(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},zl=(t,e=Ss,n=Si)=>{if(t.length===1)return t[0];const r=t.map(u=>new e(Os(u)));let i=r.map(u=>new Tp(u,!0)),s=null;const o=new n,a=new Cp(o);for(;i=i.filter(h=>h.curr!==null),i.sort((h,f)=>{if(h.curr.id.client===f.curr.id.client){const p=h.curr.id.clock-f.curr.id.clock;return p===0?h.curr.constructor===f.curr.constructor?0:h.curr.constructor===Xt?1:-1:p}else return f.curr.id.client-h.curr.id.client}),i.length!==0;){const u=i[0],d=u.curr.id.client;if(s!==null){let h=u.curr,f=!1;for(;h!==null&&h.id.clock+h.length<=s.struct.id.clock+s.struct.length&&h.id.client>=s.struct.id.client;)h=u.next(),f=!0;if(h===null||h.id.client!==d||f&&h.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)Cr(a,s.struct,s.offset),s={struct:h,offset:0},u.next();else if(s.struct.id.clock+s.struct.length<h.id.clock)if(s.struct.constructor===Xt)s.struct.length=h.id.clock+h.length-s.struct.id.clock;else{Cr(a,s.struct,s.offset);const p=h.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Xt(X(d,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-h.id.clock;p>0&&(s.struct.constructor===Xt?s.struct.length-=p:h=R3(h,p)),s.struct.mergeWith(h)||(Cr(a,s.struct,s.offset),s={struct:h,offset:0},u.next())}}else s={struct:u.curr,offset:0},u.next();for(let h=u.curr;h!==null&&h.id.client===d&&h.id.clock===s.struct.id.clock+s.struct.length&&h.constructor!==Xt;h=u.next())Cr(a,s.struct,s.offset),s={struct:h,offset:0}}s!==null&&(Cr(a,s.struct,s.offset),s=null),Sp(a);const l=r.map(u=>yp(u)),c=Th(l);return Rs(o,c),o.toUint8Array()},P3=(t,e,n=Ss,r=Si)=>{const i=Wk(e),s=new r,o=new Cp(s),a=new n(Os(t)),l=new Tp(a,!1);for(;l.curr;){const u=l.curr,d=u.id.client,h=i.get(d)||0;if(l.curr.constructor===Xt){l.next();continue}if(u.id.clock+u.length>h)for(Cr(o,u,En(h-u.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)Cr(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=h;)l.next()}Sp(o);const c=yp(a);return Rs(s,c),s.toUint8Array()},tT=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:pn(t.encoder.restEncoder)}),t.encoder.restEncoder=la(),t.written=0)},Cr=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&tT(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),ae(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Sp=t=>{tT(t);const e=t.encoder.restEncoder;ae(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];ae(e,r.written),Zc(e,r.restEncoder)}},B3=(t,e,n,r)=>{const i=new n(Os(t)),s=new Tp(i,!1),o=new r,a=new Cp(o);for(let c=s.curr;c!==null;c=s.next())Cr(a,e(c),0);Sp(a);const l=yp(i);return Rs(o,l),o.toUint8Array()},F3=t=>B3(t,iM,Ss,ua),p0="You must not compute changes after the event-handler fired.";class ou{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=H3(this.currentTarget,this.target))}deletes(e){return Ls(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Bn(p0);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=Yu(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=Yu(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=Yu(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Bn(p0);const n=this.target,r=Ci(),i=Ci(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=c.length,i.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const H3=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},dt=()=>{Pk("Invalid access: Add Yjs type to a document before reading data.")},nT=80;let wp=0;class U3{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=wp++}}const $3=t=>{t.timestamp=wp++},rT=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=wp++},z3=(t,e,n)=>{if(t.length>=nT){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return rT(r,e,n),r}else{const r=new U3(e,n);return t.push(r),r}},au=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>ol(e-s.index)<ol(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,$3(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&ol(n.index-i)<r.parent.length/nT?(rT(n,r,i),n):z3(t._searchMarker,r,i)},Yo=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=En(e,i.index+n))}},lu=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Un(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;Kk(r._eH,n,e)};class Je{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=s0(),this._dEH=s0(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw rn()}clone(){throw rn()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){o0(this._eH,e)}observeDeep(e){o0(this._dEH,e)}unobserve(e){a0(this._eH,e)}unobserveDeep(e){a0(this._dEH,e)}toJSON(){}}const iT=(t,e,n)=>{t.doc??dt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},sT=t=>{t.doc??dt();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},oT=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Zr(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Ko=(t,e)=>{let n=0,r=t._start;for(t.doc??dt();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},aT=(t,e)=>{const n=[];return Ko(t,(r,i)=>{n.push(e(r,i,t))}),n},V3=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},lT=(t,e)=>{t.doc??dt();const n=au(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Vl=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,a=s.store,l=n===null?e._start:n.right;let c=[];const u=()=>{c.length>0&&(i=new _e(X(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new xi(c)),i.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new _e(X(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ha(new Uint8Array(d))),i.integrate(t,0);break;case jr:i=new _e(X(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new fa(d)),i.integrate(t,0);break;default:if(d instanceof Je)i=new _e(X(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Sn(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},cT=()=>Bn("Length exceeded!"),uT=(t,e,n,r)=>{if(n>e._length)throw cT();if(n===0)return e._searchMarker&&Yo(e._searchMarker,n,r.length),Vl(t,e,null,r);const i=n,s=au(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Nt(t,X(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&Yo(e._searchMarker,i,r.length),Vl(t,e,o,r)},j3=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Vl(t,e,i,n)},dT=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=au(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Nt(t,X(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Nt(t,X(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw cT();e._searchMarker&&Yo(e._searchMarker,i,-s+r)},jl=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},xp=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let a;if(r==null)a=new xi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new xi([r]);break;case Uint8Array:a=new ha(r);break;case jr:a=new fa(r);break;default:if(r instanceof Je)a=new Sn(r);else throw new Error("Unexpected content type")}new _e(X(o,Be(s.store,o)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},Ap=(t,e)=>{t.doc??dt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},hT=t=>{const e={};return t.doc??dt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},fT=(t,e)=>{t.doc??dt();const n=t._map.get(e);return n!==void 0&&!n.deleted},q3=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Zr(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Ra=t=>(t.doc??dt(),l3(t._map.entries(),e=>!e[1].deleted));class W3 extends ou{}class ss extends Je{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new ss;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ss}clone(){const e=new ss;return e.insert(0,this.toArray().map(n=>n instanceof Je?n.clone():n)),e}get length(){return this.doc??dt(),this._length}_callObserver(e,n){super._callObserver(e,n),lu(this,e,new W3(this,e))}insert(e,n){this.doc!==null?Ce(this.doc,r=>{uT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Ce(this.doc,n=>{j3(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{dT(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return lT(this,e)}toArray(){return sT(this)}slice(e=0,n=this.length){return iT(this,e,n)}toJSON(){return this.map(e=>e instanceof Je?e.toJSON():e)}map(e){return aT(this,e)}forEach(e){Ko(this,e)}[Symbol.iterator](){return V3(this)}_write(e){e.writeTypeRef(bD)}}const Y3=t=>new ss;class K3 extends ou{constructor(e,n,r){super(e,n),this.keysChanged=r}}class ws extends Je{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new ws}clone(){const e=new ws;return this.forEach((n,r)=>{e.set(r,n instanceof Je?n.clone():n)}),e}_callObserver(e,n){lu(this,e,new K3(this,e,n))}toJSON(){this.doc??dt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof Je?i.toJSON():i}}),e}get size(){return[...Ra(this)].length}keys(){return ed(Ra(this),e=>e[0])}values(){return ed(Ra(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return ed(Ra(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??dt(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Ce(this.doc,n=>{jl(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Ce(this.doc,r=>{xp(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Ap(this,e)}has(e){return fT(this,e)}clear(){this.doc!==null?Ce(this.doc,e=>{this.forEach(function(n,r,i){jl(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(yD)}}const G3=t=>new ws,_r=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&nM(t,e);class wh{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){this.right===null&&kt(),this.right.content.constructor===je?this.right.deleted||Ps(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const m0=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===je?e.right.deleted||Ps(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&Nt(t,X(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Pa=(t,e,n,r)=>{const i=new Map,s=r?au(e,n):null;if(s){const o=new wh(s.p.left,s.p,s.index,i);return m0(t,o,n-s.index)}else{const o=new wh(null,e._start,0,i);return m0(t,o,n)}},pT=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===je&&_r(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,a)=>{const l=n.left,c=n.right,u=new _e(X(s,Be(i.store,s)),l,l&&l.lastId,c,c&&c.id,e,null,new je(a,o));u.integrate(t,0),n.right=u,n.forward()})},Ps=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},mT=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===je&&_r(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},gT=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!_r(c,l)){o.set(a,c);const{left:u,right:d}=n;n.right=new _e(X(s,Be(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new je(a,l)),n.right.integrate(t,0),n.forward()}}return o},rd=(t,e,n,r,i)=>{n.currentAttributes.forEach((h,f)=>{i[f]===void 0&&(i[f]=null)});const s=t.doc,o=s.clientID;mT(n,i);const a=gT(t,e,n,i),l=r.constructor===String?new kn(r):r instanceof Je?new Sn(r):new Oi(r);let{left:c,right:u,index:d}=n;e._searchMarker&&Yo(e._searchMarker,n.index,l.getLength()),u=new _e(X(o,Be(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,l),u.integrate(t,0),n.right=u,n.index=d,n.forward(),pT(t,e,n,a)},g0=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;mT(n,i);const a=gT(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===je));){if(!n.right.deleted)switch(n.right.content.constructor){case je:{const{key:l,value:c}=n.right.content,u=i[l];if(u!==void 0){if(_r(u,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(t)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&Nt(t,X(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
108
108
  `;n.right=new _e(X(o,Be(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new kn(l)),n.right.integrate(t,0),n.forward()}pT(t,e,n,a)},bT=(t,e,n,r,i)=>{let s=e;const o=nn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===je){const c=s.content;o.set(c.key,c)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const c=e.content;if(c.constructor===je){const{key:u,value:d}=c,h=r.get(u)??null;(o.get(u)!==c||h===d)&&(e.delete(t),a++,!l&&(i.get(u)??null)===d&&h!==d&&(h===null?i.delete(u):i.set(u,h))),!l&&!e.deleted&&Ps(i,c)}}e=e.right}return a},Q3=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===je){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},J3=t=>{let e=0;return Ce(t.doc,n=>{let r=t._start,i=t._start,s=nn();const o=mh(s);for(;i;)i.deleted===!1&&(i.content.constructor===je?Ps(o,i.content):(e+=bT(n,r,i,s,o),s=mh(o),r=i)),i=i.right}),e},X3=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&Xk(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===je&&o.constructor!==Jt&&e.add(o.parent)})}Ce(n,r=>{Fr(t,t.deleteSet,i=>{if(i instanceof Jt||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===je?e.add(s):Q3(r,i)});for(const i of e)J3(i)})},b0=(t,e,n)=>{const r=n,i=mh(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Sn:case Oi:case kn:n<e.right.length&&Nt(t,X(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&bT(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Yo(o._searchMarker,e.index,-r+n),e};class Z3 extends ou{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Ce(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let c="",u=0,d=0;const h=()=>{if(a!==null){let f=null;switch(a){case"delete":d>0&&(f={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(f={insert:c},i.size>0&&(f.attributes={},i.forEach((p,g)=>{p!==null&&(f.attributes[g]=p)}))),c="";break;case"retain":u>0&&(f={retain:u},tM(l)||(f.attributes=ZO({},l))),u=0;break}f&&n.push(f),a=null}};for(;o!==null;){switch(o.content.constructor){case Sn:case Oi:this.adds(o)?this.deletes(o)||(h(),a="insert",c=o.content.getContent()[0],h()):this.deletes(o)?(a!=="delete"&&(h(),a="delete"),d+=1):o.deleted||(a!=="retain"&&(h(),a="retain"),u+=1);break;case kn:this.adds(o)?this.deletes(o)||(a!=="insert"&&(h(),a="insert"),c+=o.content.str):this.deletes(o)?(a!=="delete"&&(h(),a="delete"),d+=o.length):o.deleted||(a!=="retain"&&(h(),a="retain"),u+=o.length);break;case je:{const{key:f,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=i.get(f)??null;_r(g,p)?p!==null&&o.delete(r):(a==="retain"&&h(),_r(p,s.get(f)??null)?delete l[f]:l[f]=p)}}else if(this.deletes(o)){s.set(f,p);const g=i.get(f)??null;_r(g,p)||(a==="retain"&&h(),l[f]=g)}else if(!o.deleted){s.set(f,p);const g=l[f];g!==void 0&&(_r(g,p)?g!==null&&o.delete(r):(a==="retain"&&h(),p===null?delete l[f]:l[f]=p))}o.deleted||(a==="insert"&&h(),Ps(i,o.content));break}}o=o.right}for(h();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Hr extends Je{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??dt(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Hr}clone(){const e=new Hr;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new Z3(this,e,n);lu(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??dt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===kn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Ce(this.doc,r=>{const i=new wh(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
109
- `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&rd(r,this,i,a,o.attributes||{})}else o.retain!==void 0?g0(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&b0(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??dt();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let h=!1;s.forEach((p,g)=>{h=!0,d[g]=p});const f={insert:a};h&&(f.attributes=d),i.push(f),a=""}}const u=()=>{for(;l!==null;){if(Zr(l,e)||n!==void 0&&Zr(l,n))switch(l.content.constructor){case kn:{const d=s.get("ychange");e!==void 0&&!Zr(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Zr(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),a+=l.content.str;break}case Sn:case Oi:{c();const d={insert:l.content.getContent()[0]};if(s.size>0){const h={};d.attributes=h,s.forEach((f,p)=>{h[p]=f})}i.push(d);break}case je:Zr(l,e)&&(c(),Ps(s,l.content));break}l=l.right}c()};return e||n?Ce(o,d=>{e&&Ch(d,e),n&&Ch(d,n),u()},"cleanup"):u(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),rd(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!r);rd(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ce(r,i=>{b0(i,Pa(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!1);o.right!==null&&g0(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{jl(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{xp(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Ap(this,e)}getAttributes(){return hT(this)}_write(e){e.writeTypeRef(ED)}}const eD=t=>new Hr;class id{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??dt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===at||n.constructor===wi)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class wi extends Je{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new wi}clone(){const e=new wi;return e.insert(0,this.toArray().map(n=>n instanceof Je?n.clone():n)),e}get length(){return this.doc??dt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new id(this,e)}querySelector(e){e=e.toUpperCase();const r=new id(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Br(new id(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){lu(this,e,new rD(this,n,e))}toString(){return aT(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Ko(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Ce(this.doc,r=>{uT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ce(this.doc,r=>{const i=e&&e instanceof Je?e._item:e;Vl(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Bn("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{dT(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return sT(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return lT(this,e)}slice(e=0,n=this.length){return iT(this,e,n)}forEach(e){Ko(this,e)}_write(e){e.writeTypeRef(TD)}}const tD=t=>new wi;class at extends wi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new at(this.nodeName)}clone(){const e=new at(this.nodeName),n=this.getAttributes();return eM(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Je?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{jl(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{xp(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Ap(this,e)}hasAttribute(e){return fT(this,e)}getAttributes(e){return e?q3(this,e):hT(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Ko(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(kD),e.writeKey(this.nodeName)}}const nD=t=>new at(t.readKey());class rD extends ou{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class ql extends ws{constructor(e){super(),this.hookName=e}_copy(){return new ql(this.hookName)}clone(){const e=new ql(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(CD),e.writeKey(this.hookName)}}const iD=t=>new ql(t.readKey());class Ut extends Hr{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Ut}clone(){const e=new Ut;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(SD)}}const sD=t=>new Ut;class _p{constructor(e,n){this.id=e,this.length=n}get deleted(){throw rn()}mergeWith(e){return!1}write(e,n,r){throw rn()}integrate(e,n){throw rn()}}const oD=0;class Jt extends _p{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),Jk(e.doc.store,this)}write(e,n){e.writeInfo(oD),e.writeLen(this.length-n)}getMissing(e,n){return null}}class ha{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ha(this.content)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const aD=t=>new ha(t.readBuf());class Go{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Go(this.len)}splice(e){const n=new Go(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Vo(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const lD=t=>new Go(t.readLen()),yT=(t,e)=>new jr({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class fa{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new fa(yT(this.doc.guid,this.opts))}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const cD=t=>new fa(yT(t.readString(),t.readAny()));class Oi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Oi(this.embed)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const uD=t=>new Oi(t.readJSON());class je{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new je(this.key,this.value)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const dD=t=>new je(t.readKey(),t.readJSON());class Wl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Wl(this.arr)}splice(e){const n=new Wl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const hD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Wl(n)},fD=Fl("node_env")==="development";class xi{constructor(e){this.arr=e,fD&&hk(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new xi(this.arr)}splice(e){const n=new xi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const pD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new xi(n)};class kn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new kn(this.str)}splice(e){const n=new kn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const mD=t=>new kn(t.readString()),gD=[Y3,G3,eD,nD,tD,iD,sD],bD=0,yD=1,ED=2,kD=3,TD=4,CD=5,SD=6;class Sn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Sn(this.type._copy())}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const wD=t=>new Sn(gD[t.readTypeRef()](t)),xh=(t,e)=>{let n=e,r=0,i;do r>0&&(n=X(n.client,n.clock+r)),i=is(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof _e);return{item:i,diff:r}},Np=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Yl=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new _e(X(r,i+n),e,X(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=X(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},y0=(t,e)=>np(t,n=>Ls(n.deletions,e)),ET=(t,e,n,r,i,s)=>{const o=t.doc,a=o.store,l=o.clientID,c=e.redone;if(c!==null)return Nt(t,c);let u=e.parent._item,d=null,h;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||ET(t,u,n,r,i,s)===null))return null;for(;u.redone!==null;)u=Nt(t,u.redone)}const f=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,h=e;d!==null;){let y=d;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){d=y;break}d=d.left}for(;h!==null;){let y=h;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){h=y;break}h=h.right}}else if(h=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||Ls(r,d.right.id)||y0(s.undoStack,d.right.id)||y0(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Nt(t,d.redone);if(d&&d.right!==null)return null}else d=f._map.get(e.parentSub)||null;const p=Be(a,l),g=X(l,p),b=new _e(g,d,d&&d.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,Np(b,!0),b.integrate(t,0),b};let _e=class Ah extends _p{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?jg:0}set marker(e){(this.info&Gu)>0!==e&&(this.info^=Gu)}get marker(){return(this.info&Gu)>0}get keep(){return(this.info&Vg)>0}set keep(e){this.keep!==e&&(this.info^=Vg)}get countable(){return(this.info&jg)>0}get deleted(){return(this.info&Ku)>0}set deleted(e){this.deleted!==e&&(this.info^=Ku)}markDeleted(){this.info|=Ku}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Be(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Be(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===rs&&this.id.client!==this.parent.client&&this.parent.clock>=Be(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=c0(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Nt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Jt||this.right&&this.right.constructor===Jt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Ah?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Ah&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===rs){const r=is(n,this.parent);r.constructor===Jt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=c0(e,e.doc.store,X(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Qi(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Qi(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(is(e.doc.store,i.origin)))s.has(is(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Jk(e.doc.store,this),this.content.integrate(e,this),d0(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Jt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:X(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Qi(e.origin,this.lastId)&&this.right===e&&Qi(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Vo(e.deleteSet,this.id.client,this.id.clock,this.length),d0(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw kt();this.content.gc(e),n?N3(e,this,new Jt(this.id,this.length)):this.content=new Go(this.length)}write(e,n){const r=n>0?X(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Xc|(r===null?0:bt)|(i===null?0:or)|(s===null?0:Fo);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=jo(a);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===rs?(e.writeParentInfo(!1),e.writeLeftID(a)):kt();s!==null&&e.writeString(s)}this.content.write(e,n)}};const kT=(t,e)=>xD[e&Xc](t),xD=[()=>{kt()},lD,hD,aD,mD,uD,dD,wD,pD,cD,()=>{kt()}],AD=10;class Xt extends _p{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){kt()}write(e,n){e.writeInfo(AD),ae(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const TT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},CT="__ $YJS$ __";TT[CT]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");TT[CT]=!0;const _D=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},ND=/[\uD800-\uDBFF]/,ID=/[\uDC00-\uDFFF]/,OD=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&ND.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&ID.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},MD=OD,Ie=new me("y-sync"),Dn=new me("y-undo"),Ba=new me("yjs-cursor"),vn=(t,e)=>t>>>e|t<<32-e,DD=t=>vn(t,2)^vn(t,13)^vn(t,22),vD=t=>vn(t,6)^vn(t,11)^vn(t,25),LD=t=>vn(t,7)^vn(t,18)^t>>>3,RD=t=>vn(t,17)^vn(t,19)^t>>>10,PD=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),BD=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class FD{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(BD),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=RD(n[d-2])+n[d-7]+LD(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,h,f;d<64;d++)h=u+vD(a)+(a&l^~a&c)+PD[d]+n[d]>>>0,f=DD(r)+(r&i^r&s^i&s)>>>0,u=c,c=l,l=a,a=o+h>>>0,o=s,s=i,i=r,r=h+f>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=bt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=bt<<(3-n%4)*8),this._W[14]=e.byteLength/hO,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const HD=t=>new FD().digest(t),UD=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},$D=t=>fM(UD(HD(mM(t)))),Kl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ls(e.ds,t.id),zD=[{light:"#ecd44433",dark:"#ecd444"}],VD=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Ci();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,qO(e))}return t.get(n)},jD=(t,{colors:e=zD,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new WD(t,s),l=new te({props:{editable:c=>{const u=Ie.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:Ie,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(Ie);if(d!==void 0){u=Object.assign({},u);for(const h in d)u[h]=d[h]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&pp(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),s==null&&a._forceRerender(),i(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=Dn.getState(c.state),h=d&&d.undoManager;h&&h.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},Ie)})}},destroy:()=>{a.destroy()}})});return l},qD=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Ot(t.doc));else if(e.type==="node"){const r=ci(n.doc,n.type,e.anchor,n.mapping);t.setSelection(W.create(t.doc,r))}else{const r=ci(n.doc,n.type,e.anchor,n.mapping),i=ci(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=j.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},_h=(t,e)=>({type:e.selection.jsonID,anchor:Jo(e.selection.anchor,t.type,t.mapping),head:Jo(e.selection.head,t.type,t.mapping)});class WD{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=_D(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=_h(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(pk&&this._domSelectionInView===null&&(pp(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=ca.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=Gk(Hk(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ie,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>dl(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(e),0,0));n.setMeta(Ie,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>dl(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(n),0,0));if(e){const i=sr(En(e.anchor,0),r.doc.content.size),s=sr(En(e.head,0),r.doc.content.size);r.setSelection(j.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Ie,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=nd(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&kt(),i=new jr({gc:!1}),$l(i,n),n=nd(i),$l(i,e),e=nd(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],a=on(o,s._item.id.clock);s=o[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Fr(o,d,h=>{})});const l=(d,h)=>{const f=d==="added"?a.getUserByClientId(h.client):a.getUserByDeletedId(h);return{user:f,type:d,color:VD(r.colorMapping,r.colors,f)}},c=oT(s,new kp(n.ds,e.sv)).map(d=>!d._item.deleted||Kl(d._item,e)||Kl(d._item,n)?dl(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(Ie,{isChangeOrigin:!0}))},Ie)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ie.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);Fr(n,n.deleteSet,a=>{if(a.constructor===_e){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>ST(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(s),0,0));qD(o,this.beforeTransactionSelection,this),o=o.setMeta(Ie,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof eT}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Ih(this.doc,this.type,e,this),this.beforeTransactionSelection=_h(this,this.prosemirrorView.state)},Ie)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const ST=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof at)return dl(t,e,n,r,i,s);throw rn()}return o},dl=(t,e,n,r,i,s)=>{const o=[],a=l=>{if(l instanceof at){const c=ST(l,e,n,r,i,s);c!==null&&o.push(c)}else{const c=l._item.right?.content?.type;c instanceof Hr&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=YD(l,e,n,r,i,s);u!==null&&u.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(a):oT(t,new kp(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Kl(t._item,r)?Kl(t._item,i)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,o);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),n.mapping.delete(t),null}},YD=(t,e,n,r,i,s)=>{const o=[],a=t.toDelta(r,i,s);try{for(let l=0;l<a.length;l++){const c=a[l];o.push(e.text(c.insert,ZD(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),null}return o},KD=(t,e)=>{const n=new Ut,r=t.map(i=>({insert:i.text,attributes:AT(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},GD=(t,e)=>{const n=new at(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,cu(t).map(r=>Nh(r,e))),e.mapping.set(n,t),n},Nh=(t,e)=>t instanceof Array?KD(t,e):GD(t,e),E0=t=>typeof t=="object"&&t!==null,Ip=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],a=e[s];r=s==="ychange"||o===a||E0(o)&&E0(a)&&Ip(o,a)}return r},cu=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},wT=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&dk(r.attributes||{}).length===e[i].marks.length&&Ms(r.attributes,(s,o)=>{const a=xT(o),l=e[i].marks;return Ip(s,l.find(c=>c.type.name===a)?.attrs)}))},Qo=(t,e)=>{if(t instanceof at&&!(e instanceof Array)&&Oh(t,e)){const n=cu(e);return t._length===n.length&&Ip(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Qo(r,n[i]))}return t instanceof Ut&&e instanceof Array&&wT(t,e)},Gl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),k0=(t,e,n)=>{const r=t.toArray(),i=cu(e),s=i.length,o=r.length,a=sr(o,s);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],h=i[l];if(Gl(n.mapping.get(d),h))u=!0;else if(!Qo(d,h))break}for(;l+c<a;c++){const d=r[o-c-1],h=i[s-c-1];if(Gl(n.mapping.get(d),h))u=!0;else if(!Qo(d,h))break}return{equalityFactor:l+c,foundMappedChild:u}},QD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof kn?e+=n.content.str:n.content instanceof je&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},JD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=QD(t),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,AT(c.marks,n))})),{insert:o,remove:a,index:l}=MD(i,s.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},XD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,xT=t=>XD.exec(t)?.[1]??t,ZD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(xT(r),t[r]));return n},AT=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Un(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${$D(r.toJSON())}`:r.type.name]=r.attrs}}),n},Ih=(t,e,n,r)=>{if(e instanceof at&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof at){const d=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?d[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in d)h[f]===void 0&&e.removeAttribute(f)}const i=cu(n),s=i.length,o=e.toArray(),a=o.length,l=sr(s,a);let c=0,u=0;for(;c<l;c++){const d=o[c],h=i[c];if(!Gl(r.mapping.get(d),h))if(Qo(d,h))r.mapping.set(d,h);else break}for(;u+c<l;u++){const d=o[a-u-1],h=i[s-u-1];if(!Gl(r.mapping.get(d),h))if(Qo(d,h))r.mapping.set(d,h);else break}t.transact(()=>{for(;a-c-u>0&&s-c-u>0;){const h=o[c],f=i[c],p=o[a-u-1],g=i[s-u-1];if(h instanceof Ut&&f instanceof Array)wT(h,f)||JD(h,f,r),c+=1;else{let b=h instanceof at&&Oh(h,f),y=p instanceof at&&Oh(p,g);if(b&&y){const T=k0(h,f,r),S=k0(p,g,r);T.foundMappedChild&&!S.foundMappedChild?y=!1:!T.foundMappedChild&&S.foundMappedChild||T.equalityFactor<S.equalityFactor?b=!1:y=!1}b?(Ih(t,h,f,r),c+=1):y?(Ih(t,p,g,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Nh(f,r)]),c+=1)}}const d=a-c-u;if(a===1&&s===0&&o[0]instanceof Ut?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(c,c+d).forEach(h=>r.mapping.delete(h)),e.delete(c,d)),c+u<s){const h=[];for(let f=c;f<s-u;f++)h.push(Nh(i[f],r));e.insert(c,h)}},Ie)},Oh=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let uo=null;const ev=()=>{const t=uo;uo=null,t.forEach((e,n)=>{const r=n.state.tr,i=Ie.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},tv=(t,e,n)=>{uo||(uo=new Map,pp(0,ev)),Un(uo,t,nn).set(e,n)},Jo=(t,e,n)=>{if(t===0)return td(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Ut){if(r._length>=t)return td(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Wo(r._item===null?null:r._item.id,r._item===null?jo(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Wo(r._item===null?null:r._item.id,r._item===null?jo(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw kt();if(t===0&&r.constructor!==Ut&&r!==e)return nv(r._item.parent,r._item)}return td(e,e._length,e.length===0?-1:0)},nv=(t,e)=>{let n=null,r=null;return t._item===null?r=jo(t):n=X(t._item.id.client,t._item.id.clock),new Wo(n,r,e.id)},ci=(t,e,n,r)=>{const i=A3(n,t);if(i===null||i.type!==e&&!qo(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Ut)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<i.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize}a=a.right}o+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===s)break;l.deleted||(c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize),l=l.right}}s=a}return o-1},rv=(t,e,n)=>t!==e,iv=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},_T=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),sv=/^#[0-9a-fA-F]{6}$/,T0=(t,e,n,r,i)=>{const s=Ie.getState(t),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ce.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(o.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":sv.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=ci(o,s.type,co(l.cursor.anchor),s.binding.mapping),h=ci(o,s.type,co(l.cursor.head),s.binding.mapping);if(d!==null&&h!==null){const f=En(t.doc.content.size-1,0);d=sr(d,f),h=sr(h,f),a.push(Ee.widget(h,()=>r(u,c),{key:c+"",side:10}));const p=sr(d,h),g=En(d,h);a.push(Ee.inline(p,g,i(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ce.create(t.doc,a))},ov=(t,{awarenessStateFilter:e=rv,cursorBuilder:n=iv,selectionBuilder:r=_T,getSelection:i=o=>o.selection}={},s="cursor")=>new te({key:Ba,state:{init(o,a){return T0(a,t,e,n,r)},apply(o,a,l,c){const u=Ie.getState(c),d=o.getMeta(Ba);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?T0(c,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Ba.getState(o)},view:o=>{const a=()=>{o.docView&&tv(o,Ba,{awarenessUpdated:!0})},l=()=>{const c=Ie.getState(o.state),u=t.getLocalState()||{};if(o.hasFocus()){const d=i(o.state),h=Jo(d.anchor,c.type,c.binding.mapping),f=Jo(d.head,c.type,c.binding.mapping);(u.cursor==null||!l0(co(u.cursor.anchor),h)||!l0(co(u.cursor.head),f))&&t.setLocalStateField(s,{anchor:h,head:f})}else u.cursor!=null&&ci(c.doc,c.type,co(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(s,null)}}}}),av=t=>Dn.getState(t)?.undoManager?.undo()!=null,lv=t=>Dn.getState(t)?.undoManager?.redo()!=null,cv=(t,e)=>e==null?Dn.getState(t)?.undoManager?.canUndo():av(t),uv=(t,e)=>e==null?Dn.getState(t)?.undoManager?.canRedo():lv(t),dv=new Set(["paragraph"]),hv=(t,e)=>!(t instanceof _e)||!(t.content instanceof Sn)||!(t.content.type instanceof Hr||t.content.type instanceof at&&e.has(t.content.type.nodeName))||t.content.type._length===0,fv=({protectedNodes:t=dv,trackedOrigins:e=[],undoManager:n=null}={})=>new te({key:Dn,state:{init:(r,i)=>{const s=Ie.getState(i),o=n||new eT(s.type,{trackedOrigins:new Set([Ie].concat(e)),deleteFilter:a=>hv(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=Ie.getState(o).binding,l=i.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:_h(a,s),hasUndoOps:c,hasRedoOps:u}:c!==i.hasUndoOps||u!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=Ie.getState(r.state),s=Dn.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,Dn.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),as=new WeakMap,hl=new WeakMap,Ql={current:[]};let sd=!1;const Fa=new Set,C0=new Map;function NT(t){const e=Array.from(t).sort((n,r)=>n instanceof ls&&n.options.deps.includes(r)?1:r instanceof ls&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Ql.current.includes(n))continue;Ql.current.push(n),n.recompute();const r=hl.get(n);if(r)for(const i of r){const s=as.get(i);s&&NT(s)}}}function pv(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function mv(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function gv(t){if(Fa.add(t),!sd)try{for(sd=!0;Fa.size>0;){const e=Array.from(Fa);Fa.clear();for(const n of e){const r=C0.get(n)??n.prevState;n.prevState=r,pv(n)}for(const n of e){const r=as.get(n);r&&(Ql.current.push(n),NT(r))}for(const n of e){const r=as.get(n);if(r)for(const i of r)mv(i)}}}finally{sd=!1,Ql.current=[],C0.clear()}}function bv(t){return typeof t=="function"}class Mh{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var i,s;this.listeners.add(r);const o=(s=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:s.call(i,r,this);return()=>{this.listeners.delete(r),o?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):bv(e)?this.state=e(this.prevState):this.state=e,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),gv(this)}}class ls{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let s=0;s<n;s++){const o=this.options.deps[s];r[s]=o.prevState,i[s]=o.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof ls&&s.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let s=0;s<i.length;s++)if(i[s]!==r[s]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,i;this.listeners.add(n);const s=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),s?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof Mh){let r=as.get(n);r||(r=new Set,as.set(n,r)),r.add(this);let i=hl.get(this);i||(i=new Set,hl.set(this,i)),i.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)this.unregisterFromGraph(n.options.deps);else if(n instanceof Mh){const r=as.get(n);r&&r.delete(this);const i=hl.get(this);i&&i.delete(n)}}}const Dh=Symbol("originalFactory");function pe(t){if(typeof t=="object"&&"key"in t)return function e(){return t[Dh]=e,t};if(typeof t!="function")throw new Error("factory must be a function");return function e(n){return r=>{const i=t({editor:r.editor,options:n});return i[Dh]=e,i}}}function Mi(t,e){return new Mh(t,e)}var S0=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},yv=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ev=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,kv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Tv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Cv=Tn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return S0("strong",{...sn(this.options.HTMLAttributes,t),children:S0("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bs({find:yv,type:this.type}),bs({find:kv,type:this.type})]},addPasteRules(){return[bi({find:Ev,type:this.type}),bi({find:Tv,type:this.type})]}}),Sv=Cv,wv=/(^|[^`])`([^`]+)`(?!`)$/,xv=/(^|[^`])`([^`]+)`(?!`)/g,Av=Tn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bs({find:wv,type:this.type})]},addPasteRules(){return[bi({find:xv,type:this.type})]}}),_v=Av,Nv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Iv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ov=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mv=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dv=Tn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",sn(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bs({find:Nv,type:this.type}),bs({find:Ov,type:this.type})]},addPasteRules(){return[bi({find:Iv,type:this.type}),bi({find:Mv,type:this.type})]}}),vv=Dv,Lv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Rv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pv=Tn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bs({find:Lv,type:this.type})]},addPasteRules(){return[bi({find:Rv,type:this.type})]}}),Bv=Pv,Fv=Tn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",sn(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Hv=Fv,Uv=class IT{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,n,r){e<0||this.cache.set(e,[n,r])}replace(e,n,r,i){this.remove(e),this.set(n,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const n=new IT(this.cache),r=e.mapping;return this.cache.forEach(([i,s],o)=>{if(o<0)return;const a=r.mapResult(o),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))n.remove(o);else if(o!==a.pos){const c=s.map(u=>u.map(r,0,0)).filter(u=>u!=null);n.replace(o,a.pos,l,c)}}),n}};function $v({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new me("prosemirror-highlight");return new te({key:r,state:{init(i,s){const o=new Uv,[a,l]=w0(s.doc,t,e,n,o);return{cache:o,decorations:a,promises:l}},apply:(i,s)=>{const o=s.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:o,decorations:s.decorations.map(i.mapping,i.doc),promises:s.promises};const[l,c]=w0(i.doc,t,e,n,o);return{cache:o,decorations:l,promises:c}}},view:i=>{const s=new Set,o=()=>{if(s.size>0)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const c of l?.promises??[])s.add(c),c.then(()=>{s.delete(c),o()}).catch(()=>{s.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function w0(t,e,n,r,i){const s=[],o=[];return t.descendants((a,l)=>{if(!a.type.isTextblock)return!0;if(n.includes(a.type.name)){const c=r(a),u=i.get(l);if(u){const[d,h]=u;s.push(...h)}else{const d=e({content:a.textContent,language:c||void 0,pos:l,size:a.nodeSize});d&&Array.isArray(d)?(i.set(l,a,d),s.push(...d)):d instanceof Promise&&(i.remove(l),o.push(d))}}return!1}),[ce.create(t,s),o]}function zv(t,e){return function({content:r,language:i,pos:s,size:o}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=t.codeToTokens(r,{lang:i,theme:t.getLoadedThemes()[0]}),h=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(h){const p=Ee.node(s,s+o,{style:h});a.push(p)}let f=s+1;for(const p of l){for(const g of p){const b=f+g.content.length,y=Ee.inline(f,b,{style:Vv(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(y),f=b}f+=1}return a}}function Vv(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}var jv=Object.defineProperty,qv=(t,e,n)=>e in t?jv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kr=(t,e,n)=>qv(t,typeof e!="symbol"?e+"":e,n);const Wv=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function dr(t,e="Ctrl"){return Wv()?t.replace("Mod","⌘"):t.replace("Mod",e)}function Ur(...t){return[...new Set(t.filter(e=>e).join(" ").split(" "))].join(" ")}const Nj=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function Yv(t,e,n,r){const i=document.createElement("div");i.className=Ur("bn-block-content",n.class),i.setAttribute("data-content-type",t);for(const[o,a]of Object.entries(n))o!=="class"&&i.setAttribute(o,a);const s=document.createElement(e);s.className=Ur("bn-inline-content",r.class);for(const[o,a]of Object.entries(r))o!=="class"&&s.setAttribute(o,a);return i.appendChild(s),{dom:i,contentDOM:s}}const x0=(t,e)=>{let n=Ii(t,e.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);const r=e.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r(n);if(typeof i!="object"||!("dom"in i))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return i};function Kv(t,e="<br>"){const n=t.querySelectorAll("p");if(n.length>1){const r=n[0];for(let i=1;i<n.length;i++){const s=n[i];r.innerHTML+=e+s.innerHTML,s.remove()}}}function Jl(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Ij(t){const e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function Gv(t){var e;const n=["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"];try{const r=((e=new URL(t).pathname.split(".").pop())==null?void 0:e.toLowerCase())||"";return n.includes(r)}catch{return!1}}function Qv(t){const e={};return Object.entries(t).forEach(([n,r])=>{e[n]={default:r.default,keepOnSplit:!0,parseHTML:i=>{const s=i.getAttribute(Jl(n));if(s===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return s==="true"?!0:s==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){const o=parseFloat(s);return!Number.isNaN(o)&&Number.isFinite(o)?o:null}return s},renderHTML:i=>i[n]!==r.default?{[Jl(n)]:i[n]}:{}}}),e}function Jv(t,e,n,r){const i=t();if(i===void 0)throw new Error("Cannot find node position");const s=n.state.doc.resolve(i).node().attrs.id;if(!s)throw new Error("Block doesn't have id");const o=e.getBlock(s);if(o.type!==r)throw new Error("Block type does not match");return o}function vh(t,e,n,r,i=!1,s){const o=document.createElement("div");if(s!==void 0)for(const[a,l]of Object.entries(s))a!=="class"&&o.setAttribute(a,l);o.className=Ur("bn-block-content",s?.class||""),o.setAttribute("data-content-type",e);for(const[a,l]of Object.entries(n)){const c=r[a].default;l!==c&&o.setAttribute(Jl(a),l)}return i&&o.setAttribute("data-file-block",""),o.appendChild(t.dom),t.contentDOM&&(t.contentDOM.className=Ur("bn-inline-content",t.contentDOM.className)),{...t,dom:o}}function Xv(t,e,n){return{config:{type:t.type,content:t.content,propSchema:e},implementation:{node:t.node,render:x0,toExternalHTML:x0},extensions:n}}function Zv(t,e){t.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{e.view.dom.blur()},10),!0)}function eL(t,e){const n=[{tag:"[data-content-type="+t.type+"]",contentElement:".bn-inline-content"}];return e.parse&&n.push({tag:"*",getAttrs(r){var i;if(typeof r=="string")return!1;const s=(i=e.parse)==null?void 0:i.call(e,r);return s===void 0?!1:s},preserveWhitespace:!0,getContent:t.content==="inline"||t.content==="none"?(r,i)=>{var s;if(e.parseContent)return e.parseContent({el:r,schema:i});if(t.content==="inline"){const o=r.cloneNode(!0);return Kv(o,(s=e.meta)!=null&&s.code?`
110
- `:"<br>"),mn.fromSchema(i).parse(o,{topNode:i.nodes.paragraph.create(),preserveWhitespace:!0}).content}return M.empty}:void 0}),n}function tL(t,e,n,r){var i,s,o,a;const l=e.node||Cn.create({name:t.type,content:t.content==="inline"?"inline*":t.content==="none"?"":t.content,group:"blockContent",selectable:((i=e.meta)==null?void 0:i.selectable)??!0,isolating:((s=e.meta)==null?void 0:s.isolating)??!0,code:((o=e.meta)==null?void 0:o.code)??!1,defining:((a=e.meta)==null?void 0:a.defining)??!0,priority:r,addAttributes(){return Qv(t.propSchema)},parseHTML(){return eL(t,e)},renderHTML({HTMLAttributes:c}){var u;const d=document.createElement("div");return vh({dom:d,contentDOM:t.content==="inline"?d:void 0},t.type,{},t.propSchema,((u=e.meta)==null?void 0:u.fileBlockAccept)!==void 0,c)},addNodeView(){return c=>{var u,d;const h=this.options.editor,f=Jv(c.getPos,h,this.editor,t.type),p=((u=this.options.domAttributes)==null?void 0:u.blockContent)||{},g=e.render.call({blockContentDOMAttributes:p,props:c,renderType:"nodeView"},f,h);return((d=e.meta)==null?void 0:d.selectable)===!1&&Zv(g,this.editor),g}}});if(l.name!==t.type)throw new Error("Node name does not match block type. This is a bug in BlockNote.");return{config:t,implementation:{...e,node:l,render(c,u){var d;const h=((d=l.options.domAttributes)==null?void 0:d.blockContent)||{};return e.render.call({blockContentDOMAttributes:h,props:void 0,renderType:"dom"},c,u)},toExternalHTML:(c,u,d)=>{var h,f;const p=((h=l.options.domAttributes)==null?void 0:h.blockContent)||{};return((f=e.toExternalHTML)==null?void 0:f.call({blockContentDOMAttributes:p},c,u,d))??e.render.call({blockContentDOMAttributes:p,renderType:"dom",props:void 0},c,u)}},extensions:n}}function jt(t,e,n){return(r={})=>{const i=typeof t=="function"?t(r):t,s=typeof e=="function"?e(r):e,o=n?typeof n=="function"?n(r):n:void 0;return{config:i,implementation:{...s,toExternalHTML(a,l,c){var u,d;const h=(u=s.toExternalHTML)==null?void 0:u.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l,c);if(h!==void 0)return vh(h,a.type,a.props,i.propSchema,((d=s.meta)==null?void 0:d.fileBlockAccept)!==void 0)},render(a,l){var c;const u=s.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l);return vh(u,a.type,a.props,i.propSchema,((c=s.meta)==null?void 0:c.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:o}}}function Oj(t,e,n,r){return t.dom.setAttribute("data-inline-content-type",e),Object.entries(n).filter(([i,s])=>{const o=r[i];return s!==o.default}).map(([i,s])=>[Jl(i),s]).forEach(([i,s])=>t.dom.setAttribute(i,s)),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function Mj(t){return{Backspace:({editor:e})=>{const n=e.state.selection.$from;return e.state.selection.empty&&n.node().type.name===t.type&&n.parentOffset===0}}}function Dj(t,e){return{config:t,implementation:e}}function OT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function nL(t){return t==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue!==void 0?{"data-value":e.stringValue}:{}}}}function Ha(t,e,n,r){return t.dom.setAttribute("data-style-type",e),r==="string"&&t.dom.setAttribute("data-value",n),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function MT(t,e){return{config:t,implementation:e}}function js(t,e){return MT({type:t.name,propSchema:e},{mark:t,render(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o},toExternalHTML(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o}})}function DT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function rL(t,e){const n=[{tag:`[data-style-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:{stringValue:i}}}),n}function vT(t,e){const n=Tn.create({name:t.type,addAttributes(){return nL(t.propSchema)},parseHTML(){return rL(t,e.parse)},renderHTML({mark:r}){const i=(e.toExternalHTML||e.render)(r.attrs.stringValue);return Ha(i,t.type,r.attrs.stringValue,t.propSchema)},addMarkView(){return({mark:r})=>{const i=e.render(r.attrs.stringValue);return Ha(i,t.type,r.attrs.stringValue,t.propSchema)}}});return MT(t,{...e,mark:n,render:r=>{const i=e.render(r);return Ha(i,t.type,r,t.propSchema)},toExternalHTML:r=>{const i=(e.toExternalHTML||e.render)(r);return Ha(i,t.type,r,t.propSchema)}})}function Vt(t,e){let n,r;if(e.firstChild.descendants((i,s)=>n?!1:!Op(i)||i.attrs.id!==t?!0:(n=i,r=s+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function Op(t){return t.type.isInGroup("bnBlock")}const iL=(t,e)=>({tr:n,dispatch:r})=>(r&&uu(n,t,e),!0);function uu(t,e,n,r,i){const s=Gc(t.doc.resolve(e));let o=null;s.blockNoteType==="table"&&(o=aL(t));const a=He(t),l=a.nodes[s.blockNoteType],c=a.nodes[n.type||s.blockNoteType],u=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(s.isBlockContainer&&c.isInGroup("blockContent"))A0(n,t,s),sL(n,t,l,c,s);else if(!s.isBlockContainer&&c.isInGroup("bnBlock"))A0(n,t,s);else{const d=ve(s.bnBlock.node,a);t.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,Ii({children:d.children,...n},a));return}t.setNodeMarkup(s.bnBlock.beforePos,u,{...s.bnBlock.node.attrs,...n.props}),o&&lL(t,s,o)}function sL(t,e,n,r,i,s,o){const a=He(e);let l="keep";if(t.content)if(typeof t.content=="string")l=bn([t.content],a,r.name);else if(Array.isArray(t.content))l=bn(t.content,a,r.name);else if(t.content.type==="tableContent")l=Jc(t.content,a);else throw new Pn(t.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?e.setNodeMarkup(i.blockContent.beforePos,r,{...i.blockContent.node.attrs,...t.props}):e.replaceWith(i.blockContent.beforePos,i.blockContent.afterPos,r.createChecked({...i.blockContent.node.attrs,...t.props},l))}function A0(t,e,n){const r=He(e);if(t.children!==void 0&&t.children.length>0){const i=t.children.map(s=>Ii(s,r));if(n.childContainer)e.step(new ze(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new F(M.from(i),0,0)));else{if(!n.isBlockContainer)throw new Error("impossible");e.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},i))}}}function oL(t,e,n,r,i){const s=typeof e=="string"?e:e.id,o=Vt(s,t.doc);if(!o)throw new Error(`Block with ID ${s} not found`);uu(t,o.posBeforeNode,n);const a=t.doc.resolve(o.posBeforeNode+1).node(),l=He(t);return ve(a,l)}function aL(t){const e="selection"in t?t.selection:null;if(!(e instanceof j))return null;const n=t.doc.resolve(e.head);let r=-1,i=-1;for(let g=n.depth;g>=0;g--){const b=n.node(g).type.name;if(r<0&&(b==="tableCell"||b==="tableHeader")&&(r=g),b==="table"){i=g;break}}if(r<0||i<0)return null;const s=n.before(r),o=n.before(i),a=t.doc.nodeAt(o);if(!a||a.type.name!=="table")return null;const l=Ae.get(a),c=s-(o+1),u=l.map.indexOf(c);if(u<0)return null;const d=Math.floor(u/l.width),h=u%l.width,f=s+1+1,p=Math.max(0,e.head-f);return{row:d,col:h,offset:p}}function lL(t,e,n){var r;if(e.blockNoteType!=="table")return!1;let i=-1;if(e.isBlockContainer)i=t.mapping.map(e.blockContent.beforePos);else{const b=t.mapping.map(e.bnBlock.beforePos),y=b+(((r=t.doc.nodeAt(b))==null?void 0:r.nodeSize)||0);t.doc.nodesBetween(b,y,(T,S)=>T.type.name==="table"?(i=S,!1):!0)}const s=i>=0?t.doc.nodeAt(i):null;if(!s||s.type.name!=="table")return!1;const o=Ae.get(s),a=Math.max(0,Math.min(n.row,o.height-1)),l=Math.max(0,Math.min(n.col,o.width-1)),c=a*o.width+l,u=o.map[c];if(u==null)return!1;const d=i+1+u+1,h=t.doc.nodeAt(d),f=d+1,p=h?h.content.size:0,g=f+Math.max(0,Math.min(n.offset,p));return"selection"in t&&t.setSelection(j.create(t.doc,g)),!0}const Nr={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},ye={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},Dt=t=>{const e={};return t.hasAttribute("data-background-color")?e.backgroundColor=t.getAttribute("data-background-color"):t.style.backgroundColor&&(e.backgroundColor=t.style.backgroundColor),t.hasAttribute("data-text-color")?e.textColor=t.getAttribute("data-text-color"):t.style.color&&(e.textColor=t.style.color),e.textAlignment=ye.textAlignment.values.includes(t.style.textAlign)?t.style.textAlign:void 0,e},Di=(t,e)=>{t.backgroundColor&&t.backgroundColor!==ye.backgroundColor.default&&(e.style.backgroundColor=t.backgroundColor in Nr?Nr[t.backgroundColor].background:t.backgroundColor),t.textColor&&t.textColor!==ye.textColor.default&&(e.style.color=t.textColor in Nr?Nr[t.textColor].text:t.textColor),t.textAlignment&&t.textAlignment!==ye.textAlignment.default&&(e.style.textAlign=t.textAlignment)},cL=(t="backgroundColor")=>({default:ye.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:ye.backgroundColor.default,renderHTML:e=>e[t]===ye.backgroundColor.default?{}:{"data-background-color":e[t]}}),uL=(t="textColor")=>({default:ye.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:ye.textColor.default,renderHTML:e=>e[t]===ye.textColor.default?{}:{"data-text-color":e[t]}}),du=(t,e)=>{const n=t.querySelector(e);if(!n)return;const r=t.querySelector("figcaption"),i=r?.textContent??void 0;return{targetElement:n,caption:i}},Ir=pe(({editor:t})=>{const e=Mi(void 0);function n(){e.setState(void 0)}return{key:"filePanel",store:e,mount({signal:r}){const i=t.onChange(n,!1),s=t.onSelectionChange(n,!1);r.addEventListener("abort",()=>{i(),s()})},closeMenu:n,showMenu(r){e.setState(r)}}}),dL=(t,e,n)=>{const r=document.createElement("div");r.className="bn-add-file-button";const i=document.createElement("div");i.className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i);const s=document.createElement("p");s.className="bn-add-file-button-text",s.innerHTML=t.type in e.dictionary.file_blocks.add_button_text?e.dictionary.file_blocks.add_button_text[t.type]:e.dictionary.file_blocks.add_button_text.file,r.appendChild(s);const o=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{var l;e.isEditable&&((l=e.getExtension(Ir))==null||l.showMenu(t.id))};return r.addEventListener("mousedown",o,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",o,!0),r.removeEventListener("click",a,!0)}}},hL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',fL=t=>{const e=document.createElement("div");e.className="bn-file-name-with-icon";const n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=hL,e.appendChild(n);const r=document.createElement("p");return r.className="bn-file-name",r.textContent=t.props.name,e.appendChild(r),{dom:e}},Mp=(t,e,n,r)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=dL(t,e,r);i.appendChild(o.dom);const a=e.onUploadStart(l=>{if(l===t.id){i.removeChild(o.dom);const c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",i.appendChild(c)}});return{dom:i,destroy:()=>{a(),o.destroy()}}}const s={dom:i};if(t.props.showPreview===!1||!n){const o=fL(t);i.appendChild(o.dom),s.destroy=()=>{var a;(a=o.destroy)==null||a.call(o)}}else i.appendChild(n.dom);if(t.props.caption){const o=document.createElement("p");o.className="bn-file-caption",o.textContent=t.props.caption,i.appendChild(o)}return s},Dp=(t,e)=>{const n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},hu=(t,e)=>{const n=document.createElement("div"),r=document.createElement("p");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},_0=t=>({url:t.src||void 0}),pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>',mL=t=>({type:"audio",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),gL=(t={})=>e=>{if(e.tagName==="AUDIO"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{..._0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"audio");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{..._0(r),backgroundColor:s,caption:i}}},bL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??pL;const i=document.createElement("audio");return i.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{i.src=s}):i.src=e.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,Mp(e,n,{dom:i},r.firstElementChild)},yL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add audio",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("audio"),r.src=e.props.url):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(r,e.props.caption):hu(r,e.props.caption):{dom:r}},EL=jt(mL,t=>({meta:{fileBlockAccept:["audio/*"]},parse:gL(t),render:bL(t),toExternalHTML:yL(t),runsBefore:["file"]})),N0=Symbol.for("blocknote.shikiParser"),od=Symbol.for("blocknote.shikiHighlighterPromise");function kL(t){const e=globalThis;let n,r;return $v({parser:i=>{if(!t.createHighlighter)return[];if(!n)return e[od]=e[od]||t.createHighlighter(),e[od].then(o=>{n=o});const s=LT(t,i.language);return!s||s==="text"||s==="none"||s==="plaintext"||s==="txt"?[]:n.getLoadedLanguages().includes(s)?(r||(r=e[N0]||zv(n),e[N0]=r),r(i)):n.loadLanguage(s)},languageExtractor:i=>i.attrs.language,nodeTypes:["codeBlock"]})}const TL=({defaultLanguage:t="text"})=>({type:"codeBlock",propSchema:{language:{default:t}},content:"inline"}),CL=jt(TL,t=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{var n,r;if(e.tagName!=="PRE"||e.childElementCount!==1||((n=e.firstElementChild)==null?void 0:n.tagName)!=="CODE")return;const i=e.firstElementChild;return{language:i.getAttribute("data-language")||((r=i.className.split(" ").find(s=>s.includes("language-")))==null?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:n})=>{const r=mn.fromSchema(n),i=e.firstElementChild;return r.parse(i,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(e,n){const r=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");i.appendChild(s);let o;if(t.supportedLanguages){const a=document.createElement("select");if(Object.entries(t.supportedLanguages??{}).forEach(([c,{name:u}])=>{const d=document.createElement("option");d.value=c,d.text=u,a.appendChild(d)}),a.value=e.props.language||t.defaultLanguage||"text",n.isEditable){const c=u=>{const d=u.target.value;n.updateBlock(e.id,{props:{language:d}})};a.addEventListener("change",c),o=()=>a.removeEventListener("change",c)}else a.disabled=!0;const l=document.createElement("div");l.contentEditable="false",l.appendChild(a),r.appendChild(l)}return r.appendChild(i),{dom:r,contentDOM:s,destroy:()=>{o?.()}}},toExternalHTML(e){const n=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,n.appendChild(r),{dom:n,contentDOM:r}}}),t=>[pe({key:"code-block-highlighter",prosemirrorPlugins:[kL(t)]}),pe({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(n=>{const{block:r}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:i}=n.selection;return i.parent.textContent?!1:(e.removeBlocks([r]),!0)}),Tab:({editor:e})=>t.indentLineWithTab===!1?!1:e.transact(n=>{const{block:r}=e.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:e})=>e.transact(n=>{const{block:r,nextBlock:i}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:s}=n.selection,o=s.parentOffset===s.parent.nodeSize-2,a=s.parent.textContent.endsWith(`
109
+ `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&rd(r,this,i,a,o.attributes||{})}else o.retain!==void 0?g0(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&b0(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??dt();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let h=!1;s.forEach((p,g)=>{h=!0,d[g]=p});const f={insert:a};h&&(f.attributes=d),i.push(f),a=""}}const u=()=>{for(;l!==null;){if(Zr(l,e)||n!==void 0&&Zr(l,n))switch(l.content.constructor){case kn:{const d=s.get("ychange");e!==void 0&&!Zr(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Zr(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),a+=l.content.str;break}case Sn:case Oi:{c();const d={insert:l.content.getContent()[0]};if(s.size>0){const h={};d.attributes=h,s.forEach((f,p)=>{h[p]=f})}i.push(d);break}case je:Zr(l,e)&&(c(),Ps(s,l.content));break}l=l.right}c()};return e||n?Ce(o,d=>{e&&Ch(d,e),n&&Ch(d,n),u()},"cleanup"):u(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),rd(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!r);rd(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ce(r,i=>{b0(i,Pa(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Pa(s,this,e,!1);o.right!==null&&g0(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{jl(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{xp(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Ap(this,e)}getAttributes(){return hT(this)}_write(e){e.writeTypeRef(ED)}}const eD=t=>new Hr;class id{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??dt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===at||n.constructor===wi)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class wi extends Je{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new wi}clone(){const e=new wi;return e.insert(0,this.toArray().map(n=>n instanceof Je?n.clone():n)),e}get length(){return this.doc??dt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new id(this,e)}querySelector(e){e=e.toUpperCase();const r=new id(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Br(new id(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){lu(this,e,new rD(this,n,e))}toString(){return aT(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Ko(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Ce(this.doc,r=>{uT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ce(this.doc,r=>{const i=e&&e instanceof Je?e._item:e;Vl(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Bn("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{dT(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return sT(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return lT(this,e)}slice(e=0,n=this.length){return iT(this,e,n)}forEach(e){Ko(this,e)}_write(e){e.writeTypeRef(TD)}}const tD=t=>new wi;class at extends wi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new at(this.nodeName)}clone(){const e=new at(this.nodeName),n=this.getAttributes();return eM(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Je?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{jl(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{xp(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Ap(this,e)}hasAttribute(e){return fT(this,e)}getAttributes(e){return e?q3(this,e):hT(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Ko(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(kD),e.writeKey(this.nodeName)}}const nD=t=>new at(t.readKey());class rD extends ou{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class ql extends ws{constructor(e){super(),this.hookName=e}_copy(){return new ql(this.hookName)}clone(){const e=new ql(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(CD),e.writeKey(this.hookName)}}const iD=t=>new ql(t.readKey());class Ut extends Hr{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Ut}clone(){const e=new Ut;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(SD)}}const sD=t=>new Ut;class _p{constructor(e,n){this.id=e,this.length=n}get deleted(){throw rn()}mergeWith(e){return!1}write(e,n,r){throw rn()}integrate(e,n){throw rn()}}const oD=0;class Jt extends _p{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),Jk(e.doc.store,this)}write(e,n){e.writeInfo(oD),e.writeLen(this.length-n)}getMissing(e,n){return null}}class ha{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ha(this.content)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const aD=t=>new ha(t.readBuf());class Go{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Go(this.len)}splice(e){const n=new Go(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Vo(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const lD=t=>new Go(t.readLen()),yT=(t,e)=>new jr({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class fa{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new fa(yT(this.doc.guid,this.opts))}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const cD=t=>new fa(yT(t.readString(),t.readAny()));class Oi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Oi(this.embed)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const uD=t=>new Oi(t.readJSON());class je{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new je(this.key,this.value)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const dD=t=>new je(t.readKey(),t.readJSON());class Wl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Wl(this.arr)}splice(e){const n=new Wl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const hD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Wl(n)},fD=Fl("node_env")==="development";class xi{constructor(e){this.arr=e,fD&&hk(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new xi(this.arr)}splice(e){const n=new xi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const pD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new xi(n)};class kn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new kn(this.str)}splice(e){const n=new kn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const mD=t=>new kn(t.readString()),gD=[Y3,G3,eD,nD,tD,iD,sD],bD=0,yD=1,ED=2,kD=3,TD=4,CD=5,SD=6;class Sn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Sn(this.type._copy())}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const wD=t=>new Sn(gD[t.readTypeRef()](t)),xh=(t,e)=>{let n=e,r=0,i;do r>0&&(n=X(n.client,n.clock+r)),i=is(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof _e);return{item:i,diff:r}},Np=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Yl=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new _e(X(r,i+n),e,X(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=X(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},y0=(t,e)=>np(t,n=>Ls(n.deletions,e)),ET=(t,e,n,r,i,s)=>{const o=t.doc,a=o.store,l=o.clientID,c=e.redone;if(c!==null)return Nt(t,c);let u=e.parent._item,d=null,h;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||ET(t,u,n,r,i,s)===null))return null;for(;u.redone!==null;)u=Nt(t,u.redone)}const f=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,h=e;d!==null;){let y=d;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){d=y;break}d=d.left}for(;h!==null;){let y=h;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){h=y;break}h=h.right}}else if(h=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||Ls(r,d.right.id)||y0(s.undoStack,d.right.id)||y0(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Nt(t,d.redone);if(d&&d.right!==null)return null}else d=f._map.get(e.parentSub)||null;const p=Be(a,l),g=X(l,p),b=new _e(g,d,d&&d.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,Np(b,!0),b.integrate(t,0),b};let _e=class Ah extends _p{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?jg:0}set marker(e){(this.info&Gu)>0!==e&&(this.info^=Gu)}get marker(){return(this.info&Gu)>0}get keep(){return(this.info&Vg)>0}set keep(e){this.keep!==e&&(this.info^=Vg)}get countable(){return(this.info&jg)>0}get deleted(){return(this.info&Ku)>0}set deleted(e){this.deleted!==e&&(this.info^=Ku)}markDeleted(){this.info|=Ku}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Be(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Be(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===rs&&this.id.client!==this.parent.client&&this.parent.clock>=Be(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=c0(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Nt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Jt||this.right&&this.right.constructor===Jt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Ah?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Ah&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===rs){const r=is(n,this.parent);r.constructor===Jt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=c0(e,e.doc.store,X(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Qi(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Qi(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(is(e.doc.store,i.origin)))s.has(is(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Jk(e.doc.store,this),this.content.integrate(e,this),d0(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Jt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:X(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Qi(e.origin,this.lastId)&&this.right===e&&Qi(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Vo(e.deleteSet,this.id.client,this.id.clock,this.length),d0(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw kt();this.content.gc(e),n?N3(e,this,new Jt(this.id,this.length)):this.content=new Go(this.length)}write(e,n){const r=n>0?X(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Xc|(r===null?0:bt)|(i===null?0:or)|(s===null?0:Fo);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=jo(a);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===rs?(e.writeParentInfo(!1),e.writeLeftID(a)):kt();s!==null&&e.writeString(s)}this.content.write(e,n)}};const kT=(t,e)=>xD[e&Xc](t),xD=[()=>{kt()},lD,hD,aD,mD,uD,dD,wD,pD,cD,()=>{kt()}],AD=10;class Xt extends _p{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){kt()}write(e,n){e.writeInfo(AD),ae(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const TT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},CT="__ $YJS$ __";TT[CT]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");TT[CT]=!0;const _D=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},ND=/[\uD800-\uDBFF]/,ID=/[\uDC00-\uDFFF]/,OD=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&ND.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&ID.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},MD=OD,Ie=new me("y-sync"),Dn=new me("y-undo"),Ba=new me("yjs-cursor"),vn=(t,e)=>t>>>e|t<<32-e,DD=t=>vn(t,2)^vn(t,13)^vn(t,22),vD=t=>vn(t,6)^vn(t,11)^vn(t,25),LD=t=>vn(t,7)^vn(t,18)^t>>>3,RD=t=>vn(t,17)^vn(t,19)^t>>>10,PD=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),BD=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class FD{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(BD),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=RD(n[d-2])+n[d-7]+LD(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,h,f;d<64;d++)h=u+vD(a)+(a&l^~a&c)+PD[d]+n[d]>>>0,f=DD(r)+(r&i^r&s^i&s)>>>0,u=c,c=l,l=a,a=o+h>>>0,o=s,s=i,i=r,r=h+f>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=bt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=bt<<(3-n%4)*8),this._W[14]=e.byteLength/hO,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const HD=t=>new FD().digest(t),UD=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},$D=t=>fM(UD(HD(mM(t)))),Kl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ls(e.ds,t.id),zD=[{light:"#ecd44433",dark:"#ecd444"}],VD=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Ci();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,qO(e))}return t.get(n)},jD=(t,{colors:e=zD,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new WD(t,s),l=new te({props:{editable:c=>{const u=Ie.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:Ie,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(Ie);if(d!==void 0){u=Object.assign({},u);for(const h in d)u[h]=d[h]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&pp(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),s==null&&a._forceRerender(),i(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=Dn.getState(c.state),h=d&&d.undoManager;h&&h.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},Ie)})}},destroy:()=>{a.destroy()}})});return l},qD=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Ot(t.doc));else if(e.type==="node"){const r=ci(n.doc,n.type,e.anchor,n.mapping);t.setSelection(W.create(t.doc,r))}else{const r=ci(n.doc,n.type,e.anchor,n.mapping),i=ci(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=j.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},_h=(t,e)=>({type:e.selection.jsonID,anchor:Jo(e.selection.anchor,t.type,t.mapping),head:Jo(e.selection.head,t.type,t.mapping)});class WD{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=_D(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=_h(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(pk&&this._domSelectionInView===null&&(pp(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=ca.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=Gk(Hk(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ie,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>dl(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(e),0,0));n.setMeta(Ie,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>dl(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(n),0,0));if(e){const i=sr(En(e.anchor,0),r.doc.content.size),s=sr(En(e.head,0),r.doc.content.size);r.setSelection(j.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Ie,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=nd(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&kt(),i=new jr({gc:!1}),$l(i,n),n=nd(i),$l(i,e),e=nd(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],a=on(o,s._item.id.clock);s=o[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Fr(o,d,h=>{})});const l=(d,h)=>{const f=d==="added"?a.getUserByClientId(h.client):a.getUserByDeletedId(h);return{user:f,type:d,color:VD(r.colorMapping,r.colors,f)}},c=oT(s,new kp(n.ds,e.sv)).map(d=>!d._item.deleted||Kl(d._item,e)||Kl(d._item,n)?dl(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(Ie,{isChangeOrigin:!0}))},Ie)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ie.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);Fr(n,n.deleteSet,a=>{if(a.constructor===_e){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>ST(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(M.from(s),0,0));qD(o,this.beforeTransactionSelection,this),o=o.setMeta(Ie,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof eT}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Ih(this.doc,this.type,e,this),this.beforeTransactionSelection=_h(this,this.prosemirrorView.state)},Ie)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const ST=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof at)return dl(t,e,n,r,i,s);throw rn()}return o},dl=(t,e,n,r,i,s)=>{const o=[],a=l=>{if(l instanceof at){const c=ST(l,e,n,r,i,s);c!==null&&o.push(c)}else{const c=l._item.right?.content?.type;c instanceof Hr&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=YD(l,e,n,r,i,s);u!==null&&u.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(a):oT(t,new kp(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Kl(t._item,r)?Kl(t._item,i)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,o);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),n.mapping.delete(t),null}},YD=(t,e,n,r,i,s)=>{const o=[],a=t.toDelta(r,i,s);try{for(let l=0;l<a.length;l++){const c=a[l];o.push(e.text(c.insert,ZD(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),null}return o},KD=(t,e)=>{const n=new Ut,r=t.map(i=>({insert:i.text,attributes:AT(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},GD=(t,e)=>{const n=new at(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,cu(t).map(r=>Nh(r,e))),e.mapping.set(n,t),n},Nh=(t,e)=>t instanceof Array?KD(t,e):GD(t,e),E0=t=>typeof t=="object"&&t!==null,Ip=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],a=e[s];r=s==="ychange"||o===a||E0(o)&&E0(a)&&Ip(o,a)}return r},cu=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},wT=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&dk(r.attributes||{}).length===e[i].marks.length&&Ms(r.attributes,(s,o)=>{const a=xT(o),l=e[i].marks;return Ip(s,l.find(c=>c.type.name===a)?.attrs)}))},Qo=(t,e)=>{if(t instanceof at&&!(e instanceof Array)&&Oh(t,e)){const n=cu(e);return t._length===n.length&&Ip(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Qo(r,n[i]))}return t instanceof Ut&&e instanceof Array&&wT(t,e)},Gl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),k0=(t,e,n)=>{const r=t.toArray(),i=cu(e),s=i.length,o=r.length,a=sr(o,s);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],h=i[l];if(Gl(n.mapping.get(d),h))u=!0;else if(!Qo(d,h))break}for(;l+c<a;c++){const d=r[o-c-1],h=i[s-c-1];if(Gl(n.mapping.get(d),h))u=!0;else if(!Qo(d,h))break}return{equalityFactor:l+c,foundMappedChild:u}},QD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof kn?e+=n.content.str:n.content instanceof je&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},JD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=QD(t),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,AT(c.marks,n))})),{insert:o,remove:a,index:l}=MD(i,s.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},XD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,xT=t=>XD.exec(t)?.[1]??t,ZD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(xT(r),t[r]));return n},AT=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Un(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${$D(r.toJSON())}`:r.type.name]=r.attrs}}),n},Ih=(t,e,n,r)=>{if(e instanceof at&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof at){const d=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?d[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in d)h[f]===void 0&&e.removeAttribute(f)}const i=cu(n),s=i.length,o=e.toArray(),a=o.length,l=sr(s,a);let c=0,u=0;for(;c<l;c++){const d=o[c],h=i[c];if(!Gl(r.mapping.get(d),h))if(Qo(d,h))r.mapping.set(d,h);else break}for(;u+c<l;u++){const d=o[a-u-1],h=i[s-u-1];if(!Gl(r.mapping.get(d),h))if(Qo(d,h))r.mapping.set(d,h);else break}t.transact(()=>{for(;a-c-u>0&&s-c-u>0;){const h=o[c],f=i[c],p=o[a-u-1],g=i[s-u-1];if(h instanceof Ut&&f instanceof Array)wT(h,f)||JD(h,f,r),c+=1;else{let b=h instanceof at&&Oh(h,f),y=p instanceof at&&Oh(p,g);if(b&&y){const T=k0(h,f,r),S=k0(p,g,r);T.foundMappedChild&&!S.foundMappedChild?y=!1:!T.foundMappedChild&&S.foundMappedChild||T.equalityFactor<S.equalityFactor?b=!1:y=!1}b?(Ih(t,h,f,r),c+=1):y?(Ih(t,p,g,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Nh(f,r)]),c+=1)}}const d=a-c-u;if(a===1&&s===0&&o[0]instanceof Ut?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(c,c+d).forEach(h=>r.mapping.delete(h)),e.delete(c,d)),c+u<s){const h=[];for(let f=c;f<s-u;f++)h.push(Nh(i[f],r));e.insert(c,h)}},Ie)},Oh=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let uo=null;const ev=()=>{const t=uo;uo=null,t.forEach((e,n)=>{const r=n.state.tr,i=Ie.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},tv=(t,e,n)=>{uo||(uo=new Map,pp(0,ev)),Un(uo,t,nn).set(e,n)},Jo=(t,e,n)=>{if(t===0)return td(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Ut){if(r._length>=t)return td(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Wo(r._item===null?null:r._item.id,r._item===null?jo(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Wo(r._item===null?null:r._item.id,r._item===null?jo(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw kt();if(t===0&&r.constructor!==Ut&&r!==e)return nv(r._item.parent,r._item)}return td(e,e._length,e.length===0?-1:0)},nv=(t,e)=>{let n=null,r=null;return t._item===null?r=jo(t):n=X(t._item.id.client,t._item.id.clock),new Wo(n,r,e.id)},ci=(t,e,n,r)=>{const i=A3(n,t);if(i===null||i.type!==e&&!qo(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Ut)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<i.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize}a=a.right}o+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===s)break;l.deleted||(c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize),l=l.right}}s=a}return o-1},rv=(t,e,n)=>t!==e,iv=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},_T=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),sv=/^#[0-9a-fA-F]{6}$/,T0=(t,e,n,r,i)=>{const s=Ie.getState(t),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ce.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(o.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":sv.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=ci(o,s.type,co(l.cursor.anchor),s.binding.mapping),h=ci(o,s.type,co(l.cursor.head),s.binding.mapping);if(d!==null&&h!==null){const f=En(t.doc.content.size-1,0);d=sr(d,f),h=sr(h,f),a.push(Ee.widget(h,()=>r(u,c),{key:c+"",side:10}));const p=sr(d,h),g=En(d,h);a.push(Ee.inline(p,g,i(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ce.create(t.doc,a))},ov=(t,{awarenessStateFilter:e=rv,cursorBuilder:n=iv,selectionBuilder:r=_T,getSelection:i=o=>o.selection}={},s="cursor")=>new te({key:Ba,state:{init(o,a){return T0(a,t,e,n,r)},apply(o,a,l,c){const u=Ie.getState(c),d=o.getMeta(Ba);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?T0(c,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Ba.getState(o)},view:o=>{const a=()=>{o.docView&&tv(o,Ba,{awarenessUpdated:!0})},l=()=>{const c=Ie.getState(o.state),u=t.getLocalState()||{};if(o.hasFocus()){const d=i(o.state),h=Jo(d.anchor,c.type,c.binding.mapping),f=Jo(d.head,c.type,c.binding.mapping);(u.cursor==null||!l0(co(u.cursor.anchor),h)||!l0(co(u.cursor.head),f))&&t.setLocalStateField(s,{anchor:h,head:f})}else u.cursor!=null&&ci(c.doc,c.type,co(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(s,null)}}}}),av=t=>Dn.getState(t)?.undoManager?.undo()!=null,lv=t=>Dn.getState(t)?.undoManager?.redo()!=null,cv=(t,e)=>e==null?Dn.getState(t)?.undoManager?.canUndo():av(t),uv=(t,e)=>e==null?Dn.getState(t)?.undoManager?.canRedo():lv(t),dv=new Set(["paragraph"]),hv=(t,e)=>!(t instanceof _e)||!(t.content instanceof Sn)||!(t.content.type instanceof Hr||t.content.type instanceof at&&e.has(t.content.type.nodeName))||t.content.type._length===0,fv=({protectedNodes:t=dv,trackedOrigins:e=[],undoManager:n=null}={})=>new te({key:Dn,state:{init:(r,i)=>{const s=Ie.getState(i),o=n||new eT(s.type,{trackedOrigins:new Set([Ie].concat(e)),deleteFilter:a=>hv(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=Ie.getState(o).binding,l=i.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:_h(a,s),hasUndoOps:c,hasRedoOps:u}:c!==i.hasUndoOps||u!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=Ie.getState(r.state),s=Dn.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,Dn.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),as=new WeakMap,hl=new WeakMap,Ql={current:[]};let sd=!1;const Fa=new Set,C0=new Map;function NT(t){const e=Array.from(t).sort((n,r)=>n instanceof ls&&n.options.deps.includes(r)?1:r instanceof ls&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Ql.current.includes(n))continue;Ql.current.push(n),n.recompute();const r=hl.get(n);if(r)for(const i of r){const s=as.get(i);s&&NT(s)}}}function pv(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function mv(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function gv(t){if(Fa.add(t),!sd)try{for(sd=!0;Fa.size>0;){const e=Array.from(Fa);Fa.clear();for(const n of e){const r=C0.get(n)??n.prevState;n.prevState=r,pv(n)}for(const n of e){const r=as.get(n);r&&(Ql.current.push(n),NT(r))}for(const n of e){const r=as.get(n);if(r)for(const i of r)mv(i)}}}finally{sd=!1,Ql.current=[],C0.clear()}}function bv(t){return typeof t=="function"}class Mh{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var i,s;this.listeners.add(r);const o=(s=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:s.call(i,r,this);return()=>{this.listeners.delete(r),o?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):bv(e)?this.state=e(this.prevState):this.state=e,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),gv(this)}}class ls{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let s=0;s<n;s++){const o=this.options.deps[s];r[s]=o.prevState,i[s]=o.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof ls&&s.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let s=0;s<i.length;s++)if(i[s]!==r[s]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,i;this.listeners.add(n);const s=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),s?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof Mh){let r=as.get(n);r||(r=new Set,as.set(n,r)),r.add(this);let i=hl.get(this);i||(i=new Set,hl.set(this,i)),i.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)this.unregisterFromGraph(n.options.deps);else if(n instanceof Mh){const r=as.get(n);r&&r.delete(this);const i=hl.get(this);i&&i.delete(n)}}}const Dh=Symbol("originalFactory");function pe(t){if(typeof t=="object"&&"key"in t)return function e(){return t[Dh]=e,t};if(typeof t!="function")throw new Error("factory must be a function");return function e(n){return r=>{const i=t({editor:r.editor,options:n});return i[Dh]=e,i}}}function Mi(t,e){return new Mh(t,e)}var S0=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},yv=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ev=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,kv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Tv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Cv=Tn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return S0("strong",{...sn(this.options.HTMLAttributes,t),children:S0("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bs({find:yv,type:this.type}),bs({find:kv,type:this.type})]},addPasteRules(){return[bi({find:Ev,type:this.type}),bi({find:Tv,type:this.type})]}}),Sv=Cv,wv=/(^|[^`])`([^`]+)`(?!`)$/,xv=/(^|[^`])`([^`]+)`(?!`)/g,Av=Tn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bs({find:wv,type:this.type})]},addPasteRules(){return[bi({find:xv,type:this.type})]}}),_v=Av,Nv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Iv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ov=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mv=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dv=Tn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",sn(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bs({find:Nv,type:this.type}),bs({find:Ov,type:this.type})]},addPasteRules(){return[bi({find:Iv,type:this.type}),bi({find:Mv,type:this.type})]}}),vv=Dv,Lv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Rv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pv=Tn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bs({find:Lv,type:this.type})]},addPasteRules(){return[bi({find:Rv,type:this.type})]}}),Bv=Pv,Fv=Tn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",sn(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Hv=Fv,Uv=class IT{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,n,r){e<0||this.cache.set(e,[n,r])}replace(e,n,r,i){this.remove(e),this.set(n,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const n=new IT(this.cache),r=e.mapping;return this.cache.forEach(([i,s],o)=>{if(o<0)return;const a=r.mapResult(o),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))n.remove(o);else if(o!==a.pos){const c=s.map(u=>u.map(r,0,0)).filter(u=>u!=null);n.replace(o,a.pos,l,c)}}),n}};function $v({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new me("prosemirror-highlight");return new te({key:r,state:{init(i,s){const o=new Uv,[a,l]=w0(s.doc,t,e,n,o);return{cache:o,decorations:a,promises:l}},apply:(i,s)=>{const o=s.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:o,decorations:s.decorations.map(i.mapping,i.doc),promises:s.promises};const[l,c]=w0(i.doc,t,e,n,o);return{cache:o,decorations:l,promises:c}}},view:i=>{const s=new Set,o=()=>{if(s.size>0)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const c of l?.promises??[])s.add(c),c.then(()=>{s.delete(c),o()}).catch(()=>{s.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function w0(t,e,n,r,i){const s=[],o=[];return t.descendants((a,l)=>{if(!a.type.isTextblock)return!0;if(n.includes(a.type.name)){const c=r(a),u=i.get(l);if(u){const[d,h]=u;s.push(...h)}else{const d=e({content:a.textContent,language:c||void 0,pos:l,size:a.nodeSize});d&&Array.isArray(d)?(i.set(l,a,d),s.push(...d)):d instanceof Promise&&(i.remove(l),o.push(d))}}return!1}),[ce.create(t,s),o]}function zv(t,e){return function({content:r,language:i,pos:s,size:o}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=t.codeToTokens(r,{lang:i,theme:t.getLoadedThemes()[0]}),h=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(h){const p=Ee.node(s,s+o,{style:h});a.push(p)}let f=s+1;for(const p of l){for(const g of p){const b=f+g.content.length,y=Ee.inline(f,b,{style:Vv(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(y),f=b}f+=1}return a}}function Vv(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}var jv=Object.defineProperty,qv=(t,e,n)=>e in t?jv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kr=(t,e,n)=>qv(t,typeof e!="symbol"?e+"":e,n);const Wv=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function dr(t,e="Ctrl"){return Wv()?t.replace("Mod","⌘"):t.replace("Mod",e)}function Ur(...t){return[...new Set(t.filter(e=>e).join(" ").split(" "))].join(" ")}const Ij=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function Yv(t,e,n,r){const i=document.createElement("div");i.className=Ur("bn-block-content",n.class),i.setAttribute("data-content-type",t);for(const[o,a]of Object.entries(n))o!=="class"&&i.setAttribute(o,a);const s=document.createElement(e);s.className=Ur("bn-inline-content",r.class);for(const[o,a]of Object.entries(r))o!=="class"&&s.setAttribute(o,a);return i.appendChild(s),{dom:i,contentDOM:s}}const x0=(t,e)=>{let n=Ii(t,e.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);const r=e.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r(n);if(typeof i!="object"||!("dom"in i))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return i};function Kv(t,e="<br>"){const n=t.querySelectorAll("p");if(n.length>1){const r=n[0];for(let i=1;i<n.length;i++){const s=n[i];r.innerHTML+=e+s.innerHTML,s.remove()}}}function Jl(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Oj(t){const e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function Gv(t){var e;const n=["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"];try{const r=((e=new URL(t).pathname.split(".").pop())==null?void 0:e.toLowerCase())||"";return n.includes(r)}catch{return!1}}function Qv(t){const e={};return Object.entries(t).forEach(([n,r])=>{e[n]={default:r.default,keepOnSplit:!0,parseHTML:i=>{const s=i.getAttribute(Jl(n));if(s===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return s==="true"?!0:s==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){const o=parseFloat(s);return!Number.isNaN(o)&&Number.isFinite(o)?o:null}return s},renderHTML:i=>i[n]!==r.default?{[Jl(n)]:i[n]}:{}}}),e}function Jv(t,e,n,r){const i=t();if(i===void 0)throw new Error("Cannot find node position");const s=n.state.doc.resolve(i).node().attrs.id;if(!s)throw new Error("Block doesn't have id");const o=e.getBlock(s);if(o.type!==r)throw new Error("Block type does not match");return o}function vh(t,e,n,r,i=!1,s){const o=document.createElement("div");if(s!==void 0)for(const[a,l]of Object.entries(s))a!=="class"&&o.setAttribute(a,l);o.className=Ur("bn-block-content",s?.class||""),o.setAttribute("data-content-type",e);for(const[a,l]of Object.entries(n)){const c=r[a].default;l!==c&&o.setAttribute(Jl(a),l)}return i&&o.setAttribute("data-file-block",""),o.appendChild(t.dom),t.contentDOM&&(t.contentDOM.className=Ur("bn-inline-content",t.contentDOM.className)),{...t,dom:o}}function Xv(t,e,n){return{config:{type:t.type,content:t.content,propSchema:e},implementation:{node:t.node,render:x0,toExternalHTML:x0},extensions:n}}function Zv(t,e){t.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{e.view.dom.blur()},10),!0)}function eL(t,e){const n=[{tag:"[data-content-type="+t.type+"]",contentElement:".bn-inline-content"}];return e.parse&&n.push({tag:"*",getAttrs(r){var i;if(typeof r=="string")return!1;const s=(i=e.parse)==null?void 0:i.call(e,r);return s===void 0?!1:s},preserveWhitespace:!0,getContent:t.content==="inline"||t.content==="none"?(r,i)=>{var s;if(e.parseContent)return e.parseContent({el:r,schema:i});if(t.content==="inline"){const o=r.cloneNode(!0);return Kv(o,(s=e.meta)!=null&&s.code?`
110
+ `:"<br>"),mn.fromSchema(i).parse(o,{topNode:i.nodes.paragraph.create(),preserveWhitespace:!0}).content}return M.empty}:void 0}),n}function tL(t,e,n,r){var i,s,o,a;const l=e.node||Cn.create({name:t.type,content:t.content==="inline"?"inline*":t.content==="none"?"":t.content,group:"blockContent",selectable:((i=e.meta)==null?void 0:i.selectable)??!0,isolating:((s=e.meta)==null?void 0:s.isolating)??!0,code:((o=e.meta)==null?void 0:o.code)??!1,defining:((a=e.meta)==null?void 0:a.defining)??!0,priority:r,addAttributes(){return Qv(t.propSchema)},parseHTML(){return eL(t,e)},renderHTML({HTMLAttributes:c}){var u;const d=document.createElement("div");return vh({dom:d,contentDOM:t.content==="inline"?d:void 0},t.type,{},t.propSchema,((u=e.meta)==null?void 0:u.fileBlockAccept)!==void 0,c)},addNodeView(){return c=>{var u,d;const h=this.options.editor,f=Jv(c.getPos,h,this.editor,t.type),p=((u=this.options.domAttributes)==null?void 0:u.blockContent)||{},g=e.render.call({blockContentDOMAttributes:p,props:c,renderType:"nodeView"},f,h);return((d=e.meta)==null?void 0:d.selectable)===!1&&Zv(g,this.editor),g}}});if(l.name!==t.type)throw new Error("Node name does not match block type. This is a bug in BlockNote.");return{config:t,implementation:{...e,node:l,render(c,u){var d;const h=((d=l.options.domAttributes)==null?void 0:d.blockContent)||{};return e.render.call({blockContentDOMAttributes:h,props:void 0,renderType:"dom"},c,u)},toExternalHTML:(c,u,d)=>{var h,f;const p=((h=l.options.domAttributes)==null?void 0:h.blockContent)||{};return((f=e.toExternalHTML)==null?void 0:f.call({blockContentDOMAttributes:p},c,u,d))??e.render.call({blockContentDOMAttributes:p,renderType:"dom",props:void 0},c,u)}},extensions:n}}function jt(t,e,n){return(r={})=>{const i=typeof t=="function"?t(r):t,s=typeof e=="function"?e(r):e,o=n?typeof n=="function"?n(r):n:void 0;return{config:i,implementation:{...s,toExternalHTML(a,l,c){var u,d;const h=(u=s.toExternalHTML)==null?void 0:u.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l,c);if(h!==void 0)return vh(h,a.type,a.props,i.propSchema,((d=s.meta)==null?void 0:d.fileBlockAccept)!==void 0)},render(a,l){var c;const u=s.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l);return vh(u,a.type,a.props,i.propSchema,((c=s.meta)==null?void 0:c.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:o}}}function Mj(t,e,n,r){return t.dom.setAttribute("data-inline-content-type",e),Object.entries(n).filter(([i,s])=>{const o=r[i];return s!==o.default}).map(([i,s])=>[Jl(i),s]).forEach(([i,s])=>t.dom.setAttribute(i,s)),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function Dj(t){return{Backspace:({editor:e})=>{const n=e.state.selection.$from;return e.state.selection.empty&&n.node().type.name===t.type&&n.parentOffset===0}}}function vj(t,e){return{config:t,implementation:e}}function OT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function nL(t){return t==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue!==void 0?{"data-value":e.stringValue}:{}}}}function Ha(t,e,n,r){return t.dom.setAttribute("data-style-type",e),r==="string"&&t.dom.setAttribute("data-value",n),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function MT(t,e){return{config:t,implementation:e}}function js(t,e){return MT({type:t.name,propSchema:e},{mark:t,render(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o},toExternalHTML(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o}})}function DT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function rL(t,e){const n=[{tag:`[data-style-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:{stringValue:i}}}),n}function vT(t,e){const n=Tn.create({name:t.type,addAttributes(){return nL(t.propSchema)},parseHTML(){return rL(t,e.parse)},renderHTML({mark:r}){const i=(e.toExternalHTML||e.render)(r.attrs.stringValue);return Ha(i,t.type,r.attrs.stringValue,t.propSchema)},addMarkView(){return({mark:r})=>{const i=e.render(r.attrs.stringValue);return Ha(i,t.type,r.attrs.stringValue,t.propSchema)}}});return MT(t,{...e,mark:n,render:r=>{const i=e.render(r);return Ha(i,t.type,r,t.propSchema)},toExternalHTML:r=>{const i=(e.toExternalHTML||e.render)(r);return Ha(i,t.type,r,t.propSchema)}})}function Vt(t,e){let n,r;if(e.firstChild.descendants((i,s)=>n?!1:!Op(i)||i.attrs.id!==t?!0:(n=i,r=s+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function Op(t){return t.type.isInGroup("bnBlock")}const iL=(t,e)=>({tr:n,dispatch:r})=>(r&&uu(n,t,e),!0);function uu(t,e,n,r,i){const s=Gc(t.doc.resolve(e));let o=null;s.blockNoteType==="table"&&(o=aL(t));const a=He(t),l=a.nodes[s.blockNoteType],c=a.nodes[n.type||s.blockNoteType],u=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(s.isBlockContainer&&c.isInGroup("blockContent"))A0(n,t,s),sL(n,t,l,c,s);else if(!s.isBlockContainer&&c.isInGroup("bnBlock"))A0(n,t,s);else{const d=ve(s.bnBlock.node,a);t.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,Ii({children:d.children,...n},a));return}t.setNodeMarkup(s.bnBlock.beforePos,u,{...s.bnBlock.node.attrs,...n.props}),o&&lL(t,s,o)}function sL(t,e,n,r,i,s,o){const a=He(e);let l="keep";if(t.content)if(typeof t.content=="string")l=bn([t.content],a,r.name);else if(Array.isArray(t.content))l=bn(t.content,a,r.name);else if(t.content.type==="tableContent")l=Jc(t.content,a);else throw new Pn(t.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?e.setNodeMarkup(i.blockContent.beforePos,r,{...i.blockContent.node.attrs,...t.props}):e.replaceWith(i.blockContent.beforePos,i.blockContent.afterPos,r.createChecked({...i.blockContent.node.attrs,...t.props},l))}function A0(t,e,n){const r=He(e);if(t.children!==void 0&&t.children.length>0){const i=t.children.map(s=>Ii(s,r));if(n.childContainer)e.step(new ze(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new F(M.from(i),0,0)));else{if(!n.isBlockContainer)throw new Error("impossible");e.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},i))}}}function oL(t,e,n,r,i){const s=typeof e=="string"?e:e.id,o=Vt(s,t.doc);if(!o)throw new Error(`Block with ID ${s} not found`);uu(t,o.posBeforeNode,n);const a=t.doc.resolve(o.posBeforeNode+1).node(),l=He(t);return ve(a,l)}function aL(t){const e="selection"in t?t.selection:null;if(!(e instanceof j))return null;const n=t.doc.resolve(e.head);let r=-1,i=-1;for(let g=n.depth;g>=0;g--){const b=n.node(g).type.name;if(r<0&&(b==="tableCell"||b==="tableHeader")&&(r=g),b==="table"){i=g;break}}if(r<0||i<0)return null;const s=n.before(r),o=n.before(i),a=t.doc.nodeAt(o);if(!a||a.type.name!=="table")return null;const l=Ae.get(a),c=s-(o+1),u=l.map.indexOf(c);if(u<0)return null;const d=Math.floor(u/l.width),h=u%l.width,f=s+1+1,p=Math.max(0,e.head-f);return{row:d,col:h,offset:p}}function lL(t,e,n){var r;if(e.blockNoteType!=="table")return!1;let i=-1;if(e.isBlockContainer)i=t.mapping.map(e.blockContent.beforePos);else{const b=t.mapping.map(e.bnBlock.beforePos),y=b+(((r=t.doc.nodeAt(b))==null?void 0:r.nodeSize)||0);t.doc.nodesBetween(b,y,(T,S)=>T.type.name==="table"?(i=S,!1):!0)}const s=i>=0?t.doc.nodeAt(i):null;if(!s||s.type.name!=="table")return!1;const o=Ae.get(s),a=Math.max(0,Math.min(n.row,o.height-1)),l=Math.max(0,Math.min(n.col,o.width-1)),c=a*o.width+l,u=o.map[c];if(u==null)return!1;const d=i+1+u+1,h=t.doc.nodeAt(d),f=d+1,p=h?h.content.size:0,g=f+Math.max(0,Math.min(n.offset,p));return"selection"in t&&t.setSelection(j.create(t.doc,g)),!0}const Nr={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},ye={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},Dt=t=>{const e={};return t.hasAttribute("data-background-color")?e.backgroundColor=t.getAttribute("data-background-color"):t.style.backgroundColor&&(e.backgroundColor=t.style.backgroundColor),t.hasAttribute("data-text-color")?e.textColor=t.getAttribute("data-text-color"):t.style.color&&(e.textColor=t.style.color),e.textAlignment=ye.textAlignment.values.includes(t.style.textAlign)?t.style.textAlign:void 0,e},Di=(t,e)=>{t.backgroundColor&&t.backgroundColor!==ye.backgroundColor.default&&(e.style.backgroundColor=t.backgroundColor in Nr?Nr[t.backgroundColor].background:t.backgroundColor),t.textColor&&t.textColor!==ye.textColor.default&&(e.style.color=t.textColor in Nr?Nr[t.textColor].text:t.textColor),t.textAlignment&&t.textAlignment!==ye.textAlignment.default&&(e.style.textAlign=t.textAlignment)},cL=(t="backgroundColor")=>({default:ye.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:ye.backgroundColor.default,renderHTML:e=>e[t]===ye.backgroundColor.default?{}:{"data-background-color":e[t]}}),uL=(t="textColor")=>({default:ye.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:ye.textColor.default,renderHTML:e=>e[t]===ye.textColor.default?{}:{"data-text-color":e[t]}}),du=(t,e)=>{const n=t.querySelector(e);if(!n)return;const r=t.querySelector("figcaption"),i=r?.textContent??void 0;return{targetElement:n,caption:i}},Ir=pe(({editor:t})=>{const e=Mi(void 0);function n(){e.setState(void 0)}return{key:"filePanel",store:e,mount({signal:r}){const i=t.onChange(n,!1),s=t.onSelectionChange(n,!1);r.addEventListener("abort",()=>{i(),s()})},closeMenu:n,showMenu(r){e.setState(r)}}}),dL=(t,e,n)=>{const r=document.createElement("div");r.className="bn-add-file-button";const i=document.createElement("div");i.className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i);const s=document.createElement("p");s.className="bn-add-file-button-text",s.innerHTML=t.type in e.dictionary.file_blocks.add_button_text?e.dictionary.file_blocks.add_button_text[t.type]:e.dictionary.file_blocks.add_button_text.file,r.appendChild(s);const o=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{var l;e.isEditable&&((l=e.getExtension(Ir))==null||l.showMenu(t.id))};return r.addEventListener("mousedown",o,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",o,!0),r.removeEventListener("click",a,!0)}}},hL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',fL=t=>{const e=document.createElement("div");e.className="bn-file-name-with-icon";const n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=hL,e.appendChild(n);const r=document.createElement("p");return r.className="bn-file-name",r.textContent=t.props.name,e.appendChild(r),{dom:e}},Mp=(t,e,n,r)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=dL(t,e,r);i.appendChild(o.dom);const a=e.onUploadStart(l=>{if(l===t.id){i.removeChild(o.dom);const c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",i.appendChild(c)}});return{dom:i,destroy:()=>{a(),o.destroy()}}}const s={dom:i};if(t.props.showPreview===!1||!n){const o=fL(t);i.appendChild(o.dom),s.destroy=()=>{var a;(a=o.destroy)==null||a.call(o)}}else i.appendChild(n.dom);if(t.props.caption){const o=document.createElement("p");o.className="bn-file-caption",o.textContent=t.props.caption,i.appendChild(o)}return s},Dp=(t,e)=>{const n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},hu=(t,e)=>{const n=document.createElement("div"),r=document.createElement("p");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},_0=t=>({url:t.src||void 0}),pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>',mL=t=>({type:"audio",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),gL=(t={})=>e=>{if(e.tagName==="AUDIO"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{..._0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"audio");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{..._0(r),backgroundColor:s,caption:i}}},bL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??pL;const i=document.createElement("audio");return i.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{i.src=s}):i.src=e.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,Mp(e,n,{dom:i},r.firstElementChild)},yL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add audio",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("audio"),r.src=e.props.url):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(r,e.props.caption):hu(r,e.props.caption):{dom:r}},EL=jt(mL,t=>({meta:{fileBlockAccept:["audio/*"]},parse:gL(t),render:bL(t),toExternalHTML:yL(t),runsBefore:["file"]})),N0=Symbol.for("blocknote.shikiParser"),od=Symbol.for("blocknote.shikiHighlighterPromise");function kL(t){const e=globalThis;let n,r;return $v({parser:i=>{if(!t.createHighlighter)return[];if(!n)return e[od]=e[od]||t.createHighlighter(),e[od].then(o=>{n=o});const s=LT(t,i.language);return!s||s==="text"||s==="none"||s==="plaintext"||s==="txt"?[]:n.getLoadedLanguages().includes(s)?(r||(r=e[N0]||zv(n),e[N0]=r),r(i)):n.loadLanguage(s)},languageExtractor:i=>i.attrs.language,nodeTypes:["codeBlock"]})}const TL=({defaultLanguage:t="text"})=>({type:"codeBlock",propSchema:{language:{default:t}},content:"inline"}),CL=jt(TL,t=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{var n,r;if(e.tagName!=="PRE"||e.childElementCount!==1||((n=e.firstElementChild)==null?void 0:n.tagName)!=="CODE")return;const i=e.firstElementChild;return{language:i.getAttribute("data-language")||((r=i.className.split(" ").find(s=>s.includes("language-")))==null?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:n})=>{const r=mn.fromSchema(n),i=e.firstElementChild;return r.parse(i,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(e,n){const r=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");i.appendChild(s);let o;if(t.supportedLanguages){const a=document.createElement("select");if(Object.entries(t.supportedLanguages??{}).forEach(([c,{name:u}])=>{const d=document.createElement("option");d.value=c,d.text=u,a.appendChild(d)}),a.value=e.props.language||t.defaultLanguage||"text",n.isEditable){const c=u=>{const d=u.target.value;n.updateBlock(e.id,{props:{language:d}})};a.addEventListener("change",c),o=()=>a.removeEventListener("change",c)}else a.disabled=!0;const l=document.createElement("div");l.contentEditable="false",l.appendChild(a),r.appendChild(l)}return r.appendChild(i),{dom:r,contentDOM:s,destroy:()=>{o?.()}}},toExternalHTML(e){const n=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,n.appendChild(r),{dom:n,contentDOM:r}}}),t=>[pe({key:"code-block-highlighter",prosemirrorPlugins:[kL(t)]}),pe({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(n=>{const{block:r}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:i}=n.selection;return i.parent.textContent?!1:(e.removeBlocks([r]),!0)}),Tab:({editor:e})=>t.indentLineWithTab===!1?!1:e.transact(n=>{const{block:r}=e.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:e})=>e.transact(n=>{const{block:r,nextBlock:i}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:s}=n.selection,o=s.parentOffset===s.parent.nodeSize-2,a=s.parent.textContent.endsWith(`
111
111
 
112
112
  `);if(o&&a){if(n.delete(s.pos-2,s.pos),i)return e.setTextCursorPosition(i,"start"),!0;const[l]=e.insertBlocks([{type:"paragraph"}],r,"after");return e.setTextCursorPosition(l,"start"),!0}return n.insertText(`
113
- `),!0}),"Shift-Enter":({editor:e})=>e.transact(()=>{const{block:n}=e.getTextCursorPosition();if(n.type!=="codeBlock")return!1;const[r]=e.insertBlocks([{type:"paragraph"}],n,"after");return e.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:e})=>{const n=e[1].trim();return{type:"codeBlock",props:{language:{language:LT(t,n)??n}.language},content:[]}}}]})]);function LT(t,e){var n;return(n=Object.entries(t.supportedLanguages??{}).find(([r,{aliases:i}])=>i?.includes(e)||r===e))==null?void 0:n[0]}const SL=()=>({type:"divider",propSchema:{},content:"none"}),wL=jt(SL,{meta:{isolating:!1},parse(t){if(t.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[pe({key:"divider-block-shortcuts",inputRules:[{find:new RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),I0=t=>({url:t.src||void 0}),xL=()=>({type:"file",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),AL=()=>t=>{if(t.tagName==="EMBED"){if(t.closest("figure"))return;const{backgroundColor:e}=Dt(t);return{...I0(t),backgroundColor:e}}if(t.tagName==="FIGURE"){const e=du(t,"embed");if(!e)return;const{targetElement:n,caption:r}=e,{backgroundColor:i}=Dt(t);return{...I0(n),backgroundColor:i,caption:r}}},_L=jt(xL,{meta:{fileBlockAccept:["*/*"]},parse:AL(),render(t,e){return Mp(t,e)},toExternalHTML(t){if(!t.props.url){const n=document.createElement("p");return n.textContent="Add file",{dom:n}}const e=document.createElement("a");return e.href=t.props.url,e.textContent=t.props.name||t.props.url,t.props.caption?hu(e,t.props.caption):{dom:e}}}),NL={set:(t,e)=>window.localStorage.setItem(`toggle-${t.id}`,e?"true":"false"),get:t=>window.localStorage.getItem(`toggle-${t.id}`)==="true"},RT=(t,e,n,r=NL)=>{if("isToggleable"in t.props&&!t.props.isToggleable)return{dom:n};const i=document.createElement("div"),s=document.createElement("div");s.className="bn-toggle-wrapper";const o=document.createElement("button");o.className="bn-toggle-button",o.type="button",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';const a=p=>p.preventDefault();o.addEventListener("mousedown",a);const l=()=>{var p;s.getAttribute("data-show-children")==="true"?(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1),i.contains(c)&&i.removeChild(c)):(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0),e.isEditable&&((p=e.getBlock(t))==null?void 0:p.children.length)===0&&!i.contains(c)&&i.appendChild(c))};o.addEventListener("click",l),s.appendChild(o),s.appendChild(n);const c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=e.dictionary.toggle_blocks.add_block_button;const u=p=>p.preventDefault();c.addEventListener("mousedown",u);const d=()=>{e.transact(()=>{const p=e.updateBlock(t,{children:[{}]});e.setTextCursorPosition(p.children[0].id,"end"),e.focus()})};c.addEventListener("click",d),i.appendChild(s);let h=t.children.length;const f=e.onChange(()=>{var p;const g=((p=e.getBlock(t))==null?void 0:p.children.length)??0;g>h?(s.getAttribute("data-show-children")==="false"&&(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0)),i.contains(c)&&i.removeChild(c)):g===0&&g<h&&(s.getAttribute("data-show-children")==="true"&&(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1)),i.contains(c)&&i.removeChild(c)),h=g});return r.get(t)?(s.setAttribute("data-show-children","true"),e.isEditable&&t.children.length===0&&i.appendChild(c)):s.setAttribute("data-show-children","false"),{dom:i,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===s&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===c||p.removedNodes[0]===c)),destroy:()=>{o.removeEventListener("mousedown",a),o.removeEventListener("click",l),c.removeEventListener("mousedown",u),c.removeEventListener("click",d),f?.()}}},PT=[1,2,3,4,5,6],IL=t=>({editor:e})=>{const n=e.getTextCursorPosition();return e.schema.blockSchema[n.block.type].content!=="inline"?!1:(e.updateBlock(n.block,{type:"heading",props:{level:t}}),!0)},OL=({defaultLevel:t=1,levels:e=PT,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...ye,level:{default:t,values:e},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),ML=jt(OL,({allowToggleHeadings:t=!0}={})=>({meta:{isolating:!1},parse(e){let n;switch(e.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6;break;default:return}return{...Dt(e),level:n}},render(e,n){const r=document.createElement(`h${e.props.level}`);return t?{...RT(e,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(e){const n=document.createElement(`h${e.props.level}`);return Di(e.props,n),{dom:n,contentDOM:n}}}),({levels:t=PT}={})=>[pe({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(t.map(e=>[`Mod-Alt-${e}`,IL(e)])??[]),inputRules:t.map(e=>({find:new RegExp(`^(#{${e}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),BT=(t,e,n,r,i)=>{const{dom:s,destroy:o}=Mp(t,e,n,i),a=s;a.style.position="relative",t.props.url&&t.props.showPreview&&(t.props.previewWidth?a.style.width=`${t.props.previewWidth}px`:a.style.width="fit-content");const l=document.createElement("div");l.className="bn-resize-handle",l.style.left="4px";const c=document.createElement("div");c.className="bn-resize-handle",c.style.right="4px";const u=document.createElement("div");u.style.position="absolute",u.style.height="100%",u.style.width="100%";let d,h=t.props.previewWidth;const f=S=>{var D,I;if(!d){!e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c));return}let A;const v="touches"in S?S.touches[0].clientX:S.clientX;t.props.textAlignment==="center"?d.handleUsed==="left"?A=d.initialWidth+(d.initialClientX-v)*2:A=d.initialWidth+(v-d.initialClientX)*2:d.handleUsed==="left"?A=d.initialWidth+d.initialClientX-v:A=d.initialWidth+v-d.initialClientX,h=Math.min(Math.max(A,64),((I=(D=e.domElement)==null?void 0:D.firstElementChild)==null?void 0:I.clientWidth)||Number.MAX_VALUE),a.style.width=`${h}px`},p=S=>{(!S.target||!a.contains(S.target)||!e.isEditable)&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c)),d&&(d=void 0,a.contains(u)&&a.removeChild(u),e.updateBlock(t,{props:{previewWidth:h}}))},g=()=>{e.isEditable&&(r.appendChild(l),r.appendChild(c))},b=S=>{S.relatedTarget===l||S.relatedTarget===c||d||e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c))},y=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:D}},T=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:D}};return window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",b),l.addEventListener("mousedown",y),l.addEventListener("touchstart",y),c.addEventListener("mousedown",T),c.addEventListener("touchstart",T),{dom:a,destroy:()=>{o?.(),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",b),l.removeEventListener("mousedown",y),l.removeEventListener("touchstart",y),c.removeEventListener("mousedown",T),c.removeEventListener("touchstart",T)}}},O0=t=>{const e=t.src||void 0,n=t.width||void 0,r=t.alt||void 0;return{url:e,previewWidth:n,name:r}},DL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>',vL=(t={})=>({type:"image",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),LL=(t={})=>e=>{if(e.tagName==="IMG"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{...O0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"img");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{...O0(r),backgroundColor:s,caption:i}}},RL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??DL;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("img");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.alt=e.props.name||e.props.caption||"BlockNote image",s.contentEditable="false",s.draggable=!1,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},PL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add image",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("img"),r.src=e.props.url,r.alt=e.props.name||e.props.caption||"BlockNote image",e.props.previewWidth&&(r.width=e.props.previewWidth)):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(r,e.props.caption):hu(r,e.props.caption):{dom:r}},BL=jt(vL,t=>({meta:{fileBlockAccept:["image/*"]},parse:LL(t),render:RL(t),toExternalHTML:PL(t),runsBefore:["file"]})),FL=(t,e,n)=>({state:r,dispatch:i})=>i?FT(r.tr,t,e,n):!0,FT=(t,e,n,r)=>{const i=Rr(t.doc,e),s=Pr(i);if(!s.isBlockContainer)return!1;const o=He(t),a=[{type:s.bnBlock.node.type,attrs:r?{...s.bnBlock.node.attrs,id:void 0}:{}},{type:n?s.blockContent.node.type:o.nodes.paragraph,attrs:r?{...s.blockContent.node.attrs}:{}}];return t.split(e,2,a),!0},fu=(t,e)=>{const{blockInfo:n,selectionEmpty:r}=t.transact(o=>({blockInfo:sa(o),selectionEmpty:o.selection.anchor===o.selection.head}));if(!n.isBlockContainer)return!1;const{bnBlock:i,blockContent:s}=n;return s.node.type.name!==e||!r?!1:s.node.childCount===0?(t.transact(o=>{uu(o,i.beforePos,{type:"paragraph",props:{}})}),!0):s.node.childCount>0?t.transact(o=>(o.deleteSelection(),FT(o,o.selection.from,!0))):!1};function vp(t,e,n){var r,i,s;const o=mn.fromSchema(e),a=t,l=document.createElement("div");l.setAttribute("data-node-type","blockGroup");for(const f of Array.from(a.childNodes))l.appendChild(f.cloneNode(!0));let c=o.parse(l,{topNode:e.nodes.blockGroup.create()});((i=(r=c.firstChild)==null?void 0:r.firstChild)==null?void 0:i.type.name)==="checkListItem"&&(c=c.copy(c.content.cut(c.firstChild.firstChild.nodeSize+2)));const u=(s=c.firstChild)==null?void 0:s.firstChild;if(!(u!=null&&u.isTextblock))return M.from(c);const d=e.nodes[n].create({},u.content),h=c.content.cut(u.nodeSize+2);if(h.size>0){const f=c.copy(h);return d.content.addToEnd(f)}return d.content}const HL=()=>({type:"bulletListItem",propSchema:{...ye},content:"inline"}),UL=jt(HL,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL"))return Dt(t)},parseContent:({el:t,schema:e})=>vp(t,e,"bulletListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"bulletListItem"),"Mod-Shift-8":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"bulletListItem",props:{}}),!0)}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:t}){if(xt(t.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),$L=()=>({type:"checkListItem",propSchema:{...ye,checked:{default:!1,type:"boolean"}},content:"inline"}),zL=jt($L,{meta:{isolating:!1},parse(t){var e;if(t.tagName==="input")return t.closest("[data-content-type]")||t.closest("li")?void 0:t.type==="checkbox"?{checked:t.checked}:void 0;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL")){const r=t.querySelector("input[type=checkbox]")||null;return r===null?void 0:{...Dt(t),checked:r.checked}}},parseContent:({el:t,schema:e})=>vp(t,e,"checkListItem"),render(t,e){const n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=t.props.checked,t.props.checked&&r.setAttribute("checked",""),r.addEventListener("change",()=>{e.updateBlock(t,{props:{checked:!t.props.checked}})});const i=document.createElement("p"),s=document.createElement("div");return s.contentEditable="false",s.appendChild(r),n.appendChild(s),n.appendChild(i),{dom:n,contentDOM:i}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=t.props.checked,t.props.checked&&n.setAttribute("checked","");const r=document.createElement("p");return Di(t.props,e),e.appendChild(n),e.appendChild(r),{dom:e,contentDOM:r}},runsBefore:["bulletListItem"]},[pe({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"checkListItem"),"Mod-Shift-9":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"checkListItem",props:{}}),!0)}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace(){return{type:"checkListItem",props:{checked:!1}}}},{find:/^\s?\[[Xx]\]\s$/,replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function HT(t,e,n,r){let i=t.firstChild.attrs.start||1,s=!0;const o=!!t.firstChild.attrs.start,a=Pr({posBeforeNode:e,node:t});if(!a.isBlockContainer)throw new Error("impossible");const l=n.doc.resolve(a.bnBlock.beforePos).nodeBefore,c=l?r.get(l):void 0;return c!==void 0?(i=c+1,s=!1):l&&Pr({posBeforeNode:a.bnBlock.beforePos-l.nodeSize,node:l}).blockNoteType==="numberedListItem"&&(i=HT(l,a.bnBlock.beforePos-l.nodeSize,n,r).index+1,s=!1),r.set(t,i),{index:i,isFirst:s,hasStart:o}}function M0(t,e){const n=new Map,r=e.decorations.map(t.mapping,t.doc),i=[];t.doc.nodesBetween(0,t.doc.nodeSize-2,(o,a)=>{if(o.type.name==="blockContainer"&&o.firstChild.type.name==="numberedListItem"){const{index:l,isFirst:c,hasStart:u}=HT(o,a,t,n);if(r.find(a,a+o.nodeSize,d=>d.index===l&&d.isFirst===c&&d.hasStart===u).length===0){const d=t.doc.nodeAt(a+1);i.push(Ee.node(a+1,a+1+d.nodeSize,{"data-index":l.toString()}))}}});const s=i.flatMap(o=>r.find(o.from,o.to));return{decorations:r.remove(s).add(t.doc,i)}}const VL=()=>new te({key:new me("numbered-list-indexing-decorations"),state:{init(t,e){return M0(e.tr,{decorations:ce.empty})},apply(t,e){return!t.docChanged&&!t.selectionSet&&e.decorations?e:M0(t,e)}},props:{decorations(t){var e;return((e=this.getState(t))==null?void 0:e.decorations)??ce.empty}}}),jL=()=>({type:"numberedListItem",propSchema:{...ye,start:{default:void 0,type:"number"}},content:"inline"}),qL=jt(jL,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="OL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="OL")){const r=parseInt(n.getAttribute("start")||"1"),i=Dt(t);return t.previousElementSibling||r===1?i:{...i,start:r}}},parseContent:({el:t,schema:e})=>vp(t,e,"numberedListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:t,editor:e}){if(xt(e.prosemirrorState).blockNoteType==="heading")return;const n=parseInt(t[1]);return{type:"numberedListItem",props:{start:n!==1?n:void 0}}}}],keyboardShortcuts:{Enter:({editor:t})=>fu(t,"numberedListItem"),"Mod-Shift-7":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"numberedListItem",props:{}}),!0)}},prosemirrorPlugins:[VL()]})]),WL=()=>({type:"toggleListItem",propSchema:{...ye},content:"inline"}),YL=jt(WL,{meta:{isolating:!1},render(t,e){const n=document.createElement("p");return{...RT(t,e,n),contentDOM:n}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"toggleListItem"),"Mod-Shift-6":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"toggleListItem",props:{}}),!0)}}})]),KL=()=>({type:"paragraph",propSchema:ye,content:"inline"}),GL=jt(KL,{meta:{isolating:!1},parse:t=>{var e;if(t.tagName==="P"&&(e=t.textContent)!=null&&e.trim())return Dt(t)},render:()=>{const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("p");return Di(t.props,e),{dom:e,contentDOM:e}},runsBefore:["default"]},[pe({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"paragraph",props:{}}),!0)}}})]),QL=()=>({type:"quote",propSchema:{backgroundColor:ye.backgroundColor,textColor:ye.textColor},content:"inline"}),JL=jt(QL,{meta:{isolating:!1},parse(t){if(t.tagName==="BLOCKQUOTE"){const{backgroundColor:e,textColor:n}=Dt(t);return{backgroundColor:e,textColor:n}}},render(){const t=document.createElement("blockquote");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("blockquote");return Di(t.props,e),{dom:e,contentDOM:e}}},[pe({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"quote",props:{}}),!0)}},inputRules:[{find:new RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}}]})]),XL=35,Lp=120,vj=31,ZL=Le.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[JI({cellMinWidth:XL,defaultCellMinWidth:Lp,View:null}),aO()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.insertContent({type:"hardBreak"}),!0):!1,Backspace:()=>{const t=this.editor.state.selection,e=t.empty,n=t.$head.parentOffset===0,r=t.$head.node().type.name==="tableParagraph";return e&&n&&r},Tab:()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Rg(1)(t,e,n)),"Shift-Tab":()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Rg(-1)(t,e,n))}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Te(Y(t,"tableRole",e))}}}),eR={textColor:ye.textColor},tR=Cn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["th",sn(this.options.HTMLAttributes,t),0]}}),nR=Cn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["td",sn(this.options.HTMLAttributes,t),0]}}),rR=Cn.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){var n,r,i;const s=Yv(this.name,"table",{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e},((r=this.options.domAttributes)==null?void 0:r.inlineContent)||{}),o=document.createElement("colgroup");for(const a of t.children[0].children)if(a.attrs.colwidth)for(const l of a.attrs.colwidth){const c=document.createElement("col");l&&(c.style=`width: ${l}px`),o.appendChild(c)}else o.appendChild(document.createElement("col"));return(i=s.dom.firstChild)==null||i.appendChild(o),s},addNodeView(){return({node:t,HTMLAttributes:e})=>{var n;class r extends tk{constructor(s,o,a){super(s,o),this.node=s,this.cellMinWidth=o,this.blockContentHTMLAttributes=a;const l=document.createElement("div");l.className=Ur("bn-block-content",a.class),l.setAttribute("data-content-type","table");for(const[h,f]of Object.entries(a))h!=="class"&&l.setAttribute(h,f);const c=this.dom,u=document.createElement("div");u.className="tableWrapper-inner",u.appendChild(c.firstChild),c.appendChild(u),l.appendChild(c);const d=document.createElement("div");d.className="table-widgets-container",d.style.position="relative",c.appendChild(d),this.dom=l}ignoreMutation(s){return!s.target.closest(".tableWrapper-inner")||super.ignoreMutation(s)}}return new r(t,Lp,{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e})}}}),iR=Cn.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p",getAttrs:t=>{if(typeof t=="string"||!t.textContent||!t.closest("[data-content-type]"))return!1;const e=t.parentElement;return e===null?!1:e.tagName==="TD"||e.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:t}){return["p",t,0]}}),sR=Cn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",sn(this.options.HTMLAttributes,t),0]}});function UT(t,e){const n=mn.fromSchema(e).parse(t,{topNode:e.nodes.blockGroup.create()}),r=[];return n.content.descendants(i=>{if(i.isInline)return r.push(i),!1}),M.fromArray(r)}const oR=()=>Xv({node:rR,type:"table",content:"table"},eR,[pe({key:"table-extensions",tiptapExtensions:[ZL,iR,tR,nR,sR]}),pe({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:t})=>{if(!(t.prosemirrorState.selection instanceof be))return!1;const e=t.getTextCursorPosition().block,n=e.content;let r=0;for(const s of n.rows)for(const o of s.cells){if("type"in o&&o.content.length>0||!("type"in o)&&o.length>0)return!1;r++}let i=0;return t.prosemirrorState.selection.forEachCell(()=>{i++}),i<r?!1:(t.transact(()=>{(t.getPrevBlock(e)||t.getNextBlock(e))&&t.setTextCursorPosition(e),t.removeBlocks([e])}),!0)}}})]),D0=t=>{const e=t.src||void 0,n=t.width||void 0;return{url:e,previewWidth:n}},aR='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>',lR=t=>({type:"video",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),cR=t=>e=>{if(e.tagName==="VIDEO"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{...D0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"video");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{...D0(r),backgroundColor:s,caption:i}}},uR=jt(lR,t=>({meta:{fileBlockAccept:["video/*"]},parse:cR(),render(e,n){const r=document.createElement("div");r.innerHTML=t.icon??aR;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("video");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.controls=!0,s.contentEditable="false",s.draggable=!1,s.width=e.props.previewWidth,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},toExternalHTML(e){if(!e.props.url){const r=document.createElement("p");return r.textContent="Add video",{dom:r}}let n;return e.props.showPreview?(n=document.createElement("video"),n.src=e.props.url,e.props.previewWidth&&(n.width=e.props.previewWidth)):(n=document.createElement("a"),n.href=e.props.url,n.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(n,e.props.caption):hu(n,e.props.caption):{dom:n}},runsBefore:["file"]}));function Ye(t,e,n){if(!(e in t.schema.blockSpecs))return!1;if(!n)return!0;for(const[r,i]of Object.entries(n)){if(!(r in t.schema.blockSpecs[e].config.propSchema))return!1;if(typeof i=="string"){if(t.schema.blockSpecs[e].config.propSchema[r].default!==void 0&&typeof t.schema.blockSpecs[e].config.propSchema[r].default!==i||t.schema.blockSpecs[e].config.propSchema[r].type!==void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i)return!1}else{if(t.schema.blockSpecs[e].config.propSchema[r].default!==i.default||t.schema.blockSpecs[e].config.propSchema[r].default===void 0&&i.default===void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i.type||typeof t.schema.blockSpecs[e].config.propSchema[r].values!=typeof i.values)return!1;if(typeof t.schema.blockSpecs[e].config.propSchema[r].values=="object"&&typeof i.values=="object"){for(const s of i.values)if(!t.schema.blockSpecs[e].config.propSchema[r].values.includes(s))return!1}}}return!0}function Lj(t,e,n,r){return Ye(e,n,r)&&t.type===n}function v0(t){return t instanceof be}const Ua=new Map;function dR(t){if(Ua.has(t))return Ua.get(t);const e=new ds;return t._tiptapEditor.on("transaction",({transaction:n})=>{e.appendMapping(n.mapping)}),t._tiptapEditor.on("destroy",()=>{Ua.delete(t)}),Ua.set(t,e),e}function hR(t,e,n="left"){const r=Ie.getState(t.prosemirrorState);if(!r){const s=dR(t),o=s.maps.length;return()=>s.slice(o).map(e,n==="left"?-1:1)}const i=Jo(e+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{const s=Ie.getState(t.prosemirrorState),o=ci(s.doc,s.binding.type,i,s.binding.mapping);if(o===null)throw new Error("Position not found, cannot track positions");return o+(n==="right"?-1:1)}}const fR=Wc(t=>t.type.name==="blockContainer");class pR{constructor(e,n,r){Kr(this,"state"),Kr(this,"emitUpdate"),Kr(this,"rootEl"),Kr(this,"pluginState"),Kr(this,"handleScroll",()=>{var s,o;if((s=this.state)!=null&&s.show){const a=(o=this.rootEl)==null?void 0:o.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!a)return;this.state.referencePos=a.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),Kr(this,"closeMenu",()=>{this.editor.transact(s=>s.setMeta(ni,null))}),Kr(this,"clearQuery",()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(s=>s.selection.from)}).run()});var i;this.editor=e,this.pluginState=void 0,this.emitUpdate=s=>{var o;if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");n(s,{...this.state,ignoreQueryLength:(o=this.pluginState)==null?void 0:o.ignoreQueryLength})},this.rootEl=r.root,(i=this.rootEl)==null||i.addEventListener("scroll",this.handleScroll,!0)}update(e,n){var r;const i=ni.getState(n),s=ni.getState(e.state),o=i===void 0&&s!==void 0,a=i!==void 0&&s===void 0;if(!o&&!(i!==void 0&&s!==void 0)&&!a)return;if(this.pluginState=a?i:s,a||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}const l=(r=this.rootEl)==null?void 0:r.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&l&&(this.state={show:!0,referencePos:l.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){var e;(e=this.rootEl)==null||e.removeEventListener("scroll",this.handleScroll,!0)}}const ni=new me("SuggestionMenuPlugin"),Rp=pe(({editor:t})=>{const e=[];let n;const r=Mi(void 0);return{key:"suggestionMenu",store:r,addTriggerCharacter:i=>{e.push(i)},removeTriggerCharacter:i=>{e.splice(e.indexOf(i),1)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>{var i;return((i=n?.state)==null?void 0:i.show)||!1},openSuggestionMenu:(i,s)=>{t.headless||(t.focus(),t.transact(o=>{s!=null&&s.deleteTriggerCharacter&&o.insertText(i),o.scrollIntoView().setMeta(ni,{triggerCharacter:i,deleteTriggerCharacter:s?.deleteTriggerCharacter||!1,ignoreQueryLength:s?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new te({key:ni,view:i=>(n=new pR(t,(s,o)=>{r.setState({...o,triggerCharacter:s})},i),n),state:{init(){},apply:(i,s,o,a)=>{if(i.selection.$from.parent.type.spec.code)return s;const l=i.getMeta(ni);if(typeof l=="object"&&l!==null){s&&n?.closeMenu();const u=hR(t,a.selection.from-l.triggerCharacter.length);return{triggerCharacter:l.triggerCharacter,deleteTriggerCharacter:l.deleteTriggerCharacter!==!1,queryStartPos:()=>u()+l.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:l?.ignoreQueryLength}}if(s===void 0)return s;if(a.selection.from!==a.selection.to||l===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||s.triggerCharacter!==void 0&&a.selection.from<s.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(s.queryStartPos())))return;const c={...s};return c.query=a.doc.textBetween(s.queryStartPos(),a.selection.from),c}},props:{handleTextInput(i,s,o,a){if(s===o){const l=i.state.doc;for(const c of e){const u=c.length>1?l.textBetween(s-c.length,s)+a:a;if(c===u)return i.dispatch(i.state.tr.insertText(a)),i.dispatch(i.state.tr.setMeta(ni,{triggerCharacter:u}).scrollIntoView()),!0}}return!1},decorations(i){const s=this.getState(i);if(s===void 0)return null;if(!s.deleteTriggerCharacter){const o=fR(i.selection);if(o)return ce.create(i.doc,[Ee.node(o.pos,o.pos+o.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}return ce.create(i.doc,[Ee.inline(s.queryStartPos()-s.triggerCharacter.length,s.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}}})]}});function mR(t){let e=t.getTextCursorPosition().block,n=t.schema.blockSchema[e.type].content;for(;n==="none";){if(e=t.getTextCursorPosition().nextBlock,e===void 0)return;n=t.schema.blockSchema[e.type].content,t.setTextCursorPosition(e,"end")}}function lt(t,e){const n=t.getTextCursorPosition().block;if(n.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&yi(n.content[0])&&n.content[0].type==="text"&&n.content[0].text==="/"||n.content.length===0)?(r=t.updateBlock(n,e),t.setTextCursorPosition(r)):(r=t.insertBlocks([e],n,"after")[0],t.setTextCursorPosition(t.getTextCursorPosition().nextBlock)),mR(t),r}function Rj(t){const e=[];return Ye(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:n===1?"heading":`heading_${n}`,...t.dictionary.slash_menu[n===1?"heading":`heading_${n}`]})}),Ye(t,"quote")&&e.push({onItemClick:()=>{lt(t,{type:"quote"})},key:"quote",...t.dictionary.slash_menu.quote}),Ye(t,"toggleListItem")&&e.push({onItemClick:()=>{lt(t,{type:"toggleListItem"})},badge:dr("Mod-Shift-6"),key:"toggle_list",...t.dictionary.slash_menu.toggle_list}),Ye(t,"numberedListItem")&&e.push({onItemClick:()=>{lt(t,{type:"numberedListItem"})},badge:dr("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),Ye(t,"bulletListItem")&&e.push({onItemClick:()=>{lt(t,{type:"bulletListItem"})},badge:dr("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),Ye(t,"checkListItem")&&e.push({onItemClick:()=>{lt(t,{type:"checkListItem"})},badge:dr("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),Ye(t,"paragraph")&&e.push({onItemClick:()=>{lt(t,{type:"paragraph"})},badge:dr("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),Ye(t,"codeBlock")&&e.push({onItemClick:()=>{lt(t,{type:"codeBlock"})},badge:dr("Mod-Alt-c"),key:"code_block",...t.dictionary.slash_menu.code_block}),Ye(t,"divider")&&e.push({onItemClick:()=>{lt(t,{type:"divider"})},key:"divider",...t.dictionary.slash_menu.divider}),Ye(t,"table")&&e.push({onItemClick:()=>{lt(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),Ye(t,"image",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"image"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"image",...t.dictionary.slash_menu.image}),Ye(t,"video",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"video"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"video",...t.dictionary.slash_menu.video}),Ye(t,"audio",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"audio"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"audio",...t.dictionary.slash_menu.audio}),Ye(t,"file",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"file"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"file",...t.dictionary.slash_menu.file}),Ye(t,"heading",{level:"number",isToggleable:"boolean"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n,isToggleable:!0}})},key:n===1?"toggle_heading":`toggle_heading_${n}`,...t.dictionary.slash_menu[n===1?"toggle_heading":`toggle_heading_${n}`]})}),Ye(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:`heading_${n}`,...t.dictionary.slash_menu[`heading_${n}`]})}),e.push({onItemClick:()=>{var n;(n=t.getExtension(Rp))==null||n.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...t.dictionary.slash_menu.emoji}),e}function Pj(t,e){return t.filter(({title:n,aliases:r})=>n.toLowerCase().includes(e.toLowerCase())||r&&r.filter(i=>i.toLowerCase().includes(e.toLowerCase())).length!==0)}const gR={audio:EL(),bulletListItem:UL(),checkListItem:zL(),codeBlock:CL(),divider:wL(),file:_L(),heading:ML(),image:BL(),numberedListItem:qL(),paragraph:GL(),quote:JL(),table:oR(),toggleListItem:YL(),video:uR()},bR=vT({type:"textColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.textColor.default&&(e.style.color=t in Nr?Nr[t].text:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.color)return t.style.color}}),yR=vT({type:"backgroundColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.backgroundColor.default&&(e.style.backgroundColor=t in Nr?Nr[t].background:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.backgroundColor)return t.style.backgroundColor}}),$T={bold:js(Sv,"boolean"),italic:js(vv,"boolean"),underline:js(Hv,"boolean"),strike:js(Bv,"boolean"),code:js(_v,"boolean"),textColor:bR,backgroundColor:yR};DT($T);const zT={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},Bj=OT(zT);var ad,L0;function ER(){return L0||(L0=1,ad=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),ad}var kR=ER();const TR=M1(kR);function CR(t={}){return new te({view(e){return new SR(e,t)}})}class SR{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),g=d?p.bottom:p.top;d&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:p.left,right:p.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=sy(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}var Xl=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<Xl&&this.leafAppend(e)||this.length<Xl&&e.leafPrepend(this)||this.appendInner(e)):this};Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this};Xe.prototype.appendInner=function(e){return new wR(this,e)};Xe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Xe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Xe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new VT(e):Xe.empty};var VT=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xl)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Xe);Xe.empty=new VT([]);var wR=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Xe);const xR=500;class hn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new _n(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new _n(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new hn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new _n(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>_R&&(a=AR(a,c),o-=c),new hn(a.append(s),o)}remapping(e,n){let r=new ds;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new hn(this.items.append(e.map(n=>new _n(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),b=h.selection&&h.selection.map(s.slice(l+1,f));b&&a++,r.push(new _n(p,g,b))}else r.push(new _n(p))},i);let c=[];for(let h=n;h<o;h++)c.push(new _n(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),d=new hn(u,a);return d.emptyItemCount()>xR&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new _n(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new hn(Xe.from(i.reverse()),s)}}hn.empty=new hn(Xe.empty,0);function AR(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class _n{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new _n(n.getMap().invert(),n,this.selection)}}}class yr{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const _R=20;function NR(t,e,n,r){let i=n.getMeta(ui),s;if(i)return i.historyState;n.getMeta(jT)&&(t=new yr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ui))return o.getMeta(ui).redo?new yr(t.done.addTransform(n,void 0,r,fl(e)),t.undone,R0(n.mapping.maps),t.prevTime,t.prevComposition):new yr(t.done,t.undone.addTransform(n,void 0,r,fl(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!IR(n,t.prevRanges)),c=o?ld(t.prevRanges,n.mapping):R0(n.mapping.maps);return new yr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,fl(e)),hn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new yr(t.done.rebased(n,s),t.undone.rebased(n,s),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new yr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function IR(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function R0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function ld(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function OR(t,e,n){let r=fl(e),i=ui.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new yr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(ui,{redo:n,historyState:l})}let cd=!1,P0=null;function fl(t){let e=t.plugins;if(P0!=e){cd=!1,P0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cd=!0;break}}return cd}function MR(t){return t.setMeta(jT,!0)}const ui=new me("history"),jT=new me("closeHistory");function DR(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new te({key:ui,state:{init(){return new yr(hn.empty,hn.empty,null,0,-1)},apply(e,n,r){return NR(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?WT:r=="historyRedo"?YT:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function qT(t,e){return(n,r)=>{let i=ui.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=OR(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const WT=qT(!1,!0),YT=qT(!0,!0);class pa{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}pa.prototype.normal={};pa.prototype.property={};pa.prototype.space=void 0;function KT(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new pa(n,r,e)}function Xo(t){return t.toLowerCase()}class vt{constructor(e,n){this.attribute=n,this.property=e}}vt.prototype.attribute="";vt.prototype.booleanish=!1;vt.prototype.boolean=!1;vt.prototype.commaOrSpaceSeparated=!1;vt.prototype.commaSeparated=!1;vt.prototype.defined=!1;vt.prototype.mustUseProperty=!1;vt.prototype.number=!1;vt.prototype.overloadedBoolean=!1;vt.prototype.property="";vt.prototype.spaceSeparated=!1;vt.prototype.space=void 0;let vR=0;const Z=vi(),$e=vi(),Lh=vi(),H=vi(),xe=vi(),cs=vi(),Rt=vi();function vi(){return 2**++vR}const Rh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Z,booleanish:$e,commaOrSpaceSeparated:Rt,commaSeparated:cs,number:H,overloadedBoolean:Lh,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),ud=Object.keys(Rh);class Pp extends vt{constructor(e,n,r,i){let s=-1;if(super(e,n),B0(this,"space",i),typeof r=="number")for(;++s<ud.length;){const o=ud[s];B0(this,ud[s],(r&Rh[o])===Rh[o])}}}Pp.prototype.defined=!0;function B0(t,e,n){n&&(t[e]=n)}function Bs(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Pp(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Xo(r)]=r,n[Xo(s.attribute)]=r}return new pa(e,n,t.space)}const GT=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:$e,ariaAutoComplete:null,ariaBusy:$e,ariaChecked:$e,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:$e,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:$e,ariaFlowTo:xe,ariaGrabbed:$e,ariaHasPopup:null,ariaHidden:$e,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:H,ariaLive:null,ariaModal:$e,ariaMultiLine:$e,ariaMultiSelectable:$e,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:$e,ariaReadOnly:$e,ariaRelevant:null,ariaRequired:$e,ariaRoleDescription:xe,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:$e,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function QT(t,e){return e in t?t[e]:e}function JT(t,e){return QT(t,e.toLowerCase())}const LR=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:cs,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:xe,autoFocus:Z,autoPlay:Z,blocking:xe,capture:null,charSet:null,checked:Z,cite:null,className:xe,cols:H,colSpan:null,content:null,contentEditable:$e,controls:Z,controlsList:xe,coords:H|cs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:Lh,draggable:$e,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:xe,height:H,hidden:Lh,high:H,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:xe,itemRef:xe,itemScope:Z,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:H,pattern:null,ping:xe,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:xe,required:Z,reversed:Z,rows:H,rowSpan:H,sandbox:xe,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:$e,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:$e,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:$e,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Z,disableRemotePlayback:Z,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:JT}),RR=Bs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Rt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:xe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:cs,g2:cs,glyphName:cs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Rt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rt,rev:Rt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rt,requiredFeatures:Rt,requiredFonts:Rt,requiredFormats:Rt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Rt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Rt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:QT}),XT=Bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ZT=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:JT}),eC=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),PR=/[A-Z]/g,F0=/-[a-z]/g,BR=/^data[-\w.:]+$/i;function Bp(t,e){const n=Xo(e);let r=e,i=vt;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&BR.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(F0,HR);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!F0.test(s)){let o=s.replace(PR,FR);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Pp}return new i(r,e)}function FR(t){return"-"+t.toLowerCase()}function HR(t){return t.charAt(1).toUpperCase()}const pu=KT([GT,LR,XT,ZT,eC],"html"),ma=KT([GT,RR,XT,ZT,eC],"svg");function H0(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function UR(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U0=/[#.]/g;function $R(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){U0.lastIndex=i;const a=U0.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function $0(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function zR(t){return t.join(" ").trim()}function tC(t,e,n){const r=n?WR(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=$R(s,e);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,VR(o))a.unshift(o);else for(const[d,h]of Object.entries(o))jR(t,l.properties,d,h)}for(const c of a)Ph(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function VR(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function jR(t,e,n,r){const i=Bp(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=$0(r):i.commaSeparated?s=H0(r):i.commaOrSpaceSeparated?s=$0(H0(r).join(" ")):s=z0(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?qR(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(z0(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function Ph(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Ph(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Ph(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function z0(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Xo(n)===Xo(e)))return!0}return n}function qR(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function WR(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const YR=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],nC=tC(pu,"div"),rC=tC(ma,"g",YR);function KR(t){const e=String(t),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=n[o];if(a===void 0){const l=V0(e,n[o-1]);a=l===-1?e.length+1:l+1,n[o]=a}if(a>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const a=n[n.length-1],l=V0(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;n.push(c)}const o=(s.line>1?n[s.line-2]:0)+s.column-1;if(o<n[s.line-1])return o}}}function V0(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
113
+ `),!0}),"Shift-Enter":({editor:e})=>e.transact(()=>{const{block:n}=e.getTextCursorPosition();if(n.type!=="codeBlock")return!1;const[r]=e.insertBlocks([{type:"paragraph"}],n,"after");return e.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:e})=>{const n=e[1].trim();return{type:"codeBlock",props:{language:{language:LT(t,n)??n}.language},content:[]}}}]})]);function LT(t,e){var n;return(n=Object.entries(t.supportedLanguages??{}).find(([r,{aliases:i}])=>i?.includes(e)||r===e))==null?void 0:n[0]}const SL=()=>({type:"divider",propSchema:{},content:"none"}),wL=jt(SL,{meta:{isolating:!1},parse(t){if(t.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[pe({key:"divider-block-shortcuts",inputRules:[{find:new RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),I0=t=>({url:t.src||void 0}),xL=()=>({type:"file",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),AL=()=>t=>{if(t.tagName==="EMBED"){if(t.closest("figure"))return;const{backgroundColor:e}=Dt(t);return{...I0(t),backgroundColor:e}}if(t.tagName==="FIGURE"){const e=du(t,"embed");if(!e)return;const{targetElement:n,caption:r}=e,{backgroundColor:i}=Dt(t);return{...I0(n),backgroundColor:i,caption:r}}},_L=jt(xL,{meta:{fileBlockAccept:["*/*"]},parse:AL(),render(t,e){return Mp(t,e)},toExternalHTML(t){if(!t.props.url){const n=document.createElement("p");return n.textContent="Add file",{dom:n}}const e=document.createElement("a");return e.href=t.props.url,e.textContent=t.props.name||t.props.url,t.props.caption?hu(e,t.props.caption):{dom:e}}}),NL={set:(t,e)=>window.localStorage.setItem(`toggle-${t.id}`,e?"true":"false"),get:t=>window.localStorage.getItem(`toggle-${t.id}`)==="true"},RT=(t,e,n,r=NL)=>{if("isToggleable"in t.props&&!t.props.isToggleable)return{dom:n};const i=document.createElement("div"),s=document.createElement("div");s.className="bn-toggle-wrapper";const o=document.createElement("button");o.className="bn-toggle-button",o.type="button",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';const a=p=>p.preventDefault();o.addEventListener("mousedown",a);const l=()=>{var p;s.getAttribute("data-show-children")==="true"?(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1),i.contains(c)&&i.removeChild(c)):(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0),e.isEditable&&((p=e.getBlock(t))==null?void 0:p.children.length)===0&&!i.contains(c)&&i.appendChild(c))};o.addEventListener("click",l),s.appendChild(o),s.appendChild(n);const c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=e.dictionary.toggle_blocks.add_block_button;const u=p=>p.preventDefault();c.addEventListener("mousedown",u);const d=()=>{e.transact(()=>{const p=e.updateBlock(t,{children:[{}]});e.setTextCursorPosition(p.children[0].id,"end"),e.focus()})};c.addEventListener("click",d),i.appendChild(s);let h=t.children.length;const f=e.onChange(()=>{var p;const g=((p=e.getBlock(t))==null?void 0:p.children.length)??0;g>h?(s.getAttribute("data-show-children")==="false"&&(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0)),i.contains(c)&&i.removeChild(c)):g===0&&g<h&&(s.getAttribute("data-show-children")==="true"&&(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1)),i.contains(c)&&i.removeChild(c)),h=g});return r.get(t)?(s.setAttribute("data-show-children","true"),e.isEditable&&t.children.length===0&&i.appendChild(c)):s.setAttribute("data-show-children","false"),{dom:i,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===s&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===c||p.removedNodes[0]===c)),destroy:()=>{o.removeEventListener("mousedown",a),o.removeEventListener("click",l),c.removeEventListener("mousedown",u),c.removeEventListener("click",d),f?.()}}},PT=[1,2,3,4,5,6],IL=t=>({editor:e})=>{const n=e.getTextCursorPosition();return e.schema.blockSchema[n.block.type].content!=="inline"?!1:(e.updateBlock(n.block,{type:"heading",props:{level:t}}),!0)},OL=({defaultLevel:t=1,levels:e=PT,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...ye,level:{default:t,values:e},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),ML=jt(OL,({allowToggleHeadings:t=!0}={})=>({meta:{isolating:!1},parse(e){let n;switch(e.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6;break;default:return}return{...Dt(e),level:n}},render(e,n){const r=document.createElement(`h${e.props.level}`);return t?{...RT(e,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(e){const n=document.createElement(`h${e.props.level}`);return Di(e.props,n),{dom:n,contentDOM:n}}}),({levels:t=PT}={})=>[pe({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(t.map(e=>[`Mod-Alt-${e}`,IL(e)])??[]),inputRules:t.map(e=>({find:new RegExp(`^(#{${e}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),BT=(t,e,n,r,i)=>{const{dom:s,destroy:o}=Mp(t,e,n,i),a=s;a.style.position="relative",t.props.url&&t.props.showPreview&&(t.props.previewWidth?a.style.width=`${t.props.previewWidth}px`:a.style.width="fit-content");const l=document.createElement("div");l.className="bn-resize-handle",l.style.left="4px";const c=document.createElement("div");c.className="bn-resize-handle",c.style.right="4px";const u=document.createElement("div");u.style.position="absolute",u.style.height="100%",u.style.width="100%";let d,h=t.props.previewWidth;const f=S=>{var D,I;if(!d){!e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c));return}let A;const v="touches"in S?S.touches[0].clientX:S.clientX;t.props.textAlignment==="center"?d.handleUsed==="left"?A=d.initialWidth+(d.initialClientX-v)*2:A=d.initialWidth+(v-d.initialClientX)*2:d.handleUsed==="left"?A=d.initialWidth+d.initialClientX-v:A=d.initialWidth+v-d.initialClientX,h=Math.min(Math.max(A,64),((I=(D=e.domElement)==null?void 0:D.firstElementChild)==null?void 0:I.clientWidth)||Number.MAX_VALUE),a.style.width=`${h}px`},p=S=>{(!S.target||!a.contains(S.target)||!e.isEditable)&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c)),d&&(d=void 0,a.contains(u)&&a.removeChild(u),e.updateBlock(t,{props:{previewWidth:h}}))},g=()=>{e.isEditable&&(r.appendChild(l),r.appendChild(c))},b=S=>{S.relatedTarget===l||S.relatedTarget===c||d||e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c))},y=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:D}},T=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:D}};return window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",b),l.addEventListener("mousedown",y),l.addEventListener("touchstart",y),c.addEventListener("mousedown",T),c.addEventListener("touchstart",T),{dom:a,destroy:()=>{o?.(),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",b),l.removeEventListener("mousedown",y),l.removeEventListener("touchstart",y),c.removeEventListener("mousedown",T),c.removeEventListener("touchstart",T)}}},O0=t=>{const e=t.src||void 0,n=t.width||void 0,r=t.alt||void 0;return{url:e,previewWidth:n,name:r}},DL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>',vL=(t={})=>({type:"image",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),LL=(t={})=>e=>{if(e.tagName==="IMG"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{...O0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"img");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{...O0(r),backgroundColor:s,caption:i}}},RL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??DL;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("img");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.alt=e.props.name||e.props.caption||"BlockNote image",s.contentEditable="false",s.draggable=!1,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},PL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add image",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("img"),r.src=e.props.url,r.alt=e.props.name||e.props.caption||"BlockNote image",e.props.previewWidth&&(r.width=e.props.previewWidth)):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(r,e.props.caption):hu(r,e.props.caption):{dom:r}},BL=jt(vL,t=>({meta:{fileBlockAccept:["image/*"]},parse:LL(t),render:RL(t),toExternalHTML:PL(t),runsBefore:["file"]})),FL=(t,e,n)=>({state:r,dispatch:i})=>i?FT(r.tr,t,e,n):!0,FT=(t,e,n,r)=>{const i=Rr(t.doc,e),s=Pr(i);if(!s.isBlockContainer)return!1;const o=He(t),a=[{type:s.bnBlock.node.type,attrs:r?{...s.bnBlock.node.attrs,id:void 0}:{}},{type:n?s.blockContent.node.type:o.nodes.paragraph,attrs:r?{...s.blockContent.node.attrs}:{}}];return t.split(e,2,a),!0},fu=(t,e)=>{const{blockInfo:n,selectionEmpty:r}=t.transact(o=>({blockInfo:sa(o),selectionEmpty:o.selection.anchor===o.selection.head}));if(!n.isBlockContainer)return!1;const{bnBlock:i,blockContent:s}=n;return s.node.type.name!==e||!r?!1:s.node.childCount===0?(t.transact(o=>{uu(o,i.beforePos,{type:"paragraph",props:{}})}),!0):s.node.childCount>0?t.transact(o=>(o.deleteSelection(),FT(o,o.selection.from,!0))):!1};function vp(t,e,n){var r,i,s;const o=mn.fromSchema(e),a=t,l=document.createElement("div");l.setAttribute("data-node-type","blockGroup");for(const f of Array.from(a.childNodes))l.appendChild(f.cloneNode(!0));let c=o.parse(l,{topNode:e.nodes.blockGroup.create()});((i=(r=c.firstChild)==null?void 0:r.firstChild)==null?void 0:i.type.name)==="checkListItem"&&(c=c.copy(c.content.cut(c.firstChild.firstChild.nodeSize+2)));const u=(s=c.firstChild)==null?void 0:s.firstChild;if(!(u!=null&&u.isTextblock))return M.from(c);const d=e.nodes[n].create({},u.content),h=c.content.cut(u.nodeSize+2);if(h.size>0){const f=c.copy(h);return d.content.addToEnd(f)}return d.content}const HL=()=>({type:"bulletListItem",propSchema:{...ye},content:"inline"}),UL=jt(HL,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL"))return Dt(t)},parseContent:({el:t,schema:e})=>vp(t,e,"bulletListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"bulletListItem"),"Mod-Shift-8":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"bulletListItem",props:{}}),!0)}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:t}){if(xt(t.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),$L=()=>({type:"checkListItem",propSchema:{...ye,checked:{default:!1,type:"boolean"}},content:"inline"}),zL=jt($L,{meta:{isolating:!1},parse(t){var e;if(t.tagName==="input")return t.closest("[data-content-type]")||t.closest("li")?void 0:t.type==="checkbox"?{checked:t.checked}:void 0;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL")){const r=t.querySelector("input[type=checkbox]")||null;return r===null?void 0:{...Dt(t),checked:r.checked}}},parseContent:({el:t,schema:e})=>vp(t,e,"checkListItem"),render(t,e){const n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=t.props.checked,t.props.checked&&r.setAttribute("checked",""),r.addEventListener("change",()=>{e.updateBlock(t,{props:{checked:!t.props.checked}})});const i=document.createElement("p"),s=document.createElement("div");return s.contentEditable="false",s.appendChild(r),n.appendChild(s),n.appendChild(i),{dom:n,contentDOM:i}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=t.props.checked,t.props.checked&&n.setAttribute("checked","");const r=document.createElement("p");return Di(t.props,e),e.appendChild(n),e.appendChild(r),{dom:e,contentDOM:r}},runsBefore:["bulletListItem"]},[pe({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"checkListItem"),"Mod-Shift-9":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"checkListItem",props:{}}),!0)}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace(){return{type:"checkListItem",props:{checked:!1}}}},{find:/^\s?\[[Xx]\]\s$/,replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function HT(t,e,n,r){let i=t.firstChild.attrs.start||1,s=!0;const o=!!t.firstChild.attrs.start,a=Pr({posBeforeNode:e,node:t});if(!a.isBlockContainer)throw new Error("impossible");const l=n.doc.resolve(a.bnBlock.beforePos).nodeBefore,c=l?r.get(l):void 0;return c!==void 0?(i=c+1,s=!1):l&&Pr({posBeforeNode:a.bnBlock.beforePos-l.nodeSize,node:l}).blockNoteType==="numberedListItem"&&(i=HT(l,a.bnBlock.beforePos-l.nodeSize,n,r).index+1,s=!1),r.set(t,i),{index:i,isFirst:s,hasStart:o}}function M0(t,e){const n=new Map,r=e.decorations.map(t.mapping,t.doc),i=[];t.doc.nodesBetween(0,t.doc.nodeSize-2,(o,a)=>{if(o.type.name==="blockContainer"&&o.firstChild.type.name==="numberedListItem"){const{index:l,isFirst:c,hasStart:u}=HT(o,a,t,n);if(r.find(a,a+o.nodeSize,d=>d.index===l&&d.isFirst===c&&d.hasStart===u).length===0){const d=t.doc.nodeAt(a+1);i.push(Ee.node(a+1,a+1+d.nodeSize,{"data-index":l.toString()}))}}});const s=i.flatMap(o=>r.find(o.from,o.to));return{decorations:r.remove(s).add(t.doc,i)}}const VL=()=>new te({key:new me("numbered-list-indexing-decorations"),state:{init(t,e){return M0(e.tr,{decorations:ce.empty})},apply(t,e){return!t.docChanged&&!t.selectionSet&&e.decorations?e:M0(t,e)}},props:{decorations(t){var e;return((e=this.getState(t))==null?void 0:e.decorations)??ce.empty}}}),jL=()=>({type:"numberedListItem",propSchema:{...ye,start:{default:void 0,type:"number"}},content:"inline"}),qL=jt(jL,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="OL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="OL")){const r=parseInt(n.getAttribute("start")||"1"),i=Dt(t);return t.previousElementSibling||r===1?i:{...i,start:r}}},parseContent:({el:t,schema:e})=>vp(t,e,"numberedListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:t,editor:e}){if(xt(e.prosemirrorState).blockNoteType==="heading")return;const n=parseInt(t[1]);return{type:"numberedListItem",props:{start:n!==1?n:void 0}}}}],keyboardShortcuts:{Enter:({editor:t})=>fu(t,"numberedListItem"),"Mod-Shift-7":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"numberedListItem",props:{}}),!0)}},prosemirrorPlugins:[VL()]})]),WL=()=>({type:"toggleListItem",propSchema:{...ye},content:"inline"}),YL=jt(WL,{meta:{isolating:!1},render(t,e){const n=document.createElement("p");return{...RT(t,e,n),contentDOM:n}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return Di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>fu(t,"toggleListItem"),"Mod-Shift-6":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"toggleListItem",props:{}}),!0)}}})]),KL=()=>({type:"paragraph",propSchema:ye,content:"inline"}),GL=jt(KL,{meta:{isolating:!1},parse:t=>{var e;if(t.tagName==="P"&&(e=t.textContent)!=null&&e.trim())return Dt(t)},render:()=>{const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("p");return Di(t.props,e),{dom:e,contentDOM:e}},runsBefore:["default"]},[pe({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"paragraph",props:{}}),!0)}}})]),QL=()=>({type:"quote",propSchema:{backgroundColor:ye.backgroundColor,textColor:ye.textColor},content:"inline"}),JL=jt(QL,{meta:{isolating:!1},parse(t){if(t.tagName==="BLOCKQUOTE"){const{backgroundColor:e,textColor:n}=Dt(t);return{backgroundColor:e,textColor:n}}},render(){const t=document.createElement("blockquote");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("blockquote");return Di(t.props,e),{dom:e,contentDOM:e}}},[pe({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"quote",props:{}}),!0)}},inputRules:[{find:new RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}}]})]),XL=35,Lp=120,Lj=31,ZL=Le.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[JI({cellMinWidth:XL,defaultCellMinWidth:Lp,View:null}),aO()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.insertContent({type:"hardBreak"}),!0):!1,Backspace:()=>{const t=this.editor.state.selection,e=t.empty,n=t.$head.parentOffset===0,r=t.$head.node().type.name==="tableParagraph";return e&&n&&r},Tab:()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Rg(1)(t,e,n)),"Shift-Tab":()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Rg(-1)(t,e,n))}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Te(Y(t,"tableRole",e))}}}),eR={textColor:ye.textColor},tR=Cn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["th",sn(this.options.HTMLAttributes,t),0]}}),nR=Cn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["td",sn(this.options.HTMLAttributes,t),0]}}),rR=Cn.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){var n,r,i;const s=Yv(this.name,"table",{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e},((r=this.options.domAttributes)==null?void 0:r.inlineContent)||{}),o=document.createElement("colgroup");for(const a of t.children[0].children)if(a.attrs.colwidth)for(const l of a.attrs.colwidth){const c=document.createElement("col");l&&(c.style=`width: ${l}px`),o.appendChild(c)}else o.appendChild(document.createElement("col"));return(i=s.dom.firstChild)==null||i.appendChild(o),s},addNodeView(){return({node:t,HTMLAttributes:e})=>{var n;class r extends tk{constructor(s,o,a){super(s,o),this.node=s,this.cellMinWidth=o,this.blockContentHTMLAttributes=a;const l=document.createElement("div");l.className=Ur("bn-block-content",a.class),l.setAttribute("data-content-type","table");for(const[h,f]of Object.entries(a))h!=="class"&&l.setAttribute(h,f);const c=this.dom,u=document.createElement("div");u.className="tableWrapper-inner",u.appendChild(c.firstChild),c.appendChild(u),l.appendChild(c);const d=document.createElement("div");d.className="table-widgets-container",d.style.position="relative",c.appendChild(d),this.dom=l}ignoreMutation(s){return!s.target.closest(".tableWrapper-inner")||super.ignoreMutation(s)}}return new r(t,Lp,{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e})}}}),iR=Cn.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p",getAttrs:t=>{if(typeof t=="string"||!t.textContent||!t.closest("[data-content-type]"))return!1;const e=t.parentElement;return e===null?!1:e.tagName==="TD"||e.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:t}){return["p",t,0]}}),sR=Cn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",sn(this.options.HTMLAttributes,t),0]}});function UT(t,e){const n=mn.fromSchema(e).parse(t,{topNode:e.nodes.blockGroup.create()}),r=[];return n.content.descendants(i=>{if(i.isInline)return r.push(i),!1}),M.fromArray(r)}const oR=()=>Xv({node:rR,type:"table",content:"table"},eR,[pe({key:"table-extensions",tiptapExtensions:[ZL,iR,tR,nR,sR]}),pe({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:t})=>{if(!(t.prosemirrorState.selection instanceof be))return!1;const e=t.getTextCursorPosition().block,n=e.content;let r=0;for(const s of n.rows)for(const o of s.cells){if("type"in o&&o.content.length>0||!("type"in o)&&o.length>0)return!1;r++}let i=0;return t.prosemirrorState.selection.forEachCell(()=>{i++}),i<r?!1:(t.transact(()=>{(t.getPrevBlock(e)||t.getNextBlock(e))&&t.setTextCursorPosition(e),t.removeBlocks([e])}),!0)}}})]),D0=t=>{const e=t.src||void 0,n=t.width||void 0;return{url:e,previewWidth:n}},aR='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>',lR=t=>({type:"video",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),cR=t=>e=>{if(e.tagName==="VIDEO"){if(e.closest("figure"))return;const{backgroundColor:n}=Dt(e);return{...D0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=du(e,"video");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Dt(e);return{...D0(r),backgroundColor:s,caption:i}}},uR=jt(lR,t=>({meta:{fileBlockAccept:["video/*"]},parse:cR(),render(e,n){const r=document.createElement("div");r.innerHTML=t.icon??aR;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("video");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.controls=!0,s.contentEditable="false",s.draggable=!1,s.width=e.props.previewWidth,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},toExternalHTML(e){if(!e.props.url){const r=document.createElement("p");return r.textContent="Add video",{dom:r}}let n;return e.props.showPreview?(n=document.createElement("video"),n.src=e.props.url,e.props.previewWidth&&(n.width=e.props.previewWidth)):(n=document.createElement("a"),n.href=e.props.url,n.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Dp(n,e.props.caption):hu(n,e.props.caption):{dom:n}},runsBefore:["file"]}));function Ye(t,e,n){if(!(e in t.schema.blockSpecs))return!1;if(!n)return!0;for(const[r,i]of Object.entries(n)){if(!(r in t.schema.blockSpecs[e].config.propSchema))return!1;if(typeof i=="string"){if(t.schema.blockSpecs[e].config.propSchema[r].default!==void 0&&typeof t.schema.blockSpecs[e].config.propSchema[r].default!==i||t.schema.blockSpecs[e].config.propSchema[r].type!==void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i)return!1}else{if(t.schema.blockSpecs[e].config.propSchema[r].default!==i.default||t.schema.blockSpecs[e].config.propSchema[r].default===void 0&&i.default===void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i.type||typeof t.schema.blockSpecs[e].config.propSchema[r].values!=typeof i.values)return!1;if(typeof t.schema.blockSpecs[e].config.propSchema[r].values=="object"&&typeof i.values=="object"){for(const s of i.values)if(!t.schema.blockSpecs[e].config.propSchema[r].values.includes(s))return!1}}}return!0}function Rj(t,e,n,r){return Ye(e,n,r)&&t.type===n}function v0(t){return t instanceof be}const Ua=new Map;function dR(t){if(Ua.has(t))return Ua.get(t);const e=new ds;return t._tiptapEditor.on("transaction",({transaction:n})=>{e.appendMapping(n.mapping)}),t._tiptapEditor.on("destroy",()=>{Ua.delete(t)}),Ua.set(t,e),e}function hR(t,e,n="left"){const r=Ie.getState(t.prosemirrorState);if(!r){const s=dR(t),o=s.maps.length;return()=>s.slice(o).map(e,n==="left"?-1:1)}const i=Jo(e+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{const s=Ie.getState(t.prosemirrorState),o=ci(s.doc,s.binding.type,i,s.binding.mapping);if(o===null)throw new Error("Position not found, cannot track positions");return o+(n==="right"?-1:1)}}const fR=Wc(t=>t.type.name==="blockContainer");class pR{constructor(e,n,r){Kr(this,"state"),Kr(this,"emitUpdate"),Kr(this,"rootEl"),Kr(this,"pluginState"),Kr(this,"handleScroll",()=>{var s,o;if((s=this.state)!=null&&s.show){const a=(o=this.rootEl)==null?void 0:o.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!a)return;this.state.referencePos=a.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),Kr(this,"closeMenu",()=>{this.editor.transact(s=>s.setMeta(ni,null))}),Kr(this,"clearQuery",()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(s=>s.selection.from)}).run()});var i;this.editor=e,this.pluginState=void 0,this.emitUpdate=s=>{var o;if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");n(s,{...this.state,ignoreQueryLength:(o=this.pluginState)==null?void 0:o.ignoreQueryLength})},this.rootEl=r.root,(i=this.rootEl)==null||i.addEventListener("scroll",this.handleScroll,!0)}update(e,n){var r;const i=ni.getState(n),s=ni.getState(e.state),o=i===void 0&&s!==void 0,a=i!==void 0&&s===void 0;if(!o&&!(i!==void 0&&s!==void 0)&&!a)return;if(this.pluginState=a?i:s,a||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}const l=(r=this.rootEl)==null?void 0:r.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&l&&(this.state={show:!0,referencePos:l.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){var e;(e=this.rootEl)==null||e.removeEventListener("scroll",this.handleScroll,!0)}}const ni=new me("SuggestionMenuPlugin"),Rp=pe(({editor:t})=>{const e=[];let n;const r=Mi(void 0);return{key:"suggestionMenu",store:r,addTriggerCharacter:i=>{e.push(i)},removeTriggerCharacter:i=>{e.splice(e.indexOf(i),1)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>{var i;return((i=n?.state)==null?void 0:i.show)||!1},openSuggestionMenu:(i,s)=>{t.headless||(t.focus(),t.transact(o=>{s!=null&&s.deleteTriggerCharacter&&o.insertText(i),o.scrollIntoView().setMeta(ni,{triggerCharacter:i,deleteTriggerCharacter:s?.deleteTriggerCharacter||!1,ignoreQueryLength:s?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new te({key:ni,view:i=>(n=new pR(t,(s,o)=>{r.setState({...o,triggerCharacter:s})},i),n),state:{init(){},apply:(i,s,o,a)=>{if(i.selection.$from.parent.type.spec.code)return s;const l=i.getMeta(ni);if(typeof l=="object"&&l!==null){s&&n?.closeMenu();const u=hR(t,a.selection.from-l.triggerCharacter.length);return{triggerCharacter:l.triggerCharacter,deleteTriggerCharacter:l.deleteTriggerCharacter!==!1,queryStartPos:()=>u()+l.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:l?.ignoreQueryLength}}if(s===void 0)return s;if(a.selection.from!==a.selection.to||l===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||s.triggerCharacter!==void 0&&a.selection.from<s.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(s.queryStartPos())))return;const c={...s};return c.query=a.doc.textBetween(s.queryStartPos(),a.selection.from),c}},props:{handleTextInput(i,s,o,a){if(s===o){const l=i.state.doc;for(const c of e){const u=c.length>1?l.textBetween(s-c.length,s)+a:a;if(c===u)return i.dispatch(i.state.tr.insertText(a)),i.dispatch(i.state.tr.setMeta(ni,{triggerCharacter:u}).scrollIntoView()),!0}}return!1},decorations(i){const s=this.getState(i);if(s===void 0)return null;if(!s.deleteTriggerCharacter){const o=fR(i.selection);if(o)return ce.create(i.doc,[Ee.node(o.pos,o.pos+o.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}return ce.create(i.doc,[Ee.inline(s.queryStartPos()-s.triggerCharacter.length,s.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}}})]}});function mR(t){let e=t.getTextCursorPosition().block,n=t.schema.blockSchema[e.type].content;for(;n==="none";){if(e=t.getTextCursorPosition().nextBlock,e===void 0)return;n=t.schema.blockSchema[e.type].content,t.setTextCursorPosition(e,"end")}}function lt(t,e){const n=t.getTextCursorPosition().block;if(n.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&yi(n.content[0])&&n.content[0].type==="text"&&n.content[0].text==="/"||n.content.length===0)?(r=t.updateBlock(n,e),t.setTextCursorPosition(r)):(r=t.insertBlocks([e],n,"after")[0],t.setTextCursorPosition(t.getTextCursorPosition().nextBlock)),mR(t),r}function Pj(t){const e=[];return Ye(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:n===1?"heading":`heading_${n}`,...t.dictionary.slash_menu[n===1?"heading":`heading_${n}`]})}),Ye(t,"quote")&&e.push({onItemClick:()=>{lt(t,{type:"quote"})},key:"quote",...t.dictionary.slash_menu.quote}),Ye(t,"toggleListItem")&&e.push({onItemClick:()=>{lt(t,{type:"toggleListItem"})},badge:dr("Mod-Shift-6"),key:"toggle_list",...t.dictionary.slash_menu.toggle_list}),Ye(t,"numberedListItem")&&e.push({onItemClick:()=>{lt(t,{type:"numberedListItem"})},badge:dr("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),Ye(t,"bulletListItem")&&e.push({onItemClick:()=>{lt(t,{type:"bulletListItem"})},badge:dr("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),Ye(t,"checkListItem")&&e.push({onItemClick:()=>{lt(t,{type:"checkListItem"})},badge:dr("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),Ye(t,"paragraph")&&e.push({onItemClick:()=>{lt(t,{type:"paragraph"})},badge:dr("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),Ye(t,"codeBlock")&&e.push({onItemClick:()=>{lt(t,{type:"codeBlock"})},badge:dr("Mod-Alt-c"),key:"code_block",...t.dictionary.slash_menu.code_block}),Ye(t,"divider")&&e.push({onItemClick:()=>{lt(t,{type:"divider"})},key:"divider",...t.dictionary.slash_menu.divider}),Ye(t,"table")&&e.push({onItemClick:()=>{lt(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),Ye(t,"image",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"image"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"image",...t.dictionary.slash_menu.image}),Ye(t,"video",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"video"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"video",...t.dictionary.slash_menu.video}),Ye(t,"audio",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"audio"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"audio",...t.dictionary.slash_menu.audio}),Ye(t,"file",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"file"});(n=t.getExtension(Ir))==null||n.showMenu(r.id)},key:"file",...t.dictionary.slash_menu.file}),Ye(t,"heading",{level:"number",isToggleable:"boolean"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n,isToggleable:!0}})},key:n===1?"toggle_heading":`toggle_heading_${n}`,...t.dictionary.slash_menu[n===1?"toggle_heading":`toggle_heading_${n}`]})}),Ye(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:`heading_${n}`,...t.dictionary.slash_menu[`heading_${n}`]})}),e.push({onItemClick:()=>{var n;(n=t.getExtension(Rp))==null||n.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...t.dictionary.slash_menu.emoji}),e}function Bj(t,e){return t.filter(({title:n,aliases:r})=>n.toLowerCase().includes(e.toLowerCase())||r&&r.filter(i=>i.toLowerCase().includes(e.toLowerCase())).length!==0)}const gR={audio:EL(),bulletListItem:UL(),checkListItem:zL(),codeBlock:CL(),divider:wL(),file:_L(),heading:ML(),image:BL(),numberedListItem:qL(),paragraph:GL(),quote:JL(),table:oR(),toggleListItem:YL(),video:uR()},bR=vT({type:"textColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.textColor.default&&(e.style.color=t in Nr?Nr[t].text:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.color)return t.style.color}}),yR=vT({type:"backgroundColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.backgroundColor.default&&(e.style.backgroundColor=t in Nr?Nr[t].background:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.backgroundColor)return t.style.backgroundColor}}),$T={bold:js(Sv,"boolean"),italic:js(vv,"boolean"),underline:js(Hv,"boolean"),strike:js(Bv,"boolean"),code:js(_v,"boolean"),textColor:bR,backgroundColor:yR};DT($T);const zT={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},Fj=OT(zT);var ad,L0;function ER(){return L0||(L0=1,ad=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),ad}var kR=ER();const TR=M1(kR);function CR(t={}){return new te({view(e){return new SR(e,t)}})}class SR{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),g=d?p.bottom:p.top;d&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:p.left,right:p.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=sy(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}var Xl=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<Xl&&this.leafAppend(e)||this.length<Xl&&e.leafPrepend(this)||this.appendInner(e)):this};Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this};Xe.prototype.appendInner=function(e){return new wR(this,e)};Xe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Xe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Xe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new VT(e):Xe.empty};var VT=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xl)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Xe);Xe.empty=new VT([]);var wR=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Xe);const xR=500;class hn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new _n(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new _n(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new hn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new _n(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>_R&&(a=AR(a,c),o-=c),new hn(a.append(s),o)}remapping(e,n){let r=new ds;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new hn(this.items.append(e.map(n=>new _n(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),b=h.selection&&h.selection.map(s.slice(l+1,f));b&&a++,r.push(new _n(p,g,b))}else r.push(new _n(p))},i);let c=[];for(let h=n;h<o;h++)c.push(new _n(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),d=new hn(u,a);return d.emptyItemCount()>xR&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new _n(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new hn(Xe.from(i.reverse()),s)}}hn.empty=new hn(Xe.empty,0);function AR(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class _n{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new _n(n.getMap().invert(),n,this.selection)}}}class yr{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const _R=20;function NR(t,e,n,r){let i=n.getMeta(ui),s;if(i)return i.historyState;n.getMeta(jT)&&(t=new yr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ui))return o.getMeta(ui).redo?new yr(t.done.addTransform(n,void 0,r,fl(e)),t.undone,R0(n.mapping.maps),t.prevTime,t.prevComposition):new yr(t.done,t.undone.addTransform(n,void 0,r,fl(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!IR(n,t.prevRanges)),c=o?ld(t.prevRanges,n.mapping):R0(n.mapping.maps);return new yr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,fl(e)),hn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new yr(t.done.rebased(n,s),t.undone.rebased(n,s),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new yr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ld(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function IR(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function R0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function ld(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function OR(t,e,n){let r=fl(e),i=ui.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new yr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(ui,{redo:n,historyState:l})}let cd=!1,P0=null;function fl(t){let e=t.plugins;if(P0!=e){cd=!1,P0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cd=!0;break}}return cd}function MR(t){return t.setMeta(jT,!0)}const ui=new me("history"),jT=new me("closeHistory");function DR(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new te({key:ui,state:{init(){return new yr(hn.empty,hn.empty,null,0,-1)},apply(e,n,r){return NR(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?WT:r=="historyRedo"?YT:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function qT(t,e){return(n,r)=>{let i=ui.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=OR(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const WT=qT(!1,!0),YT=qT(!0,!0);class pa{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}pa.prototype.normal={};pa.prototype.property={};pa.prototype.space=void 0;function KT(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new pa(n,r,e)}function Xo(t){return t.toLowerCase()}class vt{constructor(e,n){this.attribute=n,this.property=e}}vt.prototype.attribute="";vt.prototype.booleanish=!1;vt.prototype.boolean=!1;vt.prototype.commaOrSpaceSeparated=!1;vt.prototype.commaSeparated=!1;vt.prototype.defined=!1;vt.prototype.mustUseProperty=!1;vt.prototype.number=!1;vt.prototype.overloadedBoolean=!1;vt.prototype.property="";vt.prototype.spaceSeparated=!1;vt.prototype.space=void 0;let vR=0;const Z=vi(),$e=vi(),Lh=vi(),H=vi(),xe=vi(),cs=vi(),Rt=vi();function vi(){return 2**++vR}const Rh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Z,booleanish:$e,commaOrSpaceSeparated:Rt,commaSeparated:cs,number:H,overloadedBoolean:Lh,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),ud=Object.keys(Rh);class Pp extends vt{constructor(e,n,r,i){let s=-1;if(super(e,n),B0(this,"space",i),typeof r=="number")for(;++s<ud.length;){const o=ud[s];B0(this,ud[s],(r&Rh[o])===Rh[o])}}}Pp.prototype.defined=!0;function B0(t,e,n){n&&(t[e]=n)}function Bs(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Pp(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Xo(r)]=r,n[Xo(s.attribute)]=r}return new pa(e,n,t.space)}const GT=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:$e,ariaAutoComplete:null,ariaBusy:$e,ariaChecked:$e,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:$e,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:$e,ariaFlowTo:xe,ariaGrabbed:$e,ariaHasPopup:null,ariaHidden:$e,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:H,ariaLive:null,ariaModal:$e,ariaMultiLine:$e,ariaMultiSelectable:$e,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:$e,ariaReadOnly:$e,ariaRelevant:null,ariaRequired:$e,ariaRoleDescription:xe,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:$e,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function QT(t,e){return e in t?t[e]:e}function JT(t,e){return QT(t,e.toLowerCase())}const LR=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:cs,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:xe,autoFocus:Z,autoPlay:Z,blocking:xe,capture:null,charSet:null,checked:Z,cite:null,className:xe,cols:H,colSpan:null,content:null,contentEditable:$e,controls:Z,controlsList:xe,coords:H|cs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:Lh,draggable:$e,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:xe,height:H,hidden:Lh,high:H,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:xe,itemRef:xe,itemScope:Z,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:H,pattern:null,ping:xe,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:xe,required:Z,reversed:Z,rows:H,rowSpan:H,sandbox:xe,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:$e,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:$e,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:$e,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Z,disableRemotePlayback:Z,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:JT}),RR=Bs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Rt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:xe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:cs,g2:cs,glyphName:cs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Rt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rt,rev:Rt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rt,requiredFeatures:Rt,requiredFonts:Rt,requiredFormats:Rt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Rt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Rt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:QT}),XT=Bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ZT=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:JT}),eC=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),PR=/[A-Z]/g,F0=/-[a-z]/g,BR=/^data[-\w.:]+$/i;function Bp(t,e){const n=Xo(e);let r=e,i=vt;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&BR.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(F0,HR);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!F0.test(s)){let o=s.replace(PR,FR);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Pp}return new i(r,e)}function FR(t){return"-"+t.toLowerCase()}function HR(t){return t.charAt(1).toUpperCase()}const pu=KT([GT,LR,XT,ZT,eC],"html"),ma=KT([GT,RR,XT,ZT,eC],"svg");function H0(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function UR(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U0=/[#.]/g;function $R(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){U0.lastIndex=i;const a=U0.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function $0(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function zR(t){return t.join(" ").trim()}function tC(t,e,n){const r=n?WR(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=$R(s,e);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,VR(o))a.unshift(o);else for(const[d,h]of Object.entries(o))jR(t,l.properties,d,h)}for(const c of a)Ph(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function VR(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function jR(t,e,n,r){const i=Bp(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=$0(r):i.commaSeparated?s=H0(r):i.commaOrSpaceSeparated?s=$0(H0(r).join(" ")):s=z0(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?qR(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(z0(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function Ph(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Ph(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Ph(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function z0(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Xo(n)===Xo(e)))return!0}return n}function qR(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function WR(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const YR=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],nC=tC(pu,"div"),rC=tC(ma,"g",YR);function KR(t){const e=String(t),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=n[o];if(a===void 0){const l=V0(e,n[o-1]);a=l===-1?e.length+1:l+1,n[o]=a}if(a>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const a=n[n.length-1],l=V0(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;n.push(c)}const o=(s.line>1?n[s.line-2]:0)+s.column-1;if(o<n[s.line-1])return o}}}function V0(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
114
114
  `,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const pl={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},iC={}.hasOwnProperty,GR=Object.prototype;function QR(t,e){const n=e||{};return Fp({file:n.file||void 0,location:!1,schema:n.space==="svg"?ma:pu,verbose:n.verbose||!1},t)}function Fp(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},ml(t,r,n),n}case"#document":case"#document-fragment":{const r=e,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:sC(t,e.childNodes),data:{quirksMode:i}},t.file&&t.location){const s=String(t.file),o=KR(s),a=o.toPoint(0),l=o.toPoint(s.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},ml(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},ml(t,r,n),n}default:return n=JR(t,e),n}}function sC(t,e){let n=-1;const r=[];for(;++n<e.length;){const i=Fp(t,e[n]);r.push(i)}return r}function JR(t,e){const n=t.schema;t.schema=e.namespaceURI===pl.svg?ma:pu;let r=-1;const i={};for(;++r<e.attrs.length;){const a=e.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;iC.call(GR,l)||(i[l]=a.value)}const o=(t.schema.space==="svg"?rC:nC)(e.tagName,i,sC(t,e.childNodes));if(ml(t,e,o),o.tagName==="template"){const a=e,l=a.sourceCodeLocation,c=l&&l.startTag&&Ji(l.startTag),u=l&&l.endTag&&Ji(l.endTag),d=Fp(t,a.content);c&&u&&t.file&&(d.position={start:c.end,end:u.start}),o.content=d}return t.schema=n,o}function ml(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=XR(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function XR(t,e,n){const r=Ji(n);if(e.type==="element"){const i=e.children[e.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),t.verbose){const s={};let o;if(n.attrs)for(o in n.attrs)iC.call(n.attrs,o)&&(s[Bp(t.schema,o).property]=Ji(n.attrs[o]));n.startTag;const a=Ji(n.startTag),l=n.endTag?Ji(n.endTag):void 0,c={opening:a};l&&(c.closing=l),c.properties=s,e.data={position:c}}}return r}function Ji(t){const e=j0({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=j0({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function j0(t){return t.line&&t.column?t:void 0}const ZR=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Oe="�";var E;(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(E||(E={}));const St={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function oC(t){return t>=55296&&t<=57343}function e6(t){return t>=56320&&t<=57343}function t6(t,e){return(t-55296)*1024+9216+e}function aC(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function lC(t){return t>=64976&&t<=65007||ZR.has(t)}var O;(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(O||(O={}));const n6=65536;class r6{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=n6,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){const{line:r,col:i,offset:s}=this,o=i+n,a=s+n;return{code:e,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:a,endOffset:a}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(e6(n))return this.pos++,this._addGap(),t6(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,E.EOF;return this._err(O.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const n=this.pos+e;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;const r=this.html.charCodeAt(n);return r===E.CARRIAGE_RETURN?E.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;let e=this.html.charCodeAt(this.pos);return e===E.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,E.LINE_FEED):e===E.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,oC(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===E.LINE_FEED||e===E.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){aC(e)?this._err(O.controlCharacterInInputStream):lC(e)&&this._err(O.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var fe;(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(fe||(fe={}));function cC(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}const i6=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),s6=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function o6(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=s6.get(t))!==null&&e!==void 0?e:t}var Qe;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Qe||(Qe={}));const a6=32;var Or;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Or||(Or={}));function Bh(t){return t>=Qe.ZERO&&t<=Qe.NINE}function l6(t){return t>=Qe.UPPER_A&&t<=Qe.UPPER_F||t>=Qe.LOWER_A&&t<=Qe.LOWER_F}function c6(t){return t>=Qe.UPPER_A&&t<=Qe.UPPER_Z||t>=Qe.LOWER_A&&t<=Qe.LOWER_Z||Bh(t)}function u6(t){return t===Qe.EQUALS||c6(t)}var Ke;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Ke||(Ke={}));var er;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(er||(er={}));class d6{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Ke.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=er.Strict}startEntity(e){this.decodeMode=e,this.state=Ke.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Ke.EntityStart:return e.charCodeAt(n)===Qe.NUM?(this.state=Ke.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Ke.NamedEntity,this.stateNamedEntity(e,n));case Ke.NumericStart:return this.stateNumericStart(e,n);case Ke.NumericDecimal:return this.stateNumericDecimal(e,n);case Ke.NumericHex:return this.stateNumericHex(e,n);case Ke.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|a6)===Qe.LOWER_X?(this.state=Ke.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Ke.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Bh(i)||l6(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Bh(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Qe.SEMI)this.consumed+=1;else if(this.decodeMode===er.Strict)return 0;return this.emitCodePoint(o6(this.result),this.consumed),this.errors&&(e!==Qe.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&Or.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=h6(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===er.Attribute&&(s===0||u6(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&Or.VALUE_LENGTH)>>14,s!==0){if(o===Qe.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==er.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Or.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Or.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Ke.NamedEntity:return this.result!==0&&(this.decodeMode!==er.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ke.NumericDecimal:return this.emitNumericEntity(0,2);case Ke.NumericHex:return this.emitNumericEntity(0,3);case Ke.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ke.EntityStart:return 0}}}function h6(t,e,n,r){const i=(e&Or.BRANCH_LENGTH)>>7,s=e&Or.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,a=o+i-1;for(;o<=a;){const l=o+a>>>1,c=t[l];if(c<r)o=l+1;else if(c>r)a=l-1;else return t[l+i]}return-1}var R;(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(R||(R={}));var di;(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(di||(di={}));var Kt;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(Kt||(Kt={}));var _;(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(_||(_={}));var m;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(m||(m={}));const f6=new Map([[_.A,m.A],[_.ADDRESS,m.ADDRESS],[_.ANNOTATION_XML,m.ANNOTATION_XML],[_.APPLET,m.APPLET],[_.AREA,m.AREA],[_.ARTICLE,m.ARTICLE],[_.ASIDE,m.ASIDE],[_.B,m.B],[_.BASE,m.BASE],[_.BASEFONT,m.BASEFONT],[_.BGSOUND,m.BGSOUND],[_.BIG,m.BIG],[_.BLOCKQUOTE,m.BLOCKQUOTE],[_.BODY,m.BODY],[_.BR,m.BR],[_.BUTTON,m.BUTTON],[_.CAPTION,m.CAPTION],[_.CENTER,m.CENTER],[_.CODE,m.CODE],[_.COL,m.COL],[_.COLGROUP,m.COLGROUP],[_.DD,m.DD],[_.DESC,m.DESC],[_.DETAILS,m.DETAILS],[_.DIALOG,m.DIALOG],[_.DIR,m.DIR],[_.DIV,m.DIV],[_.DL,m.DL],[_.DT,m.DT],[_.EM,m.EM],[_.EMBED,m.EMBED],[_.FIELDSET,m.FIELDSET],[_.FIGCAPTION,m.FIGCAPTION],[_.FIGURE,m.FIGURE],[_.FONT,m.FONT],[_.FOOTER,m.FOOTER],[_.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[_.FORM,m.FORM],[_.FRAME,m.FRAME],[_.FRAMESET,m.FRAMESET],[_.H1,m.H1],[_.H2,m.H2],[_.H3,m.H3],[_.H4,m.H4],[_.H5,m.H5],[_.H6,m.H6],[_.HEAD,m.HEAD],[_.HEADER,m.HEADER],[_.HGROUP,m.HGROUP],[_.HR,m.HR],[_.HTML,m.HTML],[_.I,m.I],[_.IMG,m.IMG],[_.IMAGE,m.IMAGE],[_.INPUT,m.INPUT],[_.IFRAME,m.IFRAME],[_.KEYGEN,m.KEYGEN],[_.LABEL,m.LABEL],[_.LI,m.LI],[_.LINK,m.LINK],[_.LISTING,m.LISTING],[_.MAIN,m.MAIN],[_.MALIGNMARK,m.MALIGNMARK],[_.MARQUEE,m.MARQUEE],[_.MATH,m.MATH],[_.MENU,m.MENU],[_.META,m.META],[_.MGLYPH,m.MGLYPH],[_.MI,m.MI],[_.MO,m.MO],[_.MN,m.MN],[_.MS,m.MS],[_.MTEXT,m.MTEXT],[_.NAV,m.NAV],[_.NOBR,m.NOBR],[_.NOFRAMES,m.NOFRAMES],[_.NOEMBED,m.NOEMBED],[_.NOSCRIPT,m.NOSCRIPT],[_.OBJECT,m.OBJECT],[_.OL,m.OL],[_.OPTGROUP,m.OPTGROUP],[_.OPTION,m.OPTION],[_.P,m.P],[_.PARAM,m.PARAM],[_.PLAINTEXT,m.PLAINTEXT],[_.PRE,m.PRE],[_.RB,m.RB],[_.RP,m.RP],[_.RT,m.RT],[_.RTC,m.RTC],[_.RUBY,m.RUBY],[_.S,m.S],[_.SCRIPT,m.SCRIPT],[_.SEARCH,m.SEARCH],[_.SECTION,m.SECTION],[_.SELECT,m.SELECT],[_.SOURCE,m.SOURCE],[_.SMALL,m.SMALL],[_.SPAN,m.SPAN],[_.STRIKE,m.STRIKE],[_.STRONG,m.STRONG],[_.STYLE,m.STYLE],[_.SUB,m.SUB],[_.SUMMARY,m.SUMMARY],[_.SUP,m.SUP],[_.TABLE,m.TABLE],[_.TBODY,m.TBODY],[_.TEMPLATE,m.TEMPLATE],[_.TEXTAREA,m.TEXTAREA],[_.TFOOT,m.TFOOT],[_.TD,m.TD],[_.TH,m.TH],[_.THEAD,m.THEAD],[_.TITLE,m.TITLE],[_.TR,m.TR],[_.TRACK,m.TRACK],[_.TT,m.TT],[_.U,m.U],[_.UL,m.UL],[_.SVG,m.SVG],[_.VAR,m.VAR],[_.WBR,m.WBR],[_.XMP,m.XMP]]);function mu(t){var e;return(e=f6.get(t))!==null&&e!==void 0?e:m.UNKNOWN}const P=m,p6={[R.HTML]:new Set([P.ADDRESS,P.APPLET,P.AREA,P.ARTICLE,P.ASIDE,P.BASE,P.BASEFONT,P.BGSOUND,P.BLOCKQUOTE,P.BODY,P.BR,P.BUTTON,P.CAPTION,P.CENTER,P.COL,P.COLGROUP,P.DD,P.DETAILS,P.DIR,P.DIV,P.DL,P.DT,P.EMBED,P.FIELDSET,P.FIGCAPTION,P.FIGURE,P.FOOTER,P.FORM,P.FRAME,P.FRAMESET,P.H1,P.H2,P.H3,P.H4,P.H5,P.H6,P.HEAD,P.HEADER,P.HGROUP,P.HR,P.HTML,P.IFRAME,P.IMG,P.INPUT,P.LI,P.LINK,P.LISTING,P.MAIN,P.MARQUEE,P.MENU,P.META,P.NAV,P.NOEMBED,P.NOFRAMES,P.NOSCRIPT,P.OBJECT,P.OL,P.P,P.PARAM,P.PLAINTEXT,P.PRE,P.SCRIPT,P.SECTION,P.SELECT,P.SOURCE,P.STYLE,P.SUMMARY,P.TABLE,P.TBODY,P.TD,P.TEMPLATE,P.TEXTAREA,P.TFOOT,P.TH,P.THEAD,P.TITLE,P.TR,P.TRACK,P.UL,P.WBR,P.XMP]),[R.MATHML]:new Set([P.MI,P.MO,P.MN,P.MS,P.MTEXT,P.ANNOTATION_XML]),[R.SVG]:new Set([P.TITLE,P.FOREIGN_OBJECT,P.DESC]),[R.XLINK]:new Set,[R.XML]:new Set,[R.XMLNS]:new Set},Fh=new Set([P.H1,P.H2,P.H3,P.H4,P.H5,P.H6]);_.STYLE,_.SCRIPT,_.XMP,_.IFRAME,_.NOEMBED,_.NOFRAMES,_.PLAINTEXT;var k;(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(k||(k={}));const It={DATA:k.DATA,RCDATA:k.RCDATA,RAWTEXT:k.RAWTEXT,SCRIPT_DATA:k.SCRIPT_DATA,PLAINTEXT:k.PLAINTEXT,CDATA_SECTION:k.CDATA_SECTION};function m6(t){return t>=E.DIGIT_0&&t<=E.DIGIT_9}function to(t){return t>=E.LATIN_CAPITAL_A&&t<=E.LATIN_CAPITAL_Z}function g6(t){return t>=E.LATIN_SMALL_A&&t<=E.LATIN_SMALL_Z}function mr(t){return g6(t)||to(t)}function q0(t){return mr(t)||m6(t)}function $a(t){return t+32}function uC(t){return t===E.SPACE||t===E.LINE_FEED||t===E.TABULATION||t===E.FORM_FEED}function W0(t){return uC(t)||t===E.SOLIDUS||t===E.GREATER_THAN_SIGN}function b6(t){return t===E.NULL?O.nullCharacterReference:t>1114111?O.characterReferenceOutsideUnicodeRange:oC(t)?O.surrogateCharacterReference:lC(t)?O.noncharacterCharacterReference:aC(t)||t===E.CARRIAGE_RETURN?O.controlCharacterReference:null}class y6{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=k.DATA,this.returnState=k.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new r6(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new d6(i6,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(O.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(O.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=b6(r);i&&this._err(i,1)}}:void 0)}_err(e,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(e,n))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n<e;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,n){return this.preprocessor.startsWith(e,n)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:fe.START_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:fe.END_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:fe.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:fe.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,n){this.currentCharacterToken={type:e,chars:n,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,n;const r=this.currentToken;if(cC(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(O.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=mu(e.tagName),e.type===fe.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(O.endTagWithAttributes),e.selfClosing&&this._err(O.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case fe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case fe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case fe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:fe.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){const n=uC(e)?fe.WHITESPACE_CHARACTER:e===E.NULL?fe.NULL_CHARACTER:fe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(fe.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=k.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?er.Attribute:er.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===k.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case k.DATA:{this._stateData(e);break}case k.RCDATA:{this._stateRcdata(e);break}case k.RAWTEXT:{this._stateRawtext(e);break}case k.SCRIPT_DATA:{this._stateScriptData(e);break}case k.PLAINTEXT:{this._statePlaintext(e);break}case k.TAG_OPEN:{this._stateTagOpen(e);break}case k.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case k.TAG_NAME:{this._stateTagName(e);break}case k.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case k.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case k.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case k.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case k.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case k.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case k.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case k.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case k.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case k.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case k.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case k.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case k.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case k.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case k.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case k.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case k.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case k.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case k.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case k.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case k.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case k.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case k.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case k.BOGUS_COMMENT:{this._stateBogusComment(e);break}case k.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case k.COMMENT_START:{this._stateCommentStart(e);break}case k.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case k.COMMENT:{this._stateComment(e);break}case k.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case k.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case k.COMMENT_END:{this._stateCommentEnd(e);break}case k.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case k.DOCTYPE:{this._stateDoctype(e);break}case k.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case k.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case k.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case k.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case k.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case k.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case k.CDATA_SECTION:{this._stateCdataSection(e);break}case k.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case k.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case k.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case k.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.TAG_OPEN;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitCodePoint(e);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case E.AMPERSAND:{this._startCharacterReference();break}case E.LESS_THAN_SIGN:{this.state=k.RCDATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.RAWTEXT_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(mr(e))this._createStartTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.EXCLAMATION_MARK:{this.state=k.MARKUP_DECLARATION_OPEN;break}case E.SOLIDUS:{this.state=k.END_TAG_OPEN;break}case E.QUESTION_MARK:{this._err(O.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e);break}case E.EOF:{this._err(O.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(O.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=k.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(mr(e))this._createEndTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.GREATER_THAN_SIGN:{this._err(O.missingEndTagName),this.state=k.DATA;break}case E.EOF:{this._err(O.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(O.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.tagName+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(to(e)?$a(e):e)}}_stateRcdataLessThanSign(e){e===E.SOLIDUS?this.state=k.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){mr(e)?(this.state=k.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=k.BEFORE_ATTRIBUTE_NAME,!1;case E.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=k.SELF_CLOSING_START_TAG,!1;case E.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=k.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===E.SOLIDUS?this.state=k.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){mr(e)?(this.state=k.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case E.SOLIDUS:{this.state=k.SCRIPT_DATA_END_TAG_OPEN;break}case E.EXCLAMATION_MARK:{this.state=k.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=k.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){mr(e)?(this.state=k.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===E.SOLIDUS?this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:mr(e)?(this._emitChars("<"),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){mr(e)?(this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(St.SCRIPT,!1)&&W0(this.preprocessor.peek(St.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<St.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===E.SOLIDUS?(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(St.SCRIPT,!1)&&W0(this.preprocessor.peek(St.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<St.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._err(O.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=k.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this._leaveAttrName(),this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._leaveAttrName(),this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:{this._err(O.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.name+=Oe;break}default:this.currentAttr.name+=String.fromCodePoint(to(e)?$a(e):e)}}_stateAfterAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.EQUALS_SIGN:{this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{this.state=k.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this.state=k.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingAttributeValue),this.state=k.DATA,this.emitCurrentTagToken();break}default:this.state=k.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case E.APOSTROPHE:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:case E.EQUALS_SIGN:case E.GRAVE_ACCENT:{this._err(O.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this._leaveAttrValue(),this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._err(O.missingWhitespaceBetweenAttributes),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case E.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._err(O.unexpectedSolidusInTag),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.data+=Oe;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(St.DASH_DASH,!0)?(this._createCommentToken(St.DASH_DASH.length+1),this.state=k.COMMENT_START):this._consumeSequenceIfMatch(St.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(St.DOCTYPE.length+1),this.state=k.DOCTYPE):this._consumeSequenceIfMatch(St.CDATA_START,!0)?this.inForeignNode?this.state=k.CDATA_SECTION:(this._err(O.cdataInHtmlContent),this._createCommentToken(St.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=k.BOGUS_COMMENT):this._ensureHibernation()||(this._err(O.incorrectlyOpenedComment),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_START_DASH;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptClosingOfEmptyComment),this.state=k.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptClosingOfEmptyComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END_DASH;break}case E.LESS_THAN_SIGN:{n.data+="<",this.state=k.COMMENT_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.data+=Oe;break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case E.EXCLAMATION_MARK:{n.data+="!",this.state=k.COMMENT_LESS_THAN_SIGN_BANG;break}case E.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=k.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=k.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==E.GREATER_THAN_SIGN&&e!==E.EOF&&this._err(O.nestedComment),this.state=k.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EXCLAMATION_MARK:{this.state=k.COMMENT_END_BANG;break}case E.HYPHEN_MINUS:{n.data+="-";break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{n.data+="--!",this.state=k.COMMENT_END_DASH;break}case E.GREATER_THAN_SIGN:{this._err(O.incorrectlyClosedComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=k.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case E.EOF:{this._err(O.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingWhitespaceBeforeDoctypeName),this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(to(e))this._createDoctypeToken(String.fromCharCode($a(e))),this.state=k.DOCTYPE_NAME;else switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.NULL:{this._err(O.unexpectedNullCharacter),this._createDoctypeToken(Oe),this.state=k.DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=k.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.AFTER_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.name+=Oe;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(to(e)?$a(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(St.PUBLIC,!1)?this.state=k.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(St.SYSTEM,!1)?this.state=k.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(O.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.publicId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.publicId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.systemId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.systemId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.NULL:{this._err(O.unexpectedNullCharacter);break}case E.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case E.RIGHT_SQUARE_BRACKET:{this.state=k.CDATA_SECTION_BRACKET;break}case E.EOF:{this._err(O.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===E.RIGHT_SQUARE_BRACKET?this.state=k.CDATA_SECTION_END:(this._emitChars("]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA;break}case E.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(E.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&q0(this.preprocessor.peek(1))?k.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){q0(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===E.SEMICOLON&&this._err(O.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const dC=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),Y0=new Set([...dC,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),Zl=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),E6=new Set([...Zl,m.OL,m.UL]),k6=new Set([...Zl,m.BUTTON]),K0=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),G0=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),T6=new Set([m.TR,m.TEMPLATE,m.HTML]),C6=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),S6=new Set([m.TABLE,m.TEMPLATE,m.HTML]),w6=new Set([m.TD,m.TH]);class x6{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=m.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===m.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===R.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){const r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){const i=this._indexOf(e)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==R.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(e){for(;this.stackTop>=e;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<e)}}popUntilElementPopped(e){const n=this._indexOf(e);this.shortenToLength(Math.max(n,0))}popUntilPopped(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Fh,R.HTML)}popUntilTableCellPopped(){this.popUntilPopped(w6,R.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,n){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(S6,R.HTML)}clearBackToTableBodyContext(){this.clearBackTo(C6,R.HTML)}clearBackToTableRowContext(){this.clearBackTo(T6,R.HTML)}remove(e){const n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===m.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===m.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case R.HTML:{if(i===e)return!0;if(n.has(i))return!1;break}case R.SVG:{if(G0.has(i))return!1;break}case R.MATHML:{if(K0.has(i))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Zl)}hasInListItemScope(e){return this.hasInDynamicScope(e,E6)}hasInButtonScope(e){return this.hasInDynamicScope(e,k6)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case R.HTML:{if(Fh.has(n))return!0;if(Zl.has(n))return!1;break}case R.SVG:{if(G0.has(n))return!1;break}case R.MATHML:{if(K0.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===R.HTML)switch(this.tagIDs[e]){case m.TBODY:case m.THEAD:case m.TFOOT:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case m.OPTION:case m.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&dC.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Y0.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Y0.has(this.currentTagId);)this.pop()}}const dd=3;var Mn;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(Mn||(Mn={}));const Q0={type:Mn.Marker};class A6{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(e),o=this.treeAdapter.getNamespaceURI(e);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===Mn.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===s&&this.treeAdapter.getNamespaceURI(c)===o){const u=this.treeAdapter.getAttrList(c);u.length===i&&r.push({idx:a,attrs:u})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<dd)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<dd)return;const i=new Map(n.map(o=>[o.name,o.value]));let s=0;for(let o=0;o<r.length;o++){const a=r[o];a.attrs.every(l=>i.get(l.name)===l.value)&&(s+=1,s>=dd&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(Q0)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:Mn.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Mn.Element,element:e,token:n})}removeEntry(e){const n=this.entries.indexOf(e);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const e=this.entries.indexOf(Q0);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===Mn.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===Mn.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===Mn.Element&&n.element===e)}}const gr={createDocument(){return{nodeName:"#document",mode:Kt.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){const i=t.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=e,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};gr.appendChild(t,s)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(gr.isTextNode(n)){n.value+=e;return}}gr.appendChild(t,gr.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&gr.isTextNode(r)?r.value+=e:gr.insertBefore(t,gr.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild(t){return t.childNodes[0]},getChildNodes(t){return t.childNodes},getParentNode(t){return t.parentNode},getAttrList(t){return t.attrs},getTagName(t){return t.tagName},getNamespaceURI(t){return t.namespaceURI},getTextNodeContent(t){return t.value},getCommentNodeContent(t){return t.data},getDocumentTypeNodeName(t){return t.name},getDocumentTypeNodePublicId(t){return t.publicId},getDocumentTypeNodeSystemId(t){return t.systemId},isTextNode(t){return t.nodeName==="#text"},isCommentNode(t){return t.nodeName==="#comment"},isDocumentTypeNode(t){return t.nodeName==="#documentType"},isElementNode(t){return Object.prototype.hasOwnProperty.call(t,"tagName")},setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation(t){return t.sourceCodeLocation},updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},hC="html",_6="about:legacy-compat",N6="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",fC=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],I6=[...fC,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],O6=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),pC=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],M6=[...pC,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function J0(t,e){return e.some(n=>t.startsWith(n))}function D6(t){return t.name===hC&&t.publicId===null&&(t.systemId===null||t.systemId===_6)}function v6(t){if(t.name!==hC)return Kt.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===N6)return Kt.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),O6.has(n))return Kt.QUIRKS;let r=e===null?I6:fC;if(J0(n,r))return Kt.QUIRKS;if(r=e===null?pC:M6,J0(n,r))return Kt.LIMITED_QUIRKS}return Kt.NO_QUIRKS}const X0={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},L6="definitionurl",R6="definitionURL",P6=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),B6=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:R.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:R.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:R.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:R.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:R.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:R.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:R.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:R.XML}],["xml:space",{prefix:"xml",name:"space",namespace:R.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:R.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:R.XMLNS}]]),F6=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),H6=new Set([m.B,m.BIG,m.BLOCKQUOTE,m.BODY,m.BR,m.CENTER,m.CODE,m.DD,m.DIV,m.DL,m.DT,m.EM,m.EMBED,m.H1,m.H2,m.H3,m.H4,m.H5,m.H6,m.HEAD,m.HR,m.I,m.IMG,m.LI,m.LISTING,m.MENU,m.META,m.NOBR,m.OL,m.P,m.PRE,m.RUBY,m.S,m.SMALL,m.SPAN,m.STRONG,m.STRIKE,m.SUB,m.SUP,m.TABLE,m.TT,m.U,m.UL,m.VAR]);function U6(t){const e=t.tagID;return e===m.FONT&&t.attrs.some(({name:r})=>r===di.COLOR||r===di.SIZE||r===di.FACE)||H6.has(e)}function mC(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===L6){t.attrs[e].name=R6;break}}function gC(t){for(let e=0;e<t.attrs.length;e++){const n=P6.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function Hp(t){for(let e=0;e<t.attrs.length;e++){const n=B6.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function $6(t){const e=F6.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=mu(t.tagName))}function z6(t,e){return e===R.MATHML&&(t===m.MI||t===m.MO||t===m.MN||t===m.MS||t===m.MTEXT)}function V6(t,e,n){if(e===R.MATHML&&t===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===di.ENCODING){const i=n[r].value.toLowerCase();return i===X0.TEXT_HTML||i===X0.APPLICATION_XML}}return e===R.SVG&&(t===m.FOREIGN_OBJECT||t===m.DESC||t===m.TITLE)}function j6(t,e,n,r){return(!r||r===R.HTML)&&V6(t,e,n)||(!r||r===R.MATHML)&&z6(t,e)}const q6="hidden",W6=8,Y6=3;var C;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(C||(C={}));const K6={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},bC=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),Z0={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:gr,onParseError:null};class yC{constructor(e,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=C.INITIAL,this.originalInsertionMode=C.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Z0,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new y6(this.options,this),this.activeFormattingElements=new A6(this.treeAdapter),this.fragmentContextID=r?mu(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new x6(this.document,this.treeAdapter,this)}static parse(e,n){const r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){const r={...Z0,...n};e??(e=r.treeAdapter.createElement(_.TEMPLATE,R.HTML,[]));const i=r.treeAdapter.createElement("documentmock",R.HTML,[]),s=new this(r,i,e);return s.fragmentContextID===m.TEMPLATE&&s.tmplInsertionModeStack.unshift(C.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var i;if(!this.onParseError)return;const s=(i=e.location)!==null&&i!==void 0?i:K6,o={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(o)}onItemPush(e,n,r){var i,s;(s=(i=this.treeAdapter).onItemPush)===null||s===void 0||s.call(i,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,e,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===R.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,R.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=C.TEXT}switchToPlaintextParsing(){this.insertionMode=C.TEXT,this.originalInsertionMode=C.IN_BODY,this.tokenizer.state=It.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===_.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==R.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=It.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=It.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=It.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=It.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",i=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),e.location){const o=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));o&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,e)}}_appendElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){const r=this.treeAdapter.createElement(e,R.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,R.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(_.HTML,R.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,m.HTML)}_appendCommentNode(e,n){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;const i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,o=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:l,endCol:c,endOffset:u}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:l,endCol:c,endOffset:u})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(e),s=n.type===fe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,s)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===m.SVG&&this.treeAdapter.getTagName(n)===_.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===R.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===m.MGLYPH||e.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,R.HTML)}_processToken(e){switch(e.type){case fe.CHARACTER:{this.onCharacter(e);break}case fe.NULL_CHARACTER:{this.onNullCharacter(e);break}case fe.COMMENT:{this.onComment(e);break}case fe.DOCTYPE:{this.onDoctype(e);break}case fe.START_TAG:{this._processStartTag(e);break}case fe.END_TAG:{this.onEndTag(e);break}case fe.EOF:{this.onEof(e);break}case fe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return j6(e,i,s,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Mn.Marker||this.openElements.contains(i.element)),r=n===-1?e-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=C.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(m.P),this.openElements.popUntilTagNamePopped(m.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case m.TR:{this.insertionMode=C.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=C.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=C.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=C.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=C.IN_TABLE;return}case m.BODY:{this.insertionMode=C.IN_BODY;return}case m.FRAMESET:{this.insertionMode=C.IN_FRAMESET;return}case m.SELECT:{this._resetInsertionModeForSelect(e);return}case m.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case m.HTML:{this.insertionMode=this.headElement?C.AFTER_HEAD:C.BEFORE_HEAD;return}case m.TD:case m.TH:{if(e>0){this.insertionMode=C.IN_CELL;return}break}case m.HEAD:{if(e>0){this.insertionMode=C.IN_HEAD;return}break}}this.insertionMode=C.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===m.TEMPLATE)break;if(r===m.TABLE){this.insertionMode=C.IN_SELECT_IN_TABLE;return}}this.insertionMode=C.IN_SELECT}_isElementCausesFosterParenting(e){return bC.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case m.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===R.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case m.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){const r=this.treeAdapter.getNamespaceURI(e);return p6[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){w4(this,e);return}switch(this.insertionMode){case C.INITIAL:{qs(this,e);break}case C.BEFORE_HTML:{ho(this,e);break}case C.BEFORE_HEAD:{fo(this,e);break}case C.IN_HEAD:{po(this,e);break}case C.IN_HEAD_NO_SCRIPT:{mo(this,e);break}case C.AFTER_HEAD:{go(this,e);break}case C.IN_BODY:case C.IN_CAPTION:case C.IN_CELL:case C.IN_TEMPLATE:{kC(this,e);break}case C.TEXT:case C.IN_SELECT:case C.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case C.IN_TABLE:case C.IN_TABLE_BODY:case C.IN_ROW:{hd(this,e);break}case C.IN_TABLE_TEXT:{AC(this,e);break}case C.IN_COLUMN_GROUP:{ec(this,e);break}case C.AFTER_BODY:{tc(this,e);break}case C.AFTER_AFTER_BODY:{gl(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){S4(this,e);return}switch(this.insertionMode){case C.INITIAL:{qs(this,e);break}case C.BEFORE_HTML:{ho(this,e);break}case C.BEFORE_HEAD:{fo(this,e);break}case C.IN_HEAD:{po(this,e);break}case C.IN_HEAD_NO_SCRIPT:{mo(this,e);break}case C.AFTER_HEAD:{go(this,e);break}case C.TEXT:{this._insertCharacters(e);break}case C.IN_TABLE:case C.IN_TABLE_BODY:case C.IN_ROW:{hd(this,e);break}case C.IN_COLUMN_GROUP:{ec(this,e);break}case C.AFTER_BODY:{tc(this,e);break}case C.AFTER_AFTER_BODY:{gl(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Hh(this,e);return}switch(this.insertionMode){case C.INITIAL:case C.BEFORE_HTML:case C.BEFORE_HEAD:case C.IN_HEAD:case C.IN_HEAD_NO_SCRIPT:case C.AFTER_HEAD:case C.IN_BODY:case C.IN_TABLE:case C.IN_CAPTION:case C.IN_COLUMN_GROUP:case C.IN_TABLE_BODY:case C.IN_ROW:case C.IN_CELL:case C.IN_SELECT:case C.IN_SELECT_IN_TABLE:case C.IN_TEMPLATE:case C.IN_FRAMESET:case C.AFTER_FRAMESET:{Hh(this,e);break}case C.IN_TABLE_TEXT:{Ws(this,e);break}case C.AFTER_BODY:{tP(this,e);break}case C.AFTER_AFTER_BODY:case C.AFTER_AFTER_FRAMESET:{nP(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case C.INITIAL:{rP(this,e);break}case C.BEFORE_HEAD:case C.IN_HEAD:case C.IN_HEAD_NO_SCRIPT:case C.AFTER_HEAD:{this._err(e,O.misplacedDoctype);break}case C.IN_TABLE_TEXT:{Ws(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,O.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?x4(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case C.INITIAL:{qs(this,e);break}case C.BEFORE_HTML:{iP(this,e);break}case C.BEFORE_HEAD:{oP(this,e);break}case C.IN_HEAD:{wn(this,e);break}case C.IN_HEAD_NO_SCRIPT:{cP(this,e);break}case C.AFTER_HEAD:{dP(this,e);break}case C.IN_BODY:{mt(this,e);break}case C.IN_TABLE:{xs(this,e);break}case C.IN_TABLE_TEXT:{Ws(this,e);break}case C.IN_CAPTION:{a4(this,e);break}case C.IN_COLUMN_GROUP:{zp(this,e);break}case C.IN_TABLE_BODY:{yu(this,e);break}case C.IN_ROW:{Eu(this,e);break}case C.IN_CELL:{u4(this,e);break}case C.IN_SELECT:{IC(this,e);break}case C.IN_SELECT_IN_TABLE:{h4(this,e);break}case C.IN_TEMPLATE:{p4(this,e);break}case C.AFTER_BODY:{g4(this,e);break}case C.IN_FRAMESET:{b4(this,e);break}case C.AFTER_FRAMESET:{E4(this,e);break}case C.AFTER_AFTER_BODY:{T4(this,e);break}case C.AFTER_AFTER_FRAMESET:{C4(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?A4(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case C.INITIAL:{qs(this,e);break}case C.BEFORE_HTML:{sP(this,e);break}case C.BEFORE_HEAD:{aP(this,e);break}case C.IN_HEAD:{lP(this,e);break}case C.IN_HEAD_NO_SCRIPT:{uP(this,e);break}case C.AFTER_HEAD:{hP(this,e);break}case C.IN_BODY:{bu(this,e);break}case C.TEXT:{JP(this,e);break}case C.IN_TABLE:{Zo(this,e);break}case C.IN_TABLE_TEXT:{Ws(this,e);break}case C.IN_CAPTION:{l4(this,e);break}case C.IN_COLUMN_GROUP:{c4(this,e);break}case C.IN_TABLE_BODY:{Uh(this,e);break}case C.IN_ROW:{NC(this,e);break}case C.IN_CELL:{d4(this,e);break}case C.IN_SELECT:{OC(this,e);break}case C.IN_SELECT_IN_TABLE:{f4(this,e);break}case C.IN_TEMPLATE:{m4(this,e);break}case C.AFTER_BODY:{DC(this,e);break}case C.IN_FRAMESET:{y4(this,e);break}case C.AFTER_FRAMESET:{k4(this,e);break}case C.AFTER_AFTER_BODY:{gl(this,e);break}}}onEof(e){switch(this.insertionMode){case C.INITIAL:{qs(this,e);break}case C.BEFORE_HTML:{ho(this,e);break}case C.BEFORE_HEAD:{fo(this,e);break}case C.IN_HEAD:{po(this,e);break}case C.IN_HEAD_NO_SCRIPT:{mo(this,e);break}case C.AFTER_HEAD:{go(this,e);break}case C.IN_BODY:case C.IN_TABLE:case C.IN_CAPTION:case C.IN_COLUMN_GROUP:case C.IN_TABLE_BODY:case C.IN_ROW:case C.IN_CELL:case C.IN_SELECT:case C.IN_SELECT_IN_TABLE:{wC(this,e);break}case C.TEXT:{XP(this,e);break}case C.IN_TABLE_TEXT:{Ws(this,e);break}case C.IN_TEMPLATE:{MC(this,e);break}case C.AFTER_BODY:case C.IN_FRAMESET:case C.AFTER_FRAMESET:case C.AFTER_AFTER_BODY:case C.AFTER_AFTER_FRAMESET:{$p(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===E.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case C.IN_HEAD:case C.IN_HEAD_NO_SCRIPT:case C.AFTER_HEAD:case C.TEXT:case C.IN_COLUMN_GROUP:case C.IN_SELECT:case C.IN_SELECT_IN_TABLE:case C.IN_FRAMESET:case C.AFTER_FRAMESET:{this._insertCharacters(e);break}case C.IN_BODY:case C.IN_CAPTION:case C.IN_CELL:case C.IN_TEMPLATE:case C.AFTER_BODY:case C.AFTER_AFTER_BODY:case C.AFTER_AFTER_FRAMESET:{EC(this,e);break}case C.IN_TABLE:case C.IN_TABLE_BODY:case C.IN_ROW:{hd(this,e);break}case C.IN_TABLE_TEXT:{xC(this,e);break}}}}function G6(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):SC(t,e),n}function Q6(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function J6(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let s=0,o=i;o!==n;s++,o=i){i=t.openElements.getCommonAncestor(o);const a=t.activeFormattingElements.getElementEntry(o),l=a&&s>=Y6;!a||l?(l&&t.activeFormattingElements.removeEntry(a),t.openElements.remove(o)):(o=X6(t,a),r===e&&(t.activeFormattingElements.bookmark=a),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(o,r),r=o)}return r}function X6(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function Z6(t,e,n){const r=t.treeAdapter.getTagName(e),i=mu(r);if(t._isElementCausesFosterParenting(i))t._fosterParentElement(n);else{const s=t.treeAdapter.getNamespaceURI(e);i===m.TEMPLATE&&s===R.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function eP(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,s),t.treeAdapter.appendChild(e,s),t.activeFormattingElements.insertElementAfterBookmark(s,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,s,i.tagID)}function Up(t,e){for(let n=0;n<W6;n++){const r=G6(t,e);if(!r)break;const i=Q6(t,r);if(!i)break;t.activeFormattingElements.bookmark=r;const s=J6(t,i,r.element),o=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(s),o&&Z6(t,o,s),eP(t,i,r)}}function Hh(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function tP(t,e){t._appendCommentNode(e,t.openElements.items[0])}function nP(t,e){t._appendCommentNode(e,t.document)}function $p(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const r=t.openElements.items[0],i=t.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const s=t.openElements.items[1],o=t.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&t._setEndLocation(s,e)}}}}function rP(t,e){t._setDocumentType(e);const n=e.forceQuirks?Kt.QUIRKS:v6(e);D6(e)||t._err(e,O.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=C.BEFORE_HTML}function qs(t,e){t._err(e,O.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,Kt.QUIRKS),t.insertionMode=C.BEFORE_HTML,t._processToken(e)}function iP(t,e){e.tagID===m.HTML?(t._insertElement(e,R.HTML),t.insertionMode=C.BEFORE_HEAD):ho(t,e)}function sP(t,e){const n=e.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&ho(t,e)}function ho(t,e){t._insertFakeRootElement(),t.insertionMode=C.BEFORE_HEAD,t._processToken(e)}function oP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.HEAD:{t._insertElement(e,R.HTML),t.headElement=t.openElements.current,t.insertionMode=C.IN_HEAD;break}default:fo(t,e)}}function aP(t,e){const n=e.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?fo(t,e):t._err(e,O.endTagWithoutMatchingOpenElement)}function fo(t,e){t._insertFakeElement(_.HEAD,m.HEAD),t.headElement=t.openElements.current,t.insertionMode=C.IN_HEAD,t._processToken(e)}function wn(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.TITLE:{t._switchToTextParsing(e,It.RCDATA);break}case m.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,It.RAWTEXT):(t._insertElement(e,R.HTML),t.insertionMode=C.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{t._switchToTextParsing(e,It.RAWTEXT);break}case m.SCRIPT:{t._switchToTextParsing(e,It.SCRIPT_DATA);break}case m.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=C.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(C.IN_TEMPLATE);break}case m.HEAD:{t._err(e,O.misplacedStartTagForHeadElement);break}default:po(t,e)}}function lP(t,e){switch(e.tagID){case m.HEAD:{t.openElements.pop(),t.insertionMode=C.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{po(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function Li(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==m.TEMPLATE&&t._err(e,O.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,O.endTagWithoutMatchingOpenElement)}function po(t,e){t.openElements.pop(),t.insertionMode=C.AFTER_HEAD,t._processToken(e)}function cP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{wn(t,e);break}case m.NOSCRIPT:{t._err(e,O.nestedNoscriptInHead);break}default:mo(t,e)}}function uP(t,e){switch(e.tagID){case m.NOSCRIPT:{t.openElements.pop(),t.insertionMode=C.IN_HEAD;break}case m.BR:{mo(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function mo(t,e){const n=e.type===fe.EOF?O.openElementsLeftAfterEof:O.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=C.IN_HEAD,t._processToken(e)}function dP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BODY:{t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=C.IN_BODY;break}case m.FRAMESET:{t._insertElement(e,R.HTML),t.insertionMode=C.IN_FRAMESET;break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{t._err(e,O.abandonedHeadElementChild),t.openElements.push(t.headElement,m.HEAD),wn(t,e),t.openElements.remove(t.headElement);break}case m.HEAD:{t._err(e,O.misplacedStartTagForHeadElement);break}default:go(t,e)}}function hP(t,e){switch(e.tagID){case m.BODY:case m.HTML:case m.BR:{go(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function go(t,e){t._insertFakeElement(_.BODY,m.BODY),t.insertionMode=C.IN_BODY,gu(t,e)}function gu(t,e){switch(e.type){case fe.CHARACTER:{kC(t,e);break}case fe.WHITESPACE_CHARACTER:{EC(t,e);break}case fe.COMMENT:{Hh(t,e);break}case fe.START_TAG:{mt(t,e);break}case fe.END_TAG:{bu(t,e);break}case fe.EOF:{wC(t,e);break}}}function EC(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function kC(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function fP(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function pP(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function mP(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_FRAMESET)}function gP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function bP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&Fh.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,R.HTML)}function yP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function EP(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),n||(t.formElement=t.openElements.current))}function kP(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const i=t.openElements.tagIDs[r];if(n===m.LI&&i===m.LI||(n===m.DD||n===m.DT)&&(i===m.DD||i===m.DT)){t.openElements.generateImpliedEndTagsWithExclusion(i),t.openElements.popUntilTagNamePopped(i);break}if(i!==m.ADDRESS&&i!==m.DIV&&i!==m.P&&t._isSpecialElement(t.openElements.items[r],i))break}t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function TP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.tokenizer.state=It.PLAINTEXT}function CP(t,e){t.openElements.hasInScope(m.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1}function SP(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(_.A);n&&(Up(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function wP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function xP(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(m.NOBR)&&(Up(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function AP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function _P(t,e){t.treeAdapter.getDocumentMode(t.document)!==Kt.QUIRKS&&t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=C.IN_TABLE}function TC(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function CC(t){const e=cC(t,di.TYPE);return e!=null&&e.toLowerCase()===q6}function NP(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),CC(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function IP(t,e){t._appendElement(e,R.HTML),e.ackSelfClosing=!0}function OP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function MP(t,e){e.tagName=_.IMG,e.tagID=m.IMG,TC(t,e)}function DP(t,e){t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.tokenizer.state=It.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=C.TEXT}function vP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,It.RAWTEXT)}function LP(t,e){t.framesetOk=!1,t._switchToTextParsing(e,It.RAWTEXT)}function eb(t,e){t._switchToTextParsing(e,It.RAWTEXT)}function RP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===C.IN_TABLE||t.insertionMode===C.IN_CAPTION||t.insertionMode===C.IN_TABLE_BODY||t.insertionMode===C.IN_ROW||t.insertionMode===C.IN_CELL?C.IN_SELECT_IN_TABLE:C.IN_SELECT}function PP(t,e){t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function BP(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,R.HTML)}function FP(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(m.RTC),t._insertElement(e,R.HTML)}function HP(t,e){t._reconstructActiveFormattingElements(),mC(e),Hp(e),e.selfClosing?t._appendElement(e,R.MATHML):t._insertElement(e,R.MATHML),e.ackSelfClosing=!0}function UP(t,e){t._reconstructActiveFormattingElements(),gC(e),Hp(e),e.selfClosing?t._appendElement(e,R.SVG):t._insertElement(e,R.SVG),e.ackSelfClosing=!0}function tb(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function mt(t,e){switch(e.tagID){case m.I:case m.S:case m.B:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.SMALL:case m.STRIKE:case m.STRONG:{wP(t,e);break}case m.A:{SP(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{bP(t,e);break}case m.P:case m.DL:case m.OL:case m.UL:case m.DIV:case m.DIR:case m.NAV:case m.MAIN:case m.MENU:case m.ASIDE:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.DETAILS:case m.ADDRESS:case m.ARTICLE:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{gP(t,e);break}case m.LI:case m.DD:case m.DT:{kP(t,e);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{TC(t,e);break}case m.HR:{OP(t,e);break}case m.RB:case m.RTC:{BP(t,e);break}case m.RT:case m.RP:{FP(t,e);break}case m.PRE:case m.LISTING:{yP(t,e);break}case m.XMP:{vP(t,e);break}case m.SVG:{UP(t,e);break}case m.HTML:{fP(t,e);break}case m.BASE:case m.LINK:case m.META:case m.STYLE:case m.TITLE:case m.SCRIPT:case m.BGSOUND:case m.BASEFONT:case m.TEMPLATE:{wn(t,e);break}case m.BODY:{pP(t,e);break}case m.FORM:{EP(t,e);break}case m.NOBR:{xP(t,e);break}case m.MATH:{HP(t,e);break}case m.TABLE:{_P(t,e);break}case m.INPUT:{NP(t,e);break}case m.PARAM:case m.TRACK:case m.SOURCE:{IP(t,e);break}case m.IMAGE:{MP(t,e);break}case m.BUTTON:{CP(t,e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{AP(t,e);break}case m.IFRAME:{LP(t,e);break}case m.SELECT:{RP(t,e);break}case m.OPTION:case m.OPTGROUP:{PP(t,e);break}case m.NOEMBED:case m.NOFRAMES:{eb(t,e);break}case m.FRAMESET:{mP(t,e);break}case m.TEXTAREA:{DP(t,e);break}case m.NOSCRIPT:{t.options.scriptingEnabled?eb(t,e):tb(t,e);break}case m.PLAINTEXT:{TP(t,e);break}case m.COL:case m.TH:case m.TD:case m.TR:case m.HEAD:case m.FRAME:case m.TBODY:case m.TFOOT:case m.THEAD:case m.CAPTION:case m.COLGROUP:break;default:tb(t,e)}}function $P(t,e){if(t.openElements.hasInScope(m.BODY)&&(t.insertionMode=C.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function zP(t,e){t.openElements.hasInScope(m.BODY)&&(t.insertionMode=C.AFTER_BODY,DC(t,e))}function VP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function jP(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(m.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(m.FORM):n&&t.openElements.remove(n))}function qP(t){t.openElements.hasInButtonScope(m.P)||t._insertFakeElement(_.P,m.P),t._closePElement()}function WP(t){t.openElements.hasInListItemScope(m.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(m.LI),t.openElements.popUntilTagNamePopped(m.LI))}function YP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function KP(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function GP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function QP(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(_.BR,m.BR),t.openElements.pop(),t.framesetOk=!1}function SC(t,e){const n=e.tagName,r=e.tagID;for(let i=t.openElements.stackTop;i>0;i--){const s=t.openElements.items[i],o=t.openElements.tagIDs[i];if(r===o&&(r!==m.UNKNOWN||t.treeAdapter.getTagName(s)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=i&&t.openElements.shortenToLength(i);break}if(t._isSpecialElement(s,o))break}}function bu(t,e){switch(e.tagID){case m.A:case m.B:case m.I:case m.S:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.NOBR:case m.SMALL:case m.STRIKE:case m.STRONG:{Up(t,e);break}case m.P:{qP(t);break}case m.DL:case m.UL:case m.OL:case m.DIR:case m.DIV:case m.NAV:case m.PRE:case m.MAIN:case m.MENU:case m.ASIDE:case m.BUTTON:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.ADDRESS:case m.ARTICLE:case m.DETAILS:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.LISTING:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{VP(t,e);break}case m.LI:{WP(t);break}case m.DD:case m.DT:{YP(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{KP(t);break}case m.BR:{QP(t);break}case m.BODY:{$P(t,e);break}case m.HTML:{zP(t,e);break}case m.FORM:{jP(t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{GP(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:SC(t,e)}}function wC(t,e){t.tmplInsertionModeStack.length>0?MC(t,e):$p(t,e)}function JP(t,e){var n;e.tagID===m.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function XP(t,e){t._err(e,O.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function hd(t,e){if(t.openElements.currentTagId!==void 0&&bC.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=C.IN_TABLE_TEXT,e.type){case fe.CHARACTER:{AC(t,e);break}case fe.WHITESPACE_CHARACTER:{xC(t,e);break}}else ga(t,e)}function ZP(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_CAPTION}function e4(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_COLUMN_GROUP}function t4(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(_.COLGROUP,m.COLGROUP),t.insertionMode=C.IN_COLUMN_GROUP,zp(t,e)}function n4(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_TABLE_BODY}function r4(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(_.TBODY,m.TBODY),t.insertionMode=C.IN_TABLE_BODY,yu(t,e)}function i4(t,e){t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function s4(t,e){CC(e)?t._appendElement(e,R.HTML):ga(t,e),e.ackSelfClosing=!0}function o4(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,R.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function xs(t,e){switch(e.tagID){case m.TD:case m.TH:case m.TR:{r4(t,e);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{wn(t,e);break}case m.COL:{t4(t,e);break}case m.FORM:{o4(t,e);break}case m.TABLE:{i4(t,e);break}case m.TBODY:case m.TFOOT:case m.THEAD:{n4(t,e);break}case m.INPUT:{s4(t,e);break}case m.CAPTION:{ZP(t,e);break}case m.COLGROUP:{e4(t,e);break}default:ga(t,e)}}function Zo(t,e){switch(e.tagID){case m.TABLE:{t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode());break}case m.TEMPLATE:{Li(t,e);break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:ga(t,e)}}function ga(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,gu(t,e),t.fosterParentingEnabled=n}function xC(t,e){t.pendingCharacterTokens.push(e)}function AC(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function Ws(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)ga(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const _C=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function a4(t,e){const n=e.tagID;_C.has(n)?t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=C.IN_TABLE,xs(t,e)):mt(t,e)}function l4(t,e){const n=e.tagID;switch(n){case m.CAPTION:case m.TABLE:{t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=C.IN_TABLE,n===m.TABLE&&Zo(t,e));break}case m.BODY:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:bu(t,e)}}function zp(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.COL:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.TEMPLATE:{wn(t,e);break}default:ec(t,e)}}function c4(t,e){switch(e.tagID){case m.COLGROUP:{t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=C.IN_TABLE);break}case m.TEMPLATE:{Li(t,e);break}case m.COL:break;default:ec(t,e)}}function ec(t,e){t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=C.IN_TABLE,t._processToken(e))}function yu(t,e){switch(e.tagID){case m.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_ROW;break}case m.TH:case m.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(_.TR,m.TR),t.insertionMode=C.IN_ROW,Eu(t,e);break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE,xs(t,e));break}default:xs(t,e)}}function Uh(t,e){const n=e.tagID;switch(e.tagID){case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE);break}case m.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE,Zo(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:case m.TR:break;default:Zo(t,e)}}function Eu(t,e){switch(e.tagID){case m.TH:case m.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,R.HTML),t.insertionMode=C.IN_CELL,t.activeFormattingElements.insertMarker();break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE_BODY,yu(t,e));break}default:xs(t,e)}}function NC(t,e){switch(e.tagID){case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE_BODY);break}case m.TABLE:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE_BODY,Uh(t,e));break}case m.TBODY:case m.TFOOT:case m.THEAD:{(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(m.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=C.IN_TABLE_BODY,Uh(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:break;default:Zo(t,e)}}function u4(t,e){const n=e.tagID;_C.has(n)?(t.openElements.hasInTableScope(m.TD)||t.openElements.hasInTableScope(m.TH))&&(t._closeTableCell(),Eu(t,e)):mt(t,e)}function d4(t,e){const n=e.tagID;switch(n){case m.TD:case m.TH:{t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=C.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),NC(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:bu(t,e)}}function IC(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._insertElement(e,R.HTML);break}case m.OPTGROUP:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._insertElement(e,R.HTML);break}case m.HR:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.INPUT:case m.KEYGEN:case m.TEXTAREA:case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),e.tagID!==m.SELECT&&t._processStartTag(e));break}case m.SCRIPT:case m.TEMPLATE:{wn(t,e);break}}}function OC(t,e){switch(e.tagID){case m.OPTGROUP:{t.openElements.stackTop>0&&t.openElements.currentTagId===m.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===m.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop();break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop();break}case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode());break}case m.TEMPLATE:{Li(t,e);break}}}function h4(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t._processStartTag(e)):IC(t,e)}function f4(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t.onEndTag(e)):OC(t,e)}function p4(t,e){switch(e.tagID){case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{wn(t,e);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.tmplInsertionModeStack[0]=C.IN_TABLE,t.insertionMode=C.IN_TABLE,xs(t,e);break}case m.COL:{t.tmplInsertionModeStack[0]=C.IN_COLUMN_GROUP,t.insertionMode=C.IN_COLUMN_GROUP,zp(t,e);break}case m.TR:{t.tmplInsertionModeStack[0]=C.IN_TABLE_BODY,t.insertionMode=C.IN_TABLE_BODY,yu(t,e);break}case m.TD:case m.TH:{t.tmplInsertionModeStack[0]=C.IN_ROW,t.insertionMode=C.IN_ROW,Eu(t,e);break}default:t.tmplInsertionModeStack[0]=C.IN_BODY,t.insertionMode=C.IN_BODY,mt(t,e)}}function m4(t,e){e.tagID===m.TEMPLATE&&Li(t,e)}function MC(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):$p(t,e)}function g4(t,e){e.tagID===m.HTML?mt(t,e):tc(t,e)}function DC(t,e){var n;if(e.tagID===m.HTML){if(t.fragmentContext||(t.insertionMode=C.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===m.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&t._setEndLocation(r,e)}}else tc(t,e)}function tc(t,e){t.insertionMode=C.IN_BODY,gu(t,e)}function b4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.FRAMESET:{t._insertElement(e,R.HTML);break}case m.FRAME:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.NOFRAMES:{wn(t,e);break}}}function y4(t,e){e.tagID===m.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==m.FRAMESET&&(t.insertionMode=C.AFTER_FRAMESET))}function E4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.NOFRAMES:{wn(t,e);break}}}function k4(t,e){e.tagID===m.HTML&&(t.insertionMode=C.AFTER_AFTER_FRAMESET)}function T4(t,e){e.tagID===m.HTML?mt(t,e):gl(t,e)}function gl(t,e){t.insertionMode=C.IN_BODY,gu(t,e)}function C4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.NOFRAMES:{wn(t,e);break}}}function S4(t,e){e.chars=Oe,t._insertCharacters(e)}function w4(t,e){t._insertCharacters(e),t.framesetOk=!1}function vC(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==R.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function x4(t,e){if(U6(e))vC(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===R.MATHML?mC(e):r===R.SVG&&($6(e),gC(e)),Hp(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function A4(t,e){if(e.tagID===m.P||e.tagID===m.BR){vC(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===R.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}_.AREA,_.BASE,_.BASEFONT,_.BGSOUND,_.BR,_.COL,_.EMBED,_.FRAME,_.HR,_.IMG,_.INPUT,_.KEYGEN,_.LINK,_.META,_.PARAM,_.SOURCE,_.TRACK,_.WBR;function _4(t,e){return yC.parse(t,e)}function N4(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);const r=yC.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}function bo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?nb(t.position):"start"in t||"end"in t?nb(t):"line"in t||"column"in t?$h(t):""}function $h(t){return rb(t&&t.line)+":"+rb(t&&t.column)}function nb(t){return $h(t&&t.start)+"-"+$h(t&&t.end)}function rb(t){return t&&typeof t=="number"?t:1}class Ct extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=bo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Nn={basename:I4,dirname:O4,extname:M4,join:D4,sep:"/"};function I4(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ba(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function O4(t){if(ba(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function M4(t){ba(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function D4(...t){let e=-1,n;for(;++e<t.length;)ba(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":v4(n)}function v4(t){ba(t);const e=t.codePointAt(0)===47;let n=L4(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function L4(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function ba(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const R4={cwd:P4};function P4(){return"/"}function zh(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function B4(t){if(typeof t=="string")t=new URL(t);else if(!zh(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return F4(t)}function F4(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const fd=["history","path","basename","stem","extname","dirname"];class Vh{constructor(e){let n;e?zh(e)?n={path:e}:typeof e=="string"||H4(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":R4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<fd.length;){const s=fd[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)fd.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Nn.basename(this.path):void 0}set basename(e){md(e,"basename"),pd(e,"basename"),this.path=Nn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Nn.dirname(this.path):void 0}set dirname(e){ib(this.basename,"dirname"),this.path=Nn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Nn.extname(this.path):void 0}set extname(e){if(pd(e,"extname"),ib(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Nn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){zh(e)&&(e=B4(e)),md(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Nn.basename(this.path,this.extname):void 0}set stem(e){md(e,"stem"),pd(e,"stem"),this.path=Nn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new Ct(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function pd(t,e){if(t&&t.includes(Nn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Nn.sep+"`")}function md(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function ib(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function H4(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const U4={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},$4="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",z4=/-[a-z]/g,V4=/%c(?:([-+])(\d+))?/g,j4=/%x/g,q4={2:!0,1:!1,0:null},W4={};function Y4(t,e){const n=e||W4,r=n.onerror,i=t instanceof Vh?t:new Vh(t),s=n.fragment?N4:_4,o=String(i),a=s(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return QR(a,{file:i,space:n.space,verbose:n.verbose});function l(c){const u=c.code,d=K4(u),h=n[d],f=h??!0,p=typeof f=="number"?f:f?1:0;if(p){const b=U4[d],y=new Ct(g(b.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:u,source:"hast-util-from-html"});i.path&&(y.file=i.path,y.name=i.path+":"+y.name),y.fatal=q4[p],y.note=g(b.description),y.url=b.url===!1?void 0:$4+u,r(y)}function g(b){return b.replace(V4,y).replace(j4,T);function y(S,D,I){const A=(I?Number.parseInt(I,10):0)*(D==="-"?-1:1),v=o.charAt(c.startOffset+A);return Q4(v)}function T(){return J4(o.charCodeAt(c.startOffset))}}}}function K4(t){return t.replace(z4,G4)}function G4(t){return t.charAt(1).toUpperCase()}function Q4(t){return t==="`"?"` ` `":t}function J4(t){return"0x"+t.toString(16).toUpperCase()}function X4(t){const e=this,{emitParseErrors:n,...r}={...e.data("settings"),...t};e.parser=i;function i(s,o){return Y4(s,{...r,onerror:n?function(a){o.path&&(a.name=o.path+":"+a.name,a.file=o.path),o.messages.push(a)}:void 0})}}const LC=-1,ku=0,yo=1,nc=2,Vp=3,jp=4,qp=5,Wp=6,RC=7,PC=8,sb=typeof self=="object"?self:globalThis,Z4=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case ku:case LC:return n(o,i);case yo:{const a=n([],i);for(const l of o)a.push(r(l));return a}case nc:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case Vp:return n(new Date(o),i);case jp:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case qp:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case Wp:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case RC:{const{name:a,message:l}=o;return n(new sb[a](l),i)}case PC:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new sb[s](o),i)};return r},ob=t=>Z4(new Map,t)(0),zi="",{toString:eB}={},{keys:tB}=Object,Ys=t=>{const e=typeof t;if(e!=="object"||!t)return[ku,e];const n=eB.call(t).slice(8,-1);switch(n){case"Array":return[yo,zi];case"Object":return[nc,zi];case"Date":return[Vp,zi];case"RegExp":return[jp,zi];case"Map":return[qp,zi];case"Set":return[Wp,zi];case"DataView":return[yo,n]}return n.includes("Array")?[yo,n]:n.includes("Error")?[RC,n]:[nc,n]},za=([t,e])=>t===ku&&(e==="function"||e==="symbol"),nB=(t,e,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Ys(o);switch(a){case ku:{let u=o;switch(l){case"bigint":a=PC,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([LC],o)}return i([a,u],o)}case yo:{if(l){let h=o;return l==="DataView"?h=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(o)),i([l,[...h]],o)}const u=[],d=i([a,u],o);for(const h of o)u.push(s(h));return d}case nc:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const h of tB(o))(t||!za(Ys(o[h])))&&u.push([s(h),s(o[h])]);return d}case Vp:return i([a,o.toISOString()],o);case jp:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case qp:{const u=[],d=i([a,u],o);for(const[h,f]of o)(t||!(za(Ys(h))||za(Ys(f))))&&u.push([s(h),s(f)]);return d}case Wp:{const u=[],d=i([a,u],o);for(const h of o)(t||!za(Ys(h)))&&u.push(s(h));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},ab=(t,{json:e,lossy:n}={})=>{const r=[];return nB(!(e||n),!!e,new Map,r)(t),r},As=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?ob(ab(t,e)):structuredClone(t):(t,e)=>ob(ab(t,e)),Yp=(function(t,e,n,r,i){const s=xn(e);return BC(t)?s.call(i,t,n,r):!1}),xn=(function(t){if(t==null)return sB;if(typeof t=="string")return iB(t);if(typeof t=="object")return rB(t);if(typeof t=="function")return Kp(t);throw new Error("Expected function, string, or array as `test`")});function rB(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=xn(t[n]);return Kp(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function iB(t){return Kp(e);function e(n){return n.tagName===t}}function Kp(t){return e;function e(n,r,i){return!!(BC(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function sB(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function BC(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const FC=xn(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"}),oB=/[ \t\n\f\r]/g;function ya(t){return typeof t=="object"?t.type==="text"?lb(t.value):!1:lb(t)}function lb(t){return t.replace(oB,"")===""}const Fs=(function(t){if(t==null)return uB;if(typeof t=="function")return Tu(t);if(typeof t=="object")return Array.isArray(t)?aB(t):lB(t);if(typeof t=="string")return cB(t);throw new Error("Expected function, string, or object as test")});function aB(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Fs(t[n]);return Tu(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function lB(t){const e=t;return Tu(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function cB(t){return Tu(e);function e(n){return n&&n.type===t}}function Tu(t){return e;function e(n,r,i){return!!(dB(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function uB(){return!0}function dB(t){return t!==null&&typeof t=="object"&&"type"in t}const hB=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],fB=["button","input","select","textarea"],pB=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],mB={},Gp=Fs(["comment","doctype"]);function gB(t,e){HC(t,{collapse:SB((e||mB).newlines?TB:CB),whitespace:"normal"})}function HC(t,e){if("children"in t){const n={...e};return(t.type==="root"||zC(t))&&(n.before=!0,n.after=!0),n.whitespace=wB(t,e),yB(t,n)}if(t.type==="text"){if(e.whitespace==="normal")return bB(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Gp(t),stripAtStart:!1,remove:!1}}function bB(t,e){const n=e.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let i=0,s=n.length;return e.before&&cb(n.charAt(0))&&i++,i!==s&&cb(n.charAt(s-1))&&(e.after?s--:r.stripAtStart=!0),i===s?r.remove=!0:t.value=n.slice(i,s),r}function yB(t,e){let n=e.before;const r=e.after,i=t.children;let s=i.length,o=-1;for(;++o<s;){const a=HC(i[o],{...e,after:UC(i,o,r),before:n});a.remove?(i.splice(o,1),o--,s--):a.ignore||(n=a.stripAtStart),$C(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function UC(t,e,n){for(;++e<t.length;){const r=t[e];let i=EB(r);if(i===void 0&&"children"in r&&!kB(r)&&(i=UC(r.children,-1)),typeof i=="boolean")return i}return n}function EB(t){if(t.type==="element"){if($C(t))return!1;if(zC(t))return!0}else if(t.type==="text"){if(!ya(t))return!1}else if(!Gp(t))return!1}function $C(t){return FC(t)||Yp(t,fB)}function zC(t){return Yp(t,hB)}function kB(t){return!!(t.type==="element"&&t.properties.hidden)||Gp(t)||Yp(t,pB)}function cb(t){return t===" "||t===`
115
115
  `}function TB(t){const e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function CB(){return" "}function SB(t){return e;function e(n){return String(n).replace(/[\t\n\v\f\r ]+/g,t)}}function wB(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}return e.whitespace}function xB(t){return function(e){gB(e,t)}}const VC=[],AB=!0,rc=!1,jC="skip";function qC(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=Fs(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=VC,p,g,b;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=_B(n(l,u)),f[0]===rc))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==jC)for(g=(r?y.children.length:-1)+o,b=u.concat(y);g>-1&&g<y.children.length;){const T=y.children[g];if(p=a(T,g,b)(),p[0]===rc)return p;g=typeof p[1]=="number"?p[1]:g+o}}return f}}}function _B(t){return Array.isArray(t)?t:typeof t=="number"?[AB,t]:t==null?VC:[t]}function Ai(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),qC(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const WC=KC("end"),YC=KC("start");function KC(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function GC(t){const e=YC(t),n=WC(t);if(e&&n)return{start:e,end:n}}function NB(t,e){const n=e.properties||{},r=t.all(e),i={type:"link",url:t.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return t.patch(e,i),i}function IB(t,e){t.baseFound||(t.frozenBaseUrl=String(e.properties&&e.properties.href||"")||void 0,t.baseFound=!0)}function OB(t,e){const n={type:"blockquote",children:t.toFlow(t.all(e))};return t.patch(e,n),n}function MB(t,e){const n={type:"break"};return t.patch(e,n),n}const ub=(function(t,e,n){const r=Fs(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),db=/\n/g,hb=/[\t ]+/g,jh=xn("br"),fb=xn(FB),DB=xn("p"),pb=xn("tr"),vB=xn(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",BB,HB]),QC=xn(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Ea(t,e){const n={},r="children"in t?t.children:[],i=QC(t),s=ZC(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...XC(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...JC(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?jh(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const u=o[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
116
116
  `.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function JC(t,e,n){return t.type==="element"?LB(t,e,n):t.type==="text"?n.whitespace==="normal"?XC(t,n):RB(t):[]}function LB(t,e,n){const r=ZC(t,n),i=t.children||[];let s=-1,o=[];if(vB(t))return o;let a,l;for(jh(t)||pb(t)&&ub(e,t,pb)?l=`
@@ -172,7 +172,7 @@ ${n.toString()}`)};class jM{constructor(e){this.patterns=[],this.$state=e}if(e,n
172
172
  \f\r &>`.split(""),`\0
173
173
  \f\r "&'<=>\``.split("")],[`\0
174
174
  \f\r "&'<=>\``.split(""),`\0
175
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Cz(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=ma);const c=Sz(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(o=!1),(c||!s||!gz(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!s||!gm(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Sz(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=wz(t,i,e[i]);s&&n.push(s)}}for(;++r<n.length;){const s=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function wz(t,e,n){const r=Bp(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,s=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=us(r.attribute,Object.assign({},t.settings.characterReferences,{subset:el.name[i][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?UR:zR)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=us(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:el.unquoted[i][s]}))),a!==n&&(t.settings.quoteSmart&&ic(n,o)>ic(n,t.alternative)&&(o=t.alternative),a=o+us(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?el.single:el.double)[i][s],attribute:!0}))+o),l+(a&&"="+a))}const xz=["<","&"];function Nw(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:us(t.value,Object.assign({},r.settings.characterReferences,{subset:xz}))}function Az(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Nw(t,e,n,r)}function _z(t,e,n,r){return r.all(t)}const Nz=pS("type",{invalid:Iz,unknown:Oz,handlers:{comment:ez,doctype:tz,element:Cz,raw:Az,root:_z,text:Nw}});function Iz(t){throw new Error("Expected node, not `"+t+"`")}function Oz(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Mz={},Dz={},vz=[];function Lz(t,e){const n=e||Mz,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Rz,all:Pz,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||L$,characterReferences:n.characterReferences||Dz,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ma:pu,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Rz(t,e,n){return Nz(t,e,n,this)}function Pz(t){const e=[],n=t&&t.children||vz;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function Bz(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(i){return Lz(i,n)}}var Fz=Object.defineProperty,Hz=(t,e,n)=>e in t?Fz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,he=(t,e,n)=>Hz(t,typeof e!="symbol"?e+"":e,n);function Hj(t,e){const n=[{tag:`[data-inline-content-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:i}}),n}function Uz(t,e,n,r="before"){const i=typeof n=="string"?n:n.id,s=He(t),o=e.map(c=>Ii(c,s)),a=Vt(i,t.doc);if(!a)throw new Error(`Block with ID ${i} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),t.step(new ze(l,l,new F(M.from(o),0,0))),o.map(c=>ve(c,s))}function df(t){if(!t||t.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");const e=t.firstChild;if(!e)throw new Error("Invalid column: does not have child node.");const n=e.firstChild;if(!n)throw new Error("Invalid blockContainer: does not have child node.");return t.childCount===1&&e.childCount===1&&n.type.name==="paragraph"&&n.content.content.length===0}function $z(t,e){const n=t.doc.resolve(e),r=n.nodeAfter;if(!r||r.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");for(let i=r.childCount-1;i>=0;i--){const s=t.doc.resolve(n.pos+1).posAtIndex(i),o=t.doc.resolve(s).nodeAfter;if(!o||o.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");df(o)&&t.delete(s,s+o.nodeSize)}}function hf(t,e){$z(t,e);const n=t.doc.resolve(e).nodeAfter;if(!n||n.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");if(n.childCount>2)return;if(n.childCount<2)throw new Error("Invalid columnList: contains fewer than two children.");const r=e+1,i=t.doc.resolve(r).nodeAfter,s=e+n.nodeSize-1,o=t.doc.resolve(s).nodeBefore;if(!i||!o)throw new Error("Invalid columnList: does not contain children.");const a=df(i),l=df(o);if(a&&l){t.delete(e,e+n.nodeSize);return}if(a){t.step(new Fe(e,e+n.nodeSize,s-o.nodeSize+1,s-1,F.empty,0,!1));return}if(l){t.step(new Fe(e,e+n.nodeSize,r+1,r+i.nodeSize-1,F.empty,0,!1));return}}function S1(t,e,n){const r=He(t),i=n.map(u=>Ii(u,r)),s=new Set(e.map(u=>typeof u=="string"?u:u.id)),o=[],a=new Set,l=typeof e[0]=="string"?e[0]:e[0].id;let c=0;if(t.doc.descendants((u,d)=>{if(s.size===0)return!1;if(!u.type.isInGroup("bnBlock")||!s.has(u.attrs.id))return!0;if(o.push(ve(u,r)),s.delete(u.attrs.id),n.length>0&&u.attrs.id===l){const g=t.doc.nodeSize;t.insert(d,i);const b=t.doc.nodeSize;c+=g-b}const h=t.doc.nodeSize,f=t.doc.resolve(d-c);f.node().type.name==="column"?a.add(f.before(-1)):f.node().type.name==="columnList"&&a.add(f.before()),f.node().type.name==="blockGroup"&&f.node(f.depth-1).type.name!=="doc"&&f.node().childCount===1?t.delete(f.before(),f.after()):t.delete(d-c,d-c+u.nodeSize);const p=t.doc.nodeSize;return c+=h-p,!1}),s.size>0){const u=[...s].join(`
175
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Cz(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=ma);const c=Sz(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(o=!1),(c||!s||!gz(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!s||!gm(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Sz(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=wz(t,i,e[i]);s&&n.push(s)}}for(;++r<n.length;){const s=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function wz(t,e,n){const r=Bp(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,s=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=us(r.attribute,Object.assign({},t.settings.characterReferences,{subset:el.name[i][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?UR:zR)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=us(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:el.unquoted[i][s]}))),a!==n&&(t.settings.quoteSmart&&ic(n,o)>ic(n,t.alternative)&&(o=t.alternative),a=o+us(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?el.single:el.double)[i][s],attribute:!0}))+o),l+(a&&"="+a))}const xz=["<","&"];function Nw(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:us(t.value,Object.assign({},r.settings.characterReferences,{subset:xz}))}function Az(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Nw(t,e,n,r)}function _z(t,e,n,r){return r.all(t)}const Nz=pS("type",{invalid:Iz,unknown:Oz,handlers:{comment:ez,doctype:tz,element:Cz,raw:Az,root:_z,text:Nw}});function Iz(t){throw new Error("Expected node, not `"+t+"`")}function Oz(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Mz={},Dz={},vz=[];function Lz(t,e){const n=e||Mz,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Rz,all:Pz,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||L$,characterReferences:n.characterReferences||Dz,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ma:pu,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Rz(t,e,n){return Nz(t,e,n,this)}function Pz(t){const e=[],n=t&&t.children||vz;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function Bz(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(i){return Lz(i,n)}}var Fz=Object.defineProperty,Hz=(t,e,n)=>e in t?Fz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,he=(t,e,n)=>Hz(t,typeof e!="symbol"?e+"":e,n);function Uj(t,e){const n=[{tag:`[data-inline-content-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:i}}),n}function Uz(t,e,n,r="before"){const i=typeof n=="string"?n:n.id,s=He(t),o=e.map(c=>Ii(c,s)),a=Vt(i,t.doc);if(!a)throw new Error(`Block with ID ${i} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),t.step(new ze(l,l,new F(M.from(o),0,0))),o.map(c=>ve(c,s))}function df(t){if(!t||t.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");const e=t.firstChild;if(!e)throw new Error("Invalid column: does not have child node.");const n=e.firstChild;if(!n)throw new Error("Invalid blockContainer: does not have child node.");return t.childCount===1&&e.childCount===1&&n.type.name==="paragraph"&&n.content.content.length===0}function $z(t,e){const n=t.doc.resolve(e),r=n.nodeAfter;if(!r||r.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");for(let i=r.childCount-1;i>=0;i--){const s=t.doc.resolve(n.pos+1).posAtIndex(i),o=t.doc.resolve(s).nodeAfter;if(!o||o.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");df(o)&&t.delete(s,s+o.nodeSize)}}function hf(t,e){$z(t,e);const n=t.doc.resolve(e).nodeAfter;if(!n||n.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");if(n.childCount>2)return;if(n.childCount<2)throw new Error("Invalid columnList: contains fewer than two children.");const r=e+1,i=t.doc.resolve(r).nodeAfter,s=e+n.nodeSize-1,o=t.doc.resolve(s).nodeBefore;if(!i||!o)throw new Error("Invalid columnList: does not contain children.");const a=df(i),l=df(o);if(a&&l){t.delete(e,e+n.nodeSize);return}if(a){t.step(new Fe(e,e+n.nodeSize,s-o.nodeSize+1,s-1,F.empty,0,!1));return}if(l){t.step(new Fe(e,e+n.nodeSize,r+1,r+i.nodeSize-1,F.empty,0,!1));return}}function S1(t,e,n){const r=He(t),i=n.map(u=>Ii(u,r)),s=new Set(e.map(u=>typeof u=="string"?u:u.id)),o=[],a=new Set,l=typeof e[0]=="string"?e[0]:e[0].id;let c=0;if(t.doc.descendants((u,d)=>{if(s.size===0)return!1;if(!u.type.isInGroup("bnBlock")||!s.has(u.attrs.id))return!0;if(o.push(ve(u,r)),s.delete(u.attrs.id),n.length>0&&u.attrs.id===l){const g=t.doc.nodeSize;t.insert(d,i);const b=t.doc.nodeSize;c+=g-b}const h=t.doc.nodeSize,f=t.doc.resolve(d-c);f.node().type.name==="column"?a.add(f.before(-1)):f.node().type.name==="columnList"&&a.add(f.before()),f.node().type.name==="blockGroup"&&f.node(f.depth-1).type.name!=="doc"&&f.node().childCount===1?t.delete(f.before(),f.after()):t.delete(d-c,d-c+u.nodeSize);const p=t.doc.nodeSize;return c+=h-p,!1}),s.size>0){const u=[...s].join(`
176
176
  `);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>hf(t,u)),{insertedBlocks:i.map(u=>ve(u,r)),removedBlocks:o}}function zz(t,e,n,r,i){let s;if(e)if(typeof e=="string")s=bn([e],t.pmSchema,r);else if(Array.isArray(e))s=bn(e,t.pmSchema,r);else if(e.type==="tableContent")s=Jc(e,t.pmSchema);else throw new Pn(e.type);else throw new Error("blockContent is required");const o=(i?.document??document).createDocumentFragment();for(const a of s)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Qf(a,t.schema.inlineContentSchema,t.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},t);if(u){if(o.appendChild(u.dom),u.contentDOM){const d=n.serializeFragment(a.content,i);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in t.schema.styleSpecs){const u=t.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,t);u.contentDOM.appendChild(l),l=u.dom}else{const u=c.type.spec.toDOM(c,!0),d=zt.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}o.appendChild(l)}else{const l=n.serializeFragment(M.from([a]),i);o.appendChild(l)}return o}function Vz(t,e,n,r){var i,s,o,a,l;const c=t.pmSchema.nodes.blockContainer,u=e.props||{};for(const[p,g]of Object.entries(t.schema.blockSchema[e.type].propSchema))!(p in u)&&g.default!==void 0&&(u[p]=g.default);const d=e.children||[],h=t.blockImplementations[e.type].implementation.render.call({renderType:"dom",props:void 0},{...e,props:u,children:d},t);if(h.contentDOM&&e.content){const p=zz(t,e.content,n,e.type,r);h.contentDOM.appendChild(p)}if(t.pmSchema.nodes[e.type].isInGroup("bnBlock")){if(e.children&&e.children.length>0){const p=Iw(t,e.children,n,r);(i=h.contentDOM)==null||i.append(p)}return h.dom}const f=(o=(s=c.spec)==null?void 0:s.toDOM)==null?void 0:o.call(s,c.create({id:e.id,...u}));return(a=f.contentDOM)==null||a.appendChild(h.dom),e.children&&e.children.length>0&&((l=f.contentDOM)==null||l.appendChild(Ow(t,e.children,n,r))),f.dom}function Iw(t,e,n,r){const i=(r?.document??document).createDocumentFragment();for(const s of e){const o=Vz(t,s,n,r);i.appendChild(o)}return i}const Ow=(t,e,n,r)=>{var i;const s=t.pmSchema.nodes.blockGroup,o=s.spec.toDOM(s.create({})),a=Iw(t,e,n,r);return(i=o.contentDOM)==null||i.appendChild(a),o.dom},jz=t=>(t.querySelectorAll('[data-content-type="numberedListItem"]').forEach(e=>{var n,r;const i=(r=(n=e.closest(".bn-block-outer"))==null?void 0:n.previousElementSibling)==null?void 0:r.querySelector('[data-content-type="numberedListItem"]');if(!i)e.setAttribute("data-index",e.getAttribute("data-start")||"1");else{const s=i.getAttribute("data-index");e.setAttribute("data-index",(parseInt(s||"0")+1).toString())}}),t),qz=t=>(t.querySelectorAll('[data-content-type="checkListItem"] input').forEach(e=>{e.disabled=!0}),t),Wz=t=>(t.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(e=>{e.setAttribute("data-show-children","true")}),t),Yz=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{e.setAttribute("style",`--default-cell-min-width: ${Lp}px;`),e.setAttribute("data-show-children","true")}),t),Kz=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{var n;const r=document.createElement("div");r.className="tableWrapper";const i=document.createElement("div");i.className="tableWrapper-inner",r.appendChild(i),(n=e.parentElement)==null||n.appendChild(r),r.appendChild(e)}),t),Gz=t=>(t.querySelectorAll(".bn-inline-content:empty").forEach(e=>{const n=document.createElement("span");n.className="ProseMirror-trailingBreak",n.setAttribute("style","display: inline-block;"),e.appendChild(n)}),t),Qz=(t,e)=>{const n=zt.fromSchema(t),r=[jz,qz,Wz,Yz,Kz,Gz];return{serializeBlocks:(i,s)=>{let o=Ow(e,i,n,s);for(const a of r)o=a(o);return o.outerHTML}}};function Jz(t){return t.transact(e=>{const n=Rr(e.doc,e.selection.anchor);if(e.selection instanceof be)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:e.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:e.selection.$headCell.pos-n.posBeforeNode};if(e.selection instanceof W)return{type:"node",anchorBlockId:n.node.attrs.id};{const r=Rr(e.doc,e.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:e.selection.anchor-n.posBeforeNode,headOffset:e.selection.head-r.posBeforeNode}}})}function Xz(t,e){var n,r;const i=(n=Vt(e.anchorBlockId,t.doc))==null?void 0:n.posBeforeNode;if(i===void 0)throw new Error(`Could not find block with ID ${e.anchorBlockId} to update selection`);let s;if(e.type==="cell")s=be.create(t.doc,i+e.anchorCellOffset,i+e.headCellOffset);else if(e.type==="node")s=W.create(t.doc,i+1);else{const o=(r=Vt(e.headBlockId,t.doc))==null?void 0:r.posBeforeNode;if(o===void 0)throw new Error(`Could not find block with ID ${e.headBlockId} to update selection`);s=j.create(t.doc,i+e.anchorOffset,o+e.headOffset)}t.setSelection(s)}function ff(t){return t.map(e=>e.type==="columnList"?e.children.map(n=>ff(n.children)).flat():{...e,children:ff(e.children)}).flat()}function Mw(t,e,n){t.transact(r=>{var i;const s=((i=t.getSelection())==null?void 0:i.blocks)||[t.getTextCursorPosition().block],o=Jz(t);t.removeBlocks(s),t.insertBlocks(ff(s),e,n),Xz(r,o)})}function Dw(t){return!t||t.type!=="columnList"}function vw(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[e.children.length-1],i="after"):(r=e,i="before"):n&&(r=n,i="before"),!r||!i)return;const s=t.getParentBlock(r);return Dw(s)?{referenceBlock:r,placement:i}:vw(t,i==="after"?r:t.getPrevBlock(r),s)}function Lw(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[0],i="before"):(r=e,i="after"):n&&(r=n,i="after"),!r||!i)return;const s=t.getParentBlock(r);return Dw(s)?{referenceBlock:r,placement:i}:Lw(t,i==="before"?r:t.getNextBlock(r),s)}function Zz(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[0]||t.getTextCursorPosition().block,r=vw(t,t.getPrevBlock(n),t.getParentBlock(n));r&&Mw(t,r.referenceBlock,r.placement)})}function eV(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[e?.blocks.length-1]||t.getTextCursorPosition().block,r=Lw(t,t.getNextBlock(n),t.getParentBlock(n));r&&Mw(t,r.referenceBlock,r.placement)})}function tV(t,e,n){const{$from:r,$to:i}=t.selection,s=r.blockRange(i,f=>f.childCount>0&&(f.type.name==="blockGroup"||f.type.name==="column"));if(!s)return!1;const o=s.startIndex;if(o===0)return!1;const a=s.parent.child(o-1);if(a.type!==e)return!1;const l=a.lastChild&&a.lastChild.type===n,c=M.from(l?e.create():null),u=new F(M.from(e.create(null,M.from(n.create(null,c)))),l?3:1,0),d=s.start,h=s.end;return t.step(new Fe(d-(l?3:1),h,d,h,u,1,!0)).scrollIntoView(),!0}function Rw(t){return t.transact(e=>tV(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function nV(t){t._tiptapEditor.commands.liftListItem("blockContainer")}function rV(t){return t.transact(e=>{const{bnBlock:n}=sa(e);return e.doc.resolve(n.beforePos).nodeBefore!==null})}function iV(t){return t.transact(e=>{const{bnBlock:n}=sa(e);return e.doc.resolve(n.beforePos).depth>1})}function sV(t,e){const n=typeof e=="string"?e:e.id,r=He(t),i=Vt(n,t);if(i)return ve(i.node,r)}function oV(t,e){const n=typeof e=="string"?e:e.id,r=Vt(n,t),i=He(t);if(!r)return;const s=t.resolve(r.posBeforeNode).nodeBefore;if(s)return ve(s,i)}function aV(t,e){const n=typeof e=="string"?e:e.id,r=Vt(n,t),i=He(t);if(!r)return;const s=t.resolve(r.posBeforeNode+r.node.nodeSize).nodeAfter;if(s)return ve(s,i)}function lV(t,e){const n=typeof e=="string"?e:e.id,r=He(t),i=Vt(n,t);if(!i)return;const s=t.resolve(i.posBeforeNode),o=s.node(),a=s.node(-1),l=a.type.name!=="doc"?o.type.name==="blockGroup"?a:o:void 0;if(l)return ve(l,r)}class cV{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>iI(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(n=>sV(n.doc,e))}getPrevBlock(e){return this.editor.transact(n=>oV(n.doc,e))}getNextBlock(e){return this.editor.transact(n=>aV(n.doc,e))}getParentBlock(e){return this.editor.transact(n=>lV(n.doc,e))}forEachBlock(e,n=!1){const r=this.document.slice();n&&r.reverse();function i(s){for(const o of s){if(e(o)===!1)return!1;const a=n?o.children.slice().reverse():o.children;if(!i(a))return!1}return!0}i(r)}insertBlocks(e,n,r="before"){return this.editor.transact(i=>Uz(i,e,n,r))}updateBlock(e,n){return this.editor.transact(r=>oL(r,e,n))}removeBlocks(e){return this.editor.transact(n=>S1(n,e,[]).removedBlocks)}replaceBlocks(e,n){return this.editor.transact(r=>S1(r,e,n))}canNestBlock(){return rV(this.editor)}nestBlock(){Rw(this.editor)}canUnnestBlock(){return iV(this.editor)}unnestBlock(){nV(this.editor)}moveBlocksUp(){return Zz(this.editor)}moveBlocksDown(){return eV(this.editor)}}class uV extends aw{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:n,appendedTransactions:r})=>{this.emit("onChange",{editor:e,transaction:n,appendedTransactions:r})}),e._tiptapEditor.on("selectionUpdate",({transaction:n})=>{this.emit("onSelectionChange",{editor:e,transaction:n})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,n=!0){const r=({transaction:i,appendedTransactions:s})=>{!n&&w1(i)||e(this.editor,{getChanges(){return ZS(i,s)}})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(e,n=!1){const r=i=>{!n&&w1(i.transaction)||e(this.editor)};return this.on("onSelectionChange",r),()=>{this.off("onSelectionChange",r)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}}function w1(t){return!!t.getMeta("y-sync$")}function dV(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function hV(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function fV(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{const n=dV(e),r=e.parentElement,i=Array.from(r.childNodes).slice(n+1);e.remove(),i.forEach(s=>{s.remove()}),r.insertAdjacentElement("afterend",e),i.reverse().forEach(s=>{if(hV(s))return;const o=document.createElement("li");o.append(s),e.insertAdjacentElement("afterend",o)}),r.childNodes.length===0&&r.remove()})}function pV(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{var n,r;const i=e.previousElementSibling,s=document.createElement("div");i.insertAdjacentElement("afterend",s),s.append(i);const o=document.createElement("div");for(o.setAttribute("data-node-type","blockGroup"),s.append(o);((n=s.nextElementSibling)==null?void 0:n.nodeName)==="UL"||((r=s.nextElementSibling)==null?void 0:r.nodeName)==="OL";)o.append(s.nextElementSibling)})}let x1=null;function mV(){return x1||(x1=document.implementation.createHTMLDocument("title"))}function gV(t){if(typeof t=="string"){const e=mV().createElement("div");e.innerHTML=t,t=e}return fV(t),pV(t),t}function Pw(t,e){const n=gV(t),r=mn.fromSchema(e).parse(n,{topNode:e.nodes.blockGroup.create()}),i=[];for(let s=0;s<r.childCount;s++)i.push(ve(r.child(s),e));return i}function bV(t,e){const n=e.value?e.value:"",r={};e.lang&&(r["data-language"]=e.lang);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function yV(t,e){var n;const r=String(e?.url||""),i=e!=null&&e.title?String(e.title):void 0;let s={type:"element",tagName:"video",properties:{src:r,"data-name":i,"data-url":r,controls:!0},children:[]};return(n=t.patch)==null||n.call(t,e,s),s=t.applyData?t.applyData(e,s):s,s}function Bw(t){return YS().use(X7).use(WS).use(v$,{handlers:{...lf,image:(e,n)=>{const r=String(n?.url||"");return Gv(r)?yV(e,n):lf.image(e,n)},code:bV,blockquote:(e,n)=>{const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!1)};return e.patch(n,r),e.applyData(n,r)}}}).use(Bz).processSync(t).value}function EV(t,e){const n=Bw(t);return Pw(n,e)}class kV{constructor(e){this.editor=e}blocksToHTMLLossy(e=this.editor.document){return Au(this.editor.pmSchema,this.editor).exportBlocks(e,{})}blocksToFullHTML(e=this.editor.document){return Qz(this.editor.pmSchema,this.editor).serializeBlocks(e,{})}tryParseHTMLToBlocks(e){return Pw(e,this.editor.pmSchema)}blocksToMarkdownLossy(e=this.editor.document){return hU(e,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(e){return EV(e,this.editor.pmSchema)}pasteHTML(e,n=!1){var r;let i=e;if(!n){const s=this.tryParseHTMLToBlocks(e);i=this.blocksToFullHTML(s)}i&&((r=this.editor.prosemirrorView)==null||r.pasteHTML(i))}pasteText(e){var n;return(n=this.editor.prosemirrorView)==null?void 0:n.pasteText(e)}pasteMarkdown(e){const n=Bw(e);return this.pasteHTML(n)}}const bm=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function TV(t,e){if(!t.startsWith(".")||!e.startsWith("."))throw new Error("The strings provided are not valid file extensions.");return t===e}function CV(t,e){const n=t.split("/"),r=e.split("/");if(n.length!==2)throw new Error(`The string ${t} is not a valid MIME type.`);if(r.length!==2)throw new Error(`The string ${e} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function A1(t,e,n,r="after"){let i;return Array.isArray(e.content)&&e.content.length===0?i=t.updateBlock(e,n).id:i=t.insertBlocks([n],e,r)[0].id,i}async function Fw(t,e){var n;if(!e.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}const r="dataTransfer"in t?t.dataTransfer:t.clipboardData;if(r===null)return;let i=null;for(const o of bm)if(r.types.includes(o)){i=o;break}if(i!=="Files")return;const s=r.items;if(s){t.preventDefault();for(let o=0;o<s.length;o++){let a="file";for(const c of Object.values(e.schema.blockSpecs))for(const u of((n=c.implementation.meta)==null?void 0:n.fileBlockAccept)||[]){const d=u.startsWith("."),h=s[o].getAsFile();if(h&&(!d&&h.type&&CV(s[o].type,u)||d&&TV("."+h.name.split(".").pop(),u))){a=c.config.type;break}}const l=s[o].getAsFile();if(l){const c={type:a,props:{name:l.name}};let u;if(t.type==="paste"){const f=e.getTextCursorPosition().block;u=A1(e,f,c)}else if(t.type==="drop"){const f={left:t.clientX,top:t.clientY},p=e.prosemirrorView.posAtCoords(f);if(!p)return;u=e.transact(g=>{var b;const y=Rr(g.doc,p.pos),T=(b=e.domElement)==null?void 0:b.querySelector(`[data-id="${y.node.attrs.id}"]`),S=T?.getBoundingClientRect();return A1(e,e.getBlock(y.node.attrs.id),c,S&&(S.top+S.bottom)/2>f.top?"before":"after")})}else return;const d=await e.uploadFile(l,u),h=typeof d=="string"?{props:{url:d}}:{...d};e.updateBlock(u,h)}}}}const SV=t=>Le.create({name:"dropFile",addProseMirrorPlugins(){return[new te({props:{handleDOMEvents:{drop(e,n){if(!t.isEditable)return;let r=null;for(const i of bm)if(n.dataTransfer.types.includes(i)){r=i;break}return r===null?!0:r==="Files"?(Fw(n,t),!0):!1}}}})]}}),wV=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,xV=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,AV=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,_V=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,NV=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,IV=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,OV=/\n{2} {0,3}-{2,48}\n{2}/,MV=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,DV=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,vV=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,LV=/^\s*\|(.+\|)+\s*$/m,RV=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,PV=/^\s*\|(.+\|)+\s*$/m,BV=t=>wV.test(t)||xV.test(t)||AV.test(t)||_V.test(t)||NV.test(t)||IV.test(t)||OV.test(t)||MV.test(t)||DV.test(t)||vV.test(t)||LV.test(t)||RV.test(t)||PV.test(t);async function FV(t,e){const{schema:n}=e.state;if(!t.clipboardData)return!1;const r=t.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return e.pasteText(r),!0;const i=t.clipboardData.getData("vscode-editor-data"),s=i?JSON.parse(i):void 0,o=s?.mode;return o?(e.pasteHTML(`<pre><code class="language-${o}">${r.replace(/\r\n?/g,`
177
177
  `)}</code></pre>`),!0):!1}function HV({event:t,editor:e,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){var i;if(e.transact(a=>a.selection.$from.parent.type.spec.code&&a.selection.$to.parent.type.spec.code)){const a=(i=t.clipboardData)==null?void 0:i.getData("text/plain");if(a)return e.pasteText(a),!0}let s;for(const a of bm)if(t.clipboardData.types.includes(a)){s=a;break}if(!s)return!0;if(s==="vscode-editor-data")return FV(t,e.prosemirrorView),!0;if(s==="Files")return Fw(t,e),!0;const o=t.clipboardData.getData(s);if(s==="blocknote/html")return e.pasteHTML(o,!0),!0;if(s==="text/markdown")return e.pasteMarkdown(o),!0;if(n){const a=t.clipboardData.getData("text/plain");if(BV(a))return e.pasteMarkdown(a),!0}return s==="text/html"?(e.pasteHTML(o),!0):r?(e.pasteMarkdown(o),!0):(e.pasteText(o),!0)}const UV=(t,e)=>Le.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new te({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),!!t.isEditable)return e({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:i=!0,plainTextAsMarkdown:s=!0}={})=>HV({event:r,editor:t,prioritizeMarkdownOverHTML:i,plainTextAsMarkdown:s})})}}}})]}});function $V(t,e,n){var r;let i=!1;const s=t.state.selection instanceof be;if(!s){const l=t.state.doc.slice(t.state.selection.from,t.state.selection.to,!1).content,c=[];for(let u=0;u<l.childCount;u++)c.push(l.child(u));i=c.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,i&&(e=l)}let o;const a=Au(t.state.schema,n);if(s){((r=e.firstChild)==null?void 0:r.type.name)==="table"&&(e=e.firstChild.content);const l=VE(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=`<table>${a.exportInlineContent(l,{})}</table>`}else if(i){const l=Qc(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=a.exportInlineContent(l,{})}else{const l=rw(e);o=a.exportBlocks(l,{})}return o}function Hw(t,e){"node"in t.state.selection&&t.state.selection.node.type.spec.group==="blockContent"&&e.transact(o=>o.setSelection(new W(o.doc.resolve(t.state.selection.from-1))));const n=t.serializeForClipboard(t.state.selection.content()).dom.innerHTML,r=t.state.selection.content().content,i=$V(t,r,e),s=sm(i);return{clipboardHTML:n,externalHTML:i,markdown:s}}const _1=()=>{const t=window.getSelection();if(!t||t.isCollapsed)return!0;let e=t.focusNode;for(;e;){if(e instanceof HTMLElement&&e.getAttribute("contenteditable")==="false")return!0;e=e.parentElement}return!1},N1=(t,e,n)=>{n.preventDefault(),n.clipboardData.clearData();const{clipboardHTML:r,externalHTML:i,markdown:s}=Hw(e,t);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",i),n.clipboardData.setData("text/plain",s)},zV=t=>Le.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new te({props:{handleDOMEvents:{copy(e,n){return _1()||N1(t,e,n),!0},cut(e,n){return _1()||(N1(t,e,n),e.editable&&e.dispatch(e.state.tr.deleteSelection())),!0},dragstart(e,n){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;t.transact(o=>o.setSelection(new W(o.doc.resolve(e.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();const{clipboardHTML:r,externalHTML:i,markdown:s}=Hw(e,t);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",i),n.dataTransfer.setData("text/plain",s),!0}}}})]}}),VV=Le.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:cL()}}]}}),jV=Cn.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",sn(this.options.HTMLAttributes,t)]},renderText(){return`
178
- `}}),pf=(t,e)=>{const n=t.resolve(e),r=n.index();if(r===0)return;const i=n.posAtIndex(r-1);return Gc(t.resolve(i))},Uw=(t,e)=>{for(;e.childContainer;){const n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Gc(t.resolve(r))}return e},qV=(t,e)=>t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*"&&t.blockContent.node.childCount>0&&e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*",WV=(t,e,n,r)=>{if(!r.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){const i=t.doc.resolve(r.childContainer.beforePos+1),s=t.doc.resolve(r.childContainer.afterPos-1),o=i.blockRange(s);if(e){const a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(o,a.depth)}}if(e){if(!n.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);e(t.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},I1=t=>({state:e,dispatch:n})=>{const r=e.doc.resolve(t),i=Gc(r),s=pf(e.doc,i.bnBlock.beforePos);if(!s)return!1;const o=Uw(e.doc,s);return qV(o,i)?WV(e,n,o,i):!1},YV=Le.create({priority:50,addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.undoInputRule(),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const a=s.selection.from===o.blockContent.beforePos+1,l=o.blockContent.node.type.name==="paragraph";return a&&!l?i.command(iL(o.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{blockContent:a}=o;return s.selection.from===a.beforePos+1?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=o,c=s.selection.from===l.beforePos+1,u=s.selection.empty,d=a.beforePos;return c&&u?r().command(I1(d)).scrollIntoView().run():!1}),()=>i.command(({state:s,tr:o,dispatch:a})=>{const l=xt(s);if(!l.isBlockContainer||o.selection.from!==l.blockContent.beforePos+1)return!1;const c=o.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=o.doc.resolve(l.bnBlock.beforePos),d=o.doc.resolve(u.before()),h=d.before();if(a){const f=o.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;o.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),d.index()===0?(hf(o,h),o.insert(h,f),o.setSelection(j.near(o.doc.resolve(h)))):(o.insert(d.pos-1,f),o.setSelection(j.near(o.doc.resolve(d.pos-1))),hf(o,h))}return!0}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;if(o.blockContent.node.childCount===0&&o.blockContent.node.type.spec.content==="inline*"){const a=pf(s.doc,o.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=o.bnBlock.beforePos-1-1-1-1-1;l=l.setTextSelection(c)}else if(a.blockContent.node.type.spec.content===""){const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setNodeSelection(c)}else{const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setTextSelection(c)}return l.deleteRange({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)throw new Error("todo");const a=s.selection.from===o.blockContent.beforePos+1,l=s.selection.empty,c=pf(s.doc,o.bnBlock.beforePos);if(c&&a&&l){const u=Uw(s.doc,c);if(!u.isBlockContainer)throw new Error("todo");if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),e=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.command(({state:i})=>{const s=xt(i);if(!s.isBlockContainer)return!1;const{bnBlock:o,blockContent:a,childContainer:l}=s,{depth:c}=i.doc.resolve(o.beforePos),u=o.afterPos===i.doc.nodeSize-3,d=i.selection.from===a.afterPos-1,h=i.selection.empty;if(!u&&d&&h&&l===void 0){let f=c,p=o.afterPos+1,g=i.doc.resolve(p).depth;for(;g<f;)f=g,p+=2,g=i.doc.resolve(p).depth;return r.command(I1(p-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:i,tr:s})=>[()=>i.command(({state:o})=>{const a=xt(o);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=o.doc.resolve(l.beforePos),d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=c.node.childCount===0,p=u>1;return d&&h&&f&&p?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:o})=>{var a;const l=xt(o),c=((a=this.options.editor.schema.blockSchema[l.blockNoteType].meta)==null?void 0:a.hardBreakShortcut)??"shift+enter";if(c==="none")return!1;if(c==="shift+enter"&&r||c==="enter"){const u=s.storedMarks||s.selection.$head.marks().filter(d=>this.editor.extensionManager.splittableMarks.includes(d.type.name));return s.insert(s.selection.head,s.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>i.command(({state:o,dispatch:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=u.node.childCount===0;if(d&&h&&f){const p=c.afterPos,g=p+2;if(a){const b=o.schema.nodes.blockContainer.createAndFill();o.tr.insert(p,b).scrollIntoView(),o.tr.setSelection(new j(o.doc.resolve(g)))}return!0}return!1}),()=>i.command(({state:o,chain:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=o.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(FL(o.selection.from,u,u)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Jh))!=null&&r.store.state||((i=this.options.editor.getExtension(Ir))==null?void 0:i.store.state)!==void 0)?!1:Rw(this.options.editor)},"Shift-Tab":()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Jh))!=null&&r.store.state||((i=this.options.editor.getExtension(Ir))==null?void 0:i.store.state)!==void 0)?!1:this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),KV=Tn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="insertion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["ins",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),GV=Tn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="deletion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["del",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),QV=Tn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(t){return t.name!=="modification"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return[n?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}:!1}}]}}}),JV=Le.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment==="left"?{}:{"data-text-alignment":t.textAlignment}}}}]}}),XV=Le.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:uL()}}]}}),ZV={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},ej=Cn.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:t=>{if(typeof t=="string")return!1;const e={};for(const[n,r]of Object.entries(ZV))t.getAttribute(r)&&(e[n]=t.getAttribute(r));return e}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:t}){var e;const n=document.createElement("div");n.className="bn-block-outer",n.setAttribute("data-node-type","blockOuter");for(const[s,o]of Object.entries(t))s!=="class"&&n.setAttribute(s,o);const r={...((e=this.options.domAttributes)==null?void 0:e.block)||{},...t},i=document.createElement("div");i.className=Ur("bn-block",r.class),i.setAttribute("data-node-type",this.name);for(const[s,o]of Object.entries(r))s!=="class"&&i.setAttribute(s,o);return n.appendChild(i),{dom:n,contentDOM:i}}}),tj=Cn.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){var e;const n={...((e=this.options.domAttributes)==null?void 0:e.blockGroup)||{},...t},r=document.createElement("div");r.className=Ur("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[i,s]of Object.entries(n))i!=="class"&&r.setAttribute(i,s);return{dom:r,contentDOM:r}}}),nj=Cn.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),rj=pe(({options:t})=>({key:"collaboration",blockNoteExtensions:[KH(t),Qh(t),yl(t),El(),JH(t)]}));let O1=!1;function ij(t,e){const n=[Wi.ClipboardTextSerializer,Wi.Commands,Wi.Editable,Wi.FocusEvents,Wi.Tabindex,KU,Kc.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute}),jV,k7,KV,GV,QV,E7.extend({inclusive:!1}).configure({defaultProtocol:nU,protocols:O1?[]:tU}),...Object.values(t.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:t})),XV,VV,JV,Le.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=t.getExtension(Rp))!=null&&r.shown()?!1:(t.blur(),!0)}})}),nj,ej.configure({editor:t,domAttributes:e.domAttributes}),YV.configure({editor:t,tabBehavior:e.tabBehavior}),tj.configure({domAttributes:e.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:t,domAttributes:e.domAttributes})]:[]]),zV(t),UV(t,e.pasteHandler||(r=>r.defaultPasteHandler())),SV(t)];return O1=!0,n}function sj(t,e){const n=[ew(),XH(e),Ir(e),Jh(e),eU(e),iU(),oU(e),T7(e),yU(e),Rp(e),...e.trailingBlock!==!1?[wU()]:[]];return e.collaboration?n.push(rj(e.collaboration)):n.push(ZH()),"table"in t.schema.blockSpecs&&n.push(SU(e)),e.animations!==!1&&n.push(lU()),n}class oj{constructor(e,n){he(this,"disabledExtensions",new Set),he(this,"extensions",[]),he(this,"abortMap",new Map),he(this,"extensionFactories",new Map),he(this,"extensionPlugins",new Map),this.editor=e,this.options=n,e.onMount(()=>{for(const r of this.extensions)if(r.mount){const i=new window.AbortController,s=r.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:i.signal});s&&i.signal.addEventListener("abort",()=>{s()}),this.abortMap.set(r,i)}}),e.onUnmount(()=>{for(const[r,i]of this.abortMap.entries())this.abortMap.delete(r),i.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of sj(this.editor,this.options))this.addExtension(r);for(const r of this.options.extensions??[])this.addExtension(r);for(const r of Object.values(this.editor.schema.blockSpecs))for(const i of r.extensions??[])this.addExtension(i)}registerExtension(e){var n;const r=[].concat(e).filter(Boolean);if(!r.length){console.warn("No extensions found to register",e);return}const i=r.map(o=>this.addExtension(o)).filter(Boolean),s=new Set;for(const o of i)o!=null&&o.tiptapExtensions&&console.warn(`Extension ${o.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),(n=o?.inputRules)!=null&&n.length&&console.warn(`Extension ${o.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),this.getProsemirrorPluginsFromExtension(o).plugins.forEach(a=>{s.add(a)});this.updatePlugins(o=>[...o,...s])}addExtension(e){let n;if(typeof e=="function"?n=e({editor:this.editor}):n=e,!(!n||this.disabledExtensions.has(n.key))){if(typeof e=="function"){const r=n[Dh];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(const r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(e){const n=[];if(typeof e=="function"){const r=this.extensionFactories.get(e);r&&n.push(r)}else if(Array.isArray(e))for(const r of e)n.push(...this.resolveExtensions(r));else if(typeof e=="object"&&"key"in e)n.push(e);else if(typeof e=="string"){const r=this.extensions.find(i=>i.key===e);r&&n.push(r)}return n}unregisterExtension(e){var n;const r=this.resolveExtensions(e);if(!r.length){console.warn("No extensions found to unregister",e);return}let i=!1;const s=new Set;for(const o of r){this.extensions=this.extensions.filter(l=>l!==o),this.extensionFactories.forEach((l,c)=>{l===o&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(o))==null||n.abort(),this.abortMap.delete(o);const a=this.extensionPlugins.get(o);a?.forEach(l=>{s.add(l)}),this.extensionPlugins.delete(o),o.tiptapExtensions&&!i&&(i=!0,console.warn(`Extension ${o.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,e))}this.updatePlugins(o=>o.filter(a=>!s.has(a)))}updatePlugins(e){const n=this.editor.prosemirrorState,r=n.reconfigure({plugins:e(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var e;const n=ij(this.editor,this.options).filter(s=>!this.disabledExtensions.has(s.name)),r=sw(this.extensions),i=new Map;for(const s of this.extensions){s.tiptapExtensions&&n.push(...s.tiptapExtensions);const o=r(s.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(s);a.length&&n.push(Le.create({name:s.key,priority:o,addProseMirrorPlugins:()=>a})),l.length&&(i.has(o)||i.set(o,[]),i.get(o).push(...l))}n.push(Le.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const s=[];return Array.from(i.keys()).sort().reverse().forEach(o=>{s.push(...i.get(o))}),[UU({rules:s})]}}));for(const s of((e=this.options._tiptapOptions)==null?void 0:e.extensions)??[])n.push(s);return n}getProsemirrorPluginsFromExtension(e){var n,r,i;const s=[...e.prosemirrorPlugins??[]],o=[];return!((n=e.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(e.keyboardShortcuts||{}).length&&!((r=e.inputRules)!=null&&r.length)?{plugins:s,inputRules:o}:(this.extensionPlugins.set(e,s),(i=e.inputRules)!=null&&i.length&&o.push(...e.inputRules.map(a=>new Ri(a.find,(l,c,u,d)=>{const h=a.replace({match:c,range:{from:u,to:d},editor:this.editor});if(h){const f=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[f.block.type].content!=="inline")return null;const p=sa(l.tr),g=l.tr.deleteRange(u,d);return uu(g,p.bnBlock.beforePos,h),g}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&s.push(oE(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:s,inputRules:o})}getExtensions(){return new Map(this.extensions.map(e=>[e.key,e]))}getExtension(e){if(typeof e=="string")return this.extensions.find(r=>r.key===e)||void 0;if(typeof e=="function")return this.extensionFactories.get(e)||void 0;throw new Error(`Invalid extension type: ${typeof e}`)}hasExtension(e){return typeof e=="string"?this.extensions.some(n=>n.key===e):typeof e=="object"&&"key"in e?this.extensions.some(n=>n.key===e.key):typeof e=="function"?this.extensionFactories.has(e):!1}}function aj(t,e){let{$from:n,$to:r}=e;if(n.pos>n.start()&&n.pos<t.content.size){const i=t.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);s&&(n=t.resolve(n.pos-s[0].length))}}if(r.pos<r.end()&&r.pos>0){const i=t.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);s&&(r=t.resolve(r.pos+s[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function lj(t){const e=He(t);if(t.selection.empty||"node"in t.selection)return;const n=t.doc.resolve(Rr(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Rr(t.doc,t.selection.to).posBeforeNode),i=(c,u)=>{const d=n.posAtIndex(c,u),h=t.doc.resolve(d).nodeAfter;if(!h)throw new Error(`Error getting selection - node not found at position ${d}`);return ve(h,e)},s=[],o=n.sharedDepth(r.pos),a=n.index(o),l=r.index(o);if(n.depth>o){s.push(ve(n.nodeAfter,e));for(let c=n.depth;c>o;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,d=n.node(c).childCount;for(let h=u;h<d;h++)s.push(i(h,c))}}else s.push(i(a,o));for(let c=a+1;c<=l;c++)s.push(i(c,o));if(s.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:s}}function cj(t,e,n){const r=typeof e=="string"?e:e.id,i=typeof n=="string"?n:n.id,s=He(t),o=oa(s);if(r===i)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=Vt(r,t.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=Vt(i,t.doc);if(!l)throw new Error(`Block with ID ${i} not found`);const c=Pr(a),u=Pr(l),d=o.blockSchema[c.blockNoteType],h=o.blockSchema[u.blockNoteType];if(!c.isBlockContainer||d.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||h.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${i})`);let f,p;if(d.content==="table"){const g=Ae.get(c.blockContent.node);f=c.blockContent.beforePos+g.positionAt(0,0,c.blockContent.node)+1+2}else f=c.blockContent.beforePos+1;if(h.content==="table"){const g=Ae.get(u.blockContent.node),b=u.blockContent.beforePos+g.positionAt(g.height-1,g.width-1,u.blockContent.node)+1,y=t.doc.resolve(b).nodeAfter.nodeSize;p=b+y-2}else p=u.blockContent.afterPos-1;t.setSelection(j.create(t.doc,f,p))}function uj(t,e=!1){const n=He(t),r=e?aj(t.doc,t.selection):t.selection;let i=r.$from,s=r.$to;for(;s.parentOffset>=s.parent.nodeSize-2&&s.depth>0;)s=t.doc.resolve(s.pos+1);for(;s.parentOffset===0&&s.depth>0;)s=t.doc.resolve(s.pos-1);for(;i.parentOffset===0&&i.depth>0;)i=t.doc.resolve(i.pos-1);for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=t.doc.resolve(i.pos+1);const o=sI(t.doc.slice(i.pos,s.pos,!0),n);return{_meta:{startPos:i.pos,endPos:s.pos},...o}}function dj(t){const{bnBlock:e}=sa(t),n=He(t.doc),r=t.doc.resolve(e.beforePos),i=r.nodeBefore,s=t.doc.resolve(e.afterPos).nodeAfter;let o;return r.depth>1&&(o=r.node(),o.type.isInGroup("bnBlock")||(o=r.node(r.depth-1))),{block:ve(e.node,n),prevBlock:i===null?void 0:ve(i,n),nextBlock:s===null?void 0:ve(s,n),parentBlock:o===void 0?void 0:ve(o,n)}}function $w(t,e,n="start"){const r=typeof e=="string"?e:e.id,i=He(t.doc),s=oa(i),o=Vt(r,t.doc);if(!o)throw new Error(`Block with ID ${r} not found`);const a=Pr(o),l=s.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){t.setSelection(W.create(t.doc,c.beforePos));return}if(l==="inline")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+1)):t.setSelection(j.create(t.doc,c.afterPos-1));else if(l==="table")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+4)):t.setSelection(j.create(t.doc,c.afterPos-4));else throw new Pn(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;$w(t,c.attrs.id,n)}}class hj{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>lj(e))}getSelectionCutBlocks(e=!1){return this.editor.transact(n=>uj(n,e))}setSelection(e,n){return this.editor.transact(r=>cj(r,e,n))}getTextCursorPosition(){return this.editor.transact(e=>dj(e))}setTextCursorPosition(e,n="start"){return this.editor.transact(r=>$w(r,e,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:e}=this.editor.prosemirrorState,{ranges:n}=e,r=Math.min(...n.map(s=>s.$from.pos)),i=Math.max(...n.map(s=>s.$to.pos));if(rN(e)){const s=this.editor.prosemirrorView.nodeDOM(r);if(s)return s.getBoundingClientRect()}return wE(this.editor.prosemirrorView,r,i).toJSON()}}class fj{constructor(e){he(this,"activeTransaction",null),he(this,"isInCan",!1),this.editor=e}can(e){try{return this.isInCan=!0,e()}finally{this.isInCan=!1}}exec(e){if(this.activeTransaction)throw new Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(e);const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,i=>this.prosemirrorView.dispatch(i),r)}canExec(e){if(this.activeTransaction)throw new Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,void 0,r)}transact(e){if(this.activeTransaction)return e(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;const n=e(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw new Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var e;return((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}focus(){var e;(e=this.prosemirrorView)==null||e.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(e){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==e&&this.editor._tiptapEditor.setEditable(e)}undo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.undoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw new Error("No undo plugin found")}redo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.redoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw new Error("No redo plugin found")}}function pj(t,e,n,r={updateSelection:!0}){let{from:i,to:s}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},o=!0,a=!0,l="";if(n.forEach(c=>{c.check(),o&&c.isText&&c.marks.length===0?l+=c.text:o=!1,a=a?c.isBlock:!1}),i===s&&a){const{parent:c}=t.doc.resolve(i);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(i-=1,s+=1)}return o?t.insertText(l,i,s):t.replaceWith(i,s,n),r.updateSelection&&hE(t,t.steps.length-1,-1),!0}class mj{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:n=!1}={}){const r=bn(e,this.editor.pmSchema);this.editor.transact(i=>{pj(i,{from:i.selection.from,to:i.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(e=>{const n={},r=e.selection.$to.marks();for(const i of r){const s=this.editor.schema.styleSchema[i.type.name];if(!s){i.type.name!=="link"&&!i.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",i.type.name);continue}s.propSchema==="boolean"?n[s.type]=!0:n[s.type]=i.attrs.stringValue}return n})}addStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}removeStyles(e){for(const n of Object.keys(e))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}getSelectedText(){return this.editor.transact(e=>e.doc.textBetween(e.selection.from,e.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(e,n){if(e==="")return;const r=this.editor.pmSchema.mark("link",{href:e});this.editor.transact(i=>{const{from:s,to:o}=i.selection;n?i.insertText(n,s,o).addMark(s,s+n.length,r):i.setSelection(j.create(i.doc,o)).addMark(s,o,r)})}}function gj(t,e){const n=[];return t.forEach((r,i,s)=>{s!==e&&n.push(r)}),M.from(n)}function bj(t,e){const n=[];for(let r=0;r<t.childCount;r++)if(t.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){const i=n[n.length-1],s=i.copy(i.content.addToEnd(t.child(r)));n[n.length-1]=s}else{const i=e.nodes.table.createChecked(void 0,t.child(r));n.push(i)}else n.push(t.child(r));return t=M.from(n),t}function yj(t,e){let n=M.from(t.content);if(n=bj(n,e.state.schema),!Ej(n,e))return new F(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const i=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const o=n.child(r+1).child(0).child(0);(o.type.name==="bulletListItem"||o.type.name==="numberedListItem"||o.type.name==="checkListItem")&&(i.push(n.child(r+1)),n=gj(n,r+1))}const s=e.state.schema.nodes.blockContainer.createChecked(void 0,i);n=n.replaceChild(r,s)}return new F(n,t.openStart,t.openEnd)}function Ej(t,e){var n,r;const i=t.childCount===1,s=((n=t.firstChild)==null?void 0:n.type.spec.content)==="inline*",o=((r=t.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(i){if(s)return!1;if(o){const a=xt(e.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const kj={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class zw extends aw{constructor(e){var n,r,i,s,o,a,l,c,u,d;super(),he(this,"pmSchema"),he(this,"_tiptapEditor"),he(this,"elementRenderer",null),he(this,"blockCache",new WeakMap),he(this,"dictionary"),he(this,"schema"),he(this,"blockImplementations"),he(this,"inlineContentImplementations"),he(this,"styleImplementations"),he(this,"uploadFile"),he(this,"onUploadStartCallbacks",[]),he(this,"onUploadEndCallbacks",[]),he(this,"resolveFileUrl"),he(this,"settings"),he(this,"_blockManager"),he(this,"_eventManager"),he(this,"_exportManager"),he(this,"_extensionManager"),he(this,"_selectionManager"),he(this,"_stateManager"),he(this,"_styleManager"),he(this,"unregisterExtension",(...T)=>this._extensionManager.unregisterExtension(...T)),he(this,"registerExtension",(...T)=>this._extensionManager.registerExtension(...T)),he(this,"getExtension",(...T)=>this._extensionManager.getExtension(...T)),he(this,"mount",T=>{this._tiptapEditor.mount({mount:T})}),he(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||BU,this.settings={tables:{splitCells:((n=e?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=e?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((i=e?.tables)==null?void 0:i.cellTextColor)??!1,headers:((s=e?.tables)==null?void 0:s.headers)??!1}};const h={defaultStyles:!0,schema:e.schema||vU.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=h.schema,this.blockImplementations=h.schema.blockSpecs,this.inlineContentImplementations=h.schema.inlineContentSpecs,this.styleImplementations=h.schema.styleSpecs,h.uploadFile){const T=h.uploadFile;this.uploadFile=async(S,D)=>{this.onUploadStartCallbacks.forEach(I=>I.apply(this,[D]));try{return await T(S,D)}finally{this.onUploadEndCallbacks.forEach(I=>I.apply(this,[D]))}}}this.resolveFileUrl=h.resolveFileUrl,this._eventManager=new uV(this),this._extensionManager=new oj(this,h);const f=this._extensionManager.getTiptapExtensions(),p=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");p&&h.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const g={...kj,...h._tiptapOptions,element:null,autofocus:h.autofocus??!1,extensions:f,editorProps:{...(o=h._tiptapOptions)==null?void 0:o.editorProps,attributes:{tabIndex:"0",...(l=(a=h._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=h.domAttributes)==null?void 0:c.editor,class:Ur("bn-editor",h.defaultStyles?"bn-default-styles":"",((d=(u=h.domAttributes)==null?void 0:u.editor)==null?void 0:d.class)||"")},transformPasted:yj}};try{const T=h.initialContent||(p?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Kc.options.generateID()}]);if(!Array.isArray(T)||T.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+T);const S=Q_(g.extensions),D=T.map(A=>Ii(A,S,this.schema.styleSchema).toJSON()),I=vl({type:"doc",content:[{type:"blockGroup",content:D}]},S,g.parseOptions);this._tiptapEditor=new $N({...g,content:I.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(T){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:T})}let b;const y=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...T)=>{if(b)return b;const S=y.apply(this.pmSchema.nodes.doc,T),D=JSON.parse(JSON.stringify(S.toJSON()));return D.content[0].content[0].attrs.id="initialBlockId",b=Zt.fromJSON(this.pmSchema,D),b},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new cV(this),this._exportManager=new kV(this),this._selectionManager=new hj(this),this._stateManager=new fj(this),this._styleManager=new mj(this),this.emit("create")}static create(e){return new zw(e??{})}get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var e;if(!this.headless)return(e=this.prosemirrorView)==null?void 0:e.dom}isFocused(){var e;return this.headless?!1:((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){var e;this.headless||(e=this.domElement)==null||e.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{const n=this.onUploadStartCallbacks.indexOf(e);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{const n=this.onUploadEndCallbacks.indexOf(e);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,n=!1){this._blockManager.forEachBlock(e,n)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}onBeforeChange(e){return this._extensionManager.getExtension(ew).subscribe(e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(e=!1){return this._selectionManager.getSelectionCutBlocks(e)}setSelection(e,n){return this._selectionManager.setSelection(e,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,n,r="before"){return this._blockManager.insertBlocks(e,n,r)}updateBlock(e,n){return this._blockManager.updateBlock(e,n)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,n){return this._blockManager.replaceBlocks(e,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,n){this._styleManager.createLink(e,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,n){return this._eventManager.onChange(e,n)}onSelectionChange(e,n){return this._eventManager.onSelectionChange(e,n)}onMount(e){this._eventManager.onMount(e)}onUnmount(e){this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){const e=this.document;return e.length===0||e.length===1&&e[0].type==="paragraph"&&e[0].content.length===0}pasteHTML(e,n=!1){this._exportManager.pasteHTML(e,n)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}}export{GL as $,Pj as A,Rj as B,Qv as C,ce as D,yU as E,Ij as F,tU as G,Bj as H,Ir as I,nU as J,Hj as K,zw as L,Tn as M,wj as N,Vt as O,me as P,Po as Q,Jl as R,ih as S,v0 as T,sh as U,Lp as V,vj as W,qf as X,vU as Y,$T as Z,Rp as _,pe as a,bn as a0,xj as a1,Nj as a2,gR as a3,zT as a4,te as b,_h as c,T7 as d,Ee as e,Mi as f,M1 as g,aw as h,Ll as i,Cn as j,Oj as k,Mj as l,sn as m,Jv as n,Ur as o,Lj as p,ye as q,Jh as r,wE as s,Ye as t,SU as u,dr as v,Qf as w,Dj as x,Ie as y,eU as z};
178
+ `}}),pf=(t,e)=>{const n=t.resolve(e),r=n.index();if(r===0)return;const i=n.posAtIndex(r-1);return Gc(t.resolve(i))},Uw=(t,e)=>{for(;e.childContainer;){const n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Gc(t.resolve(r))}return e},qV=(t,e)=>t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*"&&t.blockContent.node.childCount>0&&e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*",WV=(t,e,n,r)=>{if(!r.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){const i=t.doc.resolve(r.childContainer.beforePos+1),s=t.doc.resolve(r.childContainer.afterPos-1),o=i.blockRange(s);if(e){const a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(o,a.depth)}}if(e){if(!n.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);e(t.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},I1=t=>({state:e,dispatch:n})=>{const r=e.doc.resolve(t),i=Gc(r),s=pf(e.doc,i.bnBlock.beforePos);if(!s)return!1;const o=Uw(e.doc,s);return qV(o,i)?WV(e,n,o,i):!1},YV=Le.create({priority:50,addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.undoInputRule(),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const a=s.selection.from===o.blockContent.beforePos+1,l=o.blockContent.node.type.name==="paragraph";return a&&!l?i.command(iL(o.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{blockContent:a}=o;return s.selection.from===a.beforePos+1?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=o,c=s.selection.from===l.beforePos+1,u=s.selection.empty,d=a.beforePos;return c&&u?r().command(I1(d)).scrollIntoView().run():!1}),()=>i.command(({state:s,tr:o,dispatch:a})=>{const l=xt(s);if(!l.isBlockContainer||o.selection.from!==l.blockContent.beforePos+1)return!1;const c=o.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=o.doc.resolve(l.bnBlock.beforePos),d=o.doc.resolve(u.before()),h=d.before();if(a){const f=o.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;o.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),d.index()===0?(hf(o,h),o.insert(h,f),o.setSelection(j.near(o.doc.resolve(h)))):(o.insert(d.pos-1,f),o.setSelection(j.near(o.doc.resolve(d.pos-1))),hf(o,h))}return!0}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;if(o.blockContent.node.childCount===0&&o.blockContent.node.type.spec.content==="inline*"){const a=pf(s.doc,o.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=o.bnBlock.beforePos-1-1-1-1-1;l=l.setTextSelection(c)}else if(a.blockContent.node.type.spec.content===""){const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setNodeSelection(c)}else{const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setTextSelection(c)}return l.deleteRange({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)throw new Error("todo");const a=s.selection.from===o.blockContent.beforePos+1,l=s.selection.empty,c=pf(s.doc,o.bnBlock.beforePos);if(c&&a&&l){const u=Uw(s.doc,c);if(!u.isBlockContainer)throw new Error("todo");if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),e=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.command(({state:i})=>{const s=xt(i);if(!s.isBlockContainer)return!1;const{bnBlock:o,blockContent:a,childContainer:l}=s,{depth:c}=i.doc.resolve(o.beforePos),u=o.afterPos===i.doc.nodeSize-3,d=i.selection.from===a.afterPos-1,h=i.selection.empty;if(!u&&d&&h&&l===void 0){let f=c,p=o.afterPos+1,g=i.doc.resolve(p).depth;for(;g<f;)f=g,p+=2,g=i.doc.resolve(p).depth;return r.command(I1(p-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:i,tr:s})=>[()=>i.command(({state:o})=>{const a=xt(o);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=o.doc.resolve(l.beforePos),d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=c.node.childCount===0,p=u>1;return d&&h&&f&&p?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:o})=>{var a;const l=xt(o),c=((a=this.options.editor.schema.blockSchema[l.blockNoteType].meta)==null?void 0:a.hardBreakShortcut)??"shift+enter";if(c==="none")return!1;if(c==="shift+enter"&&r||c==="enter"){const u=s.storedMarks||s.selection.$head.marks().filter(d=>this.editor.extensionManager.splittableMarks.includes(d.type.name));return s.insert(s.selection.head,s.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>i.command(({state:o,dispatch:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=u.node.childCount===0;if(d&&h&&f){const p=c.afterPos,g=p+2;if(a){const b=o.schema.nodes.blockContainer.createAndFill();o.tr.insert(p,b).scrollIntoView(),o.tr.setSelection(new j(o.doc.resolve(g)))}return!0}return!1}),()=>i.command(({state:o,chain:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=o.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(FL(o.selection.from,u,u)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Jh))!=null&&r.store.state||((i=this.options.editor.getExtension(Ir))==null?void 0:i.store.state)!==void 0)?!1:Rw(this.options.editor)},"Shift-Tab":()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Jh))!=null&&r.store.state||((i=this.options.editor.getExtension(Ir))==null?void 0:i.store.state)!==void 0)?!1:this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),KV=Tn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="insertion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["ins",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),GV=Tn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="deletion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["del",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),QV=Tn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(t){return t.name!=="modification"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return[n?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}:!1}}]}}}),JV=Le.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment==="left"?{}:{"data-text-alignment":t.textAlignment}}}}]}}),XV=Le.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:uL()}}]}}),ZV={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},ej=Cn.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:t=>{if(typeof t=="string")return!1;const e={};for(const[n,r]of Object.entries(ZV))t.getAttribute(r)&&(e[n]=t.getAttribute(r));return e}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:t}){var e;const n=document.createElement("div");n.className="bn-block-outer",n.setAttribute("data-node-type","blockOuter");for(const[s,o]of Object.entries(t))s!=="class"&&n.setAttribute(s,o);const r={...((e=this.options.domAttributes)==null?void 0:e.block)||{},...t},i=document.createElement("div");i.className=Ur("bn-block",r.class),i.setAttribute("data-node-type",this.name);for(const[s,o]of Object.entries(r))s!=="class"&&i.setAttribute(s,o);return n.appendChild(i),{dom:n,contentDOM:i}}}),tj=Cn.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){var e;const n={...((e=this.options.domAttributes)==null?void 0:e.blockGroup)||{},...t},r=document.createElement("div");r.className=Ur("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[i,s]of Object.entries(n))i!=="class"&&r.setAttribute(i,s);return{dom:r,contentDOM:r}}}),nj=Cn.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),rj=pe(({options:t})=>({key:"collaboration",blockNoteExtensions:[KH(t),Qh(t),yl(t),El(),JH(t)]}));let O1=!1;function ij(t,e){const n=[Wi.ClipboardTextSerializer,Wi.Commands,Wi.Editable,Wi.FocusEvents,Wi.Tabindex,KU,Kc.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute}),jV,k7,KV,GV,QV,E7.extend({inclusive:!1}).configure({defaultProtocol:nU,protocols:O1?[]:tU}),...Object.values(t.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:t})),XV,VV,JV,Le.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=t.getExtension(Rp))!=null&&r.shown()?!1:(t.blur(),!0)}})}),nj,ej.configure({editor:t,domAttributes:e.domAttributes}),YV.configure({editor:t,tabBehavior:e.tabBehavior}),tj.configure({domAttributes:e.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:t,domAttributes:e.domAttributes})]:[]]),zV(t),UV(t,e.pasteHandler||(r=>r.defaultPasteHandler())),SV(t)];return O1=!0,n}function sj(t,e){const n=[ew(),XH(e),Ir(e),Jh(e),eU(e),iU(),oU(e),T7(e),yU(e),Rp(e),...e.trailingBlock!==!1?[wU()]:[]];return e.collaboration?n.push(rj(e.collaboration)):n.push(ZH()),"table"in t.schema.blockSpecs&&n.push(SU(e)),e.animations!==!1&&n.push(lU()),n}class oj{constructor(e,n){he(this,"disabledExtensions",new Set),he(this,"extensions",[]),he(this,"abortMap",new Map),he(this,"extensionFactories",new Map),he(this,"extensionPlugins",new Map),this.editor=e,this.options=n,e.onMount(()=>{for(const r of this.extensions)if(r.mount){const i=new window.AbortController,s=r.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:i.signal});s&&i.signal.addEventListener("abort",()=>{s()}),this.abortMap.set(r,i)}}),e.onUnmount(()=>{for(const[r,i]of this.abortMap.entries())this.abortMap.delete(r),i.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of sj(this.editor,this.options))this.addExtension(r);for(const r of this.options.extensions??[])this.addExtension(r);for(const r of Object.values(this.editor.schema.blockSpecs))for(const i of r.extensions??[])this.addExtension(i)}registerExtension(e){var n;const r=[].concat(e).filter(Boolean);if(!r.length){console.warn("No extensions found to register",e);return}const i=r.map(o=>this.addExtension(o)).filter(Boolean),s=new Set;for(const o of i)o!=null&&o.tiptapExtensions&&console.warn(`Extension ${o.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),(n=o?.inputRules)!=null&&n.length&&console.warn(`Extension ${o.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),this.getProsemirrorPluginsFromExtension(o).plugins.forEach(a=>{s.add(a)});this.updatePlugins(o=>[...o,...s])}addExtension(e){let n;if(typeof e=="function"?n=e({editor:this.editor}):n=e,!(!n||this.disabledExtensions.has(n.key))){if(typeof e=="function"){const r=n[Dh];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(const r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(e){const n=[];if(typeof e=="function"){const r=this.extensionFactories.get(e);r&&n.push(r)}else if(Array.isArray(e))for(const r of e)n.push(...this.resolveExtensions(r));else if(typeof e=="object"&&"key"in e)n.push(e);else if(typeof e=="string"){const r=this.extensions.find(i=>i.key===e);r&&n.push(r)}return n}unregisterExtension(e){var n;const r=this.resolveExtensions(e);if(!r.length){console.warn("No extensions found to unregister",e);return}let i=!1;const s=new Set;for(const o of r){this.extensions=this.extensions.filter(l=>l!==o),this.extensionFactories.forEach((l,c)=>{l===o&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(o))==null||n.abort(),this.abortMap.delete(o);const a=this.extensionPlugins.get(o);a?.forEach(l=>{s.add(l)}),this.extensionPlugins.delete(o),o.tiptapExtensions&&!i&&(i=!0,console.warn(`Extension ${o.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,e))}this.updatePlugins(o=>o.filter(a=>!s.has(a)))}updatePlugins(e){const n=this.editor.prosemirrorState,r=n.reconfigure({plugins:e(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var e;const n=ij(this.editor,this.options).filter(s=>!this.disabledExtensions.has(s.name)),r=sw(this.extensions),i=new Map;for(const s of this.extensions){s.tiptapExtensions&&n.push(...s.tiptapExtensions);const o=r(s.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(s);a.length&&n.push(Le.create({name:s.key,priority:o,addProseMirrorPlugins:()=>a})),l.length&&(i.has(o)||i.set(o,[]),i.get(o).push(...l))}n.push(Le.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const s=[];return Array.from(i.keys()).sort().reverse().forEach(o=>{s.push(...i.get(o))}),[UU({rules:s})]}}));for(const s of((e=this.options._tiptapOptions)==null?void 0:e.extensions)??[])n.push(s);return n}getProsemirrorPluginsFromExtension(e){var n,r,i;const s=[...e.prosemirrorPlugins??[]],o=[];return!((n=e.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(e.keyboardShortcuts||{}).length&&!((r=e.inputRules)!=null&&r.length)?{plugins:s,inputRules:o}:(this.extensionPlugins.set(e,s),(i=e.inputRules)!=null&&i.length&&o.push(...e.inputRules.map(a=>new Ri(a.find,(l,c,u,d)=>{const h=a.replace({match:c,range:{from:u,to:d},editor:this.editor});if(h){const f=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[f.block.type].content!=="inline")return null;const p=sa(l.tr),g=l.tr.deleteRange(u,d);return uu(g,p.bnBlock.beforePos,h),g}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&s.push(oE(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:s,inputRules:o})}getExtensions(){return new Map(this.extensions.map(e=>[e.key,e]))}getExtension(e){if(typeof e=="string")return this.extensions.find(r=>r.key===e)||void 0;if(typeof e=="function")return this.extensionFactories.get(e)||void 0;throw new Error(`Invalid extension type: ${typeof e}`)}hasExtension(e){return typeof e=="string"?this.extensions.some(n=>n.key===e):typeof e=="object"&&"key"in e?this.extensions.some(n=>n.key===e.key):typeof e=="function"?this.extensionFactories.has(e):!1}}function aj(t,e){let{$from:n,$to:r}=e;if(n.pos>n.start()&&n.pos<t.content.size){const i=t.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);s&&(n=t.resolve(n.pos-s[0].length))}}if(r.pos<r.end()&&r.pos>0){const i=t.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);s&&(r=t.resolve(r.pos+s[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function lj(t){const e=He(t);if(t.selection.empty||"node"in t.selection)return;const n=t.doc.resolve(Rr(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Rr(t.doc,t.selection.to).posBeforeNode),i=(c,u)=>{const d=n.posAtIndex(c,u),h=t.doc.resolve(d).nodeAfter;if(!h)throw new Error(`Error getting selection - node not found at position ${d}`);return ve(h,e)},s=[],o=n.sharedDepth(r.pos),a=n.index(o),l=r.index(o);if(n.depth>o){s.push(ve(n.nodeAfter,e));for(let c=n.depth;c>o;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,d=n.node(c).childCount;for(let h=u;h<d;h++)s.push(i(h,c))}}else s.push(i(a,o));for(let c=a+1;c<=l;c++)s.push(i(c,o));if(s.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:s}}function cj(t,e,n){const r=typeof e=="string"?e:e.id,i=typeof n=="string"?n:n.id,s=He(t),o=oa(s);if(r===i)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=Vt(r,t.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=Vt(i,t.doc);if(!l)throw new Error(`Block with ID ${i} not found`);const c=Pr(a),u=Pr(l),d=o.blockSchema[c.blockNoteType],h=o.blockSchema[u.blockNoteType];if(!c.isBlockContainer||d.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||h.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${i})`);let f,p;if(d.content==="table"){const g=Ae.get(c.blockContent.node);f=c.blockContent.beforePos+g.positionAt(0,0,c.blockContent.node)+1+2}else f=c.blockContent.beforePos+1;if(h.content==="table"){const g=Ae.get(u.blockContent.node),b=u.blockContent.beforePos+g.positionAt(g.height-1,g.width-1,u.blockContent.node)+1,y=t.doc.resolve(b).nodeAfter.nodeSize;p=b+y-2}else p=u.blockContent.afterPos-1;t.setSelection(j.create(t.doc,f,p))}function uj(t,e=!1){const n=He(t),r=e?aj(t.doc,t.selection):t.selection;let i=r.$from,s=r.$to;for(;s.parentOffset>=s.parent.nodeSize-2&&s.depth>0;)s=t.doc.resolve(s.pos+1);for(;s.parentOffset===0&&s.depth>0;)s=t.doc.resolve(s.pos-1);for(;i.parentOffset===0&&i.depth>0;)i=t.doc.resolve(i.pos-1);for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=t.doc.resolve(i.pos+1);const o=sI(t.doc.slice(i.pos,s.pos,!0),n);return{_meta:{startPos:i.pos,endPos:s.pos},...o}}function dj(t){const{bnBlock:e}=sa(t),n=He(t.doc),r=t.doc.resolve(e.beforePos),i=r.nodeBefore,s=t.doc.resolve(e.afterPos).nodeAfter;let o;return r.depth>1&&(o=r.node(),o.type.isInGroup("bnBlock")||(o=r.node(r.depth-1))),{block:ve(e.node,n),prevBlock:i===null?void 0:ve(i,n),nextBlock:s===null?void 0:ve(s,n),parentBlock:o===void 0?void 0:ve(o,n)}}function $w(t,e,n="start"){const r=typeof e=="string"?e:e.id,i=He(t.doc),s=oa(i),o=Vt(r,t.doc);if(!o)throw new Error(`Block with ID ${r} not found`);const a=Pr(o),l=s.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){t.setSelection(W.create(t.doc,c.beforePos));return}if(l==="inline")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+1)):t.setSelection(j.create(t.doc,c.afterPos-1));else if(l==="table")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+4)):t.setSelection(j.create(t.doc,c.afterPos-4));else throw new Pn(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;$w(t,c.attrs.id,n)}}class hj{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>lj(e))}getSelectionCutBlocks(e=!1){return this.editor.transact(n=>uj(n,e))}setSelection(e,n){return this.editor.transact(r=>cj(r,e,n))}getTextCursorPosition(){return this.editor.transact(e=>dj(e))}setTextCursorPosition(e,n="start"){return this.editor.transact(r=>$w(r,e,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:e}=this.editor.prosemirrorState,{ranges:n}=e,r=Math.min(...n.map(s=>s.$from.pos)),i=Math.max(...n.map(s=>s.$to.pos));if(rN(e)){const s=this.editor.prosemirrorView.nodeDOM(r);if(s)return s.getBoundingClientRect()}return wE(this.editor.prosemirrorView,r,i).toJSON()}}class fj{constructor(e){he(this,"activeTransaction",null),he(this,"isInCan",!1),this.editor=e}can(e){try{return this.isInCan=!0,e()}finally{this.isInCan=!1}}exec(e){if(this.activeTransaction)throw new Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(e);const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,i=>this.prosemirrorView.dispatch(i),r)}canExec(e){if(this.activeTransaction)throw new Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,void 0,r)}transact(e){if(this.activeTransaction)return e(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;const n=e(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw new Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var e;return((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}focus(){var e;(e=this.prosemirrorView)==null||e.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(e){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==e&&this.editor._tiptapEditor.setEditable(e)}undo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.undoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw new Error("No undo plugin found")}redo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.redoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw new Error("No redo plugin found")}}function pj(t,e,n,r={updateSelection:!0}){let{from:i,to:s}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},o=!0,a=!0,l="";if(n.forEach(c=>{c.check(),o&&c.isText&&c.marks.length===0?l+=c.text:o=!1,a=a?c.isBlock:!1}),i===s&&a){const{parent:c}=t.doc.resolve(i);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(i-=1,s+=1)}return o?t.insertText(l,i,s):t.replaceWith(i,s,n),r.updateSelection&&hE(t,t.steps.length-1,-1),!0}class mj{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:n=!1}={}){const r=bn(e,this.editor.pmSchema);this.editor.transact(i=>{pj(i,{from:i.selection.from,to:i.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(e=>{const n={},r=e.selection.$to.marks();for(const i of r){const s=this.editor.schema.styleSchema[i.type.name];if(!s){i.type.name!=="link"&&!i.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",i.type.name);continue}s.propSchema==="boolean"?n[s.type]=!0:n[s.type]=i.attrs.stringValue}return n})}addStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}removeStyles(e){for(const n of Object.keys(e))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}getSelectedText(){return this.editor.transact(e=>e.doc.textBetween(e.selection.from,e.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(e,n){if(e==="")return;const r=this.editor.pmSchema.mark("link",{href:e});this.editor.transact(i=>{const{from:s,to:o}=i.selection;n?i.insertText(n,s,o).addMark(s,s+n.length,r):i.setSelection(j.create(i.doc,o)).addMark(s,o,r)})}}function gj(t,e){const n=[];return t.forEach((r,i,s)=>{s!==e&&n.push(r)}),M.from(n)}function bj(t,e){const n=[];for(let r=0;r<t.childCount;r++)if(t.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){const i=n[n.length-1],s=i.copy(i.content.addToEnd(t.child(r)));n[n.length-1]=s}else{const i=e.nodes.table.createChecked(void 0,t.child(r));n.push(i)}else n.push(t.child(r));return t=M.from(n),t}function yj(t,e){let n=M.from(t.content);if(n=bj(n,e.state.schema),!Ej(n,e))return new F(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const i=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const o=n.child(r+1).child(0).child(0);(o.type.name==="bulletListItem"||o.type.name==="numberedListItem"||o.type.name==="checkListItem")&&(i.push(n.child(r+1)),n=gj(n,r+1))}const s=e.state.schema.nodes.blockContainer.createChecked(void 0,i);n=n.replaceChild(r,s)}return new F(n,t.openStart,t.openEnd)}function Ej(t,e){var n,r;const i=t.childCount===1,s=((n=t.firstChild)==null?void 0:n.type.spec.content)==="inline*",o=((r=t.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(i){if(s)return!1;if(o){const a=xt(e.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const kj={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class zw extends aw{constructor(e){var n,r,i,s,o,a,l,c,u,d;super(),he(this,"pmSchema"),he(this,"_tiptapEditor"),he(this,"elementRenderer",null),he(this,"blockCache",new WeakMap),he(this,"dictionary"),he(this,"schema"),he(this,"blockImplementations"),he(this,"inlineContentImplementations"),he(this,"styleImplementations"),he(this,"uploadFile"),he(this,"onUploadStartCallbacks",[]),he(this,"onUploadEndCallbacks",[]),he(this,"resolveFileUrl"),he(this,"settings"),he(this,"_blockManager"),he(this,"_eventManager"),he(this,"_exportManager"),he(this,"_extensionManager"),he(this,"_selectionManager"),he(this,"_stateManager"),he(this,"_styleManager"),he(this,"unregisterExtension",(...T)=>this._extensionManager.unregisterExtension(...T)),he(this,"registerExtension",(...T)=>this._extensionManager.registerExtension(...T)),he(this,"getExtension",(...T)=>this._extensionManager.getExtension(...T)),he(this,"mount",T=>{this._tiptapEditor.mount({mount:T})}),he(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||BU,this.settings={tables:{splitCells:((n=e?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=e?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((i=e?.tables)==null?void 0:i.cellTextColor)??!1,headers:((s=e?.tables)==null?void 0:s.headers)??!1}};const h={defaultStyles:!0,schema:e.schema||vU.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=h.schema,this.blockImplementations=h.schema.blockSpecs,this.inlineContentImplementations=h.schema.inlineContentSpecs,this.styleImplementations=h.schema.styleSpecs,h.uploadFile){const T=h.uploadFile;this.uploadFile=async(S,D)=>{this.onUploadStartCallbacks.forEach(I=>I.apply(this,[D]));try{return await T(S,D)}finally{this.onUploadEndCallbacks.forEach(I=>I.apply(this,[D]))}}}this.resolveFileUrl=h.resolveFileUrl,this._eventManager=new uV(this),this._extensionManager=new oj(this,h);const f=this._extensionManager.getTiptapExtensions(),p=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");p&&h.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const g={...kj,...h._tiptapOptions,element:null,autofocus:h.autofocus??!1,extensions:f,editorProps:{...(o=h._tiptapOptions)==null?void 0:o.editorProps,attributes:{tabIndex:"0",...(l=(a=h._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=h.domAttributes)==null?void 0:c.editor,class:Ur("bn-editor",h.defaultStyles?"bn-default-styles":"",((d=(u=h.domAttributes)==null?void 0:u.editor)==null?void 0:d.class)||"")},transformPasted:yj}};try{const T=h.initialContent||(p?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Kc.options.generateID()}]);if(!Array.isArray(T)||T.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+T);const S=Q_(g.extensions),D=T.map(A=>Ii(A,S,this.schema.styleSchema).toJSON()),I=vl({type:"doc",content:[{type:"blockGroup",content:D}]},S,g.parseOptions);this._tiptapEditor=new $N({...g,content:I.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(T){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:T})}let b;const y=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...T)=>{if(b)return b;const S=y.apply(this.pmSchema.nodes.doc,T),D=JSON.parse(JSON.stringify(S.toJSON()));return D.content[0].content[0].attrs.id="initialBlockId",b=Zt.fromJSON(this.pmSchema,D),b},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new cV(this),this._exportManager=new kV(this),this._selectionManager=new hj(this),this._stateManager=new fj(this),this._styleManager=new mj(this),this.emit("create")}static create(e){return new zw(e??{})}get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var e;if(!this.headless)return(e=this.prosemirrorView)==null?void 0:e.dom}isFocused(){var e;return this.headless?!1:((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){var e;this.headless||(e=this.domElement)==null||e.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{const n=this.onUploadStartCallbacks.indexOf(e);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{const n=this.onUploadEndCallbacks.indexOf(e);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,n=!1){this._blockManager.forEachBlock(e,n)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}onBeforeChange(e){return this._extensionManager.getExtension(ew).subscribe(e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(e=!1){return this._selectionManager.getSelectionCutBlocks(e)}setSelection(e,n){return this._selectionManager.setSelection(e,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,n,r="before"){return this._blockManager.insertBlocks(e,n,r)}updateBlock(e,n){return this._blockManager.updateBlock(e,n)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,n){return this._blockManager.replaceBlocks(e,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,n){this._styleManager.createLink(e,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,n){return this._eventManager.onChange(e,n)}onSelectionChange(e,n){return this._eventManager.onSelectionChange(e,n)}onMount(e){this._eventManager.onMount(e)}onUnmount(e){this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){const e=this.document;return e.length===0||e.length===1&&e[0].type==="paragraph"&&e[0].content.length===0}pasteHTML(e,n=!1){this._exportManager.pasteHTML(e,n)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}}export{Jl as $,Bj as A,Pj as B,Qv as C,ce as D,tU as E,nU as F,Vt as G,Fj as H,Ir as I,Po as J,Uj as K,zw as L,Tn as M,xj as N,sh as O,me as P,Lp as Q,Lj as R,ih as S,v0 as T,qf as U,vU as V,$T as W,GL as X,Jv as Y,bn as Z,Rp as _,pe as a,Aj as a0,Ij as a1,gR as a2,zT as a3,te as b,T7 as c,Ee as d,aw as e,Mi as f,_h as g,Ll as h,Ur as i,Cn as j,Mj as k,Dj as l,sn as m,Rj as n,ye as o,Jh as p,wE as q,Ye as r,SU as s,dr as t,eU as u,yU as v,Qf as w,vj as x,Ie as y,Oj as z};