@junbyeol/tiptap-editor 0.1.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 (82) hide show
  1. package/README.md +73 -0
  2. package/dist/index.cjs +215 -0
  3. package/dist/index.mjs +28278 -0
  4. package/dist/style.css +1 -0
  5. package/dist/types/components/custom/color-text-popover.d.ts +11 -0
  6. package/dist/types/components/custom/table-cell-background-color-popover.d.ts +11 -0
  7. package/dist/types/components/custom/variables.d.ts +41 -0
  8. package/dist/types/components/tiptap-icons/align-center-icon.d.ts +3 -0
  9. package/dist/types/components/tiptap-icons/align-justify-icon.d.ts +3 -0
  10. package/dist/types/components/tiptap-icons/align-left-icon.d.ts +3 -0
  11. package/dist/types/components/tiptap-icons/align-right-icon.d.ts +3 -0
  12. package/dist/types/components/tiptap-icons/bold-icon.d.ts +3 -0
  13. package/dist/types/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
  14. package/dist/types/components/tiptap-icons/code2-icon.d.ts +3 -0
  15. package/dist/types/components/tiptap-icons/heading-five-icon.d.ts +3 -0
  16. package/dist/types/components/tiptap-icons/heading-four-icon.d.ts +3 -0
  17. package/dist/types/components/tiptap-icons/heading-icon.d.ts +3 -0
  18. package/dist/types/components/tiptap-icons/heading-one-icon.d.ts +3 -0
  19. package/dist/types/components/tiptap-icons/heading-six-icon.d.ts +3 -0
  20. package/dist/types/components/tiptap-icons/heading-three-icon.d.ts +3 -0
  21. package/dist/types/components/tiptap-icons/heading-two-icon.d.ts +3 -0
  22. package/dist/types/components/tiptap-icons/italic-icon.d.ts +3 -0
  23. package/dist/types/components/tiptap-icons/list-icon.d.ts +3 -0
  24. package/dist/types/components/tiptap-icons/list-ordered-icon.d.ts +3 -0
  25. package/dist/types/components/tiptap-icons/list-todo-icon.d.ts +3 -0
  26. package/dist/types/components/tiptap-icons/redo2-icon.d.ts +3 -0
  27. package/dist/types/components/tiptap-icons/strike-icon.d.ts +3 -0
  28. package/dist/types/components/tiptap-icons/subscript-icon.d.ts +3 -0
  29. package/dist/types/components/tiptap-icons/superscript-icon.d.ts +3 -0
  30. package/dist/types/components/tiptap-icons/underline-icon.d.ts +3 -0
  31. package/dist/types/components/tiptap-icons/undo2-icon.d.ts +3 -0
  32. package/dist/types/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
  33. package/dist/types/components/tiptap-ui/heading-button/index.d.ts +2 -0
  34. package/dist/types/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
  35. package/dist/types/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
  36. package/dist/types/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  37. package/dist/types/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
  38. package/dist/types/components/tiptap-ui/list-button/index.d.ts +2 -0
  39. package/dist/types/components/tiptap-ui/list-button/list-button.d.ts +23 -0
  40. package/dist/types/components/tiptap-ui/list-button/use-list.d.ts +97 -0
  41. package/dist/types/components/tiptap-ui/mark-button/index.d.ts +2 -0
  42. package/dist/types/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
  43. package/dist/types/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
  44. package/dist/types/components/tiptap-ui/text-align-button/index.d.ts +2 -0
  45. package/dist/types/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
  46. package/dist/types/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
  47. package/dist/types/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
  48. package/dist/types/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
  49. package/dist/types/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
  50. package/dist/types/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
  51. package/dist/types/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
  52. package/dist/types/components/tiptap-ui-primitive/button/button.d.ts +17 -0
  53. package/dist/types/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  54. package/dist/types/components/tiptap-ui-primitive/card/card.d.ts +9 -0
  55. package/dist/types/components/tiptap-ui-primitive/card/index.d.ts +1 -0
  56. package/dist/types/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
  57. package/dist/types/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  58. package/dist/types/components/tiptap-ui-primitive/label/index.d.ts +1 -0
  59. package/dist/types/components/tiptap-ui-primitive/label/label.d.ts +11 -0
  60. package/dist/types/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  61. package/dist/types/components/tiptap-ui-primitive/popover/popover.d.ts +5 -0
  62. package/dist/types/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  63. package/dist/types/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
  64. package/dist/types/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  65. package/dist/types/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
  66. package/dist/types/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
  67. package/dist/types/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
  68. package/dist/types/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
  69. package/dist/types/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
  70. package/dist/types/hooks/use-composed-ref.d.ts +3 -0
  71. package/dist/types/hooks/use-is-breakpoint.d.ts +9 -0
  72. package/dist/types/hooks/use-menu-navigation.d.ts +52 -0
  73. package/dist/types/hooks/use-tiptap-editor.d.ts +17 -0
  74. package/dist/types/index.d.ts +2 -0
  75. package/dist/types/lib/index.d.ts +5 -0
  76. package/dist/types/lib/tiptap-utils.d.ts +168 -0
  77. package/dist/types/tiptap/extensions/default-file-attachment.d.ts +2 -0
  78. package/dist/types/tiptap/extensions/file-attachment.d.ts +13 -0
  79. package/dist/types/tiptap/index.d.ts +29 -0
  80. package/dist/types/tiptap/menubar.d.ts +4 -0
  81. package/dist/vite.svg +1 -0
  82. package/package.json +86 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,215 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),E=require("react"),Ks=require("react-dom");function Lf(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const v=Lf(E),Ta=Lf(Ks);var co={exports:{}},Ni={};var Yc;function _0(){if(Yc)return Ni;Yc=1;var t=E;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,s=t.useLayoutEffect,i=t.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,g=p[1];return s(function(){m.value=h,m.getSnapshot=f,a(m)&&g({inst:m})},[d,h,f]),o(function(){return a(m)&&g({inst:m}),d(function(){a(m)&&g({inst:m})})},[d]),i(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Ni.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ni}var Oi={};var Xc;function H0(){return Xc||(Xc=1,process.env.NODE_ENV!=="production"&&(function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var g=p();s(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}g=i({inst:{value:m,getSnapshot:p}});var y=g[0].inst,C=g[1];return a(function(){y.value=m,y.getSnapshot=p,n(y)&&C({inst:y})},[h,m,p]),l(function(){return n(y)&&C({inst:y}),h(function(){n(y)&&C({inst:y})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!s(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=E,s=typeof Object.is=="function"?Object.is:t,i=o.useState,l=o.useEffect,a=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;Oi.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Oi}var Qc;function Aa(){return Qc||(Qc=1,process.env.NODE_ENV==="production"?co.exports=_0():co.exports=H0()),co.exports}var _f=Aa();function xe(t){this.content=t}xe.prototype={constructor:xe,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,o=r.find(t),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new xe(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 xe(n)},addToStart:function(t,e){return new xe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new xe(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new xe(o)},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=xe.from(t),t.size?new xe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=xe.from(t),t.size?new xe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=xe.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}};xe.from=function(t){if(t instanceof xe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xe(e)};function Hf(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=Hf(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function jf(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=t.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||l.content.size){let c=jf(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class T{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,o=0,s){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",i=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!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,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new T(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let s=0,i=0;i<n;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,n-i-1))),r.push(l),o+=l.nodeSize),i=a}return new T(r,o)}cutByIndex(e,n){return e==n?T.empty:e==0&&n==this.content.length?this:new T(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new T(o,s)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Hf(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return jf(this,e,n,r)}findIndex(e){if(e==0)return uo(0,e);if(e==this.size)return uo(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 o=this.child(n),s=r+o.nodeSize;if(s>=e)return s==e?uo(n+1,s):uo(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 T.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new T(n||e,r)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Ii={index:0,offset:0};function uo(t,e){return Ii.index=t,Ii.offset=e,Ii}function Go(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(!Go(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Go(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let X=class Ml{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),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&&Go(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 o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 Ml.none;if(e instanceof Ml)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};X.none=[];class Jo extends Error{}class D{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=zf(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Bf(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 D.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(T.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=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)o++;return new D(e,r,o)}}D.empty=new D(T.empty,0,0);function Bf(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:i,offset:l}=t.findIndex(n);if(o==e||s.isText){if(l!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Bf(s.content,e-o-1,n-o-1)))}function zf(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),i=t.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=zf(i.content,e-s-1,n,i);return l&&t.replaceChild(o,i.copy(l))}function j0(t,e,n){if(n.openStart>t.depth)throw new Jo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Jo("Inconsistent open depths");return $f(t,e,n,0)}function $f(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let i=$f(t,e,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,l=i.content;return gn(i,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=B0(n,t);return gn(s,Vf(t,i,l,e,r))}else return gn(s,Zo(t,e,r))}function Ff(t,e){if(!e.type.compatibleContent(t.type))throw new Jo("Cannot join "+e.type.name+" onto "+t.type.name)}function Tl(t,e,n){let r=t.node(n);return Ff(r,e.node(n)),r}function mn(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 Sr(t,e,n,r){let o=(e||t).node(n),s=0,i=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(mn(t.nodeAfter,r),s++));for(let l=s;l<i;l++)mn(o.child(l),r);e&&e.depth==n&&e.textOffset&&mn(e.nodeBefore,r)}function gn(t,e){return t.type.checkContent(e),t.copy(e)}function Vf(t,e,n,r,o){let s=t.depth>o&&Tl(t,e,o+1),i=r.depth>o&&Tl(n,r,o+1),l=[];return Sr(null,t,o,l),s&&i&&e.index(o)==n.index(o)?(Ff(s,i),mn(gn(s,Vf(t,e,n,r,o+1)),l)):(s&&mn(gn(s,Zo(t,e,o+1)),l),Sr(e,n,o,l),i&&mn(gn(i,Zo(n,r,o+1)),l)),Sr(r,null,o,l),new T(l)}function Zo(t,e,n){let r=[];if(Sr(null,t,n,r),t.depth>n){let o=Tl(t,e,n+1);mn(gn(o,Zo(t,e,n+1)),r)}return Sr(e,null,n,r),new T(r)}function B0(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(T.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Lr{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return X.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.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 Yo(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=[],o=0,s=n;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),c=s-a;if(r.push(i,l,o+a),!c||(i=i.child(l),i.isText))break;s=c-1,o+=a+1}return new Lr(n,r,s)}static resolveCached(e,n){let r=eu.get(e);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else eu.set(e,r=new z0);let o=r.elts[r.i]=Lr.resolve(e,n);return r.i=(r.i+1)%$0,o}}class z0{constructor(){this.elts=[],this.i=0}}const $0=12,eu=new WeakMap;class Yo{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 F0=Object.create(null);let Ut=class Al{constructor(e,n,r,o=X.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||T.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&Go(this.attrs,n||e.defaultAttrs||F0)&&X.sameSet(this.marks,r||X.none)}copy(e=null){return e==this.content?this:new Al(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Al(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 D.empty;let o=this.resolve(e),s=this.resolve(n),i=r?0:o.sharedDepth(n),l=o.start(i),c=o.node(i).content.cut(o.pos-l,s.pos-l);return new D(c,o.depth-i,s.depth-i)}replace(e,n,r){return j0(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Lr.resolveCached(this,e)}resolveNoCache(e){return Lr.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),Wf(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=T.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.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=X.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(!X.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 o=T.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Ut.prototype.text=void 0;class Xo extends Ut{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Wf(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 Xo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xo(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 Wf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Cn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new V0(e,n);if(r.next==null)return Cn.empty;let o=Uf(r);r.next&&r.err("Unexpected trailing text");let s=Z0(J0(o));return Y0(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 o=this;for(let s=n;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}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 o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!n||a.validEnd))return T.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=s(d,l.concat(u));if(f)return f}}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 o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
2
+ `)}}Cn.empty=new Cn(!0);class V0{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 Uf(t){let e=[];do e.push(W0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function W0(t){let e=[];do e.push(U0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function U0(t){let e=G0(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=K0(t,e);else break;return e}function tu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function K0(t,e){let n=tu(t),r=n;return t.eat(",")&&(t.next!="}"?r=tu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function q0(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(e)&&o.push(i)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function G0(t){if(t.eat("(")){let e=Uf(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=q0(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 J0(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function o(i,l){i.forEach(a=>a.to=l)}function s(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=s(i.exprs[a],l);if(a==i.exprs.length-1)return c;o(c,l=n())}else if(i.type=="star"){let a=n();return r(l,a),o(s(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=n();return o(s(i.expr,l),a),o(s(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(s(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=n();o(s(i.expr,a),u),a=u}if(i.max==-1)o(s(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=n();r(a,u),o(s(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Kf(t,e){return e-t}function nu(t,e){let n=[];return r(e),n.sort(Kf);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:l,to:a}=s[i];!l&&n.indexOf(a)==-1&&r(a)}}}function Z0(t){let e=Object.create(null);return n(nu(t,0));function n(r){let o=[];r.forEach(i=>{t[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);nu(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Cn(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let l=o[i][1].sort(Kf);s.next.push({type:o[i][0],next:e[l.join(",")]||n(l)})}return s}}function Y0(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];i.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qf(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 Gf(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Jf(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function Zf(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Q0(t,r,e[r]);return n}let ru=class Yf{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=Zf(e,r.attrs),this.defaultAttrs=qf(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==Cn.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:Gf(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ut(this,this.computeAttrs(e),T.from(n),X.setFrom(r))}createChecked(e=null,n,r){return n=T.from(n),this.checkContent(n),new Ut(this,this.computeAttrs(e),n,X.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=T.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(T.empty,!0);return s?new Ut(this,e,n.append(s),X.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){Jf(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:X.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new Yf(s,n,i));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");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 X0(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Q0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?X0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class qs{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Zf(e,o.attrs),this.excluded=null;let s=qf(this.attrs);this.instance=s?new X(this,s):null}create(e=null){return!e&&this.instance?this.instance:new X(this,Gf(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new qs(s,o++,n,i)),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){Jf(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=xe.from(e.nodes),n.marks=xe.from(e.marks||{}),this.nodes=ru.compile(this.spec.nodes,this),this.marks=qs.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=Cn.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ou(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:ou(this,i.split(" "))}this.nodeFromJSON=o=>Ut.fromJSON(this,o),this.markFromJSON=o=>X.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ru){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,o)}text(e,n){let r=this.nodes.text;return new Xo(r,r.defaultAttrs,e,X.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 ou(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],i=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ey(t){return t.tag!=null}function ty(t){return t.style!=null}class Kt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(ey(o))this.tags.push(o);else if(ty(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new iu(this,n,!1);return r.addAll(e,X.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new iu(this,n,!0);return r.addAll(e,X.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(oy(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(i.getAttrs){let a=i.getAttrs(n);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let l=n[i];if((l.priority==null?50:l.priority)<s)break}n.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=lu(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=lu(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Kt(e,Kt.schemaRules(e)))}}const Qf={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},ny={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eh={ol:!0,ul:!0},_r=1,Rl=2,Er=4;function su(t,e,n){return e!=null?(e?_r:0)|(e==="full"?Rl:0):t&&t.whitespace=="pre"?_r|Rl:n&~Er}class fo{constructor(e,n,r,o,s,i){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=X.none,this.match=s||(i&Er?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(T.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&_r)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=T.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(T.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&&!Qf.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class iu{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=su(null,n.preserveWhitespace,0)|(r?Er:0);o?s=new fo(o.type,o.attrs,X.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new fo(null,null,X.none,!0,null,i):s=new fo(e.schema.topNodeType,null,X.none,!0,null,i),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,o=this.top,s=o.options&Rl?"full":this.localPreserveWS||(o.options&_r)>0,{schema:i}=this.parser;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(i.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;eh.hasOwnProperty(i)&&this.parser.normalizeLists&&ry(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ny.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Qf.hasOwnProperty(i))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=a&&a.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,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
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 o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(s,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];i!=l;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],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 o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let i=X.none;for(let l of o.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):au(l.type,e.type))&&(i=l.addToSet(i));return s.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=su(e,s,i.options);i.options&Er&&i.content.length==0&&(l|=Er);let a=X.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):au(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new fo(e,n,a,o,null,l)),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|=_r)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(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 ry(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&eh.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function oy(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lu(t){let e={};for(let n in t)e[n]=t[n];return e}function au(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],i=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&i(u))return!0}};if(i(o.contentMatch))return!0}}class An{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Di(n).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let l=0,a=0;for(;l<s.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)o=s.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,n);u&&(s.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=_o(Di(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&_o(Di(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return _o(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new An(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=cu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return cu(e.marks)}}function cu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Di(t){return t.document||window.document}const uu=new WeakMap;function sy(t){let e=uu.get(t);return e===void 0&&uu.set(t,e=iy(t)),e}function iy(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function _o(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 o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=sy(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 i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),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 f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=_o(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const th=65535,nh=Math.pow(2,16);function ly(t,e){return t+e*nh}function du(t){return t&th}function ay(t){return(t-(t&th))/nh}const rh=1,oh=2,Ho=4,sh=8;class Nl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&sh)>0}get deletedBefore(){return(this.delInfo&(rh|Ho))>0}get deletedAfter(){return(this.delInfo&(oh|Ho))>0}get deletedAcross(){return(this.delInfo&Ho)>0}}class Fe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fe.empty)return Fe.empty}recover(e){let n=0,r=du(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+ay(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 o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:ly(l/3,e-a),m=e==a?oh:e==d?rh:Ho;return(n<0?e!=a:e!=d)&&(m|=sh),new Nl(h,m,p)}o+=u-c}return r?e+o:new Nl(e+o,0,null)}touches(e,n){let r=0,o=du(n),s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],l=i-(this.inverted?s:0),a=i+(this.inverted?0:s),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new Fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fe.empty:new Fe(e<0?[0,-e,0]:[0,0,e])}}Fe.empty=new Fe([]);class Hr{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Hr(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Hr;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 o=0;for(let s=this.from;s<this.to;s++){let i=this._maps[s],l=i.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Nl(e,o,null)}}const Pi=Object.create(null);class Oe{getMap(){return Fe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pi[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 Pi)throw new RangeError("Duplicate use of step JSON ID "+e);return Pi[e]=n,n.prototype.jsonID=e,n}}class pe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,n,r,o){try{return pe.ok(e.replace(n,r,o))}catch(s){if(s instanceof Jo)return pe.fail(s.message);throw s}}}function Ra(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(Ra(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return T.fromArray(r)}class Ft extends Oe{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),o=r.node(r.sharedDepth(this.to)),s=new D(Ra(n.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,s)}invert(){return new tt(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 Ft(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(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 Ft(n.from,n.to,e.markFromJSON(n.mark))}}Oe.jsonID("addMark",Ft);class tt extends Oe{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 D(Ra(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new Ft(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 tt(n.pos,r.pos,this.mark)}merge(e){return e instanceof tt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tt(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 tt(n.from,n.to,e.markFromJSON(n.mark))}}Oe.jsonID("removeMark",tt);class Vt extends Oe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(T.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Vt(this.pos,n.marks[o]);return new Vt(this.pos,this.mark)}}return new wn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vt(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 Vt(n.pos,e.markFromJSON(n.mark))}}Oe.jsonID("addNodeMark",Vt);class wn extends Oe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(T.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Vt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wn(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 wn(n.pos,e.markFromJSON(n.mark))}}Oe.jsonID("removeNodeMark",wn);class ye extends Oe{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Ol(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new ye(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 ye(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ye)||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?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ye(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?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ye(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 ye(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}Oe.jsonID("replace",ye);class ve extends Oe{constructor(e,n,r,o,s,i,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Ol(e,this.from,this.gapFrom)||Ol(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new Fe([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 ve(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),o=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||o<n.pos||s>r.pos?null:new ve(n.pos,r.pos,o,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 ve(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}Oe.jsonID("replaceAround",ve);function Ol(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function cy(t,e,n,r){let o=[],s=[],i,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[m])?i.to=h:o.push(i=new tt(f,h,d[m])));l&&l.to==f?l.to=h:s.push(l=new Ft(f,h,r))}}),o.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function uy(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(i,l)=>{if(!i.isInline)return;s++;let a=null;if(r instanceof qs){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==s-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=s):o.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),o.forEach(i=>t.step(new tt(i.from,i.to,i.style)))}function Na(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new ye(l,u,D.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new tt(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new D(T.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new ye(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(T.empty,!0);t.replace(l,l,new D(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function dy(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ir(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,s=0;;--r){let i=t.$from.node(r),l=t.$from.index(r)+o,a=t.$to.indexAfter(r)-s;if(r<t.depth&&i.canReplace(l,a,n))return r;if(r==0||i.type.spec.isolating||!dy(i,l,a))break;l&&(o=1),a<i.childCount&&(s=1)}return null}function fy(t,e,n){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),l=o.after(s+1),a=i,c=l,u=T.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=T.from(r.node(p).copy(u)),d++):a--;let f=T.empty,h=0;for(let p=s,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=T.from(o.node(p).copy(f)),h++):c++;t.step(new ve(a,c,i,l,new D(u.append(f),d,h),u.size-d,!0))}function Oa(t,e,n=null,r=t){let o=hy(t,e),s=o&&py(r,e);return s?o.map(fu).concat({type:e,attrs:n}).concat(s.map(fu)):null}function fu(t){return{type:t,attrs:null}}function hy(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return n.canReplaceWith(r,o,i)?s:null}function py(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:i}function my(t,e,n){let r=T.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let l=n[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=T.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new ve(o,s,o,s,new D(r,0,0),n.length,!0))}function gy(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(i,l)=>{let a=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,a)&&yy(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&lh(t,i,l,s),Na(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(l,1),f=u.map(l+i.nodeSize,1);return t.step(new ve(d,f,d+1,f-1,new D(T.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&ih(t,i,l,s),!1}})}function ih(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+s+i.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function lh(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text(`
5
+ `))}})}function yy(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function by(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ve(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new D(T.from(i),0,0),1,!0))}function St(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>s;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(s),a=r&&r[0];return o.node(s).canReplaceWith(l,l,a?a.type:o.node(s+1).type)}function vy(t,e,n=1,r){let o=t.doc.resolve(e),s=T.empty,i=T.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){s=T.from(o.node(l).copy(s));let u=r&&r[c];i=T.from(u?u.type.create(u.attrs,i):o.node(l).copy(i))}t.step(new ye(e,e,new D(s.append(i),n,n),!0))}function tn(t,e){let n=t.resolve(e),r=n.index();return ah(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),i=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ah(t,e){return!!(t&&e&&!t.isLeaf&&Cy(t,e))}function Gs(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,i,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):n>0?(s=r.node(o+1),l++,i=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),i=r.node(o+1)),s&&!s.isTextblock&&ah(s,i)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function wy(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),i=s.node().type;if(o&&i.inlineContent){let u=i.whitespace=="pre",d=!!i.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);lh(t,u.node(),u.before(),l)}i.inlineContent&&Na(t,e+n-1,i,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ye(c,a.map(e+n,-1),D.empty,!0)),r===!0){let u=t.doc.resolve(c);ih(t,u.node(),u.before(),t.steps.length)}return t}function xy(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function ch(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),c=r.node(i),u=!1;if(s==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function Js(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return uh(o,s,r)?new ye(e,n,r):new Sy(o,s,r).fit()}function uh(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Sy{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=T.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,l=o.depth;for(;i&&l&&s.childCount==1;)s=s.firstChild.content,i--,l--;let a=new D(s,i,l);return e>-1?new ve(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ye(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=Li(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(i?c.matchType(i.type)||(d=c.fillBefore(T.from(i),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Li(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Li(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new D(gr(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new D(gr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(i.content.size-i.openEnd);for(;c<l.childCount;){let m=l.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(d=g,u.push(dh(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=yr(this.placed,n,T.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?D.empty:new D(gr(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new D(gr(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_i(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),i=_i(e,n,o,r,s);if(i){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=_i(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=yr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=yr(this.placed,this.depth,T.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(T.empty,!0);n.childCount&&(this.placed=yr(this.placed,this.frontier.length,n))}}function gr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gr(t.firstChild.content,e-1,n)))}function yr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(yr(t.lastChild.content,e-1,n)))}function Li(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function dh(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,dh(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),t.copy(r)}function _i(t,e,n,r,o){let s=t.node(e),i=o?t.indexAfter(e):t.index(e);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,i);return l&&!Ey(n,s.content,i)?l:null}function Ey(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function ky(t){return t.spec.defining||t.spec.definingForContent}function My(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(uh(o,s,r))return t.step(new ye(e,n,r));let i=hh(o,s);i[i.length-1]==0&&i.pop();let l=-(o.depth+1);i.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;i.indexOf(f)>-1?l=f:o.before(f)==h&&i.splice(1,0,-f)}let a=i.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=ky(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<i.length;m++){let g=i[(m+a)%i.length],y=!0;g<0&&(y=!1,g=-g);let C=o.node(g-1),w=o.index(g-1);if(C.canReplaceWith(w,w,p.type,p.marks))return t.replace(o.before(g),y?s.after(g):n,new D(fh(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=i.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=i[f];h<0||(e=o.before(h),n=s.after(h))}}function fh(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(fh(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(t).append(t);t=i.append(s.matchFragment(i).fillBefore(T.empty,!0))}return t}function Ty(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=xy(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new D(T.from(r),0,0))}function Ay(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=hh(r,o);for(let i=0;i<s.length;i++){let l=s[i],a=i==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}function hh(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Kn extends Oe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return pe.fromReplace(e,this.pos,this.pos+1,new D(T.from(o),0,n.isLeaf?0:1))}getMap(){return Fe.empty}invert(e){return new Kn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Kn(n.pos,n.attr,n.value)}}Oe.jsonID("attr",Kn);class jr extends Oe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return pe.ok(r)}getMap(){return Fe.empty}invert(e){return new jr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new jr(n.attr,n.value)}}Oe.jsonID("docAttr",jr);let Zn=class extends Error{};Zn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Zn.prototype=Object.create(Error.prototype);Zn.prototype.constructor=Zn;Zn.prototype.name="TransformError";class Ia{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Zn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((s,i,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let o=Js(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new D(T.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return My(this,e,n,r),this}replaceRangeWith(e,n,r){return Ty(this,e,n,r),this}deleteRange(e,n){return Ay(this,e,n),this}lift(e,n){return fy(this,e,n),this}join(e,n=1){return wy(this,e,n),this}wrap(e,n){return my(this,e,n),this}setBlockType(e,n=e,r,o=null){return gy(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return by(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Kn(e,n,r)),this}setDocAttribute(e,n){return this.step(new jr(e,n)),this}addNodeMark(e,n){return this.step(new Vt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof X)n.isInSet(r.marks)&&this.step(new wn(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new wn(e,s)),o=s.removeFromSet(o);for(let l=i.length-1;l>=0;l--)this.step(i[l])}return this}split(e,n=1,r){return vy(this,e,n,r),this}addMark(e,n,r){return cy(this,e,n,r),this}removeMark(e,n,r){return uy(this,e,n,r),this}clearIncompatible(e,n,r){return Na(this,e,n,r),this}}const Hi=Object.create(null);class V{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ph(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?D.empty:n),l==0&&mu(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:l}=o[s],a=e.mapping.slice(r),c=a.map(i.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),mu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new B(e):Bn(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=n<0?Bn(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Bn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(i)return i}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new He(e.node(0))}static atStart(e){return Bn(e,e,0,0,1)||new He(e)}static atEnd(e){return Bn(e,e,e.content.size,e.childCount,-1)||new He(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Hi[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Hi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Hi[e]=n,n.prototype.jsonID=e,n}getBookmark(){return B.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class ph{constructor(e,n){this.$from=e,this.$to=n}}let hu=!1;function pu(t){!hu&&!t.parent.inlineContent&&(hu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class B extends V{constructor(e,n=e){pu(e),pu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return V.near(r);let o=e.resolve(n.map(this.anchor));return new B(o.parent.inlineContent?o:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof B&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Zs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new B(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=V.findFrom(n,r,!0)||V.findFrom(n,-r,!0);if(s)n=s.$head;else return V.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new B(e,n)}}V.jsonID("text",B);class Zs{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Zs(e.map(this.anchor),e.map(this.head))}resolve(e){return B.between(e.resolve(this.anchor),e.resolve(this.head))}}class H extends V{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?V.near(s):new H(s)}content(){return new D(T.from(this.node),0,0)}eq(e){return e instanceof H&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Da(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new H(e.resolve(n.anchor))}static create(e,n){return new H(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}H.prototype.visible=!1;V.jsonID("node",H);class Da{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Zs(r,r):new Da(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&H.isSelectable(r)?new H(n):V.near(n)}}class He extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new He(e)}map(e){return new He(e)}eq(e){return e instanceof He}getBookmark(){return Ry}}V.jsonID("all",He);const Ry={map(){return this},resolve(t){return new He(t)}};function Bn(t,e,n,r,o,s=!1){if(e.inlineContent)return B.create(t,n);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let l=e.child(i);if(l.isAtom){if(!s&&H.isSelectable(l))return H.create(t,n-(o<0?l.nodeSize:0))}else{let a=Bn(t,l,n+o,o<0?l.childCount:0,o,s);if(a)return a}n+=l.nodeSize*o}return null}function mu(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ye||o instanceof ve))return;let s=t.mapping.maps[r],i;s.forEach((l,a,c,u)=>{i==null&&(i=u)}),t.setSelection(V.near(t.doc.resolve(i),n))}const gu=1,ho=2,yu=4;class Ny extends Ia{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|gu)&~ho,this.storedMarks=null,this}get selectionSet(){return(this.updated&gu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ho,this}ensureMarks(e){return X.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ho)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ho,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||X.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(V.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=yu,this}get scrolledIntoView(){return(this.updated&yu)>0}}function bu(t,e){return!e||!t?t:t.bind(e)}class br{constructor(e,n,r){this.name=e,this.init=bu(n.init,r),this.apply=bu(n.apply,r)}}const Oy=[new br("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new br("selection",{init(t,e){return t.selection||V.atStart(e.doc)},apply(t){return t.selection}}),new br("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new br("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ji{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Oy.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new br(r.key,r.spec.state,r))})}}class Wn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=o?o[i].n:0,c=o?o[i].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}o&&(o[i]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Wn(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new Ny(this)}static create(e){let n=new ji(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Wn(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new ji(this.schema,e.plugins),r=n.fields,o=new Wn(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new ji(e.schema,e.plugins),s=new Wn(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=Ut.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=V.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[i.name]=c.fromJSON.call(a,e,n[l],s);return}}s[i.name]=i.init(e,s)}}),s}}function mh(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=mh(o,e,{})),n[r]=o}return n}class re{constructor(e){this.spec=e,this.props={},e.props&&mh(e.props,this,this.props),this.key=e.key?e.key.key:gh("plugin")}getState(e){return e[this.key]}}const Bi=Object.create(null);function gh(t){return t in Bi?t+"$"+ ++Bi[t]:(Bi[t]=0,t+"$")}class ae{constructor(e="key"){this.key=gh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Pa=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function yh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const bh=(t,e,n)=>{let r=yh(t,n);if(!r)return!1;let o=La(r);if(!o){let i=r.blockRange(),l=i&&ir(i);return l==null?!1:(e&&e(t.tr.lift(i,l).scrollIntoView()),!0)}let s=o.nodeBefore;if(Th(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Yn(s,"end")||H.isSelectable(s)))for(let i=r.depth;;i--){let l=Js(t.doc,r.before(i),r.after(i),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Yn(s,"end")?V.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):H.create(a.doc,o.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},Iy=(t,e,n)=>{let r=yh(t,n);if(!r)return!1;let o=La(r);return o?vh(t,o,e):!1},Dy=(t,e,n)=>{let r=wh(t,n);if(!r)return!1;let o=_a(r);return o?vh(t,o,e):!1};function vh(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let i=e.nodeAfter,l=i,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Js(t.doc,s,a,D.empty);if(!c||c.from!=s||c instanceof ye&&c.slice.size>=a-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(B.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Yn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Ch=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=La(r)}let i=s&&s.nodeBefore;return!i||!H.isSelectable(i)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function La(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function wh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const xh=(t,e,n)=>{let r=wh(t,n);if(!r)return!1;let o=_a(r);if(!o)return!1;let s=o.nodeAfter;if(Th(t,o,e,1))return!0;if(r.parent.content.size==0&&(Yn(s,"start")||H.isSelectable(s))){let i=Js(t.doc,r.before(),r.after(),D.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=t.tr.step(i);l.setSelection(Yn(s,"start")?V.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):H.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Sh=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=_a(r)}let i=s&&s.nodeAfter;return!i||!H.isSelectable(i)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,s.pos)).scrollIntoView()),!0)};function _a(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Py=(t,e)=>{let n=t.selection,r=n instanceof H,o;if(r){if(n.node.isTextblock||!tn(t.doc,n.from))return!1;o=n.from}else if(o=Gs(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(H.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Ly=(t,e)=>{let n=t.selection,r;if(n instanceof H){if(n.node.isTextblock||!tn(t.doc,n.to))return!1;r=n.to}else if(r=Gs(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_y=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&ir(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},Eh=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function Ha(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Hy=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),i=Ha(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,i.createAndFill());a.setSelection(V.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},kh=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof He||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Ha(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(i,s.createAndFill());l.setSelection(B.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Mh=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(St(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ir(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function jy(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof H&&e.selection.node.isBlock)return!r.parentOffset||!St(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Ha(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(a&&l?{type:l}:null),i=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof B||e.selection instanceof He)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=St(u.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=St(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(i).type!=l){let h=u.mapping.map(r.before(i)),p=u.doc.resolve(h);l&&r.node(i-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(i)),l)}return n&&n(u.scrollIntoView()),!0}}const By=jy(),zy=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(H.create(t.doc,o))),!0)};function $y(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||tn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Th(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,l,a=o.type.spec.isolating||s.type.spec.isolating;if(!a&&$y(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(l=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&l.matchType(i[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=T.empty;for(let y=i.length-1;y>=0;y--)p=T.from(i[y].create(null,p));p=T.from(o.copy(p));let m=t.tr.step(new ve(e.pos-1,h,e.pos,h,new D(p,1,0),i.length,!0)),g=m.doc.resolve(h+2*i.length);g.nodeAfter&&g.nodeAfter.type==o.type&&tn(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:V.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&ir(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Yn(s,"start",!0)&&Yn(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let y=T.empty;for(let w=p.length-1;w>=0;w--)y=T.from(p[w].copy(y));let C=t.tr.step(new ve(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new D(y,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function Ah(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(B.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const Fy=Ah(-1),Vy=Ah(1);function Wy(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),l=i&&Oa(i,t,e);return l?(r&&r(n.tr.wrap(i,l).scrollIntoView()),!0):!1}}function vu(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:i},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(i,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[i];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function ja(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}ja(Pa,bh,Ch);ja(Pa,xh,Sh);ja(Eh,kh,Mh,By);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Uy(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let l=r?n.tr:null;return Ky(l,i,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Ky(t,e,n,r=null){let o=!1,s=e,i=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=i.resolve(e.start-2);s=new Yo(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Yo(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=Oa(s,n,r,e);return l?(t&&qy(t,e,l,o,n),!0):!1}function qy(t,e,n,r,o){let s=T.empty;for(let u=n.length-1;u>=0;u--)s=T.from(n[u].type.create(n[u].attrs,s));t.step(new ve(e.start-(r?2:0),e.end,e.start,e.end,new D(s,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==o&&(i=u+1);let l=n.length-i,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&St(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function Gy(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Jy(e,n,t,s):Zy(e,n,s):!0:!1}}function Jy(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new ve(s-1,i,s,i,new D(T.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Yo(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const l=ir(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(s,-1)-1);return tn(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function Zy(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,i.content.append(a?T.empty:T.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new ve(d-(l?1:0),f+(a?1:0),d+1,f-1,new D((l?T.empty:T.from(o.copy(T.empty))).append(a?T.empty:T.from(o.copy(T.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Yy(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let i=s.startIndex;if(i==0)return!1;let l=s.parent,a=l.child(i-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=T.from(c?t.create():null),d=new D(T.from(t.create(null,T.from(l.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new ve(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Se=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Xn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Il=null;const wt=function(t,e,n){let r=Il||(Il=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Xy=function(){Il=null},xn=function(t,e,n,r){return n&&(Cu(t,e,n,r,-1)||Cu(t,e,n,r,1))},Qy=/^(img|br|input|textarea|hr)$/i;function Cu(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ge(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Xr(t)||Qy.test(t.nodeName)||t.contentEditable=="false")return!1;e=Se(t)+(o<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=i,e=o<0?Ge(t):0}else return!1}}function Ge(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function eb(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ge(t)}else if(t.parentNode&&!Xr(t))e=Se(t),t=t.parentNode;else return null}}function tb(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Xr(t))e=Se(t)+1,t=t.parentNode;else return null}}function nb(t,e,n){for(let r=e==0,o=e==Ge(t);r||o;){if(t==n)return!0;let s=Se(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Ge(t)}}function Xr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ys=function(t){return t.focusNode&&xn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function un(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function rb(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ob(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ge(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ge(r.startContainer),r.startOffset)}}}const dt=typeof navigator<"u"?navigator:null,wu=typeof document<"u"?document:null,nn=dt&&dt.userAgent||"",Dl=/Edge\/(\d+)/.exec(nn),Rh=/MSIE \d/.exec(nn),Pl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),je=!!(Rh||Pl||Dl),qt=Rh?document.documentMode:Pl?+Pl[1]:Dl?+Dl[1]:0,Je=!je&&/gecko\/(\d+)/i.test(nn);Je&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const Ll=!je&&/Chrome\/(\d+)/.exec(nn),ke=!!Ll,Nh=Ll?+Ll[1]:0,Ae=!je&&!!dt&&/Apple Computer/.test(dt.vendor),Qn=Ae&&(/Mobile\/\w+/.test(nn)||!!dt&&dt.maxTouchPoints>2),qe=Qn||(dt?/Mac/.test(dt.platform):!1),Oh=dt?/Win/.test(dt.platform):!1,xt=/Android \d/.test(nn),Qr=!!wu&&"webkitFontSmoothing"in wu.documentElement.style,sb=Qr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ib(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function gt(t,e){return typeof t=="number"?t:t[e]}function lb(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function xu(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let i=n||t.dom;i;){if(i.nodeType!=1){i=Xn(i);continue}let l=i,a=l==s.body,c=a?ib(s):lb(l),u=0,d=0;if(e.top<c.top+gt(r,"top")?d=-(c.top-e.top+gt(o,"top")):e.bottom>c.bottom-gt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+gt(o,"top")-c.top:e.bottom-c.bottom+gt(o,"bottom")),e.left<c.left+gt(r,"left")?u=-(c.left-e.left+gt(o,"left")):e.right>c.right-gt(r,"right")&&(u=e.right-c.right+gt(o,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:Xn(i)}}function ab(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=n+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=t.root.elementFromPoint(s,i);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Ih(t.dom)}}function Ih(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Xn(r));return e}function cb({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Dh(n,r==0?0:r-e)}function Dh(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Pn=null;function ub(t){if(t.setActive)return t.setActive();if(Pn)return t.focus(Pn);let e=Ih(t);t.focus(Pn==null?{get preventScroll(){return Pn={preventScroll:!0},!0}}:void 0),Pn||(Pn=!1,Dh(e,0))}function Ph(t,e){let n,r=2e8,o,s=0,i=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=wt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=i&&p.bottom>=l){i=Math.max(p.bottom,i),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?db(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:Ph(n,o)}function db(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Dt(r,1);if(i.top!=i.bottom&&Ba(e,i)){o={node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function Ba(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function fb(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function hb(t,e,n){let{node:r,offset:o}=Ph(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function pb(t,e,n,r){let o=-1;for(let s=e,i=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!i&&a.left>r.left||a.top>r.top?o=l.posBefore:(!i&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),i=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Lh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let i=t.childNodes[s];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ba(e,c))return Lh(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function mb(t,e){let n=t.dom.ownerDocument,r,o=0,s=ob(n,e.left,e.top);s&&({node:r,offset:o}=s);let i=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!Ba(e,c)||(i=Lh(t.dom,e,c),!i))return null}if(Ae)for(let c=i;r&&c;c=Xn(c))c.draggable&&(r=void 0);if(i=fb(i,e),r){if(Je&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Qr&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=pb(t,r,o,e))}l==null&&(l=hb(t,i,e));let a=t.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Su(t){return t.top<t.bottom||t.left<t.right}function Dt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Su(r))return r}return Array.prototype.find.call(n,Su)||t.getBoundingClientRect()}const gb=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _h(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=Qr||Je;if(r.nodeType==3)if(i&&(gb.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=Dt(wt(r,o,o),n);if(Je&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Dt(wt(r,o-1,o-1),-1);if(c.top==a.top){let u=Dt(wt(r,o,o+1),-1);if(u.top!=a.top)return fr(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,fr(Dt(wt(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Ge(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return zi(a.getBoundingClientRect(),!1)}if(s==null&&o<Ge(r)){let a=r.childNodes[o];if(a.nodeType==1)return zi(a.getBoundingClientRect(),!0)}return zi(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Ge(r))){let a=r.childNodes[o-1],c=a.nodeType==3?wt(a,Ge(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return fr(Dt(c,1),!1)}if(s==null&&o<Ge(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?wt(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return fr(Dt(c,-1),!0)}return fr(Dt(r.nodeType==3?wt(r):r,-n),n>=0)}function fr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function zi(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Hh(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function yb(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Hh(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let i=_h(t,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=wt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const bb=/[\u0590-\u08ac]/;function vb(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,l=t.domSelection();return l?!bb.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:i:Hh(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let Eu=null,ku=null,Mu=!1;function Cb(t,e,n){return Eu==e&&ku==n?Mu:(Eu=e,ku=n,Mu=n=="up"||n=="down"?yb(t,e,n):vb(t,e,n))}const Ze=0,Tu=1,dn=2,ft=3;class eo{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Ze,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,i;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Se(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let l=o.children[i];if(l.size){o=l;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],l=s+i.size;if(l>e||i instanceof Bh){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof jh&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Se(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Se(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let i=r,l=0;;l++){let a=this.children[l],c=i+a.size;if(o==-1&&e<=c){let u=i+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=i;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Se(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Se(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),i=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(s>p&&i<g)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Je||Ae)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
+ `),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Se(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Je&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Ae)&&xn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&xn(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Je)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],i=r+s.size;if(r==i?e<=i&&n>=r:e<i&&n>r){let l=r+s.border,a=i-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==i?dn:Tu,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ft:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?dn:ft}r=i}this.dirty=dn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?dn:Tu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class jh extends eo{constructor(e,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ze&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class wb extends eo{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Sn extends eo{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=An.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Sn(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&ft||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ft&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ze){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ze}}slice(e,n,r){let o=Sn.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=Hl(s,n,i,r)),e>0&&(s=Hl(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Gt extends eo{constructor(e,n,r,o,s,i,l,a,c){super(e,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,s,i){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=An.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Fh(u,r,n),c?a=new xb(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new Xs(e,n,r,o,u,f,s):new Gt(e,n,r,o,u,d||null,f,s,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,n,r){return this.dirty==Ze&&e.eq(this.node)&&Qo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,s=e.composing?this.localCompositionInfo(e,n):null,i=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Eb(this,i&&i.node,e);Tb(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?X.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==dn)&&(i&&this.protectLocalComposition(e,i),zh(this.contentDOM,this.children,e),Qn&&Ab(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof B)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let i=s.nodeValue,l=Rb(this.node.content,i,r-n,o-n);return l<0?null:{node:s,pos:l,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let i=new wb(this,s,n,o);e.input.compositionNodes.push(i),this.children=Hl(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==ft||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Ze}updateOuterDeco(e){if(Qo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$h(this.dom,this.nodeDOM,_l(this.outerDeco,this.node,n),_l(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Au(t,e,n,r,o){Fh(r,e,t);let s=new Gt(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class Xs extends Gt{constructor(e,n,r,o,s,i,l){super(e,n,r,o,s,null,i,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==ft||this.dirty!=Ze&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ze||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Ze,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),s=document.createTextNode(o.text);return new Xs(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ft)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Bh extends eo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ze&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xb extends Gt{constructor(e,n,r,o,s,i,l,a,c,u){super(e,n,r,o,s,i,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==ft)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function zh(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let i=e[s],l=i.dom;if(l.parentNode==t){for(;l!=r;)r=Ru(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(i instanceof Sn){let a=r?r.previousSibling:t.lastChild;zh(i.contentDOM,i.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Ru(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const kr=function(t){t&&(this.nodeName=t)};kr.prototype=Object.create(null);const fn=[new kr];function _l(t,e,n){if(t.length==0)return fn;let r=n?fn[0]:new kr,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new kr(i.nodeName));for(let l in i){let a=i[l];a!=null&&(n&&o.length==1&&o.push(r=new kr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function $h(t,e,n,r){if(n==fn&&r==fn)return e;let o=e;for(let s=0;s<r.length;s++){let i=r[s],l=n[s];if(s){let a;l&&l.nodeName==i.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=fn[0]),o=a}Sb(o,l||fn[0],i)}return o}function Sb(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function Fh(t,e,n){return $h(t,t,fn,_l(e,n,t.nodeType!=1))}function Qo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ru(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Eb{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=kb(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,o){let s=0,i=this.stack.length>>1,l=Math.min(i,e.length);for(;s<l&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Ze,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[i])&&!this.isLocked(d.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Sn.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(e,n,r))s=this.top.children.indexOf(i,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let i=this.top.children[o];return i.dirty==ft&&i.dom==i.contentDOM&&(i.dirty=dn),i.update(e,n,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Gt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ft&&Qo(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=dn,d.updateChildren(o,i+1),d.dirty=Ze),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,i){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Qo(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Gt.create(this.top,n,r,o,s,i);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,s){let i=Gt.create(this.top,e,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new jh(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Sn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Xs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ae||ke)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Bh(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function kb(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,i=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Sn)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,s.set(l,o),i.push(l)}}return{index:o,matched:s,matches:i.reverse()}}function Mb(t,e){return t.type.side-e.type.side}function Tb(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(s,u),c),s+=u.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let u,d;for(;i<o.length&&o[i].to==s;){let g=o[i++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(Mb);for(let g=0;g<d.length;g++)n(d[g],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)l.push(o[i++]);let p=s+f.nodeSize;if(f.isText){let g=p;i<o.length&&o[i].from<g&&(g=o[i].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=f.cut(g-s),f=f.cut(0,g-s),p=g,h=-1)}else for(;i<o.length&&o[i].to<p;)i++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(s,f),h),s=p}}function Ab(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Rb(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let i=t.child(o++),l=s;if(s+=i.nodeSize,!i.isText)continue;let a=i.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Hl(t,e,n,r,o){let s=[];for(let i=0,l=0;i<t.length;i++){let a=t[i],c=l,u=l+=a.size;c>=n||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),o&&(s.push(o),o=void 0),u>n&&s.push(a.slice(n-c,a.size,r)))}return s}function za(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let l=r.resolve(i),a,c;if(Ys(n)){for(a=i;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&H.isSelectable(d)&&o.parent&&!(d.isInline&&nb(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new H(i==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,i]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(i)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=$a(t,u,l,d)}return c}function Vh(t){return t.editable?t.hasFocus():Uh(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Et(t,e=!1){let n=t.state.selection;if(Wh(t,n),!!Vh(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ke){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&xn(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ob(t);else{let{anchor:r,head:o}=n,s,i;Nu&&!(n instanceof B)&&(n.$from.parent.inlineContent||(s=Ou(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=Ou(t,n.to))),t.docView.setSelection(r,o,t,e),Nu&&(s&&Iu(s),i&&Iu(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Nb(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Nu=Ae||ke&&Nh<63;function Ou(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ae&&o&&o.contentEditable=="false")return $i(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return $i(o);if(s)return $i(s)}}function $i(t){return t.contentEditable="true",Ae&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Iu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Nb(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Vh(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ob(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Se(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&je&&qt<=11&&(n.disabled=!0,n.disabled=!1)}function Wh(t,e){if(e instanceof H){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Du(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Du(t)}function Du(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function $a(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||B.between(e,n,r)}function Pu(t){return t.editable&&!t.hasFocus()?!1:Uh(t)}function Uh(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ib(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return xn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function jl(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&V.findFrom(s,e)}function Lt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Lu(t,e,n){let r=t.state.selection;if(r instanceof B)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Lt(t,new B(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=jl(t.state,e);return o&&o instanceof H?Lt(t,o):!1}else if(!(qe&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let l=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=t.docView.descAt(l))&&!i.contentDOM?H.isSelectable(s)?Lt(t,new H(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Qr?Lt(t,new B(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof H&&r.node.isInline)return Lt(t,new B(e>0?r.$to:r.$from));{let o=jl(t.state,e);return o?Lt(t,o):!1}}}function es(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Mr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ln(t,e){return e<0?Db(t):Pb(t)}function Db(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(Je&&n.nodeType==1&&r<es(n)&&Mr(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Mr(l,-1))o=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Kh(n))break;{let l=n.previousSibling;for(;l&&Mr(l,-1);)o=n.parentNode,s=Se(l),l=l.previousSibling;if(l)n=l,r=es(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Bl(t,n,r):o&&Bl(t,o,s)}function Pb(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=es(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Mr(l,1))s=n,i=++r;else break}else{if(Kh(n))break;{let l=n.nextSibling;for(;l&&Mr(l,1);)s=l.parentNode,i=Se(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=es(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Bl(t,s,i)}function Kh(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Lb(t,e){for(;t&&e==t.childNodes.length&&!Xr(t);)e=Se(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function _b(t,e){for(;t&&!e&&!Xr(t);)e=Se(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Bl(t,e,n){if(e.nodeType!=3){let s,i;(i=Lb(e,n))?(e=i,n=0):(s=_b(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ys(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Et(t)},50)}function _u(t,e){let n=t.state.doc.resolve(e);if(!(ke||Oh)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Hu(t,e,n){let r=t.state.selection;if(r instanceof B&&!r.empty||n.indexOf("s")>-1||qe&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=jl(t.state,e);if(i&&i instanceof H)return Lt(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,l=r instanceof He?V.near(i,e):V.findFrom(i,e);return l?Lt(t,l):!1}return!1}function ju(t,e){if(!(t.state.selection instanceof B))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let i=t.state.tr;return e<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),t.dispatch(i),!0}return!1}function Bu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Hb(t){if(!Ae||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bu(t,r,"true"),setTimeout(()=>Bu(t,r,"false"),20)}return!1}function jb(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Bb(t,e){let n=e.keyCode,r=jb(e);if(n==8||qe&&n==72&&r=="c")return ju(t,-1)||Ln(t,-1);if(n==46&&!e.shiftKey||qe&&n==68&&r=="c")return ju(t,1)||Ln(t,1);if(n==13||n==27)return!0;if(n==37||qe&&n==66&&r=="c"){let o=n==37?_u(t,t.state.selection.from)=="ltr"?-1:1:-1;return Lu(t,o,r)||Ln(t,o)}else if(n==39||qe&&n==70&&r=="c"){let o=n==39?_u(t,t.state.selection.from)=="ltr"?1:-1:1;return Lu(t,o,r)||Ln(t,o)}else{if(n==38||qe&&n==80&&r=="c")return Hu(t,-1,r)||Ln(t,-1);if(n==40||qe&&n==78&&r=="c")return Hb(t)||Hu(t,1,r)||Ln(t,1);if(r==(qe?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Fa(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=t.someProp("clipboardSerializer")||An.fromSchema(t.state.schema),l=Xh(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Yh[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:a,text:f,slice:e}}function qh(t,e,n,r,o){let s=o.parent.type.spec.code,i,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new D(T.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=An.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=i.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=Vb(n),Qr&&Wb(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Kt.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!zb.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Ub(zu(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen($b(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=zu(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const zb=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function $b(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,i=[];if(t.forEach(l=>{if(!i)return;let a=o.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&s.length&&Jh(a,s,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Zh(i[i.length-1],s.length));let u=Gh(l,a);i.push(u),o=o.matchType(u.type),s=a}}),i)return T.from(i)}return t}function Gh(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,T.from(t));return t}function Jh(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=Jh(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(T.from(Gh(n,t,o+1))))}}function Zh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Zh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(T.empty,!0);return t.copy(n.append(r))}function zl(t,e,n,r,o,s){let i=e<0?t.firstChild:t.lastChild,l=i.content;return t.childCount>1&&(s=0),o<r-1&&(l=zl(l,e,n,r,o+1,s)),o>=n&&(l=e<0?i.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(T.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(l))}function zu(t,e,n){return e<t.openStart&&(t=new D(zl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(zl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Yh={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let $u=null;function Xh(){return $u||($u=document.implementation.createHTMLDocument("title"))}let Fi=null;function Fb(t){let e=window.trustedTypes;return e?(Fi||(Fi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Fi.createHTML(t)):t}function Vb(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Xh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Yh[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Fb(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function Wb(t){let e=t.querySelectorAll(ke?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Ub(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:s,openEnd:i}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=T.from(a.create(r[l+1],o)),s++,i++}return new D(o,s,i)}const Ie={},De={},Kb={touchstart:!0,touchmove:!0};class qb{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Gb(t){for(let e in Ie){let n=Ie[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Zb(t,r)&&!Va(t,r)&&(t.editable||!(r.type in De))&&n(t,r)},Kb[e]?{passive:!0}:void 0)}Ae&&t.dom.addEventListener("input",()=>null),$l(t)}function Wt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Jb(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function $l(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Va(t,r))})}function Va(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Zb(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Yb(t,e){!Va(t,e)&&Ie[e.type]&&(t.editable||!(e.type in De))&&Ie[e.type](t,e)}De.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ep(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(xt&&ke&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,un(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Bb(t,n)?n.preventDefault():Wt(t,"key")};De.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};De.keypress=(t,e)=>{let n=e;if(ep(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||qe&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof B)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function Qs(t){return{left:t.clientX,top:t.clientY}}function Xb(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Wa(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,l=>i>s.depth?l(t,n,s.nodeAfter,s.before(i),o,!0):l(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function qn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Qb(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&H.isSelectable(r)?(qn(t,new H(n)),!0):!1}function ev(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof H&&(r=n.node);let s=t.state.doc.resolve(e);for(let i=s.depth+1;i>0;i--){let l=i>s.depth?s.nodeAfter:s.node(i);if(H.isSelectable(l)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(qn(t,H.create(t.state.doc,o)),!0):!1}function tv(t,e,n,r,o){return Wa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?ev(t,n):Qb(t,n))}function nv(t,e,n,r){return Wa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function rv(t,e,n,r){return Wa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||ov(t,n,r)}function ov(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(qn(t,B.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),l=o.before(s);if(i.inlineContent)qn(t,B.create(r,l+1,l+1+i.content.size));else if(H.isSelectable(i))qn(t,H.create(r,l));else continue;return!0}}function Ua(t){return ts(t)}const Qh=qe?"metaKey":"ctrlKey";Ie.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ua(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&Xb(n,t.input.lastClick)&&!n[Qh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=t.posAtCoords(Qs(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new sv(t,i,n,!!r)):(s=="doubleClick"?nv:rv)(t,i.pos,i.inside,n)?n.preventDefault():Wt(t,"pointer"))};class sv{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Qh],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),i=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,i=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof H&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Je&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Qs(e))),this.updateAllowDefault(e),this.allowDefault||!n?Wt(this.view,"pointer"):tv(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ae&&this.mightDrag&&!this.mightDrag.node.isAtom||ke&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(qn(this.view,V.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Wt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ie.touchstart=t=>{t.input.lastTouch=Date.now(),Ua(t),Wt(t,"pointer")};Ie.touchmove=t=>{t.input.lastTouch=Date.now(),Wt(t,"pointer")};Ie.contextmenu=t=>Ua(t);function ep(t,e){return t.composing?!0:Ae&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const iv=xt?5e3:-1;De.compositionstart=De.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof B&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ke&&Oh&&lv(t)))t.markCursor=t.state.storedMarks||n.marks(),ts(t,!0),t.markCursor=null;else if(ts(t,!e.selection.empty),Je&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let l=t.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}t.input.composing=!0}tp(t,iv)};function lv(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}De.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,tp(t,20))};function tp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ts(t),e))}function np(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=cv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function av(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=eb(e.focusNode,e.focusOffset),r=tb(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function cv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ts(t,e=!1){if(!(xt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),np(t),e||t.docView&&t.docView.dirty){let n=za(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function uv(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Br=je&&qt<15||Qn&&sb<604;Ie.copy=De.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=Br?null:n.clipboardData,i=r.content(),{dom:l,text:a}=Fa(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):uv(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function dv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function fv(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?zr(t,r.value,null,o,e):zr(t,r.textContent,r.innerHTML,o,e)},50)}function zr(t,e,n,r,o){let s=qh(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,s||D.empty)))return!0;if(!s)return!1;let i=dv(s),l=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function rp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}De.paste=(t,e)=>{let n=e;if(t.composing&&!xt)return;let r=Br?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&zr(t,rp(r),r.getData("text/html"),o,n)?n.preventDefault():fv(t,n)};class op{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const hv=qe?"altKey":"ctrlKey";function sp(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[hv]}Ie.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(Qs(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof H?o.to-1:o.to))){if(r&&r.mightDrag)i=H.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(i=H.create(t.state.doc,d.posBefore))}}let l=(i||t.state.selection).content(),{dom:a,text:c,slice:u}=Fa(t,l);(!n.dataTransfer.files.length||!ke||Nh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Br?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Br||n.dataTransfer.setData("text/plain",c),t.dragging=new op(u,sp(t,n),i)};Ie.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};De.dragover=De.dragenter=(t,e)=>e.preventDefault();De.drop=(t,e)=>{try{pv(t,e,t.dragging)}finally{t.dragging=null}};function pv(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Qs(e));if(!r)return;let o=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=qh(t,rp(e.dataTransfer),Br?null:e.dataTransfer.getData("text/html"),!1,o);let i=!!(n&&sp(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||D.empty,i))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?ch(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let a=t.state.tr;if(i){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&H.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new H(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>h=y),a.setSelection($a(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Ie.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Et(t)},20))};Ie.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ie.beforeinput=(t,e)=>{if(ke&&xt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,un(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in De)Ie[t]=De[t];function $r(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ns{constructor(e,n){this.toDOM=e,this.spec=n||yn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:i}=e.mapResult(n.from+o,this.side<0?-1:1);return i?null:new be(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ns&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&$r(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Jt{constructor(e,n){this.attrs=e,this.spec=n||yn}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new be(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Jt&&$r(this.attrs,e.attrs)&&$r(this.spec,e.spec)}static is(e){return e.type instanceof Jt}destroy(){}}class Ka{constructor(e,n){this.attrs=e,this.spec=n||yn}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let i=e.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new be(s.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Ka&&$r(this.attrs,e.attrs)&&$r(this.spec,e.spec)}destroy(){}}class be{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new be(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new be(e,e,new ns(n,r))}static inline(e,n,r,o){return new be(e,n,new Jt(r,o))}static node(e,n,r,o){return new be(e,n,new Ka(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof ns}}const zn=[],yn={};class ee{constructor(e,n){this.local=e.length?e:zn,this.children=n.length?n:zn}static create(e,n){return n.length?rs(n,e,0,yn):Te}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let l=this.children[i]+1;this.children[i+2].findInner(e-l,n-l,r,o+l,s)}}map(e,n,r){return this==Te||e.maps.length==0?this:this.mapInner(e,n,0,0,r||yn)}mapInner(e,n,r,o,s){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(i||(i=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?mv(this.children,i||[],e,n,r,o,s):i?new ee(i.sort(bn),zn):Te}add(e,n){return n.length?this==Te?ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=lp(n,l,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<a;)s+=3;o[s]==a?o[s+2]=o[s+2].addInner(l,u,c+1):o.splice(s,0,a,a+l.nodeSize,rs(u,l,c+1,yn)),s+=3}});let i=ip(s?ap(n):n,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new ee(i.length?this.local.concat(i).sort(bn):this.local,o||this.children)}remove(e){return e.length==0||this==Te?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,l+1);c!=Te?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<e.length;s++)if(i=e[s])for(let l=0;l<o.length;l++)o[l].eq(i,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ee(o,r):Te}forChild(e,n){if(this==Te)return this;if(n.isLeaf)return ee.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,i=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>s&&a.type instanceof Jt){let c=Math.max(s,a.from)-s,u=Math.min(i,a.to)-s;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new ee(o.sort(bn),zn);return r?new jt([l,r]):l}return r||Te}eq(e){if(this==e)return!0;if(!(e instanceof ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return qa(this.localsInner(e))}localsInner(e){if(this==Te)return zn;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ee.empty=new ee([],[]);ee.removeOverlap=qa;const Te=ee.empty;class jt{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,yn));return jt.from(r)}forChild(e,n){if(n.isLeaf)return ee.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Te&&(s instanceof jt?r=r.concat(s.members):r.push(s))}return jt.from(r)}eq(e){if(!(e instanceof jt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?qa(r?n:n.sort(bn)):zn}static from(e){switch(e.length){case 0:return Te;case 1:return e[0];default:return new jt(e.every(n=>n instanceof ee)?e:e.reduce((n,r)=>n.concat(r instanceof ee?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function mv(t,e,n,r,o,s,i){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let y=0;y<l.length;y+=3){let C=l[y+1];if(C<0||f>C+u-d)continue;let w=l[y]+u-d;h>=w?l[y+1]=f<=w?-2:-1:f>=u&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=l[c+2].mapInner(n,g,u+1,t[c]+s+1,i);y!=Te?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=gv(l,t,e,n,o,s,i),u=rs(c,r,0,i);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ee(e.sort(bn),l)}function ip(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new be(o.from+e,o.to+e,o.type))}return n}function gv(t,e,n,r,o,s,i){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):i.onRemove&&i.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function lp(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,i;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function ap(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function rs(t,e,n,r){let o=[],s=!1;e.forEach((l,a)=>{let c=lp(t,l,a+n);if(c){s=!0;let u=rs(c,l,n+a+1,r);u!=Te&&o.push(a,a+l.nodeSize,u)}});let i=ip(s?ap(t):t,-n).sort(bn);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||(r.onRemove&&r.onRemove(i[l].spec),i.splice(l--,1));return i.length||o.length?new ee(i,o):Te}function bn(t,e){return t.from-e.from||t.to-e.to}function qa(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),Fu(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Fu(e,o,r.copy(s.from,r.to)));break}}}return e}function Fu(t,e,n){for(;e<t.length&&bn(n,t[e])>0;)e++;t.splice(e,0,n)}function Vi(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Te&&e.push(r)}),t.cursorWrapper&&e.push(ee.create(t.state.doc,[t.cursorWrapper.deco])),jt.from(e)}const yv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bv=je&&qt<=11;class vv{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Cv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);je&&qt<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Ae&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bv&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yv)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Pu(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(je&&qt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&xn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Xn(s))n.add(s);for(let s=e.anchorNode;s;s=Xn(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Pu(e)&&!this.ignoreSelectionChange(r),s=-1,i=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(s=s<0?d.from:Math.min(d.from,s),i=i<0?d.to:Math.max(d.to,i),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(Je&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Sv(e,d)!=h)&&f.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ys(r)&&(c=za(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),wv(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Ev(e,a)),this.handleDOMChange(s,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(je&&qt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let i=o&&o.parentNode==e.target?Se(o)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=s&&s.parentNode==e.target?Se(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Vu=new WeakMap,Wu=!1;function wv(t){if(!Vu.has(t)&&(Vu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Je,Wu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Wu=!0}}function Uu(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return xn(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function xv(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Uu(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Uu(t,n):null}function Sv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Ev(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let i=s.nextSibling;for(;i&&i.nodeName!="TD"&&i.nodeName!="TH";)i=i.nextSibling;if(i){let l=i;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,o)}else s.parentNode.removeChild(s)}}function kv(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:i,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ys(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ke&&t.input.lastKeyCode===8)for(let g=s;g>o;g--){let y=r.childNodes[g-1],C=y.pmViewDesc;if(y.nodeName=="BR"&&!C){s=g;break}if(!C||C.size)break}let d=t.state.doc,f=t.someProp("domParser")||Kt.fromSchema(t.state.schema),h=d.resolve(i),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Mv,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+i,head:y+i}}return{doc:m,sel:p,from:i,to:l}}function Mv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ae&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ae&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Tv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Av(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let k=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,A=za(t,k);if(A&&!t.state.selection.eq(A)){if(ke&&xt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,un(13,"Enter"))))return;let P=t.state.tr.setSelection(A);k=="pointer"?P.setMeta("pointer",!0):k=="key"&&P.scrollIntoView(),s&&P.setMeta("composition",s),t.dispatch(P)}return}let i=t.state.doc.resolve(e),l=i.sharedDepth(n);e=i.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=kv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=Ov(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Qn&&t.input.lastIOSEnter>Date.now()-225||xt)&&o.some(k=>k.nodeType==1&&!Tv.test(k.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",k=>k(t,un(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof B&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let k=Ku(t,t.state.doc,c.sel);if(k&&!k.eq(t.state.selection)){let A=t.state.tr.setSelection(k);s&&A.setMeta("composition",s),t.dispatch(A)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof B&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),je&&qt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Qn&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",k=>k(t,un(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Nv(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",k=>k(t,un(8,"Backspace")))){xt&&ke&&t.domObserver.suppressSelectionUpdates();return}ke&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),xt&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(k){return k(t,un(13,"Enter"))})},20));let w=p.start,x=p.endA,S=k=>{let A=k||t.state.tr.replace(w,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let P=Ku(t,A.doc,c.sel);P&&!(ke&&t.composing&&P.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(P.head==w||P.head==A.mapping.map(x)-1)||je&&P.empty&&P.head==w)&&A.setSelection(P)}return s&&A.setMeta("composition",s),A.scrollIntoView()},M;if(C)if(m.pos==g.pos){je&&qt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(t),20));let k=S(t.state.tr.delete(w,x)),A=u.resolve(p.start).marksAcross(u.resolve(p.endA));A&&k.ensureMarks(A),t.dispatch(k)}else if(p.endA==p.endB&&(M=Rv(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let k=S(t.state.tr);M.type=="add"?k.addMark(w,x,M.mark):k.removeMark(w,x,M.mark),t.dispatch(k)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let k=m.parent.textBetween(m.parentOffset,g.parentOffset),A=()=>S(t.state.tr.insertText(k,w,x));t.someProp("handleTextInput",P=>P(t,w,x,k,A))||t.dispatch(A())}else t.dispatch(S());else t.dispatch(S())}function Ku(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:$a(t,e.resolve(n.anchor),e.resolve(n.head))}function Rv(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,i,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(o.length==1&&s.length==0)l=o[0],i="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&s.length==1)l=s[0],i="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(T.from(c).eq(t))return{mark:l,type:i}}function Nv(t,e,n,r,o){if(n-e<=o.pos-r.pos||Wi(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=t.resolve(Wi(s,!0,!0));return!i.parent.isTextblock||i.pos>n||Wi(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function Wi(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Ov(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:i,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,s-Math.min(i,l));r-=i+a-s}if(i<s&&t.size<e.size){let a=r<=s&&r>=i?s-r:0;s-=a,s&&s<e.size&&qu(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-i),i=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<t.size&&qu(t.textBetween(s-1,s+1))&&(s+=a?1:-1),i=s+(i-l),l=s}return{start:s,endA:i,endB:l}}function qu(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class cp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new qb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Xu),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Zu(this),Ju(this),this.nodeViews=Yu(this),this.docView=Au(this.state.doc,Gu(this),Vi(this),this.dom,this),this.domObserver=new Cv(this,(r,o,s,i)=>Av(this,r,o,s,i)),this.domObserver.start(),Gb(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&$l(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Xu),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(np(this),i=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Yu(this);Dv(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&$l(this),this.editable=Zu(this),Ju(this);let a=Vi(this),c=Gu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(i=!0);let f=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&ab(this);if(i){this.domObserver.stop();let h=d&&(je||ke)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Iv(o.selection,e.selection);if(d){let p=ke?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=av(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Au(e.doc,c,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ib(this))?Et(this,h):(Wh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&cb(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof H){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&xu(this,n.getBoundingClientRect(),e)}else xu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new op(e.slice,e.move,o<0?void 0:H.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[e];if(l!=null&&(o=n?n(l):l))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let l=s[i].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(je){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ub(this.dom),Et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return mb(this,e)}coordsAtPos(e,n=1){return _h(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return Cb(this,n||this.state,e)}pasteHTML(e,n){return zr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return zr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Fa(this,e)}destroy(){this.docView&&(Jb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Xy())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Yb(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ae&&this.root.nodeType===11&&rb(this.dom.ownerDocument)==this.dom&&xv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}cp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Gu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[be.node(0,t.state.doc.content.size,e)]}function Ju(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:be.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Zu(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Iv(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Yu(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Dv(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Xu(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Yt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ss={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Pv=typeof navigator<"u"&&/Mac/.test(navigator.platform),Lv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)Yt[48+Ee]=Yt[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)Yt[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)Yt[Ee]=String.fromCharCode(Ee+32),ss[Ee]=String.fromCharCode(Ee);for(var Ui in Yt)ss.hasOwnProperty(Ui)||(ss[Ui]=Yt[Ui]);function _v(t){var e=Pv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Lv&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ss:Yt)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Hv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),jv=typeof navigator<"u"&&/Win/.test(navigator.platform);function Bv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Hv?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function zv(t){let e=Object.create(null);for(let n in t)e[Bv(n)]=t[n];return e}function Ki(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function $v(t){return new re({props:{handleKeyDown:Ga(t)}})}function Ga(t){let e=zv(t);return function(n,r){let o=_v(r),s,i=e[Ki(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Ki(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(jv&&r.ctrlKey&&r.altKey)&&(s=Yt[r.keyCode])&&s!=o){let l=e[Ki(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Fv=Object.defineProperty,Ja=(t,e)=>{for(var n in e)Fv(t,n,{get:e[n],enumerable:!0})};function ei(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var ti=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,l])=>[i,(...c)=>{const u=l(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),i.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),g=f(...p)(m);return i.push(g),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i={tr:t,editor:r,view:s,state:ei({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(i)]))}};return i}},up={};Ja(up,{blur:()=>Vv,clearContent:()=>Wv,clearNodes:()=>Uv,command:()=>Kv,createParagraphNear:()=>qv,cut:()=>Gv,deleteCurrentNode:()=>Jv,deleteNode:()=>Zv,deleteRange:()=>Yv,deleteSelection:()=>Xv,enter:()=>Qv,exitCode:()=>eC,extendMarkRange:()=>tC,first:()=>nC,focus:()=>oC,forEach:()=>sC,insertContent:()=>iC,insertContentAt:()=>cC,joinBackward:()=>fC,joinDown:()=>dC,joinForward:()=>hC,joinItemBackward:()=>pC,joinItemForward:()=>mC,joinTextblockBackward:()=>gC,joinTextblockForward:()=>yC,joinUp:()=>uC,keyboardShortcut:()=>vC,lift:()=>CC,liftEmptyBlock:()=>wC,liftListItem:()=>xC,newlineInCode:()=>SC,resetAttributes:()=>EC,scrollIntoView:()=>kC,selectAll:()=>MC,selectNodeBackward:()=>TC,selectNodeForward:()=>AC,selectParentNode:()=>RC,selectTextblockEnd:()=>NC,selectTextblockStart:()=>OC,setContent:()=>IC,setMark:()=>XC,setMeta:()=>QC,setNode:()=>e2,setNodeSelection:()=>t2,setTextDirection:()=>n2,setTextSelection:()=>r2,sinkListItem:()=>o2,splitBlock:()=>s2,splitListItem:()=>i2,toggleList:()=>a2,toggleMark:()=>c2,toggleNode:()=>u2,toggleWrap:()=>d2,undoInputRule:()=>f2,unsetAllMarks:()=>h2,unsetMark:()=>p2,unsetTextDirection:()=>m2,updateAttributes:()=>g2,wrapIn:()=>y2,wrapInList:()=>b2});var Vv=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Wv=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Uv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{t.doc.nodesBetween(s.pos,i.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ir(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Kv=t=>e=>t(e),qv=()=>({state:t,dispatch:e})=>kh(t,e),Gv=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const i=r.mapping.map(e);return r.insert(i,s.content),r.setSelection(new B(r.doc.resolve(Math.max(i-1,0)))),!0},Jv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const l=o.before(s),a=o.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Zv=t=>({tr:e,state:n,dispatch:r})=>{const o=me(t,n.schema),s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const a=s.before(i),c=s.after(i);e.delete(a,c).scrollIntoView()}return!0}return!1},Yv=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},Xv=()=>({state:t,dispatch:e})=>Pa(t,e),Qv=()=>({commands:t})=>t.keyboardShortcut("Enter"),eC=()=>({state:t,dispatch:e})=>Hy(t,e);function Za(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function is(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Za(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function dp(t,e,n={}){return t.find(r=>r.type===e&&is(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Qu(t,e,n={}){return!!dp(t,e,n)}function Ya(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!dp([...r.node.marks],e,n))return;let s=r.index,i=t.start()+r.offset,l=s+1,a=i+r.node.nodeSize;for(;s>0&&Qu([...t.parent.child(s-1).marks],e,n);)s-=1,i-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Qu([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:i,to:a}}function Nt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var tC=(t,e)=>({tr:n,state:r,dispatch:o})=>{const s=Nt(t,r.schema),{doc:i,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=Ya(a,s,e);if(d&&d.from<=c&&d.to>=u){const f=B.create(i,d.from,d.to);n.setSelection(f)}}return!0},nC=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function fp(t){return t instanceof B}function hn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function hp(t,e=null){if(!e)return null;const n=V.atStart(t),r=V.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?B.create(t,hn(0,o,s),hn(t.content.size,o,s)):B.create(t,hn(e,o,s),hn(e,o,s))}function Fl(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Fr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function rC(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var oC=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(Fr()||Fl())&&r.dom.focus(),rC()&&!Fr()&&!Fl()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!fp(n.state.selection))return i(),!0;const l=hp(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},sC=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),iC=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),pp=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&pp(r)}return t};function po(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return pp(n)}function Vr(t,e,n){if(t instanceof Ut||t instanceof T)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return T.fromArray(t.map(l=>e.nodeFromJSON(l)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Vr("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,l="";const a=new Xf({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Kt.fromSchema(a).parseSlice(po(t),n.parseOptions):Kt.fromSchema(a).parse(po(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Kt.fromSchema(e);return n.slice?s.parseSlice(po(t),n.parseOptions).content:s.parse(po(t),n.parseOptions)}return Vr("",e,n)}function lC(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof ye||o instanceof ve))return;const s=t.mapping.maps[r];let i=0;s.forEach((l,a,c,u)=>{i===0&&(i=u)}),t.setSelection(V.near(t.doc.resolve(i),n))}var aC=t=>!("type"in t),cC=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Vr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=Vr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:s.options.enableContentCheck})}catch(g){return a(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((aC(l)?l:[l]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof T){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const g=r.doc.resolve(u),y=g.node(),C=g.parentOffset===0,w=y.isText||y.isTextblock,x=y.content.size>0;C&&w&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&lC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},uC=()=>({state:t,dispatch:e})=>Py(t,e),dC=()=>({state:t,dispatch:e})=>Ly(t,e),fC=()=>({state:t,dispatch:e})=>bh(t,e),hC=()=>({state:t,dispatch:e})=>xh(t,e),pC=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Gs(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},mC=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Gs(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},gC=()=>({state:t,dispatch:e})=>Iy(t,e),yC=()=>({state:t,dispatch:e})=>Dy(t,e);function mp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function bC(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Fr()||mp()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var vC=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=bC(t).split(/-(?!$)/),i=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Xt(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=o-r,c=l.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>is(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var CC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return Xt(n,o,e)?_y(n,r):!1},wC=()=>({state:t,dispatch:e})=>Mh(t,e),xC=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return Gy(r)(e,n)},SC=()=>({state:t,dispatch:e})=>Eh(t,e);function ni(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ed(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var EC=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=ni(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=me(t,r.schema)),l==="mark"&&(i=Nt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(a=!0,o&&n.setNodeMarkup(d,void 0,ed(u.attrs,e))),i&&u.marks.length&&u.marks.forEach(f=>{i===f.type&&(a=!0,o&&n.addMark(d,d+u.nodeSize,i.create(ed(f.attrs,e))))})})}),a},kC=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),MC=()=>({tr:t,dispatch:e})=>{if(e){const n=new He(t.doc);t.setSelection(n)}return!0},TC=()=>({state:t,dispatch:e})=>Ch(t,e),AC=()=>({state:t,dispatch:e})=>Sh(t,e),RC=()=>({state:t,dispatch:e})=>zy(t,e),NC=()=>({state:t,dispatch:e})=>Vy(t,e),OC=()=>({state:t,dispatch:e})=>Fy(t,e);function Vl(t,e,n={},r={}){return Vr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var IC=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:i,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=Vl(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return i&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return i&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function gp(t,e){const n=Nt(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{i.push(...a.marks)});const l=i.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function yp(t,e){const n=new Ia(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function DC(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function PC(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function bp(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ri(t){return e=>bp(e.$from,t)}function z(t,e,n){return t.config[e]===void 0&&t.parent?z(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?z(t.parent,e,n):null}):t.config[e]}function Xa(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",n);return r?[e,...Xa(r())]:e}).flat(10)}function Qa(t,e){const n=An.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function vp(t){return typeof t=="function"}function Z(t,e=void 0,...n){return vp(t)?e?t.bind(e)(...n):t(...n):t}function LC(t={}){return Object.keys(t).length===0&&t.constructor===Object}function er(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Cp(t){const e=[],{nodeExtensions:n,markExtensions:r}=er(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},i=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...i,...l];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:o},d=z(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=a:h.types==="nodes"?p=i:h.types==="marks"?p=l:p=[],p.forEach(m=>{Object.entries(h.attributes).forEach(([g,y])=>{e.push({type:m,name:g,attribute:{...s,...y}})})})})}),o.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=z(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const m={...s,...p};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:c.name,name:h,attribute:m})})}),e}function _C(t){const e=[];let n="",r=!1,o=!1,s=0;const i=t.length;for(let l=0;l<i;l+=1){const a=t[l];if(a==="'"&&!o){r=!r,n+=a;continue}if(a==='"'&&!r){o=!o,n+=a;continue}if(!r&&!o){if(a==="("){s+=1,n+=a;continue}if(a===")"&&s>0){s-=1,n+=a;continue}if(a===";"&&s===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function td(t){const e=[],n=_C(t||""),r=n.length;for(let o=0;o<r;o+=1){const s=n[o],i=s.indexOf(":");if(i===-1)continue;const l=s.slice(0,i).trim(),a=s.slice(i+1).trim();l&&a&&e.push([l,a])}return e}function Q(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const l=s?String(s).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=new Map([...td(r[o]),...td(s)]);r[o]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[o]=s}),r},{})}function tr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Q(n,r),{})}function HC(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function nd(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,i)=>{const l=i.attribute.parseHTML?i.attribute.parseHTML(n):HC(n.getAttribute(i.name));return l==null?s:{...s,[i.name]:l}},{});return{...r,...o}}}}function rd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&LC(n)?!1:n!=null))}function od(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function jC(t,e){var n;const r=Cp(t),{nodeExtensions:o,markExtensions:s}=er(t),i=(n=o.find(c=>z(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,C)=>{const w=z(C,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=rd({...f,content:Z(z(c,"content",d)),marks:Z(z(c,"marks",d)),group:Z(z(c,"group",d)),inline:Z(z(c,"inline",d)),atom:Z(z(c,"atom",d)),selectable:Z(z(c,"selectable",d)),draggable:Z(z(c,"draggable",d)),code:Z(z(c,"code",d)),whitespace:Z(z(c,"whitespace",d)),linebreakReplacement:Z(z(c,"linebreakReplacement",d)),defining:Z(z(c,"defining",d)),isolating:Z(z(c,"isolating",d)),attrs:Object.fromEntries(u.map(od))}),p=Z(z(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>nd(y,u)));const m=z(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:tr(y,u)}));const g=z(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,y)=>{const C=z(y,"extendMarkSchema",d);return{...g,...C?C(c):{}}},{}),h=rd({...f,inclusive:Z(z(c,"inclusive",d)),excludes:Z(z(c,"excludes",d)),group:Z(z(c,"group",d)),spanning:Z(z(c,"spanning",d)),code:Z(z(c,"code",d)),attrs:Object.fromEntries(u.map(od))}),p=Z(z(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>nd(g,u)));const m=z(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:tr(g,u)})),[c.name,h]}));return new Xf({topNode:i,nodes:l,marks:a})}function BC(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Tr(t){return t.sort((n,r)=>{const o=z(n,"priority")||100,s=z(r,"priority")||100;return o>s?-1:o<s?1:0})}function wp(t){const e=Tr(Xa(t)),n=BC(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function xp(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:i={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=s);const h=i?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function zC(t,e){const n={from:0,to:t.content.size};return xp(t,n,e)}function Sp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function $C(t,e){const n=me(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,l=>{s.push(l)});const i=s.reverse().find(l=>l.type.name===n.name);return i?{...i.attrs}:{}}function Ep(t,e){const n=ni(typeof e=="string"?e:e.name,t.schema);return n==="node"?$C(t,e):n==="mark"?gp(t,e):{}}function FC(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function VC(t){const e=FC(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function kp(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((l,a)=>{i.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;i.push({from:l,to:a})}i.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),VC(r)}function ec(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=Ya(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}var WC=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,i=null;for(;s>0&&i===null;){const l=o.node(s);l?.type.name===e?i=l:s-=1}return[i,s]};function hr(t,e){return e.nodes[t]||e.marks[t]||null}function jo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var UC=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,i,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:s,parent:i,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Wl(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Nt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>is(d.attrs,n,{strict:!1}));let i=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),C=Math.min(p,g+m.nodeSize),w=C-y;i+=w,l.push(...m.marks.map(x=>({mark:x,from:y,to:C})))})}),i===0)return!1;const a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>is(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=i}function KC(t,e,n={}){if(!e)return Xt(t,null,n)||Wl(t,null,n);const r=ni(e,t.schema);return r==="node"?Xt(t,e,n):r==="mark"?Wl(t,e,n):!1}var qC=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=ri(l=>l.type.name===e)(t.selection);if(!s)return!1;const i=t.doc.resolve(s.pos+1);return o.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},GC=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function sd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function qi(t,e){const{nodeExtensions:n}=er(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=Z(z(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function oi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(s=>{o!==!1&&(oi(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function Mp(t){return t instanceof H}var Tp=class Ap{constructor(e){this.position=e}static fromJSON(e){return new Ap(e.position)}toJSON(){return{position:this.position}}};function JC(t,e){const n=e.mapping.mapResult(t.position);return{position:new Tp(n.pos),mapResult:n}}function ZC(t){return new Tp(t)}function YC(t,e,n){var r;const{selection:o}=e;let s=null;if(fp(o)&&(s=o.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:i}=o;return i.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var XC=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:l}=s,a=Nt(t,r.schema);if(o)if(i){const c=gp(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&n.addMark(p,m,a.create({...y.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return YC(r,n,a)},QC=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),e2=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=me(t,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:l})=>vu(s,{...i,...e})(n)?!0:l.clearNodes()).command(({state:l})=>vu(s,{...i,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},t2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=hn(t,0,r.content.size),s=H.create(r,o);e.setSelection(s)}return!0},n2=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;let i,l;return typeof e=="number"?(i=e,l=e):e&&"from"in e&&"to"in e?(i=e.from,l=e.to):(i=s.from,l=s.to),o&&n.doc.nodesBetween(i,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},r2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=B.atStart(r).from,l=B.atEnd(r).to,a=hn(o,i,l),c=hn(s,i,l),u=B.create(r,a,c);e.setSelection(u)}return!0},o2=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return Yy(r)(e,n)};function id(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var s2=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=e,{$from:l,$to:a}=s,c=o.extensionManager.attributes,u=jo(c,l.node().type.name,l.node().attrs);if(s instanceof H&&s.node.isBlock)return!l.parentOffset||!St(i,l.pos)?!1:(r&&(t&&id(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:DC(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=St(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&St(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof B&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&id(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},i2=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=T.empty;const C=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-C;A>=a.depth-3;A-=1)y=T.from(a.node(A).copy(y));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x={...jo(f,a.node().type.name,a.node().attrs),...e},S=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;y=y.append(T.from(l.createAndFill(null,S)||void 0));const M=a.before(a.depth-(C-1));n.replace(M,a.after(-w),new D(y,4-C,0));let k=-1;n.doc.nodesBetween(M,n.doc.content.size,(A,P)=>{if(k>-1)return!1;A.isTextblock&&A.content.size===0&&(k=P+1)}),k>-1&&n.setSelection(B.near(n.doc.resolve(k))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...jo(f,d.type.name,d.attrs),...e},m={...jo(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!St(n.doc,a.pos,2))return!1;if(o){const{selection:y,storedMarks:C}=r,{splittableMarks:w}=s.extensionManager,x=C||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!x||!o)return!0;const S=x.filter(M=>w.includes(M.type.name));n.ensureMarks(S)}return!0},Gi=(t,e)=>{const n=ri(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&tn(t.doc,n.pos)&&t.join(n.pos),!0},Ji=(t,e)=>{const n=ri(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&tn(t.doc,r)&&t.join(r),!0};function l2(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=1,o=n.nodeSize-1;return B.create(e,r,o)}var a2=(t,e,n,r={})=>({editor:o,tr:s,state:i,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=me(t,i.schema),p=me(e,i.schema),{selection:m,storedMarks:g}=i,{$from:y,$to:C}=m,w=y.blockRange(C),x=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;const S=ri($=>qi($.type.name,d))(m),M=m.from===0&&m.to===i.doc.content.size,k=i.doc.content.content,A=k.length===1?k[0]:null,P=M&&A&&qi(A.type.name,d)?{node:A,pos:0}:null,_=S??P,U=!!S&&w.depth>=1&&w.depth-S.depth<=1,W=!!P;if((U||W)&&_){if(_.node.type===h)return M&&W?a().command(({tr:$,dispatch:I})=>{const j=l2($);return j?($.setSelection(j),I&&I($),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(qi(_.node.type.name,d)&&h.validContent(_.node.content))return a().command(()=>(s.setNodeMarkup(_.pos,h),!0)).command(()=>Gi(s,h)).command(()=>Ji(s,h)).run()}return!n||!x||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Gi(s,h)).command(()=>Ji(s,h)).run():a().command(()=>{const $=u().wrapInList(h,r),I=x.filter(j=>f.includes(j.type.name));return s.ensureMarks(I),$?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Gi(s,h)).command(()=>Ji(s,h)).run()},c2=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=Nt(t,r.schema);return Wl(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},u2=(t,e,n={})=>({state:r,commands:o})=>{const s=me(t,r.schema),i=me(e,r.schema),l=Xt(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(i,a):o.setNode(s,{...a,...n})},d2=(t,e={})=>({state:n,commands:r})=>{const o=me(t,n.schema);return Xt(n,o,e)?r.lift(o):r.wrapIn(o,e)},f2=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const i=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)i.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else i.delete(s.from,s.to)}return!0}}return!1},h2=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},p2=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=n,a=Nt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&i){let{from:f,to:h}=l;const p=(s=c.marks().find(g=>g.type===a))==null?void 0:s.attrs,m=Ya(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},m2=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let s,i;return typeof t=="number"?(s=t,i=t):t&&"from"in t&&"to"in t?(s=t.from,i=t.to):(s=o.from,i=o.to),r&&e.doc.nodesBetween(s,i,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},g2=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=ni(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=me(t,r.schema)),l==="mark"&&(i=Nt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(a=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(a=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g),y>=u&&y<=d&&(s&&s===g.type&&(a=!0,o&&n.setNodeMarkup(y,void 0,{...g.attrs,...e})),i&&g.marks.length&&g.marks.forEach(C=>{if(i===C.type&&(a=!0,o)){const w=Math.max(y,u),x=Math.min(y+g.nodeSize,d);n.addMark(w,x,i.create({...C.attrs,...e}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),i&&h.marks.length&&h.marks.forEach(g=>{i===g.type&&o&&n.addMark(p,m,i.create({...g.attrs,...e}))}))}),a},y2=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return Wy(o,e)(n,r)},b2=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return Uy(o,e)(n,r)},v2=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},si=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},C2=(t,e)=>{if(Za(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function mo(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=UC(c)+s;return i.forEach(f=>{if(u)return;const h=C2(d,f.find);if(!h)return;const p=a.state.tr,m=ei({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:o},{commands:y,chain:C,can:w}=new ti({editor:n,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:C,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:o,text:s}),a.dispatch(p),u=!0)}),u}function w2(t){const{editor:e,rules:n}=t,r=new re({state:{init(){return null},apply(o,s,i){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Qa(T.from(u),i.schema);const{from:d}=a,f=d+u.length;mo({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,l){return mo({editor:e,from:s,to:i,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&mo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?mo({editor:e,from:i.pos,to:i.pos,text:`
13
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function x2(t){return Object.prototype.toString.call(t).slice(8,-1)}function go(t){return x2(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Rp(t,e){const n={...t};return go(t)&&go(e)&&Object.keys(e).forEach(r=>{go(e[r])&&go(t[r])?n[r]=Rp(t[r],e[r]):n[r]=e[r]}),n}var tc=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Z(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Z(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Rp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},rn=class Np extends tc{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Np(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(c=>c?.type.name===n.name))return!1;const a=i.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function S2(t){return typeof t=="number"}var E2=class{constructor(t){this.find=t.find,this.handler=t.handler}},k2=(t,e,n)=>{if(Za(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function M2(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:l}=t,{commands:a,chain:c,can:u}=new ti({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,g,y,C,w;if((g=(m=h.type)==null?void 0:m.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(w=(C=(y=h.content)==null?void 0:y.size)!=null?C:h.nodeSize)!=null?w:0,S=Math.max(r,p),M=Math.min(o,p+x);if(S>=M)return;const k=h.isText?h.text||"":h.textBetween(S-p,M-p,void 0,"");k2(k,s.find,i).forEach(P=>{if(P.index===void 0)return;const _=S+P.index+1,U=_+P[0].length,W={from:n.tr.mapping.map(_),to:n.tr.mapping.map(U)},$=s.handler({state:n,range:W,match:P,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});d.push($)})}),d.every(h=>h!==null)}var yo=null,T2=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function A2(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=ei({state:u,transaction:m});if(!(!M2({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new re({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(yo=e)},h=()=>{yo&&(yo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,l=f,!s){const h=yo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return i=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),C=!!y;if(!m&&!g&&!C)return;if(C){let{text:S}=y;typeof S=="string"?S=S:S=Qa(T.from(S),h.schema);const{from:M}=y,k=M+S.length,A=T2(S);return a({rule:u,state:h,from:M,to:{b:k},pasteEvt:A})}const w=f.doc.content.findDiffStart(h.doc.content),x=f.doc.content.findDiffEnd(h.doc.content);if(!(!S2(w)||!x||w===x.b))return a({rule:u,state:h,from:w,to:x,pasteEvt:i})}}))}var ii=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=wp(t),this.schema=jC(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:hr(e.name,this.schema)},r=z(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Tr([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:hr(r.name,this.schema)},s=[],i=z(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&z(r,"exitable",o)&&(l.ArrowRight=()=>rn.handleExit({editor:t,mark:r})),i){const f=Object.fromEntries(Object.entries(i()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=$v(l);s.push(a);const c=z(r,"addInputRules",o);if(sd(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=w2({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=z(r,"addPasteRules",o);if(sd(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=A2({editor:t,rules:f});s.push(...h)}}const d=z(r,"addProseMirrorPlugins",o);if(d){const f=d();s.push(...f)}return s})}get attributes(){return Cp(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=er(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},s=z(n,"addNodeView",o);if(!s)return[];const i=s();if(!i)return[];const l=(a,c,u,d,f)=>{const h=tr(a,r);return i({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return Tr([...this.extensions].reverse()).reduceRight((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:hr(o.name,this.schema)},i=z(o,"dispatchTransaction",s);return i?l=>{i.call(s,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Tr([...this.extensions]).reduce((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:hr(o.name,this.schema)},i=z(o,"transformPastedHTML",s);return i?(l,a)=>{const c=r(l,a);return i.call(s,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=er(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Nt(n.name,this.schema)},s=z(n,"addMarkView",o);if(!s)return[];const i=(l,a,c)=>{const u=tr(l,r);return s()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{V2(l,t,d)}})};return[n.name,i]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:hr(e.name,this.schema)};e.type==="mark"&&((n=Z(z(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=z(e,"onBeforeCreate",r),s=z(e,"onCreate",r),i=z(e,"onUpdate",r),l=z(e,"onSelectionUpdate",r),a=z(e,"onTransaction",r),c=z(e,"onFocus",r),u=z(e,"onBlur",r),d=z(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};ii.resolve=wp;ii.sort=Tr;ii.flatten=Xa;var R2={};Ja(R2,{ClipboardTextSerializer:()=>Ip,Commands:()=>Dp,Delete:()=>Pp,Drop:()=>Lp,Editable:()=>_p,FocusEvents:()=>jp,Keymap:()=>Bp,Paste:()=>zp,Tabindex:()=>$p,TextDirection:()=>Fp,focusEventsPluginKey:()=>Hp});var Y=class Op extends tc{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Op(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ip=Y.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new re({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=Sp(n);return xp(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Dp=Y.create({name:"commands",addCommands(){return{...up}}}),Pp=Y.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const s=()=>{var i,l,a,c;if((c=(a=(l=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=yp(t.before,[t,...e]);kp(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,y=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,g;if(h instanceof tt){const y=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),w=f.invert().map(y,-1),x=f.invert().map(C),S=y>0?(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(k=>k.eq(h.mark)):!1,M=(g=u.doc.nodeAt(C))==null?void 0:g.marks.some(k=>k.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:x},newRange:{from:y,to:C},partial:!!(M||S),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),Lp=Y.create({name:"drop",addProseMirrorPlugins(){return[new re({key:new ae("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),_p=Y.create({name:"editable",addProseMirrorPlugins(){return[new re({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Hp=new ae("focusEvents"),jp=Y.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new re({key:Hp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Bp=Y.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:V.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Fr()||mp()?s:o},addProseMirrorPlugins(){return[new re({key:new ae("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:l}=e.selection,a=V.atStart(e.doc).from,c=V.atEnd(e.doc).to;if(s||!(i===a&&l===c)||!oi(n.doc))return;const f=n.tr,h=ei({state:n,transaction:f}),{commands:p}=new ti({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),zp=Y.create({name:"paste",addProseMirrorPlugins(){return[new re({key:new ae("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),$p=Y.create({name:"tabindex",addProseMirrorPlugins(){return[new re({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Fp=Y.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=er(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new re({key:new ae("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),N2=class vr{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new vr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new vr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new vr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&!i&&a.depth<=this.depth)return;const c=new vr(a,this.editor,o,o||i?n:null);o&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,i=Object.keys(n);for(let l=0;l<i.length;l+=1){const a=i[l];if(s[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===e&&s.every(a=>n[a]===i.node.attrs[a])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},O2=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function I2(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var D2=class extends v2{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:JC,createMappablePosition:ZC},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:s})=>this.options.onDrop(r,o,s)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=hp(e,this.options.autofocus);this.editorState=Wn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=I2(O2,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=vp(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;n=n.filter(i=>!i.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[_p,Ip.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Dp,jp,Bp,$p,Lp,zp,Pp,Fp.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new ii(r,this)}createCommandManager(){this.commandManager=new ti({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Vl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Vl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,i=this.extensionManager.transformPastedHTML(s);this.editorView=new cp(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:o,transformPastedHTML:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=i?.getMeta("focus"),a=i?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:i}),a&&this.emit("blur",{editor:this,event:a.event,transaction:i}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Ep(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return KC(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Qa(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
84
+
85
+ `,textSerializers:n={}}=t||{};return zC(this.state.doc,{blockSeparator:e,textSerializers:{...Sp(this.schema),...n}})}get isEmpty(){return oi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new N2(e,this)}get $doc(){return this.$pos(0)}};function nr(t){return new si({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Z(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,i=r[r.length-1],l=r[0];if(i){const a=l.search(/\S/),c=n.from+l.indexOf(i),u=c+i.length;if(ec(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+a,c);const f=n.from+a+i.length;s.addMark(n.from+a,f,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function Vp(t){return new si({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Z(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,i+r[0].length-1),s.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?i:i-1;s.insert(c,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function Ul(t){return new si({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=Z(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function rr(t){return new si({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=Z(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),c=a&&Oa(a,t.type,s);if(!c)return null;if(i.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));i.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,s).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&tn(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)},undoable:t.undoable})}var P2=t=>"touches"in t,L2=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,o,s,i;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(o=t.options)!=null&&o.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(i=t.options)!=null&&i.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),o=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,P2(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,o,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,o=this.startHeight;const s=t.includes("right"),i=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return s?r=this.startWidth+e:i&&(r=this.startWidth-e),l?o=this.startHeight+n:a&&(o=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(o=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o,s,i;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(o=this.maxSize)!=null&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(i=this.maxSize)!=null&&i.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",o=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:o?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function _2(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof H){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}var H2={};Ja(H2,{createAtomBlockMarkdownSpec:()=>j2,createBlockMarkdownSpec:()=>B2,createInlineMarkdownSpec:()=>F2,parseAttributes:()=>nc,parseIndentedBlocks:()=>Kl,renderNestedMarkdownContent:()=>oc,serializeAttributes:()=>rc});function nc(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(i)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function rc(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function j2(t){const{nodeName:e,name:n,parseAttributes:r=nc,serializeAttributes:o=rc,defaultAttributes:s={},requiredAttributes:i=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...s,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",g=r(m);if(!i.find(C=>!(C in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function B2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=nc,serializeAttributes:s=rc,defaultAttributes:i={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...i,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;const[y,C=""]=g,w=o(C);let x=1;const S=y.length;let M="";const k=/^:::([\w-]*)(\s.*)?/gm,A=d.slice(S);for(k.lastIndex=0;;){const P=k.exec(A);if(P===null)break;const _=P.index,U=P[1];if(!((p=P[2])!=null&&p.endsWith(":::"))){if(U)x+=1;else if(x-=1,x===0){const W=A.slice(0,_);M=W.trim();const $=d.slice(0,S+_+P[0].length);let I=[];if(M)if(l==="block")for(I=h.blockTokens(W),I.forEach(j=>{j.text&&(!j.tokens||j.tokens.length===0)&&(j.tokens=h.inlineTokens(j.text))});I.length>0;){const j=I[I.length-1];if(j.type==="paragraph"&&(!j.text||j.text.trim()===""))I.pop();else break}else I=h.inlineTokens(M);return{type:e,raw:$,attributes:w,content:M,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",g=f.renderChildren(d.content||[],`
86
+
87
+ `);return`:::${c}${m}
88
+
89
+ ${g}
90
+
91
+ :::`}}}function z2(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,s,i]=r;e[o]=s||i,r=n.exec(t)}return e}function $2(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function F2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=z2,serializeAttributes:s=$2,defaultAttributes:i={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=f=>{if(!a)return f;const h={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){const y=f[m];if(g!==void 0&&y===g)return;h[m]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...i,...f.attributes};if(l)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=f.match(m);if(!g)return;let y="",C="";if(l){const[,x]=g;C=x}else{const[,x,S]=g;C=x,y=S||""}const w=o(C.trim());return{type:e,raw:g[0],content:y.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(f.attrs||{}),m=s(p),g=m?` ${m}`:"";return l?`[${c}${g}]`:`[${c}${g}]${h}[/${c}]`}}}function Kl(t,e,n){var r,o,s,i;const l=t.split(`
92
+ `),a=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<l.length;){const f=l[u],h=f.match(e.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
93
+ `;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:g}=p;c=`${c}${f}
94
+ `;const y=[g];for(u+=1;u<l.length;){const S=l[u];if(S.trim()===""){const k=l.slice(u+1).findIndex(_=>_.trim()!=="");if(k===-1)break;if((((o=(r=l[u+1+k].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){y.push(S),c=`${c}${S}
95
+ `,u+=1;continue}else break}if((((i=(s=S.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:i.length)||0)>m)y.push(S),c=`${c}${S}
96
+ `,u+=1;else break}let C;const w=y.slice(1);if(w.length>0){const S=w.map(M=>M.slice(m+d)).join(`
97
+ `);S.trim()&&(e.customNestedParser?C=e.customNestedParser(S):C=n.blockTokens(S))}const x=e.createToken(p,C);a.push(x)}if(a.length!==0)return{items:a,raw:c}}function oc(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[s,...i]=t.content,l=e.renderChildren([s]);let a=`${o}${l}`;return i&&i.length>0&&i.forEach((c,u)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){const p=h.split(`
98
+ `).map(m=>m?e.indent(m):e.indent("")).join(`
99
+ `);a+=c.type==="paragraph"?`
100
+
101
+ ${p}`:`
102
+ ${p}`}}),a}function V2(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,i=t;o.descendants((l,a)=>{const c=s.mapping.map(a),u=s.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==i)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var ge=class Wp extends tc{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Wp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},W2=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,o,s,i,l;const{view:a}=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,f=0;if(this.dom!==u){const C=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),x=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,S=(i=t.offsetY)!=null?i:(s=t.nativeEvent)==null?void 0:s.offsetY;d=w.x-C.x+x,f=w.y-C.y+S}const h=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();h.style.width=`${Math.round(C.width)}px`,h.style.height=`${Math.round(C.height)}px`,h.style.boxSizing="border-box",h.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(h),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const g=H.create(a.state.doc,m),y=a.state.tr.setSelection(g);a.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 o=t.type.startsWith("drag"),s=t.type==="dragover"||t.type==="dragenter",i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=H.isSelectable(this.node),f=t.type==="copy",h=t.type==="paste",p=t.type==="cut",m=t.type==="mousedown";if(!u&&d&&o&&t.target===this.dom&&t.preventDefault(),u&&o&&!c&&t.target===this.dom)return t.preventDefault(),!1;if(u&&a&&!c&&m){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!(c||s||i||f||h||p||m&&d)}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"&&(Fr()||Fl())&&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 En(t){return new E2({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=Z(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:i}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(ec(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+l.length,i.addMark(n.from+u,c,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||i.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:U2,getOwnPropertySymbols:K2}=Object,{hasOwnProperty:q2}=Object.prototype;function Zi(t,e){return function(r,o,s){return t(r,o,s)&&e(r,o,s)}}function bo(t){return function(n,r,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,o);const{cache:s}=o,i=s.get(n),l=s.get(r);if(i&&l)return i===r&&l===n;s.set(n,r),s.set(r,n);const a=t(n,r,o);return s.delete(n),s.delete(r),a}}function G2(t){return t?.[Symbol.toStringTag]}function ld(t){return U2(t).concat(K2(t))}const J2=Object.hasOwn||((t,e)=>q2.call(t,e));function Rn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Z2="__v",Y2="__o",X2="_owner",{getOwnPropertyDescriptor:ad,keys:cd}=Object;function Q2(t,e){return t.byteLength===e.byteLength&&ls(new Uint8Array(t),new Uint8Array(e))}function ew(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function tw(t,e){return t.byteLength===e.byteLength&&ls(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function nw(t,e){return Rn(t.getTime(),e.getTime())}function rw(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function ow(t,e){return t===e}function ud(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.entries();let i,l,a=0;for(;(i=s.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(o[d]){d++;continue}const f=i.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=o[d]=!0;break}d++}if(!u)return!1;a++}return!0}const sw=Rn;function iw(t,e,n){const r=cd(t);let o=r.length;if(cd(e).length!==o)return!1;for(;o-- >0;)if(!Up(t,e,n,r[o]))return!1;return!0}function pr(t,e,n){const r=ld(t);let o=r.length;if(ld(e).length!==o)return!1;let s,i,l;for(;o-- >0;)if(s=r[o],!Up(t,e,n,s)||(i=ad(t,s),l=ad(e,s),(i||l)&&(!i||!l||i.configurable!==l.configurable||i.enumerable!==l.enumerable||i.writable!==l.writable)))return!1;return!0}function lw(t,e){return Rn(t.valueOf(),e.valueOf())}function aw(t,e){return t.source===e.source&&t.flags===e.flags}function dd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.values();let i,l;for(;(i=s.next())&&!i.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!o[u]&&n.equals(i.value,l.value,i.value,l.value,t,e,n)){c=o[u]=!0;break}u++}if(!c)return!1}return!0}function ls(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function cw(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Up(t,e,n,r){return(r===X2||r===Y2||r===Z2)&&(t.$$typeof||e.$$typeof)?!0:J2(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const uw="[object ArrayBuffer]",dw="[object Arguments]",fw="[object Boolean]",hw="[object DataView]",pw="[object Date]",mw="[object Error]",gw="[object Map]",yw="[object Number]",bw="[object Object]",vw="[object RegExp]",Cw="[object Set]",ww="[object String]",xw={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Sw="[object URL]",Ew=Object.prototype.toString;function kw({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:s,areMapsEqual:i,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(g,y,C){if(g===y)return!0;if(g==null||y==null)return!1;const w=typeof g;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?l(g,y,C):w==="function"?s(g,y,C):!1;const x=g.constructor;if(x!==y.constructor)return!1;if(x===Object)return a(g,y,C);if(Array.isArray(g))return e(g,y,C);if(x===Date)return r(g,y,C);if(x===RegExp)return u(g,y,C);if(x===Map)return i(g,y,C);if(x===Set)return d(g,y,C);const S=Ew.call(g);if(S===pw)return r(g,y,C);if(S===vw)return u(g,y,C);if(S===gw)return i(g,y,C);if(S===Cw)return d(g,y,C);if(S===bw)return typeof g.then!="function"&&typeof y.then!="function"&&a(g,y,C);if(S===Sw)return h(g,y,C);if(S===mw)return o(g,y,C);if(S===dw)return a(g,y,C);if(xw[S])return f(g,y,C);if(S===uw)return t(g,y,C);if(S===hw)return n(g,y,C);if(S===fw||S===yw||S===ww)return c(g,y,C);if(p){let M=p[S];if(!M){const k=G2(g);k&&(M=p[k])}if(M)return M(g,y,C)}return!1}}function Mw({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Q2,areArraysEqual:n?pr:ew,areDataViewsEqual:tw,areDatesEqual:nw,areErrorsEqual:rw,areFunctionsEqual:ow,areMapsEqual:n?Zi(ud,pr):ud,areNumbersEqual:sw,areObjectsEqual:n?pr:iw,arePrimitiveWrappersEqual:lw,areRegExpsEqual:aw,areSetsEqual:n?Zi(dd,pr):dd,areTypedArraysEqual:n?Zi(ls,pr):ls,areUrlsEqual:cw,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=bo(r.areArraysEqual),s=bo(r.areMapsEqual),i=bo(r.areObjectsEqual),l=bo(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:i,areSetsEqual:l})}return r}function Tw(t){return function(e,n,r,o,s,i,l){return t(e,n,l)}}function Aw({circular:t,comparator:e,createState:n,equals:r,strict:o}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:o})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const s={cache:void 0,equals:r,meta:void 0,strict:o};return function(l,a){return e(l,a,s)}}const Rw=on();on({strict:!0});on({circular:!0});on({circular:!0,strict:!0});on({createInternalComparator:()=>Rn});on({strict:!0,createInternalComparator:()=>Rn});on({circular:!0,createInternalComparator:()=>Rn});on({circular:!0,createInternalComparator:()=>Rn,strict:!0});function on(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,s=Mw(t),i=kw(s),l=n?n(i):Tw(i);return Aw({circular:e,comparator:i,createState:r,equals:l,strict:o})}var vo={exports:{}},Yi={};var fd;function Nw(){if(fd)return Yi;fd=1;var t=E,e=Aa();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,s=t.useRef,i=t.useEffect,l=t.useMemo,a=t.useDebugValue;return Yi.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function y(M){if(!C){if(C=!0,w=M,M=f(M),h!==void 0&&m.hasValue){var k=m.value;if(h(k,M))return x=k}return x=M}if(k=x,r(w,M))return k;var A=f(M);return h!==void 0&&h(k,A)?(w=M,k):(w=M,x=A)}var C=!1,w,x,S=d===void 0?null:d;return[function(){return y(u())},S===null?void 0:function(){return y(S())}]},[u,d,f,h]);var g=o(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},Yi}var Xi={};var hd;function Ow(){return hd||(hd=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=E,n=Aa(),r=typeof Object.is=="function"?Object.is:t,o=n.useSyncExternalStore,s=e.useRef,i=e.useEffect,l=e.useMemo,a=e.useDebugValue;Xi.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function y(M){if(!C){if(C=!0,w=M,M=f(M),h!==void 0&&m.hasValue){var k=m.value;if(h(k,M))return x=k}return x=M}if(k=x,r(w,M))return k;var A=f(M);return h!==void 0&&h(k,A)?(w=M,k):(w=M,x=A)}var C=!1,w,x,S=d===void 0?null:d;return[function(){return y(u())},S===null?void 0:function(){return y(S())}]},[u,d,f,h]);var g=o(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Xi}var pd;function Iw(){return pd||(pd=1,process.env.NODE_ENV==="production"?vo.exports=Nw():vo.exports=Ow()),vo.exports}var Dw=Iw(),Pw=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Lw=({contentComponent:t})=>{const e=_f.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return b.jsx(b.Fragment,{children:Object.values(e)})};function _w(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ks.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var Hw=class extends E.Component{constructor(t){var e;super(t),this.editorContentRef=E.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=_w(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:Pw(e,this.editorContentRef),...n}),t?.contentComponent&&b.jsx(Lw,{contentComponent:t.contentComponent})]})}},jw=E.forwardRef((t,e)=>{const n=E.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return E.createElement(Hw,{key:n,innerRef:e,...t})}),Kp=E.memo(jw),Bw=typeof window<"u"?E.useLayoutEffect:E.useEffect,zw=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function sc(t){var e;const[n]=E.useState(()=>new zw(t.editor)),r=Dw.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Rw);return Bw(()=>n.watch(t.editor),[t.editor,n]),E.useDebugValue(r),r}var md=process.env.NODE_ENV!=="production",ql=typeof window>"u",$w=ql||!!(typeof window<"u"&&window.next),Fw=class qp{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(ql||$w){if(md)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&ql&&md)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onBeforeCreate)==null?void 0:s.call(o,...r)},onBlur:(...r)=>{var o,s;return(s=(o=this.options.current).onBlur)==null?void 0:s.call(o,...r)},onCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onCreate)==null?void 0:s.call(o,...r)},onDestroy:(...r)=>{var o,s;return(s=(o=this.options.current).onDestroy)==null?void 0:s.call(o,...r)},onFocus:(...r)=>{var o,s;return(s=(o=this.options.current).onFocus)==null?void 0:s.call(o,...r)},onSelectionUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onSelectionUpdate)==null?void 0:s.call(o,...r)},onTransaction:(...r)=>{var o,s;return(s=(o=this.options.current).onTransaction)==null?void 0:s.call(o,...r)},onUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onUpdate)==null?void 0:s.call(o,...r)},onContentError:(...r)=>{var o,s;return(s=(o=this.options.current).onContentError)==null?void 0:s.call(o,...r)},onDrop:(...r)=>{var o,s;return(s=(o=this.options.current).onDrop)==null?void 0:s.call(o,...r)},onPaste:(...r)=>{var o,s;return(s=(o=this.options.current).onPaste)==null?void 0:s.call(o,...r)},onDelete:(...r)=>{var o,s;return(s=(o=this.options.current).onDelete)==null?void 0:s.call(o,...r)}};return new D2(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((o,s)=>{var i;return o===((i=n.extensions)==null?void 0:i[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?qp.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Vw(t={},e=[]){const n=E.useRef(t);n.current=t;const[r]=E.useState(()=>new Fw(n)),o=_f.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return E.useDebugValue(o),E.useEffect(r.onRender(e)),sc({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var li=E.createContext({editor:null});li.Consumer;var Ww=()=>E.useContext(li),Gp=E.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Uw=()=>E.useContext(Gp),Kw=E.forwardRef((t,e)=>{const{onDragStart:n}=Uw(),r=t.as||"div";return b.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function gd(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function yd(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function qw(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Gw(t){if(gd(t)||yd(t))return!0;if(qw(t)){const e=t.type;if(e)return gd(e)||yd(e)}return!1}function Jw(){try{if(E.version)return parseInt(E.version.split(".")[0],10)>=19}catch{}return!1}var Zw=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Ks.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,o=Jw(),s=Gw(e),i={...n};i.ref&&!(o||s)&&delete i.ref,!i.ref&&(o||s)&&(i.ref=l=>{this.ref=l}),this.reactElement=b.jsx(e,{...i}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};E.createContext({markViewContentRef:()=>{}});var Yw=class extends W2{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,o){var s;return r==="storage"?(s=t.storage[e.name])!=null?s:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:E.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},o=this.component,s=E.memo(a=>b.jsx(Gp.Provider,{value:r,children:E.createElement(o,a)}));s.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Zw(s,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,i=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:s,newNode:t,newDecorations:e,oldInnerDecorations:i,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=tr(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Xw(t,e){return n=>n.editor.contentComponent?new Yw(t,n,e):{}}var ic=E.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});ic.displayName="TiptapContext";var Qw=()=>E.useContext(ic);function Jp({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=E.useMemo(()=>({editor:r}),[r]),s=E.useMemo(()=>({editor:r}),[r]);return b.jsx(li.Provider,{value:s,children:b.jsx(ic.Provider,{value:o,children:n})})}Jp.displayName="Tiptap";function Zp({...t}){const{editor:e}=Qw();return b.jsx(Kp,{editor:e,...t})}Zp.displayName="Tiptap.Content";Object.assign(Jp,{Content:Zp});var as=(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]},ex=/^\s*>\s$/,tx=ge.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return as("blockquote",{...Q(this.options.HTMLAttributes,t),children:as("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(o=>{const l=e.renderChildren([o]).split(`
103
+ `).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
104
+ `))}),r.join(`
105
+ ${n}
106
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[rr({find:ex,type:this.type})]}}),nx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,rx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ox=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ix=rn.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 as("strong",{...Q(this.options.HTMLAttributes,t),children:as("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[nr({find:nx,type:this.type}),nr({find:ox,type:this.type})]},addPasteRules(){return[En({find:rx,type:this.type}),En({find:sx,type:this.type})]}}),lx=/(^|[^`])`([^`]+)`(?!`)$/,ax=/(^|[^`])`([^`]+)`(?!`)/g,cx=rn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Q(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[nr({find:lx,type:this.type})]},addPasteRules(){return[En({find:ax,type:this.type})]}}),Qi=4,ux=/^```([a-z]+)?[\s\n]$/,dx=/^~~~([a-z]+)?[\s\n]$/,fx=ge.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Qi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Q(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
107
+ `):r=`\`\`\`${o}
108
+
109
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Qi,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return i?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=o,h=r.doc.textBetween(c,u,`
110
+ `,`
111
+ `).split(`
112
+ `).map(p=>l+p).join(`
113
+ `);return a.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Qi,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;return s.parent.type!==this.type?!1:i?t.commands.command(({tr:l})=>{var a;const{pos:c}=s,u=s.start(),d=s.end(),h=r.doc.textBetween(u,d,`
114
+ `,`
115
+ `).split(`
116
+ `);let p=0,m=0;const g=c-u;for(let M=0;M<h.length;M+=1){if(m+h[M].length>=g){p=M;break}m+=h[M].length+1}const C=((a=h[p].match(/^ */))==null?void 0:a[0])||"",w=Math.min(C.length,n);if(w===0)return!0;let x=u;for(let M=0;M<p;M+=1)x+=h[M].length+1;return l.delete(x,x+w),c-x<=w&&l.setSelection(B.create(l.doc,x)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=o,f=r.doc.textBetween(a,c,`
117
+ `,`
118
+ `).split(`
119
+ `).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,n);return h.slice(g)}).join(`
120
+ `);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
121
+
122
+ `);return!s||!i?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(V.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ul({find:ux,type:this.type,getAttributes:t=>({language:t[1]})}),Ul({find:dx,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new re({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!n||!s)return!1;const{tr:i,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
123
+ `));return i.replaceSelectionWith(this.type.create({language:s},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(B.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),hx=ge.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
124
+
125
+ `):""}),px=ge.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Q(this.options.HTMLAttributes,t)]},renderText(){return`
126
+ `},renderMarkdown:()=>`
127
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,a=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&i){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),mx=ge.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Q(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ul({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),gx=ge.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Q(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!_2(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return Mp(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:s,tr:i,dispatch:l})=>{if(l){const{$to:a}=i.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(B.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(H.create(i.doc,a.pos)):i.setSelection(B.create(i.doc,a.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(i.insert(c,d),i.setSelection(B.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Vp({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),yx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,bx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,vx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Cx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,wx=rn.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",Q(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[nr({find:yx,type:this.type}),nr({find:vx,type:this.type})]},addPasteRules(){return[En({find:bx,type:this.type}),En({find:Cx,type:this.type})]}});const xx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Sx="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Gl="numeric",Jl="ascii",Zl="alpha",Ar="asciinumeric",Cr="alphanumeric",Yl="domain",Yp="emoji",Ex="scheme",kx="slashscheme",el="whitespace";function Mx(t,e){return t in e||(e[t]=[]),e[t]}function pn(t,e,n){e[Gl]&&(e[Ar]=!0,e[Cr]=!0),e[Jl]&&(e[Ar]=!0,e[Zl]=!0),e[Ar]&&(e[Cr]=!0),e[Zl]&&(e[Cr]=!0),e[Cr]&&(e[Yl]=!0),e[Yp]&&(e[Yl]=!0);for(const r in e){const o=Mx(r,n);o.indexOf(t)<0&&o.push(t)}}function Tx(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function _e(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}_e.groups={};_e.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||_e.groups;let o;return e&&e.j?o=e:(o=new _e(e),n&&r&&pn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(t[i]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||_e.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let i,l=o.go(t);if(l?(i=new _e,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new _e,s){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign(Tx(i.t,r),n);pn(s,a,r)}else n&&pn(s,n,r);i.t=s}return o.j[t]=i,i}};const q=(t,e,n,r,o)=>t.ta(e,n,r,o),ce=(t,e,n,r,o)=>t.tr(e,n,r,o),bd=(t,e,n,r,o)=>t.ts(e,n,r,o),N=(t,e,n,r,o)=>t.tt(e,n,r,o),vt="WORD",Xl="UWORD",Xp="ASCIINUMERICAL",Qp="ALPHANUMERICAL",Wr="LOCALHOST",Ql="TLD",ea="UTLD",Bo="SCHEME",$n="SLASH_SCHEME",lc="NUM",ta="WS",ac="NL",Rr="OPENBRACE",Nr="CLOSEBRACE",cs="OPENBRACKET",us="CLOSEBRACKET",ds="OPENPAREN",fs="CLOSEPAREN",hs="OPENANGLEBRACKET",ps="CLOSEANGLEBRACKET",ms="FULLWIDTHLEFTPAREN",gs="FULLWIDTHRIGHTPAREN",ys="LEFTCORNERBRACKET",bs="RIGHTCORNERBRACKET",vs="LEFTWHITECORNERBRACKET",Cs="RIGHTWHITECORNERBRACKET",ws="FULLWIDTHLESSTHAN",xs="FULLWIDTHGREATERTHAN",Ss="AMPERSAND",Es="APOSTROPHE",ks="ASTERISK",_t="AT",Ms="BACKSLASH",Ts="BACKTICK",As="CARET",Bt="COLON",cc="COMMA",Rs="DOLLAR",ot="DOT",Ns="EQUALS",uc="EXCLAMATION",Ke="HYPHEN",Or="PERCENT",Os="PIPE",Is="PLUS",Ds="POUND",Ir="QUERY",dc="QUOTE",em="FULLWIDTHMIDDLEDOT",fc="SEMI",st="SLASH",Dr="TILDE",Ps="UNDERSCORE",tm="EMOJI",Ls="SYM";var nm=Object.freeze({__proto__:null,ALPHANUMERICAL:Qp,AMPERSAND:Ss,APOSTROPHE:Es,ASCIINUMERICAL:Xp,ASTERISK:ks,AT:_t,BACKSLASH:Ms,BACKTICK:Ts,CARET:As,CLOSEANGLEBRACKET:ps,CLOSEBRACE:Nr,CLOSEBRACKET:us,CLOSEPAREN:fs,COLON:Bt,COMMA:cc,DOLLAR:Rs,DOT:ot,EMOJI:tm,EQUALS:Ns,EXCLAMATION:uc,FULLWIDTHGREATERTHAN:xs,FULLWIDTHLEFTPAREN:ms,FULLWIDTHLESSTHAN:ws,FULLWIDTHMIDDLEDOT:em,FULLWIDTHRIGHTPAREN:gs,HYPHEN:Ke,LEFTCORNERBRACKET:ys,LEFTWHITECORNERBRACKET:vs,LOCALHOST:Wr,NL:ac,NUM:lc,OPENANGLEBRACKET:hs,OPENBRACE:Rr,OPENBRACKET:cs,OPENPAREN:ds,PERCENT:Or,PIPE:Os,PLUS:Is,POUND:Ds,QUERY:Ir,QUOTE:dc,RIGHTCORNERBRACKET:bs,RIGHTWHITECORNERBRACKET:Cs,SCHEME:Bo,SEMI:fc,SLASH:st,SLASH_SCHEME:$n,SYM:Ls,TILDE:Dr,TLD:Ql,UNDERSCORE:Ps,UTLD:ea,UWORD:Xl,WORD:vt,WS:ta});const yt=/[a-z]/,mr=new RegExp("\\p{L}","u"),tl=new RegExp("\\p{Emoji}","u"),bt=/\d/,nl=/\s/,vd="\r",rl=`
128
+ `,Ax="️",Rx="‍",ol="";let Co=null,wo=null;function Nx(t=[]){const e={};_e.groups=e;const n=new _e;Co==null&&(Co=Cd(xx)),wo==null&&(wo=Cd(Sx)),N(n,"'",Es),N(n,"{",Rr),N(n,"}",Nr),N(n,"[",cs),N(n,"]",us),N(n,"(",ds),N(n,")",fs),N(n,"<",hs),N(n,">",ps),N(n,"(",ms),N(n,")",gs),N(n,"「",ys),N(n,"」",bs),N(n,"『",vs),N(n,"』",Cs),N(n,"<",ws),N(n,">",xs),N(n,"&",Ss),N(n,"*",ks),N(n,"@",_t),N(n,"`",Ts),N(n,"^",As),N(n,":",Bt),N(n,",",cc),N(n,"$",Rs),N(n,".",ot),N(n,"=",Ns),N(n,"!",uc),N(n,"-",Ke),N(n,"%",Or),N(n,"|",Os),N(n,"+",Is),N(n,"#",Ds),N(n,"?",Ir),N(n,'"',dc),N(n,"/",st),N(n,";",fc),N(n,"~",Dr),N(n,"_",Ps),N(n,"\\",Ms),N(n,"・",em);const r=ce(n,bt,lc,{[Gl]:!0});ce(r,bt,r);const o=ce(r,yt,Xp,{[Ar]:!0}),s=ce(r,mr,Qp,{[Cr]:!0}),i=ce(n,yt,vt,{[Jl]:!0});ce(i,bt,o),ce(i,yt,i),ce(o,bt,o),ce(o,yt,o);const l=ce(n,mr,Xl,{[Zl]:!0});ce(l,yt),ce(l,bt,s),ce(l,mr,l),ce(s,bt,s),ce(s,yt),ce(s,mr,s);const a=N(n,rl,ac,{[el]:!0}),c=N(n,vd,ta,{[el]:!0}),u=ce(n,nl,ta,{[el]:!0});N(n,ol,u),N(c,rl,a),N(c,ol,u),ce(c,nl,u),N(u,vd),N(u,rl),ce(u,nl,u),N(u,ol,u);const d=ce(n,tl,tm,{[Yp]:!0});N(d,"#"),ce(d,tl,d),N(d,Ax,d);const f=N(d,Rx);N(f,"#"),ce(f,tl,d);const h=[[yt,i],[bt,o]],p=[[yt,null],[mr,l],[bt,s]];for(let m=0;m<Co.length;m++)Ot(n,Co[m],Ql,vt,h);for(let m=0;m<wo.length;m++)Ot(n,wo[m],ea,Xl,p);pn(Ql,{tld:!0,ascii:!0},e),pn(ea,{utld:!0,alpha:!0},e),Ot(n,"file",Bo,vt,h),Ot(n,"mailto",Bo,vt,h),Ot(n,"http",$n,vt,h),Ot(n,"https",$n,vt,h),Ot(n,"ftp",$n,vt,h),Ot(n,"ftps",$n,vt,h),pn(Bo,{scheme:!0,ascii:!0},e),pn($n,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],C=t[m][1]?{[Ex]:!0}:{[kx]:!0};g.indexOf("-")>=0?C[Yl]=!0:yt.test(g)?bt.test(g)?C[Ar]=!0:C[Jl]=!0:C[Gl]=!0,bd(n,g,g,C)}return bd(n,"localhost",Wr,{ascii:!0}),n.jd=new _e(Ls),{start:n,tokens:Object.assign({groups:e},nm)}}function rm(t,e){const n=Ox(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let s=0,i=0;for(;i<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;i<r&&(a=l.go(n[i]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[i].length,f++),c+=n[i].length,s+=n[i].length,i++;s-=d,i-=f,c-=d,o.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return o}function Ox(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,i=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(i),r+=i.length}return e}function Ot(t,e,n,r,o){let s;const i=e.length;for(let l=0;l<i-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new _e(r),s.jr=o.slice(),t.j[a]=s),t=s}return s=new _e(n),s.jr=o.slice(),t.j[e[i-1]]=s,s}function Cd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let i=parseInt(t.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Ur={defaultProtocol:"http",events:null,format:wd,formatHref:wd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function hc(t,e=null){let n=Object.assign({},Ur);t&&(n=Object.assign(n,t instanceof hc?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}hc.prototype={o:Ur,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Ur[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function wd(t){return t}function om(t,e){this.t="token",this.v=t,this.tk=e}om.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Ur.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),s=this.toFormattedString(t),i={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=r,l&&(i.class=l),a&&(i.target=a),c&&(i.rel=c),u&&Object.assign(i,u),{tagName:o,attributes:i,content:s,eventListeners:d}}};function ai(t,e){class n extends om{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const xd=ai("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sd=ai("text"),Ix=ai("nl"),xo=ai("url",{isLink:!0,toHref(t=Ur.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Wr&&t[1].t===Bt}}),We=t=>new _e(t);function Dx({groups:t}){const e=t.domain.concat([Ss,ks,_t,Ms,Ts,As,Rs,Ns,Ke,lc,Or,Os,Is,Ds,st,Ls,Dr,Ps]),n=[Es,Bt,cc,ot,uc,Or,Ir,dc,fc,hs,ps,Rr,Nr,us,cs,ds,fs,ms,gs,ys,bs,vs,Cs,ws,xs],r=[Ss,Es,ks,Ms,Ts,As,Rs,Ns,Ke,Rr,Nr,Or,Os,Is,Ds,Ir,st,Ls,Dr,Ps],o=We(),s=N(o,Dr);q(s,r,s),q(s,t.domain,s);const i=We(),l=We(),a=We();q(o,t.domain,i),q(o,t.scheme,l),q(o,t.slashscheme,a),q(i,r,s),q(i,t.domain,i);const c=N(i,_t);N(s,_t,c),N(l,_t,c),N(a,_t,c);const u=N(s,ot);q(u,r,s),q(u,t.domain,s);const d=We();q(c,t.domain,d),q(d,t.domain,d);const f=N(d,ot);q(f,t.domain,d);const h=We(xd);q(f,t.tld,h),q(f,t.utld,h),N(c,Wr,h);const p=N(d,Ke);N(p,Ke,p),q(p,t.domain,d),q(h,t.domain,d),N(h,ot,f),N(h,Ke,p);const m=N(h,Bt);q(m,t.numeric,xd);const g=N(i,Ke),y=N(i,ot);N(g,Ke,g),q(g,t.domain,i),q(y,r,s),q(y,t.domain,i);const C=We(xo);q(y,t.tld,C),q(y,t.utld,C),q(C,t.domain,i),q(C,r,s),N(C,ot,y),N(C,Ke,g),N(C,_t,c);const w=N(C,Bt),x=We(xo);q(w,t.numeric,x);const S=We(xo),M=We();q(S,e,S),q(S,n,M),q(M,e,S),q(M,n,M),N(C,st,S),N(x,st,S);const k=N(l,Bt),A=N(a,Bt),P=N(A,st),_=N(P,st);q(l,t.domain,i),N(l,ot,y),N(l,Ke,g),q(a,t.domain,i),N(a,ot,y),N(a,Ke,g),q(k,t.domain,S),N(k,st,S),N(k,Ir,S),q(_,t.domain,S),q(_,e,S),N(_,st,S);const U=[[Rr,Nr],[cs,us],[ds,fs],[hs,ps],[ms,gs],[ys,bs],[vs,Cs],[ws,xs]];for(let W=0;W<U.length;W++){const[$,I]=U[W],j=N(S,$);N(M,$,j),N(j,I,S);const F=We(xo);q(j,e,F);const L=We();q(j,n),q(F,e,F),q(F,n,L),q(L,e,F),q(L,n,L),N(F,I,S),N(L,I,S)}return N(o,Wr,C),N(o,ac,Ix),{start:o,tokens:nm}}function Px(t,e,n){let r=n.length,o=0,s=[],i=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)i.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(i.push(n[o]),o++);else{i.length>0&&(s.push(sl(Sd,e,i)),i=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);s.push(sl(h,e,p))}}return i.length>0&&s.push(sl(Sd,e,i)),s}function sl(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const Lx=typeof console<"u"&&console&&console.warn||(()=>{}),_x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ie={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Hx(){return _e.groups={},ie.scanner=null,ie.parser=null,ie.tokenQueue=[],ie.pluginQueue=[],ie.customSchemes=[],ie.initialized=!1,ie}function Ed(t,e=!1){if(ie.initialized&&Lx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${_x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
129
+ 1. Must only contain digits, lowercase ASCII letters or "-"
130
+ 2. Cannot start or end with "-"
131
+ 3. "-" cannot repeat`);ie.customSchemes.push([t,e])}function jx(){ie.scanner=Nx(ie.customSchemes);for(let t=0;t<ie.tokenQueue.length;t++)ie.tokenQueue[t][1]({scanner:ie.scanner});ie.parser=Dx(ie.scanner.tokens);for(let t=0;t<ie.pluginQueue.length;t++)ie.pluginQueue[t][1]({scanner:ie.scanner,parser:ie.parser});return ie.initialized=!0,ie}function pc(t){return ie.initialized||jx(),Px(ie.parser.start,t,rm(ie.scanner.start,t))}pc.scan=rm;function sm(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new hc(n),o=pc(t),s=[];for(let i=0;i<o.length;i++){const l=o[i];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var mc="[\0-   ᠎ -\u2029  ]",Bx=new RegExp(mc),zx=new RegExp(`${mc}$`),$x=new RegExp(mc,"g");function Fx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Vx(t){return new re({key:new ae("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,l=yp(n.doc,[...e]);if(kp(l).forEach(({newRange:c})=>{const u=PC(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!zx.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Bx).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=pc(p).map(y=>y.toObject(t.defaultProtocol));if(!Fx(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{ec(y.from,y.to,r.doc).some(C=>C.mark.type===t.type)||i.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!i.steps.length)return i}})}function Wx(t){return new re({key:new ae("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;i=a.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=Ep(e.state,t.type.name),c=(o=i.href)!=null?o:a.href,u=(s=i.target)!=null?s:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function Ux(t){return new re({key:new ae("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:s}=e,{selection:i}=s,{empty:l}=i;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=sm(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function an(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace($x,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Kx=rn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Ed(t);return}Ed(t.scheme,t.optionalSlashes)})},onDestroy(){Hx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!an(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const o=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!an(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!an(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Q(this.options.HTMLAttributes,t),0]:["a",Q(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,o,s;const i=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(s=(o=t.attrs)==null?void 0:o.title)!=null?s:"",a=e.renderChildren(t);return l?`[${a}](${i} "${l}")`:`[${a}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!an(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!an(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[En({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=sm(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!an(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Vx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!an(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Wx({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Ux({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),qx=Object.defineProperty,Gx=(t,e)=>{for(var n in e)qx(t,n,{get:e[n],enumerable:!0})},Jx="listItem",kd="textStyle",Md=/^\s*([-+*])\s$/,im=ge.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
132
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Jx,this.editor.getAttributes(kd)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=rr({find:Md,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=rr({find:Md,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kd),editor:this.editor})),[t]}}),lm=ge.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const i=t.tokens.slice(1),l=e.parseChildren(i);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>oc(t,e,r=>{var o,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Zx={};Gx(Zx,{findListItemPos:()=>to,getNextListDepth:()=>gc,handleBackspace:()=>na,handleDelete:()=>ra,hasListBefore:()=>am,hasListItemAfter:()=>Yx,hasListItemBefore:()=>cm,listItemHasSubList:()=>um,nextListIsDeeper:()=>dm,nextListIsHigher:()=>fm});var to=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let o=null,s=n.depth,i=n.pos,l=null;for(;s>0&&l===null;)o=n.node(s),o.type===r?l=s:(s-=1,i-=1);return l===null?null:{$pos:e.doc.resolve(i),depth:l}},gc=(t,e)=>{const n=to(t,e);if(!n)return!1;const[,r]=WC(e,t,n.$pos.pos+4);return r},am=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),s=t.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},cm=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},um=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},na=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Xt(t.state,e)&&am(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!Xt(t.state,e)||!GC(t.state))return!1;const r=to(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=um(e,t.state,s);return cm(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},dm=(t,e)=>{const n=gc(t,e),r=to(t,e);return!r||!n?!1:n>r.depth},fm=(t,e)=>{const n=gc(t,e),r=to(t,e);return!r||!n?!1:n<r.depth},ra=(t,e)=>{if(!Xt(t.state,e)||!qC(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:dm(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():fm(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Yx=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},hm=Y.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&ra(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&ra(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&na(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&na(t,n,r)&&(e=!0)}),e}}}}),Td=/^(\s*)(\d+)\.\s+(.*)$/,Xx=/^\s/;function Qx(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(Td);if(!s)break;const[,i,l,a]=s,c=i.length;let u=a,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(Td))break;if(h.trim()==="")f.push(h),u+=`
133
+ `,d+=1;else if(h.match(Xx))f.push(h),u+=`
134
+ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:u.trim(),raw:f.join(`
135
+ `)}),r=d,n=d}return[e,r]}function pm(t,e,n){var r;const o=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const l=i.content.split(`
136
+ `),a=((r=l[0])==null?void 0:r.trim())||"",c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.slice(1).join(`
137
+ `).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=pm(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
138
+ `)})}o.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return o}function eS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const s=e.parseChildren([o]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([o]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var tS="listItem",Ad="textStyle",Rd=/^(\d+)\.\s$/,mm=ge.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Q(this.options.HTMLAttributes,n),0]:["ol",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?eS(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
139
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
140
+ `),[s,i]=Qx(o);if(s.length===0)return;const l=pm(s,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,i).join(`
141
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tS,this.editor.getAttributes(Ad)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=rr({find:Rd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=rr({find:Rd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ad)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),nS=/^\s*(\[([( |x])?\])\s$/,rS=ge.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Q(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return oc(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{o.setAttribute(d,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,i),o.append(s,a),Object.entries(e).forEach(([d,f])=>{o.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:o,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=tr(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(g=>{p.has(g)||(g in m?o.setAttribute(g,m[g]):o.removeAttribute(g))}),Object.entries(h).forEach(([g,y])=>{y==null?g in m?o.setAttribute(g,m[g]):o.removeAttribute(g):o.setAttribute(g,y)}),u=p,!0}}}},addInputRules(){return[rr({find:nS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),oS=ge.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
142
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const i=Kl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(s)},o=Kl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,i)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:i}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Y.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(im.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(lm.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(hm.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(mm.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(rS.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(oS.configure(this.options.taskList)),t}});var Nd="&nbsp;",sS=" ",iS=ge.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Q(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Nd||r[0].text===sS)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Nd:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),lS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cS=rn.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",Q(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[nr({find:lS,type:this.type})]},addPasteRules(){return[En({find:aS,type:this.type})]}}),uS=ge.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),dS=rn.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",Q(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 o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const s=o[2].trim();return{type:"underline",raw:o[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()}}});function fS(t={}){return new re({view(e){return new hS(e,t)}})}class hS{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(o=>{let s=i=>{this[o](i)};return e.dom.addEventListener(o,s),{name:o,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,o=this.editorView.dom,s=o.getBoundingClientRect(),i=s.width/o.offsetWidth,l=s.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ch(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends V{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ue.valid(r)?new ue(r):V.near(r)}content(){return D.empty}eq(e){return e instanceof ue&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ue(e.resolve(n.pos))}getBookmark(){return new yc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!pS(e)||!mS(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ue.valid(e))return e;let o=e.pos,s=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){s=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;o+=n;let a=e.doc.resolve(o);if(ue.valid(a))return a}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!H.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let l=e.doc.resolve(o);if(ue.valid(l))return l}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;V.jsonID("gapcursor",ue);class yc{constructor(e){this.pos=e}map(e){return new yc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ue.valid(n)?new ue(n):V.near(n)}}function gm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function pS(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||gm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function mS(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||gm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function gS(){return new re({props:{decorations:CS,createSelectionBetween(t,e,n){return e.pos==n.pos&&ue.valid(n)?new ue(n):null},handleClick:bS,handleKeyDown:yS,handleDOMEvents:{beforeinput:vS}}})}const yS=Ga({ArrowLeft:So("horiz",-1),ArrowRight:So("horiz",1),ArrowUp:So("vert",-1),ArrowDown:So("vert",1)});function So(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof B){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ue.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new ue(c))),!0):!1}}function bS(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ue.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&H.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ue(r))),!0)}function vS(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ue))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=T.empty;for(let i=r.length-1;i>=0;i--)o=T.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return s.setSelection(B.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function CS(t){if(!(t.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ee.create(t.doc,[be.widget(t.selection.head,e,{key:"gapcursor"})])}var _s=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<_s&&this.leafAppend(e)||this.length<_s&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new wS(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.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)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(e(s,i))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new ym(e):Ce.empty};var ym=(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(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,i,l){for(var a=s;a<i;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,i,l){for(var a=s-1;a>=i;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=_s)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=_s)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new ym([]);var wS=(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,o,s,i){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(s,l),i)===!1||s>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,s)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,i){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(s,l)-l,i+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(o,l),s,i)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})(Ce);const xS=500;class et{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 o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),s=o.maps.length),s--,u.push(d);return}if(o){u.push(new It(d.map));let h=d.step.map(o.slice(s)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new It(p,void 0,void 0,c.length+u.length))),s--,p&&o.appendMap(p,s)}else i.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(s)):d.selection,a=new et(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,n,r,o){let s=[],i=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new It(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),n&&(i++,n=void 0),o||(a=f)}let c=i-r.depth;return c>ES&&(l=SS(l,c),i-=c),new et(l.append(s),i)}remapping(e,n){let r=new Hr;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new et(this.items.append(e.map(n=>new It(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(a+1,h));g&&l++,r.push(new It(p,m,g))}else r.push(new It(p))},o);let c=[];for(let f=n;f<i;f++)c.push(new It(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new et(u,l);return d.emptyItemCount()>xS&&(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,o=[],s=0;return this.items.forEach((i,l)=>{if(l>=e)o.push(i),i.selection&&s++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=i.selection&&i.selection.map(n.slice(r));u&&s++;let d=new It(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else i.map&&r--},this.items.length,0),new et(Ce.from(o.reverse()),s)}}et.empty=new et(Ce.empty,0);function SS(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let It=class bm{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new bm(n.getMap().invert(),n,this.selection)}}};class Ht{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const ES=20;function kS(t,e,n,r){let o=n.getMeta(vn),s;if(o)return o.historyState;n.getMeta(AS)&&(t=new Ht(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(vn))return i.getMeta(vn).redo?new Ht(t.done.addTransform(n,void 0,r,zo(e)),t.undone,Od(n.mapping.maps),t.prevTime,t.prevComposition):new Ht(t.done,t.undone.addTransform(n,void 0,r,zo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!MS(n,t.prevRanges)),c=i?il(t.prevRanges,n.mapping):Od(n.mapping.maps);return new Ht(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,zo(e)),et.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Ht(t.done.rebased(n,s),t.undone.rebased(n,s),il(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ht(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),il(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function MS(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function Od(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,i)=>e.push(s,i));return e}function il(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function TS(t,e,n){let r=zo(e),o=vn.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),a=new Ht(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(i).setMeta(vn,{redo:n,historyState:a})}let ll=!1,Id=null;function zo(t){let e=t.plugins;if(Id!=e){ll=!1,Id=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ll=!0;break}}return ll}const vn=new ae("history"),AS=new ae("closeHistory");function RS(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new re({key:vn,state:{init(){return new Ht(et.empty,et.empty,null,0,-1)},apply(e,n,r){return kS(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Cm:r=="historyRedo"?wm:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function vm(t,e){return(n,r)=>{let o=vn.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=TS(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Cm=vm(!1,!0),wm=vm(!0,!0);Y.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new re({key:new ae("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const i=s-o,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var NS=Y.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[fS(this.options)]}});Y.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new re({key:new ae("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return ee.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;i+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(be.node(c,c+a.nodeSize,{class:this.options.className}))}),ee.create(t,s)}}})]}});var xm=Y.create({name:"gapCursor",addProseMirrorPlugins(){return[gS()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Z(z(t,"allowGapCursor",n)))!=null?e:null}}}),Dd="placeholder";function OS(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}Y.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Dd,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${OS(this.options.dataAttribute)}`:`data-${Dd}`;return[new re({key:new ae("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,s=[];if(!r)return null;const i=this.editor.isEmpty;return e.descendants((l,a)=>{const c=o>=a&&o<=a+l.nodeSize,u=!l.isLeaf&&oi(l);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const f=be.node(a,a+l.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),ee.create(e,s)}}})]}});Y.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new re({key:new ae("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Mp(n.selection)||t.view.dragging?null:ee.create(n.doc,[be.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Pd({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var IS=Y.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ae(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new re({key:e,appendTransaction:(o,s,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,s)=>{const i=s.tr.doc.lastChild;return!Pd({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!Pd({node:i,types:r})}}})]}}),DS=Y.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Cm(t,e),redo:()=>({state:t,dispatch:e})=>wm(t,e)}},addProseMirrorPlugins(){return[RS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),PS=Y.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(ix.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(tx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(im.configure(this.options.bulletList)),this.options.code!==!1&&o.push(cx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(fx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(hx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(NS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(xm.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(px.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(mx.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(DS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(gx.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(wx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(lm.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(hm.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Kx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(mm.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(iS.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(cS.configure(this.options.strike)),this.options.text!==!1&&o.push(uS.configure(this.options.text)),this.options.underline!==!1&&o.push(dS.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(IS.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),LS=PS;let oa,sa;if(typeof WeakMap<"u"){let t=new WeakMap;oa=e=>t.get(e),sa=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;oa=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},sa=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var de=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,i=o+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;i<this.height&&this.map[e+this.width*l]==n;l++)i++;return{left:r,top:o,right:s,bottom:i}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:s,bottom:i}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:i==this.height)?null:this.map[r+this.width*(n<0?s-1:i)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:s}=this.findCell(t),{left:i,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,i),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const s=r*this.width+o,i=this.map[s];n[i]||(n[i]=!0,!(o==t.left&&o&&this.map[s-1]==i||r==t.top&&r&&this.map[s-this.width]==i)&&e.push(i))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==t){let i=e+t*this.width;const l=(t+1)*this.width;for(;i<l&&this.map[i]<o;)i++;return i==l?s-1:this.map[i]}o=s}}static get(t){return oa(t)||sa(t,_S(t))}};function _S(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=HS(t),n=t.childCount,r=[];let o=0,s=null;const i=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:y,colwidth:C}=m.attrs;for(let w=0;w<y;w++){if(w+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:y-w});break}const x=o+w*e;for(let S=0;S<g;S++){r[x+S]==0?r[x+S]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:g-S});const M=C&&C[S];if(M){const k=(x+S)%e*2,A=i[k];A==null||A!=M&&i[k+1]==1?(i[k]=M,i[k+1]=1):A==M&&i[k+1]++}}}o+=g,u+=m.nodeSize}const f=(c+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new de(e,n,r,s);let a=!1;for(let c=0;!a&&c<i.length;c+=2)i[c]!=null&&i[c+1]<n&&(a=!0);return a&&jS(l,i,t),l}function HS(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let s=0;if(n)for(let i=0;i<r;i++){const l=t.child(i);for(let a=0;a<l.childCount;a++){const c=l.child(a);i+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let i=0;i<o.childCount;i++){const l=o.child(i);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function jS(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const s=t.map[o];if(r[s])continue;r[s]=!0;const i=n.nodeAt(s);if(!i)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=i.attrs;for(let c=0;c<a.colspan;c++){const u=e[(o+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=BS(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function BS(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Re(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}const zt=new ae("selectingCells");function kn(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function zS(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function rt(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function ci(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=kn(e.$head)||$S(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function $S(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function ia(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function FS(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function bc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Sm(t,e,n){const r=t.node(-1),o=de.get(r),s=t.start(-1),i=o.nextCell(t.pos-s,e,n);return i==null?null:t.node(0).resolve(s+i)}function Mn(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Em(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function VS(t,e,n){const r=Re(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var ne=class Ct extends V{constructor(e,n=e){const r=e.node(-1),o=de.get(r),s=e.start(-1),i=o.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=o.cellsInRect(i).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new ph(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(ia(r)&&ia(o)&&bc(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Ct.rowSelection(r,o):s&&this.isColSelection()?Ct.colSelection(r,o):new Ct(r,o)}return B.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=de.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},i=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let u=a*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(s[f])continue;s[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=o.left-h.left,g=h.right-o.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=Mn(y,0,m)),g>0&&(y=Mn(y,y.colspan-g,g)),h.left<o.left){if(p=p.type.createAndFill(y),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(h.top<o.top||h.bottom>o.bottom){const y={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}i.push(e.child(a).copy(T.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:i;return new D(T.from(l),1,1)}replace(e,n=D.empty){const r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){const{$from:l,$to:a}=o[i],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),i?D.empty:n)}const s=V.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new D(T.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=de.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let i=0;i<s.length;i++)e(n.nodeAt(s[i]),o+s[i])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=de.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.top<=l.top?(i.top>0&&(e=a.resolve(s+o.map[i.left])),l.bottom<o.height&&(n=a.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+o.map[l.left])),i.bottom<o.height&&(e=a.resolve(s+o.map[o.width*(o.height-1)+i.right-1]))),new Ct(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=de.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const i=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==n.width}eq(e){return e instanceof Ct&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=de.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.left<=l.left?(i.left>0&&(e=a.resolve(s+o.map[i.top*o.width])),l.right<o.width&&(n=a.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+o.map[l.top*o.width])),i.right<o.width&&(e=a.resolve(s+o.map[o.width*(i.top+1)-1]))),new Ct(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Ct(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Ct(e.resolve(n),e.resolve(r))}getBookmark(){return new WS(this.$anchorCell.pos,this.$headCell.pos)}};ne.prototype.visible=!1;V.jsonID("cell",ne);var WS=class km{constructor(e,n){this.anchor=e,this.head=n}map(e){return new km(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&bc(n,r)?new ne(n,r):V.near(r,1)}};function US(t){if(!(t.selection instanceof ne))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(be.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ee.create(t.doc,e)}function KS({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function qS({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function GS(t,e,n){const r=(e||t).selection,o=(e||t).doc;let s,i;if(r instanceof H&&(i=r.node.type.spec.tableRole)){if(i=="cell"||i=="header_cell")s=ne.create(o,r.from);else if(i=="row"){const l=o.resolve(r.from+1);s=ne.rowSelection(l,l)}else if(!n){const l=de.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=ne.create(o,a+1,c)}}else r instanceof B&&KS(r)?s=B.create(o,r.from):r instanceof B&&qS(r)&&(s=B.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const JS=new ae("fix-tables");function Mm(t,e,n,r){const o=t.childCount,s=e.childCount;e:for(let i=0,l=0;i<s;i++){const a=e.child(i);for(let c=l,u=Math.min(o,i+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?Mm(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Tm(t,e){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=ZS(t,o,s,n))};return e?e.doc!=t.doc&&Mm(e.doc,t.doc,0,r):t.doc.descendants(r),n}function ZS(t,e,n,r){const o=de.get(e);if(!o.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<o.height;a++)s.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)s[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Mn(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let i,l;for(let a=0;a<s.length;a++)s[a]&&(i==null&&(i=a),l=a);for(let a=0,c=n+1;a<o.height;a++){const u=e.child(a),d=c+u.nodeSize,f=s[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const y=Re(t.schema)[h].createAndFill();y&&p.push(y)}const m=(a==0||i==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(JS,{fixTables:!0})}function ht(t){const e=t.selection,n=ci(t),r=n.node(-1),o=n.start(-1),s=de.get(r);return{...e instanceof ne?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function Am(t,{map:e,tableStart:n,table:r},o){let s=o>0?-1:0;VS(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let i=0;i<e.height;i++){const l=i*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,Em(c.attrs,o-e.colCount(a))),i+=c.attrs.rowspan-1}else{const a=s==null?Re(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(i,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function YS(t,e){if(!rt(t))return!1;if(e){const n=ht(t);e(Am(t.tr,n,n.left))}return!0}function XS(t,e){if(!rt(t))return!1;if(e){const n=ht(t);e(Am(t.tr,n,n.right))}return!0}function QS(t,{map:e,table:n,tableStart:r},o){const s=t.mapping.maps.length;for(let i=0;i<e.height;){const l=i*e.width+o,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(s).map(r+a),null,Mn(u,o-e.colCount(a)));else{const d=t.mapping.slice(s).map(r+a);t.delete(d,d+c.nodeSize)}i+=u.rowspan}}function eE(t,e){if(!rt(t))return!1;if(e){const n=ht(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;QS(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=de.get(s)}e(r)}return!0}function tE(t,e,n){var r;const o=Re(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function Rm(t,{map:e,tableStart:n,table:r},o){let s=n;for(let c=0;c<o;c++)s+=r.child(c).nodeSize;const i=[];let l=o>0?-1:0;tE(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;const d=l==null?Re(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&i.push(f)}return t.insert(s,Re(r.type.schema).row.create(null,i)),t}function nE(t,e){if(!rt(t))return!1;if(e){const n=ht(t);e(Rm(t.tr,n,n.top))}return!0}function rE(t,e){if(!rt(t))return!1;if(e){const n=ht(t);e(Rm(t.tr,n,n.bottom))}return!0}function oE(t,{map:e,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const i=s+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(s+r,i+r);const a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function sE(t,e){if(!rt(t))return!1;if(e){const n=ht(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;oE(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=de.get(n.table)}e(r)}return!0}function Ld(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function iE({width:t,height:e,map:n},r){let o=r.top*t+r.left,s=o,i=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[i]==n[i+t])return!0;o++,i++}return!1}function _d(t,e){const n=t.selection;if(!(n instanceof ne)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=ht(t),{map:o}=r;if(iE(o,r))return!1;if(e){const s=t.tr,i={};let l=T.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(i[f]||!h))if(i[f]=!0,a==null)a=f,c=h;else{Ld(h)||(l=l.append(h.content));const p=s.mapping.map(f+r.tableStart);s.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...Em(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const u=a+1+c.content.size,d=Ld(c)?a+1:u;s.replaceWith(d+r.tableStart,u+r.tableStart,l)}s.setSelection(new ne(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function Hd(t,e){const n=Re(t.schema);return lE(({node:r})=>n[r.type.spec.tableRole])(t,e)}function lE(t){return(e,n)=>{const r=e.selection;let o,s;if(r instanceof ne){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var i;if(o=zS(r.$from),!o)return!1;s=(i=kn(r.$from))===null||i===void 0?void 0:i.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=ht(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:o,row:h,col:m}).createAndFill(a[g]))}d.setNodeMarkup(s,t({node:o,row:u.top,col:u.left}),a[0]),r instanceof ne&&d.setSelection(new ne(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function aE(t,e){return function(n,r){if(!rt(n))return!1;const o=ci(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof ne?n.selection.forEachCell((i,l)=>{i.attrs[t]!==e&&s.setNodeMarkup(l,null,{...i.attrs,[t]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function cE(t){return function(e,n){if(!rt(e))return!1;if(n){const r=Re(e.schema),o=ht(e),s=e.tr,i=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=i.map(a=>o.table.nodeAt(a));for(let a=0;a<i.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(o.tableStart+i[a],r.cell,l[a].attrs);if(s.steps.length===0)for(let a=0;a<i.length;a++)s.setNodeMarkup(o.tableStart+i[a],r.header_cell,l[a].attrs);n(s)}return!0}}function jd(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function Kr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cE(t):function(n,r){if(!rt(n))return!1;if(r){const o=Re(n.schema),s=ht(n),i=n.tr,l=jd("row",s,o),a=jd("column",s,o),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:s.map.height}:t=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(u).forEach(f=>{const h=f+s.tableStart,p=i.doc.nodeAt(h);p&&i.setNodeMarkup(h,d,p.attrs)}),r(i)}return!0}}Kr("row",{useDeprecatedLogic:!0});Kr("column",{useDeprecatedLogic:!0});const uE=Kr("cell",{useDeprecatedLogic:!0});function dE(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const s=t.node(-1).child(r),i=s.lastChild;if(i)return o-1-i.nodeSize;o-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function Bd(t){return function(e,n){if(!rt(e))return!1;const r=dE(ci(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(B.between(o,FS(o))).scrollIntoView())}return!0}}function fE(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Eo(t,e){const n=t.selection;if(!(n instanceof ne))return!1;if(e){const r=t.tr,o=Re(t.schema).cell.createAndFill().content;n.forEachCell((s,i)=>{s.content.eq(o)||r.replace(r.mapping.map(i+1),r.mapping.map(i+s.nodeSize-1),new D(o,0,0))}),r.docChanged&&e(r)}return!0}function hE(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,i=o.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=la(Re(i).row,new D(c,u,d)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?la(Re(i).row,new D(e,n,r)).content:e);else return null;return pE(i,l)}function pE(t,e){const n=[];for(let o=0;o<e.length;o++){const s=e[o];for(let i=s.childCount-1;i>=0;i--){const{rowspan:l,colspan:a}=s.child(i).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(T.empty),n[o]<r){const s=Re(t).cell.createAndFill(),i=[];for(let l=n[o];l<r;l++)i.push(s);e[o]=e[o].append(T.from(i))}return{height:e.length,width:r,rows:e}}function la(t,e){const n=t.createAndFill();return new Ia(n).replace(0,n.content.size,e).doc}function mE({width:t,height:e,rows:n},r,o){if(t!=r){const s=[],i=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=s[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Mn(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)s[l+h]=(s[l+h]||0)+f.attrs.colspan}i.push(T.from(c))}n=i,t=r}if(e!=o){const s=[];for(let i=0,l=0;i<o;i++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);i+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}s.push(T.from(a))}n=s,e=o}return{width:t,height:e,rows:n}}function gE(t,e,n,r,o,s,i){const l=t.doc.type.schema,a=Re(l);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<o;g++)p.push(m);t.insert(t.mapping.slice(i).map(f-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,T.from(d)),h=[];for(let p=e.height;p<s;p++)h.push(f);t.insert(t.mapping.slice(i).map(r+n.nodeSize-2),h)}return!!(c||u)}function zd(t,e,n,r,o,s,i,l){if(i==0||i==e.height)return!1;let a=!1;for(let c=o;c<s;c++){const u=i*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:i-h}),t.insert(t.mapping.slice(l).map(e.positionAt(i,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-i})),c+=f.attrs.colspan-1}}return a}function $d(t,e,n,r,o,s,i,l){if(i==0||i==e.width)return!1;let a=!1;for(let c=o;c<s;c++){const u=c*e.width+i,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,Mn(f.attrs,i-h,f.attrs.colspan-(i-h))),t.insert(p+f.nodeSize,f.type.createAndFill(Mn(f.attrs,0,i-h))),c+=f.attrs.rowspan-1}}return a}function Fd(t,e,n,r,o){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let i=de.get(s);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=t.tr;let f=0;function h(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");i=de.get(s),f=d.mapping.maps.length}gE(d,i,s,n,c,u,f)&&h(),zd(d,i,s,n,a,c,l,f)&&h(),zd(d,i,s,n,a,c,u,f)&&h(),$d(d,i,s,n,l,u,a,f)&&h(),$d(d,i,s,n,l,u,c,f)&&h();for(let p=l;p<u;p++){const m=i.positionAt(p,a,s),g=i.positionAt(p,c,s);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(g+n),new D(o.rows[p-l],0,0))}h(),d.setSelection(new ne(d.doc.resolve(n+i.positionAt(l,a,s)),d.doc.resolve(n+i.positionAt(u-1,c-1,s)))),e(d)}const yE=Ga({ArrowLeft:ko("horiz",-1),ArrowRight:ko("horiz",1),ArrowUp:ko("vert",-1),ArrowDown:ko("vert",1),"Shift-ArrowLeft":Mo("horiz",-1),"Shift-ArrowRight":Mo("horiz",1),"Shift-ArrowUp":Mo("vert",-1),"Shift-ArrowDown":Mo("vert",1),Backspace:Eo,"Mod-Backspace":Eo,Delete:Eo,"Mod-Delete":Eo});function $o(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function ko(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof ne)return $o(n,r,V.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const i=Nm(o,t,e);if(i==null)return!1;if(t=="horiz")return $o(n,r,V.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(i),a=Sm(l,t,e);let c;return a?c=V.near(a,1):e<0?c=V.near(n.doc.resolve(l.before(-1)),-1):c=V.near(n.doc.resolve(l.after(-1)),1),$o(n,r,c)}}}function Mo(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let i;if(s instanceof ne)i=s;else{const a=Nm(o,t,e);if(a==null)return!1;i=new ne(n.doc.resolve(a))}const l=Sm(i.$headCell,t,e);return l?$o(n,r,new ne(i.$anchorCell,l)):!1}}function bE(t,e){const n=t.state.doc,r=kn(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ne(r))),!0):!1}function vE(t,e,n){if(!rt(t.state))return!1;let r=hE(n);const o=t.state.selection;if(o instanceof ne){r||(r={width:1,height:1,rows:[T.from(la(Re(t.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),l=de.get(s).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=mE(r,l.right-l.left,l.bottom-l.top),Fd(t.state,t.dispatch,i,l,r),!0}else if(r){const s=ci(t.state),i=s.start(-1);return Fd(t.state,t.dispatch,i,de.get(s.node(-1)).findCell(s.pos-i),r),!0}else return!1}function CE(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Vd(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof ne)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=kn(t.state.selection.$anchor))!=null&&((n=al(t,e))===null||n===void 0?void 0:n.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(a,c){let u=al(t,c);const d=zt.getState(t.state)==null;if(!u||!bc(a,u))if(d)u=a;else return;const f=new ne(a,u);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(zt,a.pos),t.dispatch(h)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",l),zt.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zt,-1))}function l(a){const c=a,u=zt.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(Vd(t,c.target)!=r&&(d=al(t,e),!d))return i();d&&s(d,c)}t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",l)}function Nm(t,e,n){if(!(t.state.selection instanceof B))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const i=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?i:null}}return null}function Vd(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function al(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&kn(t.state.doc.resolve(r))||kn(t.state.doc.resolve(o))}var wE=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),aa(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,aa(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function aa(t,e,n,r,o,s){let i=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let m=0;m<h;m++,f++){const g=o==f?s:p&&p[m],y=g?g+"px":"";if(i+=g||r,g||(l=!1),a)a.style.width!=y&&(a.style.width=y),a=a.nextSibling;else{const C=document.createElement("col");C.style.width=y,e.appendChild(C)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=i+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=i+"px")}}const Ve=new ae("tableColumnResizing");function xE({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=wE,lastColumnResizable:o=!0}={}){const s=new re({key:Ve,state:{init(i,l){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Re(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new SE(-1,!1)},apply(i,l){return l.apply(i)}},props:{attributes:i=>{const l=Ve.getState(i);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(i,l)=>{EE(i,l,t,o)},mouseleave:i=>{kE(i)},mousedown:(i,l)=>{ME(i,l,e,n)}},decorations:i=>{const l=Ve.getState(i);if(l&&l.activeHandle>-1)return OE(i,l.activeHandle)},nodeViews:{}}});return s}var SE=class Fo{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ve);if(r&&r.setHandle!=null)return new Fo(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Fo(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return ia(e.doc.resolve(o))||(o=-1),new Fo(o,n.dragging)}return n}};function EE(t,e,n,r){if(!t.editable)return;const o=Ve.getState(t.state);if(o&&!o.dragging){const s=AE(e.target);let i=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?i=Wd(t,e,"left",n):a-e.clientX<=n&&(i=Wd(t,e,"right",n))}if(i!=o.activeHandle){if(!r&&i!==-1){const l=t.state.doc.resolve(i),a=l.node(-1),c=de.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Om(t,i)}}}function kE(t){if(!t.editable)return;const e=Ve.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Om(t,-1)}function ME(t,e,n,r){var o;if(!t.editable)return!1;const s=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,i=Ve.getState(t.state);if(!i||i.activeHandle==-1||i.dragging)return!1;const l=t.state.doc.nodeAt(i.activeHandle),a=TE(t,i.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Ve,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=Ve.getState(t.state);f?.dragging&&(RE(t,f.activeHandle,Ud(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ve,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ve.getState(t.state);if(f&&f.dragging){const h=Ud(f.dragging,d,n);Kd(t,f.activeHandle,h,r)}}return Kd(t,i.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function TE(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=t.domAtPos(e);let i=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(i-=r[a],l--);return i/l}function AE(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Wd(t,e,n,r){const o=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:i}=s,l=kn(t.state.doc.resolve(i));if(!l)return-1;if(n=="right")return l.pos;const a=de.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Ud(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Om(t,e){t.dispatch(t.state.tr.setMeta(Ve,{setHandle:e}))}function RE(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),s=de.get(o),i=r.start(-1),l=s.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:l-s.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():NE(f.colspan);p[h]=n,a.setNodeMarkup(i+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function Kd(t,e,n,r){const o=t.state.doc.resolve(e),s=o.node(-1),i=o.start(-1),l=de.get(s).colCount(o.pos-i)+o.nodeAfter.attrs.colspan-1;let a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&aa(s,a.firstChild,a,r,l,n)}function NE(t){return Array(t).fill(0)}function OE(t,e){const n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return ee.empty;const s=de.get(o),i=r.start(-1),l=s.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=l+c*s.width;if((l==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],f=i+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Ve.getState(t))===null||a===void 0)&&a.dragging&&n.push(be.node(i+d,i+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(be.widget(f,h))}}return ee.create(t.doc,n)}function IE({allowTableNodeSelection:t=!1}={}){return new re({key:zt,state:{init(){return null},apply(e,n){const r=e.getMeta(zt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:s}=e.mapping.mapResult(n);return o?null:s}},props:{decorations:US,handleDOMEvents:{mousedown:CE},createSelectionBetween(e){return zt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:bE,handleKeyDown:yE,handlePaste:vE},appendTransaction(e,n,r){return GS(r,Tm(r,n),t)}})}const DE={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Pe(...t){return t.filter(Boolean).join(" ")}function PE(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const LE=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return DE[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},lr=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>LE(o,PE(),r)):[]},Im=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,ui=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function vc(t){return typeof t=="number"&&t>=0}function Dm(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(s=>s.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function _E(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function Pm(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,s=vc(r);if(!o&&!s)return null;if(o){let i=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(i=c,l=a,!1):!0),i!==-1&&l!==null)return{pos:i,node:l}}if(s){const i=_E(e,r);if(i)return{pos:r,node:i}}return null}function no(t,e=[],n=!1){if(!t||!t.state.selection)return!1;const{selection:r}=t.state;if(r.empty)return!1;if(r instanceof H){const o=r.node;return o?e.includes(o.type.name):!1}if(n){const{$from:o}=r;for(let s=o.depth;s>0;s--){const i=o.node(s);if(e.includes(i.type.name))return!0}}return!1}function di(t,e=[]){if(!t||e.length===0)return!1;const{state:n}=t,{selection:r}=n,o=new Set(e);if(r instanceof H){const s=r.node?.type?.name;return!!s&&o.has(s)}if(r instanceof B||r instanceof He){let s=!0;return n.doc.nodesBetween(r.from,r.to,i=>i.isTextblock&&!o.has(i.type.name)?(s=!1,!1):s),s}return!1}function Lm(t){const{doc:e}=t.state,{from:n,to:r}=t.state.selection,o=[],s=new Set;return e.nodesBetween(n,r,(i,l)=>{if(i.isBlock)return s.has(l)||(s.add(l),o.push(i)),!1}),o}const _m=E.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const i=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return b.jsx("div",{className:Pe("tiptap-separator",n),"data-orientation":e,...i,...r,ref:o})});_m.displayName="Separator";function HE({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:s,orientation:i="vertical",autoSelectFirstItem:l=!0}){const[a,c]=E.useState(l?0:-1);return E.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return i==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return i==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return i==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return i==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),s?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,s,i]),E.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const qd=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},jE=(t,e)=>{const n=E.useRef(null);return E.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&qd(n.current,null),n.current=e,e&&qd(e,r)},[t,e])},BE=t=>{const[e,n]=E.useState([]),r=E.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);E.useEffect(()=>{const s=t.current;if(!s)return;const i=()=>n(r());i();const l=new MutationObserver(i);return l.observe(s,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=HE({containerRef:t,items:e,orientation:"horizontal",onSelect:s=>s.click(),autoSelectFirstItem:!1});E.useEffect(()=>{const s=t.current;if(!s)return;const i=a=>{const c=a.target;s.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;s.contains(c)&&c.removeAttribute("data-focus-visible")};return s.addEventListener("focus",i,!0),s.addEventListener("blur",l,!0),()=>{s.removeEventListener("focus",i,!0),s.removeEventListener("blur",l,!0)}},[t]),E.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},Hm=E.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const s=E.useRef(null),i=jE(s,o);return BE(s),b.jsx("div",{ref:i,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Pe("tiptap-toolbar",e),...r,children:t})});Hm.displayName="Toolbar";const ca=E.forwardRef(({children:t,className:e,...n},r)=>b.jsx("div",{ref:r,role:"group",className:Pe("tiptap-toolbar-group",e),...n,children:t}));ca.displayName="ToolbarGroup";const Vo=E.forwardRef(({...t},e)=>b.jsx(_m,{ref:e,orientation:"vertical",decorative:!0,...t}));Vo.displayName="ToolbarSeparator";function ze(t){const{editor:e}=Ww(),n=E.useMemo(()=>t||e,[t,e]);return sc({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}function fi(){return typeof window<"u"}function ar(t){return Cc(t)?(t.nodeName||"").toLowerCase():"#document"}function Be(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pt(t){var e;return(e=(Cc(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Cc(t){return fi()?t instanceof Node||t instanceof Be(t).Node:!1}function te(t){return fi()?t instanceof Element||t instanceof Be(t).Element:!1}function Qe(t){return fi()?t instanceof HTMLElement||t instanceof Be(t).HTMLElement:!1}function ua(t){return!fi()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Be(t).ShadowRoot}function ro(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Xe(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function zE(t){return/^(table|td|th)$/.test(ar(t))}function hi(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const $E=/transform|translate|scale|rotate|perspective|filter/,FE=/paint|layout|strict|content/,cn=t=>!!t&&t!=="none";let cl;function wc(t){const e=te(t)?Xe(t):t;return cn(e.transform)||cn(e.translate)||cn(e.scale)||cn(e.rotate)||cn(e.perspective)||!pi()&&(cn(e.backdropFilter)||cn(e.filter))||$E.test(e.willChange||"")||FE.test(e.contain||"")}function VE(t){let e=Mt(t);for(;Qe(e)&&!kt(e);){if(wc(e))return e;if(hi(e))return null;e=Mt(e)}return null}function pi(){return cl==null&&(cl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),cl}function kt(t){return/^(html|body|#document)$/.test(ar(t))}function Xe(t){return Be(t).getComputedStyle(t)}function mi(t){return te(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mt(t){if(ar(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ua(t)&&t.host||pt(t);return ua(e)?e.host:e}function jm(t){const e=Mt(t);return kt(e)?t.ownerDocument?t.ownerDocument.body:t.body:Qe(e)&&ro(e)?e:jm(e)}function Zt(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=jm(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),i=Be(o);if(s){const l=da(i);return e.concat(i,i.visualViewport||[],ro(o)?o:[],l&&n?Zt(l):[])}else return e.concat(o,Zt(o,[],n))}function da(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const WE=["top","right","bottom","left"],Qt=Math.min,$e=Math.max,Hs=Math.round,To=Math.floor,ut=t=>({x:t,y:t}),UE={left:"right",right:"left",bottom:"top",top:"bottom"};function fa(t,e,n){return $e(t,Qt(e,n))}function Tt(t,e){return typeof t=="function"?t(e):t}function At(t){return t.split("-")[0]}function cr(t){return t.split("-")[1]}function xc(t){return t==="x"?"y":"x"}function Sc(t){return t==="y"?"height":"width"}function at(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Ec(t){return xc(at(t))}function KE(t,e,n){n===void 0&&(n=!1);const r=cr(t),o=Ec(t),s=Sc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=js(i)),[i,js(i)]}function qE(t){const e=js(t);return[ha(t),e,ha(e)]}function ha(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Gd=["left","right"],Jd=["right","left"],GE=["top","bottom"],JE=["bottom","top"];function ZE(t,e,n){switch(t){case"top":case"bottom":return n?e?Jd:Gd:e?Gd:Jd;case"left":case"right":return e?GE:JE;default:return[]}}function YE(t,e,n,r){const o=cr(t);let s=ZE(At(t),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),e&&(s=s.concat(s.map(ha)))),s}function js(t){const e=At(t);return UE[e]+t.slice(e.length)}function XE(t){return{top:0,right:0,bottom:0,left:0,...t}}function Bm(t){return typeof t!="number"?XE(t):{top:t,right:t,bottom:t,left:t}}function Bs(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}var QE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],pa=QE.join(","),zm=typeof Element>"u",qr=zm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,zs=!zm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},$s=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=o===""||o==="true",i=s||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):$s(e.parentNode));return i},ek=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},tk=function(e,n,r){if($s(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(pa));return n&&qr.call(e,pa)&&o.unshift(e),o=o.filter(r),o},ma=function(e,n,r){for(var o=[],s=Array.from(e);s.length;){var i=s.shift();if(!$s(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=ma(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=qr.call(i,pa);u&&r.filter(i)&&(n||!e.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!$s(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var h=ma(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return o},$m=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Fm=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||ek(e))&&!$m(e)?0:e.tabIndex},nk=function(e,n){var r=Fm(e);return r<0&&n&&!$m(e)?0:r},rk=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Vm=function(e){return e.tagName==="INPUT"},ok=function(e){return Vm(e)&&e.type==="hidden"},sk=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},ik=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},lk=function(e){if(!e.name)return!0;var n=e.form||zs(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=ik(o,e.form);return!s||s===e},ak=function(e){return Vm(e)&&e.type==="radio"},ck=function(e){return ak(e)&&!lk(e)},uk=function(e){var n,r=e&&zs(e),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!s&&o;){var c,u,d;r=zs(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Zd=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},dk=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=qr.call(e,"details>summary:first-of-type"),l=i?e.parentElement:e;if(qr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=zs(e);if(c&&!c.shadowRoot&&o(c)===!0)return Zd(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if(uk(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Zd(e);return!1},fk=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return qr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},hk=function(e,n){return!(n.disabled||ok(n)||dk(n,e)||sk(n)||fk(n))},Yd=function(e,n){return!(ck(n)||Fm(n)<0||!hk(e,n))},pk=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Wm=function(e){var n=[],r=[];return e.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=nk(l,i),c=i?Wm(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(rk).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Um=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ma([e],n.includeContainer,{filter:Yd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:pk}):r=tk(e,n.includeContainer,Yd.bind(null,n)),Wm(r)};function mk(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function gk(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function Km(){return/apple/i.test(navigator.vendor)}function yk(){return mk().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function bk(){return gk().includes("jsdom/")}const Xd="data-floating-ui-focusable",vk="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ga(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function or(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&ua(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Fn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function ul(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Ck(t){return t.matches("html,body")}function ct(t){return t?.ownerDocument||document}function wk(t){return Qe(t)&&t.matches(vk)}function xk(t){if(!t||bk())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function Sk(t){return t?t.hasAttribute(Xd)?t:t.querySelector("["+Xd+"]")||t:null}function Wo(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var s;return o.parentId===e&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Wo(t,o.id,n)])}function Ek(t){return"nativeEvent"in t}function ya(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var kk=typeof document<"u",Mk=function(){},nt=kk?E.useLayoutEffect:Mk;const Tk={...v};function Ao(t){const e=v.useRef(t);return nt(()=>{e.current=t}),e}const Ak=Tk.useInsertionEffect,Rk=Ak||(t=>t());function it(t){const e=v.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Rk(()=>{e.current=t}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const qm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Gm(t,e){const n=Um(t,qm()),r=n.length;if(r===0)return;const o=ga(ct(t)),s=n.indexOf(o),i=s===-1?e===1?0:r-1:s+e;return n[i]}function Nk(t){return Gm(ct(t).body,1)||t}function Ok(t){return Gm(ct(t).body,-1)||t}function dl(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!or(n,r)}function Ik(t){Um(t,qm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Qd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function ef(t,e,n){let{reference:r,floating:o}=t;const s=at(e),i=Ec(e),l=Sc(i),a=At(e),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(cr(e)){case"start":h[i]-=f*(n&&c?-1:1);break;case"end":h[i]+=f*(n&&c?-1:1);break}return h}async function Dk(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Tt(e,t),p=Bm(h),g=l[f?d==="floating"?"reference":"floating":d],y=Bs(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),x=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},S=Bs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:w,strategy:a}):C);return{top:(y.top-S.top+p.top)/x.y,bottom:(S.bottom-y.bottom+p.bottom)/x.y,left:(y.left-S.left+p.left)/x.x,right:(S.right-y.right+p.right)/x.x}}const Pk=50,Lk=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:Dk},a=await(i.isRTL==null?void 0:i.isRTL(e));let c=await i.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=ef(c,r,a),f=r,h=0;const p={};for(let m=0;m<s.length;m++){const g=s[m];if(!g)continue;const{name:y,fn:C}=g,{x:w,y:x,data:S,reset:M}=await C({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});u=w??u,d=x??d,p[y]={...p[y],...S},M&&h<Pk&&(h++,typeof M=="object"&&(M.placement&&(f=M.placement),M.rects&&(c=M.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:o}):M.rects),{x:u,y:d}=ef(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},_k=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Tt(t,e)||{};if(c==null)return{};const d=Bm(u),f={x:n,y:r},h=Ec(o),p=Sc(h),m=await i.getDimensions(c),g=h==="y",y=g?"top":"left",C=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=s.reference[p]+s.reference[h]-f[h]-s.floating[p],S=f[h]-s.reference[h],M=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let k=M?M[w]:0;(!k||!await(i.isElement==null?void 0:i.isElement(M)))&&(k=l.floating[w]||s.floating[p]);const A=x/2-S/2,P=k/2-m[p]/2-1,_=Qt(d[y],P),U=Qt(d[C],P),W=_,$=k-m[p]-U,I=k/2-m[p]/2+A,j=fa(W,I,$),F=!a.arrow&&cr(o)!=null&&I!==j&&s.reference[p]/2-(I<W?_:U)-m[p]/2<0,L=F?I<W?I-W:I-$:0;return{[h]:f[h]+L,data:{[h]:j,centerOffset:I-j-L,...F&&{alignmentOffset:L}},reset:F}}}),Hk=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=Tt(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=At(o),C=at(l),w=At(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(c.floating)),S=f||(w||!m?[js(l)]:qE(l)),M=p!=="none";!f&&M&&S.push(...YE(l,m,p,x));const k=[l,...S],A=await a.detectOverflow(e,g),P=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(A[y]),d){const I=KE(o,i,x);P.push(A[I[0]],A[I[1]])}if(_=[..._,{placement:o,overflows:P}],!P.every(I=>I<=0)){var U,W;const I=(((U=s.flip)==null?void 0:U.index)||0)+1,j=k[I];if(j&&(!(d==="alignment"?C!==at(j):!1)||_.every(R=>at(R.placement)===C?R.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:j}};let F=(W=_.filter(L=>L.overflows[0]<=0).sort((L,R)=>L.overflows[1]-R.overflows[1])[0])==null?void 0:W.placement;if(!F)switch(h){case"bestFit":{var $;const L=($=_.filter(R=>{if(M){const O=at(R.placement);return O===C||O==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(O=>O>0).reduce((O,K)=>O+K,0)]).sort((R,O)=>R[1]-O[1])[0])==null?void 0:$[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function tf(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function nf(t){return WE.some(e=>t[e]>=0)}const jk=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...s}=Tt(t,e);switch(o){case"referenceHidden":{const i=await r.detectOverflow(e,{...s,elementContext:"reference"}),l=tf(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:nf(l)}}}case"escaped":{const i=await r.detectOverflow(e,{...s,altBoundary:!0}),l=tf(i,n.floating);return{data:{escapedOffsets:l,escaped:nf(l)}}}default:return{}}}}},Jm=new Set(["left","top"]);async function Bk(t,e){const{placement:n,platform:r,elements:o}=t,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=At(n),l=cr(n),a=at(n)==="y",c=Jm.has(i)?-1:1,u=s&&a?-1:1,d=Tt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const zk=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=e,a=await Bk(e,t);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},$k=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:s}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:y=>{let{x:C,y:w}=y;return{x:C,y:w}}},...c}=Tt(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),f=at(At(o)),h=xc(f);let p=u[h],m=u[f];if(i){const y=h==="y"?"top":"left",C=h==="y"?"bottom":"right",w=p+d[y],x=p-d[C];p=fa(w,p,x)}if(l){const y=f==="y"?"top":"left",C=f==="y"?"bottom":"right",w=m+d[y],x=m-d[C];m=fa(w,m,x)}const g=a.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[f]:l}}}}}},Fk=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Tt(t,e),u={x:n,y:r},d=at(o),f=xc(d);let h=u[f],p=u[d];const m=Tt(l,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const w=f==="y"?"height":"width",x=s.reference[f]-s.floating[w]+g.mainAxis,S=s.reference[f]+s.reference[w]-g.mainAxis;h<x?h=x:h>S&&(h=S)}if(c){var y,C;const w=f==="y"?"width":"height",x=Jm.has(At(o)),S=s.reference[d]-s.floating[w]+(x&&((y=i.offset)==null?void 0:y[d])||0)+(x?0:g.crossAxis),M=s.reference[d]+s.reference[w]+(x?0:((C=i.offset)==null?void 0:C[d])||0)-(x?g.crossAxis:0);p<S?p=S:p>M&&(p=M)}return{[f]:h,[d]:p}}}},Vk=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:s,platform:i,elements:l}=e,{apply:a=()=>{},...c}=Tt(t,e),u=await i.detectOverflow(e,c),d=At(o),f=cr(o),h=at(o)==="y",{width:p,height:m}=s.floating;let g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,w=p-u.left-u.right,x=Qt(m-u[g],C),S=Qt(p-u[y],w),M=!e.middlewareData.shift;let k=x,A=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=C),M&&!f){const _=$e(u.left,0),U=$e(u.right,0),W=$e(u.top,0),$=$e(u.bottom,0);h?A=p-2*(_!==0||U!==0?_+U:$e(u.left,u.right)):k=m-2*(W!==0||$!==0?W+$:$e(u.top,u.bottom))}await a({...e,availableWidth:A,availableHeight:k});const P=await i.getDimensions(l.floating);return p!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function Zm(t){const e=Xe(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Qe(t),s=o?t.offsetWidth:n,i=o?t.offsetHeight:r,l=Hs(n)!==s||Hs(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function kc(t){return te(t)?t:t.contextElement}function Gn(t){const e=kc(t);if(!Qe(e))return ut(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=Zm(e);let i=(s?Hs(n.width):n.width)/r,l=(s?Hs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Wk=ut(0);function Ym(t){const e=Be(t);return!pi()||!e.visualViewport?Wk:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Uk(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Be(t)?!1:e}function Tn(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=kc(t);let i=ut(1);e&&(r?te(r)&&(i=Gn(r)):i=Gn(t));const l=Uk(s,n,r)?Ym(s):ut(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const f=Be(s),h=r&&te(r)?Be(r):r;let p=f,m=da(p);for(;m&&r&&h!==p;){const g=Gn(m),y=m.getBoundingClientRect(),C=Xe(m),w=y.left+(m.clientLeft+parseFloat(C.paddingLeft))*g.x,x=y.top+(m.clientTop+parseFloat(C.paddingTop))*g.y;a*=g.x,c*=g.y,u*=g.x,d*=g.y,a+=w,c+=x,p=Be(m),m=da(p)}}return Bs({width:u,height:d,x:a,y:c})}function gi(t,e){const n=mi(t).scrollLeft;return e?e.left+n:Tn(pt(t)).left+n}function Xm(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-gi(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function Kk(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",i=pt(r),l=e?hi(e.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=ut(1);const u=ut(0),d=Qe(r);if((d||!d&&!s)&&((ar(r)!=="body"||ro(i))&&(a=mi(r)),d)){const h=Tn(r);c=Gn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!s?Xm(i,a):ut(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function qk(t){return Array.from(t.getClientRects())}function Gk(t){const e=pt(t),n=mi(t),r=t.ownerDocument.body,o=$e(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=$e(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gi(t);const l=-n.scrollTop;return Xe(r).direction==="rtl"&&(i+=$e(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const rf=25;function Jk(t,e){const n=Be(t),r=pt(t),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=pi();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=gi(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=rf&&(s-=p)}else c<=rf&&(s+=c);return{width:s,height:i,x:l,y:a}}function Zk(t,e){const n=Tn(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=Qe(t)?Gn(t):ut(1),i=t.clientWidth*s.x,l=t.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function of(t,e,n){let r;if(e==="viewport")r=Jk(t,n);else if(e==="document")r=Gk(pt(t));else if(te(e))r=Zk(e,n);else{const o=Ym(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Bs(r)}function Qm(t,e){const n=Mt(t);return n===e||!te(n)||kt(n)?!1:Xe(n).position==="fixed"||Qm(n,e)}function Yk(t,e){const n=e.get(t);if(n)return n;let r=Zt(t,[],!1).filter(l=>te(l)&&ar(l)!=="body"),o=null;const s=Xe(t).position==="fixed";let i=s?Mt(t):t;for(;te(i)&&!kt(i);){const l=Xe(i),a=wc(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ro(i)&&!a&&Qm(t,i))?r=r.filter(u=>u!==i):o=l,i=Mt(i)}return e.set(t,r),r}function Xk(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?hi(e)?[]:Yk(e,this._c):[].concat(n),r],l=of(e,i[0],o);let a=l.top,c=l.right,u=l.bottom,d=l.left;for(let f=1;f<i.length;f++){const h=of(e,i[f],o);a=$e(h.top,a),c=Qt(h.right,c),u=Qt(h.bottom,u),d=$e(h.left,d)}return{width:c-d,height:u-a,x:d,y:a}}function Qk(t){const{width:e,height:n}=Zm(t);return{width:e,height:n}}function eM(t,e,n){const r=Qe(e),o=pt(e),s=n==="fixed",i=Tn(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=ut(0);function c(){a.x=gi(o)}if(r||!r&&!s)if((ar(e)!=="body"||ro(o))&&(l=mi(e)),r){const h=Tn(e,!0,s,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Xm(o,l):ut(0),d=i.left+l.scrollLeft-a.x-u.x,f=i.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function fl(t){return Xe(t).position==="static"}function sf(t,e){if(!Qe(t)||Xe(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pt(t)===n&&(n=n.ownerDocument.body),n}function eg(t,e){const n=Be(t);if(hi(t))return n;if(!Qe(t)){let o=Mt(t);for(;o&&!kt(o);){if(te(o)&&!fl(o))return o;o=Mt(o)}return n}let r=sf(t,e);for(;r&&zE(r)&&fl(r);)r=sf(r,e);return r&&kt(r)&&fl(r)&&!wc(r)?n:r||VE(t)||n}const tM=async function(t){const e=this.getOffsetParent||eg,n=this.getDimensions,r=await n(t.floating);return{reference:eM(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nM(t){return Xe(t).direction==="rtl"}const rM={convertOffsetParentRelativeRectToViewportRelativeRect:Kk,getDocumentElement:pt,getClippingRect:Xk,getOffsetParent:eg,getElementRects:tM,getClientRects:qk,getDimensions:Qk,getScale:Gn,isElement:te,isRTL:nM};function tg(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function oM(t,e){let n=null,r;const o=pt(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=To(d),m=To(o.clientWidth-(u+f)),g=To(o.clientHeight-(d+h)),y=To(u),w={rootMargin:-p+"px "+-m+"px "+-g+"px "+-y+"px",threshold:$e(0,Qt(1,a))||1};let x=!0;function S(M){const k=M[0].intersectionRatio;if(k!==a){if(!x)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!tg(c,t.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(S,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(t)}return i(!0),s}function ng(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=kc(t),u=o||s?[...c?Zt(c):[],...e?Zt(e):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&l?oM(c,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(y=>{let[C]=y;C&&C.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),n()}),c&&!a&&h.observe(c),e&&h.observe(e));let p,m=a?Tn(t):null;a&&g();function g(){const y=Tn(t);m&&!tg(m,y)&&n(),m=y,p=requestAnimationFrame(g)}return n(),()=>{var y;u.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const sM=zk,iM=$k,lM=Hk,aM=Vk,cM=jk,lf=_k,uM=Fk,dM=(t,e,n)=>{const r=new Map,o={platform:rM,...n},s={...o.platform,_c:r};return Lk(t,e,{...o,platform:s})};var fM=typeof document<"u",hM=function(){},Uo=fM?E.useLayoutEffect:hM;function Fs(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Fs(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&t.$$typeof)&&!Fs(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function rg(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function af(t,e){const n=rg(t);return Math.round(e*n)/n}function hl(t){const e=v.useRef(t);return Uo(()=>{e.current=t}),e}function og(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=v.useState(r);Fs(f,r)||h(r);const[p,m]=v.useState(null),[g,y]=v.useState(null),C=v.useCallback(R=>{R!==M.current&&(M.current=R,m(R))},[]),w=v.useCallback(R=>{R!==k.current&&(k.current=R,y(R))},[]),x=s||p,S=i||g,M=v.useRef(null),k=v.useRef(null),A=v.useRef(u),P=a!=null,_=hl(a),U=hl(o),W=hl(c),$=v.useCallback(()=>{if(!M.current||!k.current)return;const R={placement:e,strategy:n,middleware:f};U.current&&(R.platform=U.current),dM(M.current,k.current,R).then(O=>{const K={...O,isPositioned:W.current!==!1};I.current&&!Fs(A.current,K)&&(A.current=K,Ta.flushSync(()=>{d(K)}))})},[f,e,n,U,W]);Uo(()=>{c===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[c]);const I=v.useRef(!1);Uo(()=>(I.current=!0,()=>{I.current=!1}),[]),Uo(()=>{if(x&&(M.current=x),S&&(k.current=S),x&&S){if(_.current)return _.current(x,S,$);$()}},[x,S,$,_,P]);const j=v.useMemo(()=>({reference:M,floating:k,setReference:C,setFloating:w}),[C,w]),F=v.useMemo(()=>({reference:x,floating:S}),[x,S]),L=v.useMemo(()=>{const R={position:n,left:0,top:0};if(!F.floating)return R;const O=af(F.floating,u.x),K=af(F.floating,u.y);return l?{...R,transform:"translate("+O+"px, "+K+"px)",...rg(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:K}},[n,l,F.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:$,refs:j,elements:F,floatingStyles:L}),[u,$,j,F,L])}const pM=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?lf({element:r.current,padding:o}).fn(n):{}:r?lf({element:r,padding:o}).fn(n):{}}}},sg=(t,e)=>{const n=sM(t);return{name:n.name,fn:n.fn,options:[t,e]}},ig=(t,e)=>{const n=iM(t);return{name:n.name,fn:n.fn,options:[t,e]}},mM=(t,e)=>({fn:uM(t).fn,options:[t,e]}),lg=(t,e)=>{const n=lM(t);return{name:n.name,fn:n.fn,options:[t,e]}},gM=(t,e)=>{const n=aM(t);return{name:n.name,fn:n.fn,options:[t,e]}},yM=(t,e)=>{const n=cM(t);return{name:n.name,fn:n.fn,options:[t,e]}},bM=(t,e)=>{const n=pM(t);return{name:n.name,fn:n.fn,options:[t,e]}};function ag(t){const e=v.useRef(void 0),n=v.useCallback(r=>{const o=t.map(s=>{if(s!=null){if(typeof s=="function"){const i=s,l=i(r);return typeof l=="function"?l:()=>{i(null)}}return s.current=r,()=>{s.current=null}}});return()=>{o.forEach(s=>s?.())}},t);return v.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const vM="data-floating-ui-focusable",cf="active",uf="selected",CM={...v};let df=!1,wM=0;const ff=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+wM++;function xM(){const[t,e]=v.useState(()=>df?ff():void 0);return nt(()=>{t==null&&e(ff())},[]),v.useEffect(()=>{df=!0},[]),t}const SM=CM.useId,Mc=SM||xM;let ba;process.env.NODE_ENV!=="production"&&(ba=new Set);function EM(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ba)!=null&&t.has(o))){var s;(s=ba)==null||s.add(o),console.error(o)}}function kM(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const MM=v.createContext(null),TM=v.createContext(null),Tc=()=>{var t;return((t=v.useContext(MM))==null?void 0:t.id)||null},Ac=()=>v.useContext(TM);function oo(t){return"data-floating-ui-"+t}function Ue(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const hf=oo("safe-polygon");function pl(t,e,n){if(n&&!ya(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function ml(t){return typeof t=="function"?t():t}function AM(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=Ac(),p=Tc(),m=Ao(c),g=Ao(a),y=Ao(n),C=Ao(d),w=v.useRef(),x=v.useRef(-1),S=v.useRef(),M=v.useRef(-1),k=v.useRef(!0),A=v.useRef(!1),P=v.useRef(()=>{}),_=v.useRef(!1),U=it(()=>{var L;const R=(L=o.current.openEvent)==null?void 0:L.type;return R?.includes("mouse")&&R!=="mousedown"});v.useEffect(()=>{if(!l)return;function L(R){let{open:O}=R;O||(Ue(x),Ue(M),k.current=!0,_.current=!1)}return s.on("openchange",L),()=>{s.off("openchange",L)}},[l,s]),v.useEffect(()=>{if(!l||!m.current||!n)return;function L(O){U()&&r(!1,O,"hover")}const R=ct(i.floating).documentElement;return R.addEventListener("mouseleave",L),()=>{R.removeEventListener("mouseleave",L)}},[i.floating,n,r,l,m,U]);const W=v.useCallback(function(L,R,O){R===void 0&&(R=!0),O===void 0&&(O="hover");const K=pl(g.current,"close",w.current);K&&!S.current?(Ue(x),x.current=window.setTimeout(()=>r(!1,L,O),K)):R&&(Ue(x),r(!1,L,O))},[g,r]),$=it(()=>{P.current(),S.current=void 0}),I=it(()=>{if(A.current){const L=ct(i.floating).body;L.style.pointerEvents="",L.removeAttribute(hf),A.current=!1}}),j=it(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);v.useEffect(()=>{if(!l)return;function L(J){if(Ue(x),k.current=!1,u&&!ya(w.current)||ml(C.current)>0&&!pl(g.current,"open"))return;const le=pl(g.current,"open",w.current);le?x.current=window.setTimeout(()=>{y.current||r(!0,J,"hover")},le):n||r(!0,J,"hover")}function R(J){if(j()){I();return}P.current();const le=ct(i.floating);if(Ue(M),_.current=!1,m.current&&o.current.floatingContext){n||Ue(x),S.current=m.current({...o.current.floatingContext,tree:h,x:J.clientX,y:J.clientY,onClose(){I(),$(),j()||W(J,!0,"safe-polygon")}});const he=S.current;le.addEventListener("mousemove",he),P.current=()=>{le.removeEventListener("mousemove",he)};return}(w.current!=="touch"||!or(i.floating,J.relatedTarget))&&W(J)}function O(J){j()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:J.clientX,y:J.clientY,onClose(){I(),$(),j()||W(J)}})(J))}function K(){Ue(x)}function oe(J){j()||W(J,!1)}if(te(i.domReference)){const J=i.domReference,le=i.floating;return n&&J.addEventListener("mouseleave",O),f&&J.addEventListener("mousemove",L,{once:!0}),J.addEventListener("mouseenter",L),J.addEventListener("mouseleave",R),le&&(le.addEventListener("mouseleave",O),le.addEventListener("mouseenter",K),le.addEventListener("mouseleave",oe)),()=>{n&&J.removeEventListener("mouseleave",O),f&&J.removeEventListener("mousemove",L),J.removeEventListener("mouseenter",L),J.removeEventListener("mouseleave",R),le&&(le.removeEventListener("mouseleave",O),le.removeEventListener("mouseenter",K),le.removeEventListener("mouseleave",oe))}}},[i,l,t,u,f,W,$,I,r,n,y,h,g,m,o,j,C]),nt(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&U()){A.current=!0;const O=i.floating;if(te(i.domReference)&&O){var R;const K=ct(i.floating).body;K.setAttribute(hf,"");const oe=i.domReference,J=h==null||(R=h.nodesRef.current.find(le=>le.id===p))==null||(R=R.context)==null?void 0:R.elements.floating;return J&&(J.style.pointerEvents=""),K.style.pointerEvents="none",oe.style.pointerEvents="auto",O.style.pointerEvents="auto",()=>{K.style.pointerEvents="",oe.style.pointerEvents="",O.style.pointerEvents=""}}}},[l,n,p,i,h,m,U]),nt(()=>{n||(w.current=void 0,_.current=!1,$(),I())},[n,$,I]),v.useEffect(()=>()=>{$(),Ue(x),Ue(M),I()},[l,i.domReference,$,I]);const F=v.useMemo(()=>{function L(R){w.current=R.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(R){const{nativeEvent:O}=R;function K(){!k.current&&!y.current&&r(!0,O,"hover")}u&&!ya(w.current)||n||ml(C.current)===0||_.current&&R.movementX**2+R.movementY**2<2||(Ue(M),w.current==="touch"?K():(_.current=!0,M.current=window.setTimeout(K,ml(C.current))))}}},[u,r,n,y,C]);return v.useMemo(()=>l?{reference:F}:{},[l,F])}const pf=()=>{},RM=v.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:pf,setState:pf,isInstantPhase:!1});function NM(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,s]=v.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),i=v.useRef(null),l=v.useCallback(a=>{s({currentId:a})},[]);return nt(()=>{o.currentId?i.current===null?i.current=o.currentId:o.isInstantPhase||s({isInstantPhase:!0}):(o.isInstantPhase&&s({isInstantPhase:!1}),i.current=null)},[o.currentId,o.isInstantPhase]),b.jsx(RM.Provider,{value:v.useMemo(()=>({...o,setState:s,setCurrentId:l}),[o,l]),children:e})}const OM={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},mf=v.forwardRef(function(e,n){const[r,o]=v.useState();nt(()=>{Km()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[oo("focus-guard")]:"",style:OM};return b.jsx("span",{...e,...s})}),IM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},cg=v.createContext(null),gf=oo("portal");function DM(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Mc(),o=LM(),[s,i]=v.useState(null),l=v.useRef(null);return nt(()=>()=>{s?.remove(),queueMicrotask(()=>{l.current=null})},[s]),nt(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(gf,""),a.appendChild(c),l.current=c,i(c)},[e,r]),nt(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!Cc(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(gf,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[e,n,r,o]),s}function PM(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,s=DM({id:n,root:r}),[i,l]=v.useState(null),a=v.useRef(null),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=i?.modal,h=i?.open,p=!!i&&!i.modal&&i.open&&o&&!!(r||s);return v.useEffect(()=>{if(!s||!o||f)return;function m(g){s&&dl(g)&&(g.type==="focusin"?Qd:Ik)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,f]),v.useEffect(()=>{s&&(h||Qd(s))},[h,s]),b.jsxs(cg.Provider,{value:v.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:s,setFocusManagerState:l}),[o,s]),children:[p&&s&&b.jsx(mf,{"data-type":"outside",ref:a,onFocus:m=>{if(dl(m,s)){var g;(g=u.current)==null||g.focus()}else{const y=i?i.domReference:null,C=Ok(y);C?.focus()}}}),p&&s&&b.jsx("span",{"aria-owns":s.id,style:IM}),s&&Ta.createPortal(e,s),p&&s&&b.jsx(mf,{"data-type":"outside",ref:c,onFocus:m=>{if(dl(m,s)){var g;(g=d.current)==null||g.focus()}else{const y=i?i.domReference:null,C=Nk(y);C?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const LM=()=>v.useContext(cg),_M={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},HM={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},yf=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function jM(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=t,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=Ac(),g=it(typeof a=="function"?a:()=>!1),y=typeof a=="function"?g:a,C=v.useRef(!1),{escapeKey:w,outsidePress:x}=yf(h),{escapeKey:S,outsidePress:M}=yf(p),k=v.useRef(!1),A=it(I=>{var j;if(!n||!i||!l||I.key!=="Escape"||k.current)return;const F=(j=s.current.floatingContext)==null?void 0:j.nodeId,L=m?Wo(m.nodesRef.current,F):[];if(!w&&(I.stopPropagation(),L.length>0)){let R=!0;if(L.forEach(O=>{var K;if((K=O.context)!=null&&K.open&&!O.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}r(!1,Ek(I)?I.nativeEvent:I,"escape-key")}),P=it(I=>{var j;const F=()=>{var L;A(I),(L=Fn(I))==null||L.removeEventListener("keydown",F)};(j=Fn(I))==null||j.addEventListener("keydown",F)}),_=it(I=>{var j;const F=s.current.insideReactTree;s.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof y=="function"&&!y(I))return;const R=Fn(I),O="["+oo("inert")+"]",K=ct(o.floating).querySelectorAll(O);let oe=te(R)?R:null;for(;oe&&!kt(oe);){const he=Mt(oe);if(kt(he)||!te(he))break;oe=he}if(K.length&&te(R)&&!Ck(R)&&!or(R,o.floating)&&Array.from(K).every(he=>!or(oe,he)))return;if(Qe(R)&&$){const he=kt(R),we=Xe(R),se=/auto|scroll/,ln=he||se.test(we.overflowX),Mi=he||se.test(we.overflowY),Ti=ln&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,Ai=Mi&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,Ri=we.direction==="rtl",Dn=Ai&&(Ri?I.offsetX<=R.offsetWidth-R.clientWidth:I.offsetX>R.clientWidth),L0=Ti&&I.offsetY>R.clientHeight;if(Dn||L0)return}const J=(j=s.current.floatingContext)==null?void 0:j.nodeId,le=m&&Wo(m.nodesRef.current,J).some(he=>{var we;return ul(I,(we=he.context)==null?void 0:we.elements.floating)});if(ul(I,o.floating)||ul(I,o.domReference)||le)return;const mt=m?Wo(m.nodesRef.current,J):[];if(mt.length>0){let he=!0;if(mt.forEach(we=>{var se;if((se=we.context)!=null&&se.open&&!we.context.dataRef.current.__outsidePressBubbles){he=!1;return}}),!he)return}r(!1,I,"outside-press")}),U=it(I=>{var j;const F=()=>{var L;_(I),(L=Fn(I))==null||L.removeEventListener(c,F)};(j=Fn(I))==null||j.addEventListener(c,F)});v.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=w,s.current.__outsidePressBubbles=x;let I=-1;function j(K){r(!1,K,"ancestor-scroll")}function F(){window.clearTimeout(I),k.current=!0}function L(){I=window.setTimeout(()=>{k.current=!1},pi()?5:0)}const R=ct(o.floating);l&&(R.addEventListener("keydown",S?P:A,S),R.addEventListener("compositionstart",F),R.addEventListener("compositionend",L)),y&&R.addEventListener(c,M?U:_,M);let O=[];return f&&(te(o.domReference)&&(O=Zt(o.domReference)),te(o.floating)&&(O=O.concat(Zt(o.floating))),!te(o.reference)&&o.reference&&o.reference.contextElement&&(O=O.concat(Zt(o.reference.contextElement)))),O=O.filter(K=>{var oe;return K!==((oe=R.defaultView)==null?void 0:oe.visualViewport)}),O.forEach(K=>{K.addEventListener("scroll",j,{passive:!0})}),()=>{l&&(R.removeEventListener("keydown",S?P:A,S),R.removeEventListener("compositionstart",F),R.removeEventListener("compositionend",L)),y&&R.removeEventListener(c,M?U:_,M),O.forEach(K=>{K.removeEventListener("scroll",j)}),window.clearTimeout(I)}},[s,o,l,y,c,n,r,f,i,w,x,A,S,P,_,M,U]),v.useEffect(()=>{s.current.insideReactTree=!1},[s,y,c]);const W=v.useMemo(()=>({onKeyDown:A,...u&&{[_M[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[A,r,u,d]),$=v.useMemo(()=>{function I(j){j.button===0&&(C.current=!0)}return{onKeyDown:A,onMouseDown:I,onMouseUp:I,[HM[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return v.useMemo(()=>i?{reference:W,floating:$}:{},[i,W,$])}function BM(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Mc(),s=v.useRef({}),[i]=v.useState(()=>kM()),l=Tc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!te(h)&&EM("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=v.useState(r.reference),u=it((h,p,m)=>{s.current.openEvent=h?p:void 0,i.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=v.useMemo(()=>({setPositionReference:c}),[]),f=v.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return v.useMemo(()=>({dataRef:s,open:e,onOpenChange:u,elements:f,events:i,floatingId:o,refs:d}),[e,u,f,i,o,d])}function zM(t){t===void 0&&(t={});const{nodeId:e}=t,n=BM({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[s,i]=v.useState(null),[l,a]=v.useState(null),u=o?.domReference||s,d=v.useRef(null),f=Ac();nt(()=>{u&&(d.current=u)},[u]);const h=og({...t,elements:{...o,...l&&{reference:l}}}),p=v.useCallback(w=>{const x=te(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;a(x),h.refs.setReference(x)},[h.refs]),m=v.useCallback(w=>{(te(w)||w===null)&&(d.current=w,i(w)),(te(h.refs.reference.current)||h.refs.reference.current===null||w!==null&&!te(w))&&h.refs.setReference(w)},[h.refs]),g=v.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),y=v.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=v.useMemo(()=>({...h,...r,refs:g,elements:y,nodeId:e}),[h,g,y,e,r]);return nt(()=>{r.dataRef.current.floatingContext=C;const w=f?.nodesRef.current.find(x=>x.id===e);w&&(w.context=C)}),v.useMemo(()=>({...h,context:C,refs:g,elements:y}),[h,g,y,C])}function gl(){return yk()&&Km()}function $M(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=v.useRef(!1),u=v.useRef(-1),d=v.useRef(!0);v.useEffect(()=>{if(!l)return;const h=Be(i.domReference);function p(){!n&&Qe(i.domReference)&&i.domReference===ga(ct(i.domReference))&&(c.current=!0)}function m(){d.current=!0}function g(){d.current=!1}return h.addEventListener("blur",p),gl()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",g,!0)),()=>{h.removeEventListener("blur",p),gl()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",g,!0))}},[i.domReference,n,l]),v.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),v.useEffect(()=>()=>{Ue(u)},[]);const f=v.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Fn(h.nativeEvent);if(a&&te(p)){if(gl()&&!h.relatedTarget){if(!d.current&&!wk(p))return}else if(!xk(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,g=te(p)&&p.hasAttribute(oo("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var y;const C=ga(i.domReference?i.domReference.ownerDocument:document);!p&&C===i.domReference||or((y=s.current.floatingContext)==null?void 0:y.refs.floating.current,C)||or(i.domReference,C)||g||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return v.useMemo(()=>l?{reference:f}:{},[l,f])}function yl(t,e,n){const r=new Map,o=n==="item";let s=t;if(o&&t){const{[cf]:i,[uf]:l,...a}=t;s=a}return{...n==="floating"&&{tabIndex:-1,[vM]:""},...s,...e.map(i=>{const l=i?i[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[cf,uf].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),i[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(g=>g(...p)).find(g=>g!==void 0)}}}else i[c]=u}),i),{})}}function FM(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=v.useCallback(l=>yl(l,t,"reference"),e),s=v.useCallback(l=>yl(l,t,"floating"),n),i=v.useCallback(l=>yl(l,t,"item"),r);return v.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const VM=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function WM(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:s,floatingId:i}=t,{enabled:l=!0,role:a="dialog"}=e,c=Mc(),u=((n=s.domReference)==null?void 0:n.id)||c,d=v.useMemo(()=>{var C;return((C=Sk(s.floating))==null?void 0:C.id)||i},[s.floating,i]),f=(r=VM.get(a))!=null?r:a,p=Tc()!=null,m=v.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),g=v.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),y=v.useCallback(C=>{let{active:w,selected:x}=C;const S={role:"option",...w&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...S,"aria-selected":x}}return{}},[d,a]);return v.useMemo(()=>l?{reference:m,floating:g,item:y}:{},[l,m,g,y])}function UM({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:s=0}={}){const[i,l]=E.useState(t),a=n??i,c=r??l,u=zM({placement:e,open:a,onOpenChange:c,whileElementsMounted:ng,middleware:[sg(4),lg({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),ig({padding:4})]}),d=u.context,f=AM(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:s}}),h=$M(d,{enabled:n==null}),p=jM(d),m=WM(d,{role:"tooltip"}),g=FM([f,h,p,m]);return E.useMemo(()=>({open:a,setOpen:c,...g,...u}),[a,c,g,u])}const va=E.createContext(null);function ug(){const t=E.useContext(va);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function dg({children:t,...e}){const n=UM(e);return e.useDelayGroup?b.jsx(NM,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:b.jsx(va.Provider,{value:n,children:t})}):b.jsx(va.Provider,{value:n,children:t})}const fg=E.forwardRef(function({children:e,asChild:n=!1,...r},o){const s=ug(),i=E.isValidElement(e)?parseInt(E.version,10)>=19?e.props.ref:e.ref:void 0,l=ag([s.refs.setReference,o,i]);if(n&&E.isValidElement(e)){const a={"data-tooltip-state":s.open?"open":"closed"};return E.cloneElement(e,s.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return b.jsx("button",{ref:l,"data-tooltip-state":s.open?"open":"closed",...s.getReferenceProps(r),children:e})}),hg=E.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...s},i){const l=ug(),a=ag([l.refs.setFloating,i]);if(!l.open)return null;const c=b.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(s),className:"tiptap-tooltip",children:n});return r?b.jsx(PM,{...o,children:c}):c});dg.displayName="Tooltip";fg.displayName="TooltipTrigger";hg.displayName="TooltipContent";const KM=({shortcuts:t})=>t.length===0?null:b.jsx("div",{children:t.map((e,n)=>b.jsxs(E.Fragment,{children:[n>0&&b.jsx("kbd",{children:"+"}),b.jsx("kbd",{children:e})]},n))}),fe=E.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,variant:s,size:i,...l},a)=>{const c=E.useMemo(()=>lr({shortcutKeys:o}),[o]);return!n||!r?b.jsx("button",{className:Pe("tiptap-button",t),ref:a,"data-style":s,"data-size":i,...l,children:e}):b.jsxs(dg,{delay:200,children:[b.jsx(fg,{className:Pe("tiptap-button",t),ref:a,"data-style":s,"data-size":i,...l,children:e}),b.jsxs(hg,{children:[n,b.jsx(KM,{shortcuts:c})]})]})});fe.displayName="Button";const pg=E.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>b.jsx("div",{ref:o,className:Pe("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));pg.displayName="ButtonGroup";const ur=E.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:s,...i},l)=>b.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...i,children:s}));ur.displayName="Badge";function qM({action:t,shortcutKeys:e=yg[t]}){return b.jsx(ur,{children:lr({shortcutKeys:e})})}const Ca=E.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:s=!1,onClick:i,children:l,...a},c)=>{const{editor:u}=ze(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:g}=XM({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),y=E.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return d?b.jsx(fe,{type:"button",disabled:!p,variant:"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:y,...a,ref:c,children:l??b.jsxs(b.Fragment,{children:[b.jsx(m,{className:"tiptap-button-icon"}),n&&b.jsx("span",{className:"tiptap-button-text",children:n}),s&&b.jsx(qM,{action:e,shortcutKeys:g})]})}):null});Ca.displayName="UndoRedoButton";const mg=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));mg.displayName="Redo2Icon";const gg=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));gg.displayName="Undo2Icon";const yg={undo:"mod+z",redo:"mod+shift+z"},GM={undo:"Undo",redo:"Redo"},JM={undo:gg,redo:mg};function Rc(t,e){return!t||!t.isEditable||no(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function ZM(t,e){if(!t||!t.isEditable||!Rc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function YM(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Rc(e,r):!0}function XM(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:s}=ze(e),[i,l]=E.useState(!0),a=Rc(s,n);E.useEffect(()=>{if(!s)return;const u=()=>{l(YM({editor:s,hideWhenUnavailable:r,action:n}))};return u(),s.on("transaction",u),()=>{s.off("transaction",u)}},[s,r,n]);const c=E.useCallback(()=>{if(!s)return!1;const u=ZM(s,n);return u&&o?.(),u},[s,n,o]);return{isVisible:i,handleAction:c,canExecute:a,label:GM[n],shortcutKeys:yg[n],Icon:JM[n]}}function G(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function bf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function yi(...t){return e=>{let n=!1;const r=t.map(o=>{const s=bf(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():bf(t[o],null)}}}}function Ne(...t){return v.useCallback(yi(...t),t)}function dr(t,e=[]){let n=[];function r(s,i){const l=v.createContext(i),a=n.length;n=[...n,i];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,g=v.useMemo(()=>p,Object.values(p));return b.jsx(m.Provider,{value:g,children:h})};c.displayName=s+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=v.useContext(h);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(l){const a=l?.[t]||s;return v.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,QM(o,...e)]}function QM(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(s)[`__scope${c}`];return{...l,...d}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return n.scopeName=e.scopeName,n}function Gr(t){const e=eT(t),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,l=v.Children.toArray(s),a=l.find(nT);if(a){const c=a.props.children,u=l.map(d=>d===a?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:d);return b.jsx(e,{...i,ref:o,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return b.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function eT(t){const e=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=oT(o),l=rT(s,o.props);return o.type!==v.Fragment&&(l.ref=r?yi(r,i):i),v.cloneElement(o,l)}return v.Children.count(o)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var tT=Symbol("radix.slottable");function nT(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===tT}function rT(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const a=s(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function oT(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var sT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=sT.reduce((t,e)=>{const n=Gr(`Primitive.${e}`),r=v.forwardRef((o,s)=>{const{asChild:i,...l}=o,a=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(a,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function bg(t,e){t&&Ta.flushSync(()=>t.dispatchEvent(e))}function Rt(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>e.current?.(...n),[])}function iT(t,e=globalThis?.document){const n=Rt(t);v.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var lT="DismissableLayer",wa="dismissableLayer.update",aT="dismissableLayer.pointerDownOutside",cT="dismissableLayer.focusOutside",vf,vg=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Nc=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...a}=t,c=v.useContext(vg),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=v.useState({}),p=Ne(e,k=>d(k)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),C=u?m.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,x=C>=y,S=fT(k=>{const A=k.target,P=[...c.branches].some(_=>_.contains(A));!x||P||(o?.(k),i?.(k),k.defaultPrevented||l?.())},f),M=hT(k=>{const A=k.target;[...c.branches].some(_=>_.contains(A))||(s?.(k),i?.(k),k.defaultPrevented||l?.())},f);return iT(k=>{C===c.layers.size-1&&(r?.(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},f),v.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(vf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Cf(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vf)}},[u,f,n,c]),v.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Cf())},[u,c]),v.useEffect(()=>{const k=()=>h({});return document.addEventListener(wa,k),()=>document.removeEventListener(wa,k)},[]),b.jsx(Me.div,{...a,ref:p,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:G(t.onFocusCapture,M.onFocusCapture),onBlurCapture:G(t.onBlurCapture,M.onBlurCapture),onPointerDownCapture:G(t.onPointerDownCapture,S.onPointerDownCapture)})});Nc.displayName=lT;var uT="DismissableLayerBranch",dT=v.forwardRef((t,e)=>{const n=v.useContext(vg),r=v.useRef(null),o=Ne(e,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),b.jsx(Me.div,{...t,ref:o})});dT.displayName=uT;function fT(t,e=globalThis?.document){const n=Rt(t),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let a=function(){Cg(aT,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function hT(t,e=globalThis?.document){const n=Rt(t),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Cg(cT,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Cf(){const t=new CustomEvent(wa);document.dispatchEvent(t)}function Cg(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?bg(o,s):o.dispatchEvent(s)}var bl=0;function wg(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??wf()),document.body.insertAdjacentElement("beforeend",t[1]??wf()),bl++,()=>{bl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),bl--}},[])}function wf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var vl="focusScope.autoFocusOnMount",Cl="focusScope.autoFocusOnUnmount",xf={bubbles:!1,cancelable:!0},pT="FocusScope",Oc=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=t,[l,a]=v.useState(null),c=Rt(o),u=Rt(s),d=v.useRef(null),f=Ne(e,m=>a(m)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(h.paused||!l)return;const x=w.target;l.contains(x)?d.current=x:Pt(d.current,{select:!0})},g=function(w){if(h.paused||!l)return;const x=w.relatedTarget;x!==null&&(l.contains(x)||Pt(d.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Pt(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const C=new MutationObserver(y);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),C.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){Ef.add(h);const m=document.activeElement;if(!l.contains(m)){const y=new CustomEvent(vl,xf);l.addEventListener(vl,c),l.dispatchEvent(y),y.defaultPrevented||(mT(CT(xg(l)),{select:!0}),document.activeElement===m&&Pt(l))}return()=>{l.removeEventListener(vl,c),setTimeout(()=>{const y=new CustomEvent(Cl,xf);l.addEventListener(Cl,u),l.dispatchEvent(y),y.defaultPrevented||Pt(m??document.body,{select:!0}),l.removeEventListener(Cl,u),Ef.remove(h)},0)}}},[l,c,u,h]);const p=v.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const C=m.currentTarget,[w,x]=gT(C);w&&x?!m.shiftKey&&y===x?(m.preventDefault(),n&&Pt(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),n&&Pt(x,{select:!0})):y===C&&m.preventDefault()}},[n,r,h.paused]);return b.jsx(Me.div,{tabIndex:-1,...i,ref:f,onKeyDown:p})});Oc.displayName=pT;function mT(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Pt(r,{select:e}),document.activeElement!==n)return}function gT(t){const e=xg(t),n=Sf(e,t),r=Sf(e.reverse(),t);return[n,r]}function xg(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Sf(t,e){for(const n of t)if(!yT(n,{upTo:e}))return n}function yT(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function bT(t){return t instanceof HTMLInputElement&&"select"in t}function Pt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&bT(t)&&e&&t.select()}}var Ef=vT();function vT(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=kf(t,e),t.unshift(e)},remove(e){t=kf(t,e),t[0]?.resume()}}}function kf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function CT(t){return t.filter(e=>e.tagName!=="A")}var en=globalThis?.document?v.useLayoutEffect:()=>{},wT=v[" useId ".trim().toString()]||(()=>{}),xT=0;function Vs(t){const[e,n]=v.useState(wT());return en(()=>{n(r=>r??String(xT++))},[t]),t||(e?`radix-${e}`:"")}var ST="Arrow",Sg=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...s}=t;return b.jsx(Me.svg,{...s,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});Sg.displayName=ST;var ET=Sg;function kT(t){const[e,n]=v.useState(void 0);return en(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const a=s.borderBoxSize,c=Array.isArray(a)?a[0]:a;i=c.inlineSize,l=c.blockSize}else i=t.offsetWidth,l=t.offsetHeight;n({width:i,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Ic="Popper",[Eg,bi]=dr(Ic),[MT,kg]=Eg(Ic),Mg=t=>{const{__scopePopper:e,children:n}=t,[r,o]=v.useState(null);return b.jsx(MT,{scope:e,anchor:r,onAnchorChange:o,children:n})};Mg.displayName=Ic;var Tg="PopperAnchor",Ag=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=kg(Tg,n),i=v.useRef(null),l=Ne(e,i),a=v.useRef(null);return v.useEffect(()=>{const c=a.current;a.current=r?.current||i.current,c!==a.current&&s.onAnchorChange(a.current)}),r?null:b.jsx(Me.div,{...o,ref:l})});Ag.displayName=Tg;var Dc="PopperContent",[TT,AT]=Eg(Dc),Rg=v.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,g=kg(Dc,n),[y,C]=v.useState(null),w=Ne(e,se=>C(se)),[x,S]=v.useState(null),M=kT(x),k=M?.width??0,A=M?.height??0,P=r+(s!=="center"?"-"+s:""),_=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],W=U.length>0,$={padding:_,boundary:U.filter(NT),altBoundary:W},{refs:I,floatingStyles:j,placement:F,isPositioned:L,middlewareData:R}=og({strategy:"fixed",placement:P,whileElementsMounted:(...se)=>ng(...se,{animationFrame:h==="always"}),elements:{reference:g.anchor},middleware:[sg({mainAxis:o+A,alignmentAxis:i}),a&&ig({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?mM():void 0,...$}),a&&lg({...$}),gM({...$,apply:({elements:se,rects:ln,availableWidth:Mi,availableHeight:Ti})=>{const{width:Ai,height:Ri}=ln.reference,Dn=se.floating.style;Dn.setProperty("--radix-popper-available-width",`${Mi}px`),Dn.setProperty("--radix-popper-available-height",`${Ti}px`),Dn.setProperty("--radix-popper-anchor-width",`${Ai}px`),Dn.setProperty("--radix-popper-anchor-height",`${Ri}px`)}}),x&&bM({element:x,padding:l}),OT({arrowWidth:k,arrowHeight:A}),f&&yM({strategy:"referenceHidden",...$})]}),[O,K]=Ig(F),oe=Rt(p);en(()=>{L&&oe?.()},[L,oe]);const J=R.arrow?.x,le=R.arrow?.y,mt=R.arrow?.centerOffset!==0,[he,we]=v.useState();return en(()=>{y&&we(window.getComputedStyle(y).zIndex)},[y]),b.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(" "),...R.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:b.jsx(TT,{scope:n,placedSide:O,onArrowChange:S,arrowX:J,arrowY:le,shouldHideArrow:mt,children:b.jsx(Me.div,{"data-side":O,"data-align":K,...m,ref:w,style:{...m.style,animation:L?void 0:"none"}})})})});Rg.displayName=Dc;var Ng="PopperArrow",RT={top:"bottom",right:"left",bottom:"top",left:"right"},Og=v.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=AT(Ng,r),i=RT[s.placedSide];return b.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:b.jsx(ET,{...o,ref:n,style:{...o.style,display:"block"}})})});Og.displayName=Ng;function NT(t){return t!==null}var OT=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,i=o.arrow?.centerOffset!==0,l=i?0:t.arrowWidth,a=i?0:t.arrowHeight,[c,u]=Ig(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=i?d:`${f}px`,m=`${-a}px`):c==="top"?(p=i?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=i?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=i?d:`${h}px`),{data:{x:p,y:m}}}});function Ig(t){const[e,n="center"]=t.split("-");return[e,n]}var Dg=Mg,Pc=Ag,Pg=Rg,Lg=Og,IT="Portal",Lc=v.forwardRef((t,e)=>{const{container:n,...r}=t,[o,s]=v.useState(!1);en(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Ks.createPortal(b.jsx(Me.div,{...r,ref:e}),i):null});Lc.displayName=IT;function DT(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var Nn=t=>{const{present:e,children:n}=t,r=PT(e),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Ne(r.ref,LT(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};Nn.displayName="Presence";function PT(t){const[e,n]=v.useState(),r=v.useRef(null),o=v.useRef(t),s=v.useRef("none"),i=t?"mounted":"unmounted",[l,a]=DT(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const c=Ro(r.current);s.current=l==="mounted"?c:"none"},[l]),en(()=>{const c=r.current,u=o.current;if(u!==t){const f=s.current,h=Ro(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),en(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=Ro(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=h=>{h.target===e&&(s.current=Ro(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Ro(t){return t?.animationName||"none"}function LT(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var _T=v[" useInsertionEffect ".trim().toString()]||en;function _c({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=HT({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=v.useRef(t!==void 0);v.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=v.useCallback(u=>{if(l){const d=jT(u)?u(t):u;d!==t&&i.current?.(d)}else s(u)},[l,t,s,i]);return[a,c]}function HT({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),o=v.useRef(n),s=v.useRef(e);return _T(()=>{s.current=e},[e]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function jT(t){return typeof t=="function"}var BT=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},_n=new WeakMap,No=new WeakMap,Oo={},wl=0,_g=function(t){return t&&(t.host||_g(t.parentNode))},zT=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=_g(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},$T=function(t,e,n,r){var o=zT(e,Array.isArray(t)?t:[t]);Oo[n]||(Oo[n]=new WeakMap);var s=Oo[n],i=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(_n.get(f)||0)+1,g=(s.get(f)||0)+1;_n.set(f,m),s.set(f,g),i.push(f),m===1&&p&&No.set(f,!0),g===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return u(e),l.clear(),wl++,function(){i.forEach(function(d){var f=_n.get(d)-1,h=s.get(d)-1;_n.set(d,f),s.set(d,h),f||(No.has(d)||d.removeAttribute(r),No.delete(d)),h||d.removeAttribute(n)}),wl--,wl||(_n=new WeakMap,_n=new WeakMap,No=new WeakMap,Oo={})}},Hg=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=BT(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),$T(r,o,n,"aria-hidden")):function(){return null}},lt=function(){return lt=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},lt.apply(this,arguments)};function jg(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function FT(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,s;r<o;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var Ko="right-scroll-bar-position",qo="width-before-scroll-bar",VT="with-scroll-bars-hidden",WT="--removed-body-scroll-bar-size";function xl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function UT(t,e){var n=E.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var KT=typeof window<"u"?v.useLayoutEffect:v.useEffect,Mf=new WeakMap;function qT(t,e){var n=UT(null,function(r){return t.forEach(function(o){return xl(o,r)})});return KT(function(){var r=Mf.get(n);if(r){var o=new Set(r),s=new Set(t),i=n.current;o.forEach(function(l){s.has(l)||xl(l,null)}),s.forEach(function(l){o.has(l)||xl(l,i)})}Mf.set(n,t)},[t]),n}function GT(t){return t}function JT(t,e){e===void 0&&(e=GT);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var i=e(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var a=function(){var u=i;i=[],u.forEach(s)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){i.push(u),c()},filter:function(u){return i=i.filter(u),n}}}};return o}function ZT(t){t===void 0&&(t={});var e=JT(null);return e.options=lt({async:!0,ssr:!1},t),e}var Bg=function(t){var e=t.sideCar,n=jg(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,lt({},n))};Bg.isSideCarExport=!0;function YT(t,e){return t.useMedium(e),Bg}var zg=ZT(),Sl=function(){},vi=v.forwardRef(function(t,e){var n=v.useRef(null),r=v.useState({onScrollCapture:Sl,onWheelCapture:Sl,onTouchMoveCapture:Sl}),o=r[0],s=r[1],i=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,g=t.allowPinchZoom,y=t.as,C=y===void 0?"div":y,w=t.gapMode,x=jg(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,M=qT([n,e]),k=lt(lt({},x),o);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:zg,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:w}),i?v.cloneElement(v.Children.only(l),lt(lt({},k),{ref:M})):v.createElement(C,lt({},k,{className:a,ref:M}),l))});vi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vi.classNames={fullWidth:qo,zeroRight:Ko};var XT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function QT(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=XT();return e&&t.setAttribute("nonce",e),t}function eA(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function tA(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var nA=function(){var t=0,e=null;return{add:function(n){t==0&&(e=QT())&&(eA(e,n),tA(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},rA=function(){var t=nA();return function(e,n){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},$g=function(){var t=rA(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},oA={left:0,top:0,right:0,gap:0},El=function(t){return parseInt(t||"",10)||0},sA=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[El(n),El(r),El(o)]},iA=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return oA;var e=sA(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},lA=$g(),Jn="data-scroll-locked",aA=function(t,e,n,r){var o=t.left,s=t.top,i=t.right,l=t.gap;return n===void 0&&(n="margin"),`
143
+ .`.concat(VT,` {
144
+ overflow: hidden `).concat(r,`;
145
+ padding-right: `).concat(l,"px ").concat(r,`;
146
+ }
147
+ body[`).concat(Jn,`] {
148
+ overflow: hidden `).concat(r,`;
149
+ overscroll-behavior: contain;
150
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
151
+ padding-left: `.concat(o,`px;
152
+ padding-top: `).concat(s,`px;
153
+ padding-right: `).concat(i,`px;
154
+ margin-left:0;
155
+ margin-top:0;
156
+ margin-right: `).concat(l,"px ").concat(r,`;
157
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
158
+ }
159
+
160
+ .`).concat(Ko,` {
161
+ right: `).concat(l,"px ").concat(r,`;
162
+ }
163
+
164
+ .`).concat(qo,` {
165
+ margin-right: `).concat(l,"px ").concat(r,`;
166
+ }
167
+
168
+ .`).concat(Ko," .").concat(Ko,` {
169
+ right: 0 `).concat(r,`;
170
+ }
171
+
172
+ .`).concat(qo," .").concat(qo,` {
173
+ margin-right: 0 `).concat(r,`;
174
+ }
175
+
176
+ body[`).concat(Jn,`] {
177
+ `).concat(WT,": ").concat(l,`px;
178
+ }
179
+ `)},Tf=function(){var t=parseInt(document.body.getAttribute(Jn)||"0",10);return isFinite(t)?t:0},cA=function(){v.useEffect(function(){return document.body.setAttribute(Jn,(Tf()+1).toString()),function(){var t=Tf()-1;t<=0?document.body.removeAttribute(Jn):document.body.setAttribute(Jn,t.toString())}},[])},uA=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;cA();var s=v.useMemo(function(){return iA(o)},[o]);return v.createElement(lA,{styles:aA(s,!e,o,n?"":"!important")})},xa=!1;if(typeof window<"u")try{var Io=Object.defineProperty({},"passive",{get:function(){return xa=!0,!0}});window.addEventListener("test",Io,Io),window.removeEventListener("test",Io,Io)}catch{xa=!1}var Hn=xa?{passive:!1}:!1,dA=function(t){return t.tagName==="TEXTAREA"},Fg=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!dA(t)&&n[e]==="visible")},fA=function(t){return Fg(t,"overflowY")},hA=function(t){return Fg(t,"overflowX")},Af=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Vg(t,r);if(o){var s=Wg(t,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},pA=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},mA=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Vg=function(t,e){return t==="v"?fA(e):hA(e)},Wg=function(t,e){return t==="v"?pA(e):mA(e)},gA=function(t,e){return t==="h"&&e==="rtl"?-1:1},yA=function(t,e,n,r,o){var s=gA(t,window.getComputedStyle(e).direction),i=s*r,l=n.target,a=e.contains(l),c=!1,u=i>0,d=0,f=0;do{if(!l)break;var h=Wg(t,l),p=h[0],m=h[1],g=h[2],y=m-g-s*p;(p||y)&&Vg(t,l)&&(d+=y,f+=p);var C=l.parentNode;l=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},Do=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Rf=function(t){return[t.deltaX,t.deltaY]},Nf=function(t){return t&&"current"in t?t.current:t},bA=function(t,e){return t[0]===e[0]&&t[1]===e[1]},vA=function(t){return`
180
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
181
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
182
+ `)},CA=0,jn=[];function wA(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(CA++)[0],s=v.useState($g)[0],i=v.useRef(t);v.useEffect(function(){i.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=FT([t.lockRef.current],(t.shards||[]).map(Nf),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=v.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var y=Do(m),C=n.current,w="deltaX"in m?m.deltaX:C[0]-y[0],x="deltaY"in m?m.deltaY:C[1]-y[1],S,M=m.target,k=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in m&&k==="h"&&M.type==="range")return!1;var A=window.getSelection(),P=A&&A.anchorNode,_=P?P===M||P.contains(M):!1;if(_)return!1;var U=Af(k,M);if(!U)return!0;if(U?S=k:(S=k==="v"?"h":"v",U=Af(k,M)),!U)return!1;if(!r.current&&"changedTouches"in m&&(w||x)&&(r.current=S),!S)return!0;var W=r.current||S;return yA(W,g,m,W==="h"?w:x)},[]),a=v.useCallback(function(m){var g=m;if(!(!jn.length||jn[jn.length-1]!==s)){var y="deltaY"in g?Rf(g):Do(g),C=e.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&bA(S.delta,y)})[0];if(C&&C.should){g.cancelable&&g.preventDefault();return}if(!C){var w=(i.current.shards||[]).map(Nf).filter(Boolean).filter(function(S){return S.contains(g.target)}),x=w.length>0?l(g,w[0]):!i.current.noIsolation;x&&g.cancelable&&g.preventDefault()}}},[]),c=v.useCallback(function(m,g,y,C){var w={name:m,delta:g,target:y,should:C,shadowParent:xA(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),u=v.useCallback(function(m){n.current=Do(m),r.current=void 0},[]),d=v.useCallback(function(m){c(m.type,Rf(m),m.target,l(m,t.lockRef.current))},[]),f=v.useCallback(function(m){c(m.type,Do(m),m.target,l(m,t.lockRef.current))},[]);v.useEffect(function(){return jn.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Hn),document.addEventListener("touchmove",a,Hn),document.addEventListener("touchstart",u,Hn),function(){jn=jn.filter(function(m){return m!==s}),document.removeEventListener("wheel",a,Hn),document.removeEventListener("touchmove",a,Hn),document.removeEventListener("touchstart",u,Hn)}},[]);var h=t.removeScrollBar,p=t.inert;return v.createElement(v.Fragment,null,p?v.createElement(s,{styles:vA(o)}):null,h?v.createElement(uA,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function xA(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const SA=YT(zg,wA);var Hc=v.forwardRef(function(t,e){return v.createElement(vi,lt({},t,{ref:e,sideCar:SA}))});Hc.classNames=vi.classNames;var Ci="Popover",[Ug]=dr(Ci,[bi]),so=bi(),[EA,sn]=Ug(Ci),Kg=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=t,l=so(e),a=v.useRef(null),[c,u]=v.useState(!1),[d,f]=_c({prop:r,defaultProp:o??!1,onChange:s,caller:Ci});return b.jsx(Dg,{...l,children:b.jsx(EA,{scope:e,contentId:Vs(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:i,children:n})})};Kg.displayName=Ci;var qg="PopoverAnchor",kA=v.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=sn(qg,n),s=so(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return v.useEffect(()=>(i(),()=>l()),[i,l]),b.jsx(Pc,{...s,...r,ref:e})});kA.displayName=qg;var Gg="PopoverTrigger",Jg=v.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=sn(Gg,n),s=so(n),i=Ne(e,o.triggerRef),l=b.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":e1(o.open),...r,ref:i,onClick:G(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:b.jsx(Pc,{asChild:!0,...s,children:l})});Jg.displayName=Gg;var jc="PopoverPortal",[MA,TA]=Ug(jc,{forceMount:void 0}),Zg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,s=sn(jc,e);return b.jsx(MA,{scope:e,forceMount:n,children:b.jsx(Nn,{present:n||s.open,children:b.jsx(Lc,{asChild:!0,container:o,children:r})})})};Zg.displayName=jc;var sr="PopoverContent",Yg=v.forwardRef((t,e)=>{const n=TA(sr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,s=sn(sr,t.__scopePopover);return b.jsx(Nn,{present:r||s.open,children:s.modal?b.jsx(RA,{...o,ref:e}):b.jsx(NA,{...o,ref:e})})});Yg.displayName=sr;var AA=Gr("PopoverContent.RemoveScroll"),RA=v.forwardRef((t,e)=>{const n=sn(sr,t.__scopePopover),r=v.useRef(null),o=Ne(e,r),s=v.useRef(!1);return v.useEffect(()=>{const i=r.current;if(i)return Hg(i)},[]),b.jsx(Hc,{as:AA,allowPinchZoom:!0,children:b.jsx(Xg,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(t.onCloseAutoFocus,i=>{i.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:G(t.onPointerDownOutside,i=>{const l=i.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:G(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),NA=v.forwardRef((t,e)=>{const n=sn(sr,t.__scopePopover),r=v.useRef(!1),o=v.useRef(!1);return b.jsx(Xg,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Xg=v.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=sn(sr,n),h=so(n);return wg(),b.jsx(Oc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:b.jsx(Nc,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:b.jsx(Pg,{"data-state":e1(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Qg="PopoverClose",OA=v.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=sn(Qg,n);return b.jsx(Me.button,{type:"button",...r,ref:e,onClick:G(t.onClick,()=>o.onOpenChange(!1))})});OA.displayName=Qg;var IA="PopoverArrow",DA=v.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=so(n);return b.jsx(Lg,{...o,...r,ref:e})});DA.displayName=IA;function e1(t){return t?"open":"closed"}var PA=Kg,LA=Jg,_A=Zg,HA=Yg;function t1({...t}){return b.jsx(PA,{...t})}function n1({...t}){return b.jsx(LA,{...t})}function r1({className:t,align:e="center",sideOffset:n=4,...r}){return b.jsx(_A,{children:b.jsx(HA,{align:e,sideOffset:n,className:Pe("tiptap-popover",t),...r})})}const wi=E.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:Pe("tiptap-card",t),...e}));wi.displayName="Card";const jA=E.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:Pe("tiptap-card-header",t),...e}));jA.displayName="CardHeader";const xi=E.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:Pe("tiptap-card-body",t),...e}));xi.displayName="CardBody";const $t=E.forwardRef(({className:t,orientation:e="vertical",...n},r)=>b.jsx("div",{ref:r,"data-orientation":e,className:Pe("tiptap-card-item-group",t),...n}));$t.displayName="CardItemGroup";const Pr=E.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:Pe("tiptap-card-group-label",t),...e}));Pr.displayName="CardGroupLabel";const BA=E.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:Pe("tiptap-card-footer",t),...e}));BA.displayName="CardFooter";const zA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"})),$A=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M12 3C12.5523 3 13 3.44772 13 4L12.9998 11.9998C13.8355 11.372 14.8743 11 16 11C18.7614 11 21 13.2386 21 16C21 18.7614 18.7614 21 16 21C14.9681 21 14.0092 20.6874 13.2129 20.1518L13 20C13 20.5523 12.5523 21 12 21H6C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3H12ZM11 5H7V19H11V5ZM19 15H13V17H19V15Z"})),FA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M20 5C20.5523 5 21 5.44772 21 6V12C21 12.5523 20.5523 13 20 13C20.628 13.8355 21 14.8743 21 16C21 18.7614 18.7614 21 16 21C13.2386 21 11 18.7614 11 16C11 14.8743 11.372 13.8355 11.9998 12.9998L4 13C3.44772 13 3 12.5523 3 12V6C3 5.44772 3.44772 5 4 5H20ZM13 15V17H19V15H13ZM19 7H5V11H19V7Z"})),VA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M10 3C10.5523 3 11 3.44772 11 4V20C11 20.5523 10.5523 21 10 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H10ZM9 5H5V19H9V5ZM18 7C20.7614 7 23 9.23858 23 12C23 14.7614 20.7614 17 18 17C15.2386 17 13 14.7614 13 12C13 9.23858 15.2386 7 18 7ZM19 9H17V10.999L15 11V13L17 12.999V15H19V12.999L21 13V11L19 10.999V9Z"})),WA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M12 13C14.7614 13 17 15.2386 17 18C17 20.7614 14.7614 23 12 23C9.23858 23 7 20.7614 7 18C7 15.2386 9.23858 13 12 13ZM13 15H11V16.999L9 17V19L11 18.999V21H13V18.999L15 19V17L13 16.999V15ZM20 3C20.5523 3 21 3.44772 21 4V10C21 10.5523 20.5523 11 20 11H4C3.44772 11 3 10.5523 3 10V4C3 3.44772 3.44772 3 4 3H20ZM5 5V9H19V5H5Z"})),UA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M20 3C20.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 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"})),KA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M19.2277 18.7323L20.9955 16.9645L22.7632 18.7323C23.7395 19.7086 23.7395 21.2915 22.7632 22.2678C21.7869 23.2441 20.204 23.2441 19.2277 22.2678C18.2514 21.2915 18.2514 19.7086 19.2277 18.7323ZM8.87861 1.07971L20.1923 12.3934C20.5828 12.7839 20.5828 13.4171 20.1923 13.8076L11.707 22.2929C11.3165 22.6834 10.6833 22.6834 10.2928 22.2929L1.80754 13.8076C1.41702 13.4171 1.41702 12.7839 1.80754 12.3934L9.58572 4.61525L7.4644 2.49393L8.87861 1.07971ZM10.9999 6.02946L3.92886 13.1005H18.071L10.9999 6.02946Z"})),qA=({color:t="currentColor",size:e=24,className:n,...r})=>E.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:t,...r,className:"remixicon "+(n||"")},E.createElement("path",{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 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 3Z"})),Un=[{name:"Default",color:"#ffffff",contrastColor:"#374151"},{name:"Gray",color:"#f3f4f6",contrastColor:"#6b7280"},{name:"Brown",color:"#f4eef8",contrastColor:"#92400e"},{name:"Orange",color:"#fff7ed",contrastColor:"#ea580c"},{name:"Yellow",color:"#fef9c3",contrastColor:"#ca8a04"},{name:"Green",color:"#dcfce7",contrastColor:"#16a34a"},{name:"Blue",color:"#e0f2fe",contrastColor:"#0284c7"},{name:"Purple",color:"#f3e8ff",contrastColor:"#7c3aed"},{name:"Pink",color:"#fce7f3",contrastColor:"#db2777"},{name:"Red",color:"#ffe4e6",contrastColor:"#dc2626"}],Bc=3,Po=({textColorHex:t,backgroundColorHex:e,className:n=""})=>{const r=t??"#374151",o=e??"#ffffff",s=t??"#e5e7eb";return b.jsx("span",{className:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.5rem",height:"1.5rem",borderRadius:"50%",border:`1px solid ${s}`,backgroundColor:o,color:r,fontSize:"0.75rem",fontWeight:700},"aria-hidden":!0,children:"A"})},o1="color-text-popover-recent",GA=()=>{try{const t=localStorage.getItem(o1);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e.slice(0,Bc):[]}catch{return[]}},JA=t=>{try{localStorage.setItem(o1,JSON.stringify(t.slice(0,Bc)))}catch{}},s1=E.forwardRef(({editor:t,...e})=>{const{editor:n}=ze(t),[r,o]=E.useState(GA),s=sc({editor:n??null,selector:f=>{if(!f.editor)return{color:null,backgroundColor:null};const h=f.editor.getAttributes("textStyle");return{color:h.color??null,backgroundColor:h.backgroundColor??null}}}),i=s?.color??null,l=s?.backgroundColor??null,a=E.useCallback((f,h)=>{o(p=>{const m=[{textColor:f,backgroundColor:h},...p.filter(g=>!(g.textColor===f&&g.backgroundColor===h))].slice(0,Bc);return JA(m),m})},[]),c=E.useCallback(f=>{if(!n)return;f===null?n.chain().focus().unsetColor().run():n.chain().focus().setColor(f).run();const h=n.getAttributes("textStyle").backgroundColor??null;a(f,h)},[n,a]),u=E.useCallback(f=>{if(!n)return;f===null?n.chain().focus().unsetBackgroundColor().run():n.chain().focus().setBackgroundColor(f).run();const h=n.getAttributes("textStyle").color??null;a(h,f)},[n,a]),d=E.useCallback(f=>{n&&(f.textColor!==null?n.chain().focus().setColor(f.textColor).run():n.chain().focus().unsetColor().run(),f.backgroundColor!==null?n.chain().focus().setBackgroundColor(f.backgroundColor).run():n.chain().focus().unsetBackgroundColor().run(),a(f.textColor,f.backgroundColor))},[n,a]);return b.jsxs(t1,{children:[b.jsx(n1,{asChild:!0,children:b.jsxs(fe,{"data-style":"ghost",...e,children:[b.jsx(Po,{textColorHex:i,backgroundColorHex:l,className:"tiptap-color-trigger-icon"}),b.jsx(zA,{className:"tiptap-color-trigger-chevron","aria-hidden":!0})]})}),b.jsx(r1,{align:"start",children:b.jsx(wi,{children:b.jsxs(xi,{children:[b.jsx(Pr,{children:"Recently Used"}),b.jsx($t,{orientation:"horizontal",children:r.map((f,h)=>b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>d(f),"aria-label":`Apply recent color combination ${h+1}`,className:"tiptap-color-recent-button",children:b.jsx(Po,{textColorHex:f.textColor,backgroundColorHex:f.backgroundColor})},`${f.textColor??""}-${f.backgroundColor??""}-${h}`))}),b.jsx(Pr,{children:"Text Color"}),b.jsx($t,{orientation:"horizontal",children:Un.slice(0,5).map((f,h)=>{const p=h===0,m=p?null:f.contrastColor,g=i===m||p&&i===null;return b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>c(m),"aria-label":`Text color: ${f.name}`,"aria-pressed":g,className:"tiptap-color-text-button",children:b.jsx(Po,{textColorHex:m,backgroundColorHex:"#ffffff"})},f.name)})}),b.jsx($t,{orientation:"horizontal",children:Un.slice(5,10).map((f,h)=>{const p=h===0,m=p?null:f.contrastColor,g=i===m||p&&i===null;return b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>c(m),"aria-label":`Text color: ${f.name}`,"aria-pressed":g,className:"tiptap-color-text-button",children:b.jsx(Po,{textColorHex:m,backgroundColorHex:"#ffffff"})},f.name)})}),b.jsx(Pr,{children:"Highlight Color"}),b.jsx($t,{orientation:"horizontal",children:Un.slice(0,5).map((f,h)=>{const p=h===0,m=p?null:f.color,g=l===m||p&&l===null;return b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>u(m),"aria-label":`Highlight color: ${f.name}`,"aria-pressed":g,className:"tiptap-color-highlight-button",children:b.jsx("span",{style:{display:"inline-block",width:"1.5rem",height:"1.5rem",borderRadius:"50%",backgroundColor:m??"#ffffff",border:`1px solid ${m?f.contrastColor:"#e5e7eb"}`},"aria-hidden":!0})},f.name)})}),b.jsx($t,{orientation:"horizontal",children:Un.slice(5,10).map((f,h)=>{const p=h===0,m=p?null:f.color,g=l===m||p&&l===null;return b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>u(m),"aria-label":`Highlight color: ${f.name}`,"aria-pressed":g,className:"tiptap-color-highlight-button",children:b.jsx("span",{style:{display:"inline-block",width:"1.5rem",height:"1.5rem",borderRadius:"50%",backgroundColor:m??"#ffffff",border:`1px solid ${m?f.contrastColor:"#e5e7eb"}`},"aria-hidden":!0})},f.name)})})]})})})]})});s1.displayName="ColorTextPopover";const i1=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));i1.displayName="ChevronDownIcon";function ZA({level:t,shortcutKeys:e=m1[t]}){return b.jsx(ur,{children:lr({shortcutKeys:e})})}const l1=E.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:i,children:l,...a},c)=>{const{editor:u}=ze(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:g,shortcutKeys:y}=XA({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=E.useCallback(w=>{i?.(w),!w.defaultPrevented&&p()},[p,i]);return d?b.jsx(fe,{type:"button",variant:"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??b.jsxs(b.Fragment,{children:[b.jsx(g,{className:"tiptap-button-icon"}),n&&b.jsx("span",{className:"tiptap-button-text",children:n}),s&&b.jsx(ZA,{level:e,shortcutKeys:y})]})}):null});l1.displayName="HeadingButton";const a1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),b.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));a1.displayName="HeadingOneIcon";const c1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),b.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));c1.displayName="HeadingTwoIcon";const u1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));u1.displayName="HeadingThreeIcon";const d1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),b.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));d1.displayName="HeadingFourIcon";const f1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),b.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));f1.displayName="HeadingFiveIcon";const h1=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));h1.displayName="HeadingSixIcon";const p1={1:a1,2:c1,3:u1,4:d1,5:f1,6:h1},m1={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Jr(t,e,n=!0){return!t||!t.isEditable||!ui("heading",t)||no(t,["image"])?!1:n?di(t,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?e?t.can().setNode("heading",{level:e})||t.can().clearNodes():t.can().setNode("heading")||t.can().clearNodes():!1:e?t.can().setNode("heading",{level:e}):t.can().setNode("heading")}function zc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function YA(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Jr(t,o));if(!r)return!1;try{const o=t.view;let s=o.state,i=s.tr;const l=Lm(t),a=di(t,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])&&l.length===1;if((s.selection.empty||s.selection instanceof B)&&a){const h=Pm({editor:t,node:s.selection.$anchor.node(1)})?.pos;if(!vc(h))return!1;i=i.setSelection(H.create(s.doc,h)),o.dispatch(i),s=o.state}const c=s.selection;let u=t.chain().focus();if(c instanceof H){const h=c.node.firstChild?.firstChild,p=c.node.lastChild?.lastChild,m=h?c.from+h.nodeSize:c.from+1,g=p?c.to-p.nodeSize:c.to-1,y=s.doc.resolve(m),C=s.doc.resolve(g);u=u.setTextSelection(B.between(y,C)).clearNodes()}return(n.some(h=>t.isActive("heading",{level:h}))?u.setNode("paragraph"):u.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function g1(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return e?r?!e.isEditable||!ui("heading",e)?!1:e.isActive("code")?!0:Array.isArray(n)?n.some(o=>Jr(e,o)):Jr(e,n):!0:!1}function XA(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:s}=ze(e),[i,l]=E.useState(!0),a=Jr(s,n),c=zc(s,n);E.useEffect(()=>{if(!s)return;const d=()=>{l(g1({editor:s,level:n,hideWhenUnavailable:r}))};return d(),s.on("selectionUpdate",d),()=>{s.off("selectionUpdate",d)}},[s,n,r]);const u=E.useCallback(()=>{if(!s)return!1;const d=YA(s,n);return d&&o?.(),d},[s,n,o]);return{isVisible:i,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:m1[n],Icon:p1[n]}}function y1(t){const e=t+"CollectionProvider",[n,r]=dr(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:g,children:y}=m,C=E.useRef(null),w=E.useRef(new Map).current;return b.jsx(o,{scope:g,itemMap:w,collectionRef:C,children:y})};i.displayName=e;const l=t+"CollectionSlot",a=Gr(l),c=E.forwardRef((m,g)=>{const{scope:y,children:C}=m,w=s(l,y),x=Ne(g,w.collectionRef);return b.jsx(a,{ref:x,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Gr(u),h=E.forwardRef((m,g)=>{const{scope:y,children:C,...w}=m,x=E.useRef(null),S=Ne(g,x),M=s(u,y);return E.useEffect(()=>(M.itemMap.set(x,{ref:x,...w}),()=>{M.itemMap.delete(x)})),b.jsx(f,{[d]:"",ref:S,children:C})});h.displayName=u;function p(m){const g=s(t+"CollectionConsumer",m);return E.useCallback(()=>{const C=g.collectionRef.current;if(!C)return[];const w=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((M,k)=>w.indexOf(M.ref.current)-w.indexOf(k.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},p,r]}var QA=v.createContext(void 0);function b1(t){const e=v.useContext(QA);return t||e||"ltr"}var kl="rovingFocusGroup.onEntryFocus",eR={bubbles:!1,cancelable:!0},io="RovingFocusGroup",[Sa,v1,tR]=y1(io),[nR,C1]=dr(io,[tR]),[rR,oR]=nR(io),w1=v.forwardRef((t,e)=>b.jsx(Sa.Provider,{scope:t.__scopeRovingFocusGroup,children:b.jsx(Sa.Slot,{scope:t.__scopeRovingFocusGroup,children:b.jsx(sR,{...t,ref:e})})}));w1.displayName=io;var sR=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=v.useRef(null),h=Ne(e,f),p=b1(s),[m,g]=_c({prop:i,defaultProp:l??null,onChange:a,caller:io}),[y,C]=v.useState(!1),w=Rt(c),x=v1(n),S=v.useRef(!1),[M,k]=v.useState(0);return v.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(kl,w),()=>A.removeEventListener(kl,w)},[w]),b.jsx(rR,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(A=>g(A),[g]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:v.useCallback(()=>k(A=>A-1),[]),children:b.jsx(Me.div,{tabIndex:y||M===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:G(t.onMouseDown,()=>{S.current=!0}),onFocus:G(t.onFocus,A=>{const P=!S.current;if(A.target===A.currentTarget&&P&&!y){const _=new CustomEvent(kl,eR);if(A.currentTarget.dispatchEvent(_),!_.defaultPrevented){const U=x().filter(F=>F.focusable),W=U.find(F=>F.active),$=U.find(F=>F.id===m),j=[W,$,...U].filter(Boolean).map(F=>F.ref.current);E1(j,u)}}S.current=!1}),onBlur:G(t.onBlur,()=>C(!1))})})}),x1="RovingFocusGroupItem",S1=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=t,a=Vs(),c=s||a,u=oR(x1,n),d=u.currentTabStopId===c,f=v1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),b.jsx(Sa.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:b.jsx(Me.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:G(t.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:G(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:G(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=aR(g,u.orientation,u.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=f().filter(x=>x.focusable).map(x=>x.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const x=w.indexOf(g.currentTarget);w=u.loop?cR(w,x+1):w.slice(x+1)}setTimeout(()=>E1(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:m!=null}):i})})});S1.displayName=x1;var iR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function aR(t,e,n){const r=lR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iR[r]}function E1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function cR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var uR=w1,dR=S1,Ea=["Enter"," "],fR=["ArrowDown","PageUp","Home"],k1=["ArrowUp","PageDown","End"],hR=[...fR,...k1],pR={ltr:[...Ea,"ArrowRight"],rtl:[...Ea,"ArrowLeft"]},mR={ltr:["ArrowLeft"],rtl:["ArrowRight"]},lo="Menu",[Zr,gR,yR]=y1(lo),[On,M1]=dr(lo,[yR,bi,C1]),Si=bi(),T1=C1(),[bR,In]=On(lo),[vR,ao]=On(lo),A1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=t,l=Si(e),[a,c]=v.useState(null),u=v.useRef(!1),d=Rt(s),f=b1(o);return v.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),b.jsx(Dg,{...l,children:b.jsx(bR,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:b.jsx(vR,{scope:e,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:i,children:r})})})};A1.displayName=lo;var CR="MenuAnchor",$c=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=Si(n);return b.jsx(Pc,{...o,...r,ref:e})});$c.displayName=CR;var Fc="MenuPortal",[wR,R1]=On(Fc,{forceMount:void 0}),N1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,s=In(Fc,e);return b.jsx(wR,{scope:e,forceMount:n,children:b.jsx(Nn,{present:n||s.open,children:b.jsx(Lc,{asChild:!0,container:o,children:r})})})};N1.displayName=Fc;var Ye="MenuContent",[xR,Vc]=On(Ye),O1=v.forwardRef((t,e)=>{const n=R1(Ye,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=In(Ye,t.__scopeMenu),i=ao(Ye,t.__scopeMenu);return b.jsx(Zr.Provider,{scope:t.__scopeMenu,children:b.jsx(Nn,{present:r||s.open,children:b.jsx(Zr.Slot,{scope:t.__scopeMenu,children:i.modal?b.jsx(SR,{...o,ref:e}):b.jsx(ER,{...o,ref:e})})})})}),SR=v.forwardRef((t,e)=>{const n=In(Ye,t.__scopeMenu),r=v.useRef(null),o=Ne(e,r);return v.useEffect(()=>{const s=r.current;if(s)return Hg(s)},[]),b.jsx(Wc,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ER=v.forwardRef((t,e)=>{const n=In(Ye,t.__scopeMenu);return b.jsx(Wc,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),kR=Gr("MenuContent.ScrollLock"),Wc=v.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,g=In(Ye,n),y=ao(Ye,n),C=Si(n),w=T1(n),x=gR(n),[S,M]=v.useState(null),k=v.useRef(null),A=Ne(e,k,g.onContentChange),P=v.useRef(0),_=v.useRef(""),U=v.useRef(0),W=v.useRef(null),$=v.useRef("right"),I=v.useRef(0),j=p?Hc:v.Fragment,F=p?{as:kR,allowPinchZoom:!0}:void 0,L=O=>{const K=_.current+O,oe=x().filter(se=>!se.disabled),J=document.activeElement,le=oe.find(se=>se.ref.current===J)?.textValue,mt=oe.map(se=>se.textValue),he=HR(mt,K,le),we=oe.find(se=>se.textValue===he)?.ref.current;(function se(ln){_.current=ln,window.clearTimeout(P.current),ln!==""&&(P.current=window.setTimeout(()=>se(""),1e3))})(K),we&&setTimeout(()=>we.focus())};v.useEffect(()=>()=>window.clearTimeout(P.current),[]),wg();const R=v.useCallback(O=>$.current===W.current?.side&&BR(O,W.current?.area),[]);return b.jsx(xR,{scope:n,searchRef:_,onItemEnter:v.useCallback(O=>{R(O)&&O.preventDefault()},[R]),onItemLeave:v.useCallback(O=>{R(O)||(k.current?.focus(),M(null))},[R]),onTriggerLeave:v.useCallback(O=>{R(O)&&O.preventDefault()},[R]),pointerGraceTimerRef:U,onPointerGraceIntentChange:v.useCallback(O=>{W.current=O},[]),children:b.jsx(j,{...F,children:b.jsx(Oc,{asChild:!0,trapped:o,onMountAutoFocus:G(s,O=>{O.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:b.jsx(Nc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:b.jsx(uR,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:M,onEntryFocus:G(a,O=>{y.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:b.jsx(Pg,{role:"menu","aria-orientation":"vertical","data-state":q1(g.open),"data-radix-menu-content":"",dir:y.dir,...C,...m,ref:A,style:{outline:"none",...m.style},onKeyDown:G(m.onKeyDown,O=>{const oe=O.target.closest("[data-radix-menu-content]")===O.currentTarget,J=O.ctrlKey||O.altKey||O.metaKey,le=O.key.length===1;oe&&(O.key==="Tab"&&O.preventDefault(),!J&&le&&L(O.key));const mt=k.current;if(O.target!==mt||!hR.includes(O.key))return;O.preventDefault();const we=x().filter(se=>!se.disabled).map(se=>se.ref.current);k1.includes(O.key)&&we.reverse(),LR(we)}),onBlur:G(t.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(P.current),_.current="")}),onPointerMove:G(t.onPointerMove,Yr(O=>{const K=O.target,oe=I.current!==O.clientX;if(O.currentTarget.contains(K)&&oe){const J=O.clientX>I.current?"right":"left";$.current=J,I.current=O.clientX}}))})})})})})})});O1.displayName=Ye;var MR="MenuGroup",Uc=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return b.jsx(Me.div,{role:"group",...r,ref:e})});Uc.displayName=MR;var TR="MenuLabel",I1=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return b.jsx(Me.div,{...r,ref:e})});I1.displayName=TR;var Ws="MenuItem",Of="menu.itemSelect",Ei=v.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,s=v.useRef(null),i=ao(Ws,t.__scopeMenu),l=Vc(Ws,t.__scopeMenu),a=Ne(e,s),c=v.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(Of,{bubbles:!0,cancelable:!0});d.addEventListener(Of,h=>r?.(h),{once:!0}),bg(d,f),f.defaultPrevented?c.current=!1:i.onClose()}};return b.jsx(D1,{...o,ref:a,disabled:n,onClick:G(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:G(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:G(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||Ea.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Ei.displayName=Ws;var D1=v.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=t,i=Vc(Ws,n),l=T1(n),a=v.useRef(null),c=Ne(e,a),[u,d]=v.useState(!1),[f,h]=v.useState("");return v.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[s.children]),b.jsx(Zr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:b.jsx(dR,{asChild:!0,...l,focusable:!r,children:b.jsx(Me.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:G(t.onPointerMove,Yr(p=>{r?i.onItemLeave(p):(i.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(t.onPointerLeave,Yr(p=>i.onItemLeave(p))),onFocus:G(t.onFocus,()=>d(!0)),onBlur:G(t.onBlur,()=>d(!1))})})})}),AR="MenuCheckboxItem",P1=v.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return b.jsx(B1,{scope:t.__scopeMenu,checked:n,children:b.jsx(Ei,{role:"menuitemcheckbox","aria-checked":Us(n)?"mixed":n,...o,ref:e,"data-state":qc(n),onSelect:G(o.onSelect,()=>r?.(Us(n)?!0:!n),{checkForDefaultPrevented:!1})})})});P1.displayName=AR;var L1="MenuRadioGroup",[RR,NR]=On(L1,{value:void 0,onValueChange:()=>{}}),_1=v.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,s=Rt(r);return b.jsx(RR,{scope:t.__scopeMenu,value:n,onValueChange:s,children:b.jsx(Uc,{...o,ref:e})})});_1.displayName=L1;var H1="MenuRadioItem",j1=v.forwardRef((t,e)=>{const{value:n,...r}=t,o=NR(H1,t.__scopeMenu),s=n===o.value;return b.jsx(B1,{scope:t.__scopeMenu,checked:s,children:b.jsx(Ei,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":qc(s),onSelect:G(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});j1.displayName=H1;var Kc="MenuItemIndicator",[B1,OR]=On(Kc,{checked:!1}),z1=v.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,s=OR(Kc,n);return b.jsx(Nn,{present:r||Us(s.checked)||s.checked===!0,children:b.jsx(Me.span,{...o,ref:e,"data-state":qc(s.checked)})})});z1.displayName=Kc;var IR="MenuSeparator",$1=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return b.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});$1.displayName=IR;var DR="MenuArrow",F1=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=Si(n);return b.jsx(Lg,{...o,...r,ref:e})});F1.displayName=DR;var PR="MenuSub",[P5,V1]=On(PR),wr="MenuSubTrigger",W1=v.forwardRef((t,e)=>{const n=In(wr,t.__scopeMenu),r=ao(wr,t.__scopeMenu),o=V1(wr,t.__scopeMenu),s=Vc(wr,t.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=s,c={__scopeMenu:t.__scopeMenu},u=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),b.jsx($c,{asChild:!0,...c,children:b.jsx(D1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":q1(n.open),...t,ref:yi(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(t.onPointerMove,Yr(d=>{s.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:G(t.onPointerLeave,Yr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,g=f[p?"left":"right"],y=f[p?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:g,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:g,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:G(t.onKeyDown,d=>{const f=s.searchRef.current!=="";t.disabled||f&&d.key===" "||pR[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});W1.displayName=wr;var U1="MenuSubContent",K1=v.forwardRef((t,e)=>{const n=R1(Ye,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=In(Ye,t.__scopeMenu),i=ao(Ye,t.__scopeMenu),l=V1(U1,t.__scopeMenu),a=v.useRef(null),c=Ne(e,a);return b.jsx(Zr.Provider,{scope:t.__scopeMenu,children:b.jsx(Nn,{present:r||s.open,children:b.jsx(Zr.Slot,{scope:t.__scopeMenu,children:b.jsx(Wc,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{i.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:G(t.onFocusOutside,u=>{u.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:G(t.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:G(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=mR[i.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});K1.displayName=U1;function q1(t){return t?"open":"closed"}function Us(t){return t==="indeterminate"}function qc(t){return Us(t)?"indeterminate":t?"checked":"unchecked"}function LR(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function _R(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function HR(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let i=_R(t,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const a=i.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function jR(t,e){const{x:n,y:r}=t;let o=!1;for(let s=0,i=e.length-1;s<e.length;i=s++){const l=e[s],a=e[i],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function BR(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return jR(n,e)}function Yr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var zR=A1,$R=$c,FR=N1,VR=O1,WR=Uc,UR=I1,KR=Ei,qR=P1,GR=_1,JR=j1,ZR=z1,YR=$1,XR=F1,QR=W1,e7=K1,ki="DropdownMenu",[t7]=dr(ki,[M1]),Le=M1(),[n7,G1]=t7(ki),J1=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:l=!0}=t,a=Le(e),c=v.useRef(null),[u,d]=_c({prop:o,defaultProp:s??!1,onChange:i,caller:ki});return b.jsx(n7,{scope:e,triggerId:Vs(),triggerRef:c,contentId:Vs(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:l,children:b.jsx(zR,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};J1.displayName=ki;var Z1="DropdownMenuTrigger",Y1=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,s=G1(Z1,n),i=Le(n);return b.jsx($R,{asChild:!0,...i,children:b.jsx(Me.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:yi(e,s.triggerRef),onPointerDown:G(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:G(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Y1.displayName=Z1;var r7="DropdownMenuPortal",X1=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Le(e);return b.jsx(FR,{...r,...n})};X1.displayName=r7;var Q1="DropdownMenuContent",e0=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=G1(Q1,n),s=Le(n),i=v.useRef(!1);return b.jsx(VR,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:e,onCloseAutoFocus:G(t.onCloseAutoFocus,l=>{i.current||o.triggerRef.current?.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:G(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(i.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});e0.displayName=Q1;var o7="DropdownMenuGroup",s7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(WR,{...o,...r,ref:e})});s7.displayName=o7;var i7="DropdownMenuLabel",l7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(UR,{...o,...r,ref:e})});l7.displayName=i7;var a7="DropdownMenuItem",t0=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(KR,{...o,...r,ref:e})});t0.displayName=a7;var c7="DropdownMenuCheckboxItem",u7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(qR,{...o,...r,ref:e})});u7.displayName=c7;var d7="DropdownMenuRadioGroup",f7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(GR,{...o,...r,ref:e})});f7.displayName=d7;var h7="DropdownMenuRadioItem",p7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(JR,{...o,...r,ref:e})});p7.displayName=h7;var m7="DropdownMenuItemIndicator",g7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(ZR,{...o,...r,ref:e})});g7.displayName=m7;var y7="DropdownMenuSeparator",b7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(YR,{...o,...r,ref:e})});b7.displayName=y7;var v7="DropdownMenuArrow",C7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(XR,{...o,...r,ref:e})});C7.displayName=v7;var w7="DropdownMenuSubTrigger",x7=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(QR,{...o,...r,ref:e})});x7.displayName=w7;var S7="DropdownMenuSubContent",n0=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Le(n);return b.jsx(e7,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});n0.displayName=S7;var E7=J1,r0=Y1,k7=X1,o0=e0,M7=t0,s0=n0;function T7({...t}){return b.jsx(E7,{modal:!1,...t})}function i0({...t}){return b.jsx(k7,{...t})}const l0=E.forwardRef(({...t},e)=>b.jsx(r0,{ref:e,...t}));l0.displayName=r0.displayName;const A7=M7,R7=E.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=b.jsx(s0,{ref:r,className:Pe("tiptap-dropdown-menu",t),...n});return e?b.jsx(i0,{...typeof e=="object"?e:{},children:o}):o});R7.displayName=s0.displayName;const a0=E.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const s=b.jsx(o0,{ref:o,sideOffset:e,onCloseAutoFocus:i=>i.preventDefault(),className:Pe("tiptap-dropdown-menu",t),...r});return n?b.jsx(i0,{...typeof n=="object"?n:{},children:s}):s});a0.displayName=o0.displayName;const c0=E.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,children:s,...i},l)=>{const{editor:a}=ze(t),[c,u]=E.useState(!1),{isVisible:d,isActive:f,canToggle:h,Icon:p}=O7({editor:a,levels:e,hideWhenUnavailable:n}),m=E.useCallback(g=>{!a||!h||(u(g),o?.(g))},[h,a,o]);return d?b.jsxs(T7,{modal:!0,open:c,onOpenChange:m,children:[b.jsx(l0,{asChild:!0,children:b.jsx(fe,{type:"button",variant:"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":"Format text as heading","aria-pressed":f,tooltip:"Heading",...i,ref:l,children:s||b.jsxs(b.Fragment,{children:[b.jsx(p,{className:"tiptap-button-icon"}),b.jsx(i1,{className:"tiptap-button-dropdown-small"})]})})}),b.jsx(a0,{align:"start",portal:r,children:b.jsx(wi,{children:b.jsx(xi,{children:b.jsx(pg,{children:e.map(g=>b.jsx(A7,{asChild:!0,children:b.jsx(l1,{editor:a,level:g,text:`Heading ${g}`,showTooltip:!1})},`heading-${g}`))})})})})]}):null});c0.displayName="HeadingDropdownMenu";const u0=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));u0.displayName="HeadingIcon";function N7(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>zc(t,n))}function O7(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ze(e),[s,i]=E.useState(!0),l=N7(o,n),a=zc(o),c=Jr(o);return E.useEffect(()=>{if(!o)return;const u=()=>{i(g1({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:s,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?p1[l]:u0}}function I7({align:t,shortcutKeys:e=m0[t]}){return b.jsx(ur,{children:lr({shortcutKeys:e})})}const xr=E.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:s=!1,onClick:i,icon:l,children:a,...c},u)=>{const{editor:d}=ze(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:g,Icon:y,shortcutKeys:C}=B7({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),w=E.useCallback(S=>{i?.(S),!S.defaultPrevented&&h()},[h,i]);if(!f)return null;const x=l??y;return b.jsx(fe,{type:"button",disabled:!m,variant:"ghost","data-active-state":g?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":g,tooltip:p,onClick:w,...c,ref:u,children:a??b.jsxs(b.Fragment,{children:[b.jsx(x,{className:"tiptap-button-icon"}),n&&b.jsx("span",{className:"tiptap-button-text",children:n}),s&&b.jsx(I7,{align:e,shortcutKeys:C})]})})});xr.displayName="TextAlignButton";const d0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));d0.displayName="AlignCenterIcon";const f0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));f0.displayName="AlignJustifyIcon";const h0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));h0.displayName="AlignLeftIcon";const p0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));p0.displayName="AlignRightIcon";const m0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},D7={left:h0,center:d0,right:p0,justify:f0},P7={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Gc(t,e){return!t||!t.isEditable||!Dm(t,"textAlign")||no(t,["image","horizontalRule"])?!1:t.can().setTextAlign(e)}function L7(t){return"setTextAlign"in t}function _7(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function H7(t,e){if(!t||!t.isEditable||!Gc(t,e))return!1;const n=t.chain().focus();return L7(n)?n.setTextAlign(e).run():!1}function j7(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return e?n?!e.isEditable||!Dm(e,"textAlign")?!1:e.isActive("code")?!0:Gc(e,r):!0:!1}function B7(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:s}=ze(e),[i,l]=E.useState(!0),a=Gc(s,n),c=_7(s,n);E.useEffect(()=>{if(!s)return;const d=()=>{l(j7({editor:s,align:n,hideWhenUnavailable:r}))};return d(),s.on("selectionUpdate",d),()=>{s.off("selectionUpdate",d)}},[s,r,n]);const u=E.useCallback(()=>{if(!s)return!1;const d=H7(s,n);return d&&o?.(),d},[s,n,o]);return{isVisible:i,isActive:c,handleTextAlign:u,canAlign:a,label:P7[n],shortcutKeys:m0[n],Icon:D7[n]}}function z7({type:t,shortcutKeys:e=v0[t]}){return b.jsx(ur,{children:lr({shortcutKeys:e})})}const ka=E.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:i,children:l,...a},c)=>{const{editor:u}=ze(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:g,Icon:y}=K7({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=E.useCallback(w=>{i?.(w),!w.defaultPrevented&&p()},[p,i]);return d?b.jsx(fe,{type:"button",variant:"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??b.jsxs(b.Fragment,{children:[b.jsx(y,{className:"tiptap-button-icon"}),n&&b.jsx("span",{className:"tiptap-button-text",children:n}),s&&b.jsx(z7,{type:e,shortcutKeys:g})]})}):null});ka.displayName="ListButton";const g0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));g0.displayName="ListIcon";const y0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));y0.displayName="ListOrderedIcon";const b0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));b0.displayName="ListTodoIcon";const $7={bulletList:g0,orderedList:y0,taskList:b0},F7={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},v0={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function Jc(t,e,n=!0){if(!t||!t.isEditable||!ui(e,t)||no(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}if(!di(t,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"]))return!1;switch(e){case"bulletList":return t.can().toggleBulletList()||t.can().clearNodes();case"orderedList":return t.can().toggleOrderedList()||t.can().clearNodes();case"taskList":return t.can().toggleList("taskList","taskItem")||t.can().clearNodes();default:return!1}}function V7(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function W7(t,e){if(!t||!t.isEditable||!Jc(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;const s=Lm(t),i=di(t,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])&&s.length===1;if((r.selection.empty||r.selection instanceof B)&&i){const c=Pm({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!vc(c))return!1;o=o.setSelection(H.create(r.doc,c)),n.dispatch(o),r=n.state}const l=r.selection;let a=t.chain().focus();if(l instanceof H){const c=l.node.firstChild?.firstChild,u=l.node.lastChild?.lastChild,d=c?l.from+c.nodeSize:l.from+1,f=u?l.to-u.nodeSize:l.to-1,h=r.doc.resolve(d),p=r.doc.resolve(f);a=a.setTextSelection(B.between(h,p)).clearNodes()}if(t.isActive(e))a.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const u={bulletList:()=>a.toggleBulletList(),orderedList:()=>a.toggleOrderedList(),taskList:()=>a.toggleList("taskList","taskItem")}[e];if(!u)return!1;u().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function U7(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return e?r?!e.isEditable||!ui(n,e)?!1:e.isActive("code")?!0:Jc(e,n):!0:!1}function K7(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:s}=ze(e),[i,l]=E.useState(!0),a=Jc(s,n),c=V7(s,n);E.useEffect(()=>{if(!s)return;const d=()=>{l(U7({editor:s,type:n,hideWhenUnavailable:r}))};return d(),s.on("selectionUpdate",d),()=>{s.off("selectionUpdate",d)}},[s,n,r]);const u=E.useCallback(()=>{if(!s)return!1;const d=W7(s,n);return d&&o?.(),d},[s,n,o]);return{isVisible:i,isActive:c,handleToggle:u,canToggle:a,label:F7[n],shortcutKeys:v0[n],Icon:$7[n]}}function q7({type:t,shortcutKeys:e=T0[t]}){return b.jsx(ur,{children:lr({shortcutKeys:e})})}const Vn=E.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:i,children:l,...a},c)=>{const{editor:u}=ze(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:g,shortcutKeys:y}=Q7({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=E.useCallback(w=>{i?.(w),!w.defaultPrevented&&f()},[f,i]);return d?b.jsx(fe,{type:"button",disabled:!p,variant:"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??b.jsxs(b.Fragment,{children:[b.jsx(g,{className:"tiptap-button-icon"}),n&&b.jsx("span",{className:"tiptap-button-text",children:n}),s&&b.jsx(q7,{type:e,shortcutKeys:y})]})}):null});Vn.displayName="MarkButton";const C0=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));C0.displayName="BoldIcon";const w0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),b.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),b.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));w0.displayName="Code2Icon";const x0=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));x0.displayName="ItalicIcon";const S0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),b.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));S0.displayName="StrikeIcon";const E0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));E0.displayName="SubscriptIcon";const k0=E.memo(({className:t,...e})=>b.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));k0.displayName="SuperscriptIcon";const M0=E.memo(({className:t,...e})=>b.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));M0.displayName="UnderlineIcon";const G7={bold:C0,italic:x0,underline:M0,strike:S0,code:w0,superscript:k0,subscript:E0},T0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Zc(t,e){return!t||!t.isEditable||!Im(e,t)||no(t,["image"])?!1:t.can().toggleMark(e)}function J7(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function Z7(t,e){return!t||!t.isEditable||!Zc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function Y7(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return e?r?!e.isEditable||!Im(n,e)?!1:e.isActive("code")?!0:Zc(e,n):!0:!1}function X7(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Q7(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:s}=ze(e),[i,l]=E.useState(!0),a=Zc(s,n),c=J7(s,n);E.useEffect(()=>{if(!s)return;const d=()=>{l(Y7({editor:s,type:n,hideWhenUnavailable:r}))};return d(),s.on("selectionUpdate",d),()=>{s.off("selectionUpdate",d)}},[s,n,r]);const u=E.useCallback(()=>{if(!s)return!1;const d=Z7(s,n);return d&&o?.(),d},[s,n,o]);return{isVisible:i,isActive:c,handleMark:u,canToggle:a,label:X7(n),shortcutKeys:T0[n],Icon:G7[n]}}const If=({backgroundColorHex:t,borderColorHex:e,className:n=""})=>{const r=t??"#ffffff",o=e??"#e5e7eb";return b.jsx("span",{className:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.5rem",height:"1.5rem",borderRadius:"50%",border:`1px solid ${o}`,backgroundColor:r,fontSize:"0.75rem",fontWeight:700},"aria-hidden":!0})},e5=E.forwardRef(({editor:t,...e})=>{const{editor:n}=ze(t),r=E.useCallback(o=>{n&&n.chain().focus().setCellAttribute("backgroundColor",o).run()},[n]);return b.jsxs(t1,{children:[b.jsx(n1,{asChild:!0,children:b.jsx(fe,{"data-style":"ghost",tooltip:"셀 배경색 변경",...e,children:b.jsx(KA,{className:"tiptap-button-icon"})})}),b.jsx(r1,{align:"start",children:b.jsx(wi,{children:b.jsxs(xi,{children:[b.jsx(Pr,{children:"Background Color"}),b.jsx($t,{orientation:"horizontal",children:Un.slice(0,5).map((o,s)=>b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>r(o.color),"aria-label":`Background color: ${o.name}`,className:"tiptap-background-color-button",children:b.jsx(If,{backgroundColorHex:o.color,borderColorHex:o.contrastColor})},`${o.color}-${s}`))}),b.jsx($t,{orientation:"horizontal",children:Un.slice(5,10).map((o,s)=>b.jsx(fe,{"data-style":"ghost",type:"button",onClick:()=>r(o.color),"aria-label":`Background color: ${o.name}`,className:"tiptap-background-color-button",children:b.jsx(If,{backgroundColorHex:o.color,borderColorHex:o.contrastColor})},`${o.color}-${s}`))})]})})})]})});function t5({editor:t}){return b.jsxs(Hm,{className:"my-toolbar",children:[b.jsxs(ca,{children:[b.jsx(Ca,{editor:t,tooltip:"실행 취소",action:"undo"}),b.jsx(Ca,{editor:t,tooltip:"다시 실행",action:"redo"}),b.jsx(Vo,{}),b.jsx(Vn,{type:"bold"}),b.jsx(Vn,{type:"italic"}),b.jsx(Vn,{type:"strike"}),b.jsx(Vn,{type:"code"}),b.jsx(Vn,{type:"underline"}),b.jsx(s1,{editor:t}),b.jsx(c0,{editor:t,levels:[1,2,3,4],hideWhenUnavailable:!0,portal:!1}),b.jsx(Vo,{}),b.jsx(xr,{editor:t,align:"left"}),b.jsx(xr,{align:"center"}),b.jsx(xr,{align:"right"}),b.jsx(xr,{align:"justify"}),b.jsx(Vo,{}),b.jsx(ka,{editor:t,type:"bulletList"}),b.jsx(ka,{editor:t,type:"orderedList"})]}),b.jsxs(ca,{children:[b.jsx(fe,{"data-style":"ghost",tooltip:"표 삽입",onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!1}).run(),children:b.jsx(qA,{className:"tiptap-button-icon"})}),b.jsx(fe,{"data-style":"ghost",tooltip:"열 추가",onClick:()=>t.chain().focus().addColumnAfter().run(),children:b.jsx(VA,{className:"tiptap-button-icon"})}),b.jsx(fe,{"data-style":"ghost",tooltip:"열 제거",onClick:()=>t.chain().focus().deleteColumn().run(),children:b.jsx($A,{className:"tiptap-button-icon"})}),b.jsx(fe,{"data-style":"ghost",tooltip:"행 추가",onClick:()=>t.chain().focus().addRowAfter().run(),children:b.jsx(WA,{className:"tiptap-button-icon"})}),b.jsx(fe,{"data-style":"ghost",tooltip:"행 제거",onClick:()=>t.chain().focus().deleteRow().run(),children:b.jsx(FA,{className:"tiptap-button-icon"})}),b.jsx(fe,{"data-style":"ghost",tooltip:"셀 병합",onClick:()=>t.chain().focus().mergeOrSplit().run(),children:b.jsx(UA,{className:"tiptap-button-icon"})}),b.jsx(e5,{editor:t})]})]})}var n5=20,A0=(t,e=0)=>{const n=[];return!t.children.length||e>n5||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...A0(r,e+1))}),n},r5=t=>{if(!t.children.length)return;const e=A0(t);e&&e.forEach(n=>{var r,o;const s=n.getAttribute("style"),i=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${i};${s}`)})},R0=rn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&r5(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),N0=Y.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(i==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),O0=Y.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(i==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),o5=Y.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),s5=Y.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),i5=Y.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Y.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(N0.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(O0.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(o5.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(s5.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(i5.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(R0.configure(this.options.textStyle)),t}});var l5=Y.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),a5=l5,I0=ge.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),i=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(i&&i>-1&&s&&s[i]){const l=s[i].getAttribute("width");return l?[parseInt(l,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Q(this.options.HTMLAttributes,t),0]}}),c5=ge.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Q(this.options.HTMLAttributes,t),0]}}),u5=ge.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Q(this.options.HTMLAttributes,t),0]}});function Ma(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Df(t,e,n,r,o,s){var i;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let f=0,h=0;f<u.childCount;f+=1){const{colspan:p,colwidth:m}=u.child(f).attrs;for(let g=0;g<p;g+=1,h+=1){const y=o===h?s:m&&m[g],C=y?`${y}px`:"";if(l+=y||r,y||(a=!1),c){if(c.style.width!==C){const[w,x]=Ma(r,y);c.style.setProperty(w,x)}c=c.nextSibling}else{const w=document.createElement("col"),[x,S]=Ma(r,y);w.style.setProperty(x,S),e.appendChild(w)}}}for(;c;){const f=c.nextSibling;(i=c.parentNode)==null||i.removeChild(c),c=f}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);a&&!d?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var d5=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Df(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Df(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function f5(t,e,n,r){let o=0,s=!0;const i=[],l=t.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=n===f?r:p&&p[m];o+=g||e,g||(s=!1);const[y,C]=Ma(e,g);i.push(["col",{style:`${y}: ${C}`}])}}const a=s?`${o}px`:"",c=s?"":`${o}px`;return{colgroup:["colgroup",{},...i],tableWidth:a,tableMinWidth:c}}function Pf(t,e){return t.createAndFill()}function h5(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function p5(t,e,n,r,o){const s=h5(t),i=[],l=[];for(let c=0;c<n;c+=1){const u=Pf(s.cell);if(u&&l.push(u),r){const d=Pf(s.header_cell);d&&i.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(s.row.createChecked(null,r&&c===0?i:l));return s.table.createChecked(null,a)}function m5(t){return t instanceof ne}var Lo=({editor:t})=>{const{selection:e}=t.state;if(!m5(e))return!1;let n=0;const r=bp(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},g5="";function y5(t){return(t||"").replace(/\s+/g," ").trim()}function b5(t,e,n={}){var r;const o=(r=n.cellLineSeparator)!=null?r:g5;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(g=>{let y="";g.content&&Array.isArray(g.content)&&g.content.length>1?y=g.content.map(S=>e.renderChildren(S)).join(o):y=g.content?e.renderChildren(g.content):"";const C=y5(y),w=g.type==="tableHeader";m.push({text:C,isHeader:w})}),s.push(m)});const i=s.reduce((p,m)=>Math.max(p,m.length),0);if(i===0)return"";const l=new Array(i).fill(0);s.forEach(p=>{var m;for(let g=0;g<i;g+=1){const C=(((m=p[g])==null?void 0:m.text)||"").length;C>l[g]&&(l[g]=C),l[g]<3&&(l[g]=3)}});const a=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),c=s[0],u=c.some(p=>p.isHeader);let d=`
183
+ `;const f=new Array(i).fill(0).map((p,m)=>u&&c[m]&&c[m].text||"");return d+=`| ${f.map((p,m)=>a(p,l[m])).join(" | ")} |
184
+ `,d+=`| ${l.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |
185
+ `,(u?s.slice(1):s).forEach(p=>{d+=`| ${new Array(i).fill(0).map((m,g)=>a(p[g]&&p[g].text||"",l[g])).join(" | ")} |
186
+ `}),d}var v5=b5,C5=ge.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:d5,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=f5(t,this.options.cellMinWidth),s=e.style;function i(){return s||(r?`width: ${r}`:`min-width: ${o}`)}const l=["table",Q(this.options.HTMLAttributes,e,{style:i()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(o=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const o=[];r.forEach(s=>{o.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>v5(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const i=p5(s.schema,t,e,n);if(o){const l=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(B.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>YS(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>XS(t,e),deleteColumn:()=>({state:t,dispatch:e})=>eE(t,e),addRowBefore:()=>({state:t,dispatch:e})=>nE(t,e),addRowAfter:()=>({state:t,dispatch:e})=>rE(t,e),deleteRow:()=>({state:t,dispatch:e})=>sE(t,e),deleteTable:()=>({state:t,dispatch:e})=>fE(t,e),mergeCells:()=>({state:t,dispatch:e})=>_d(t,e),splitCell:()=>({state:t,dispatch:e})=>Hd(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Kr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Kr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>uE(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>_d(t,e)?!0:Hd(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>aE(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Bd(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Bd(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Tm(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ne.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Lo,"Mod-Backspace":Lo,Delete:Lo,"Mod-Delete":Lo}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[xE({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],IE({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Z(z(t,"tableRole",e))}}}),w5=Y.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(C5.configure(this.options.table)),this.options.tableCell!==!1&&t.push(I0.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(c5.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(u5.configure(this.options.tableRow)),t}}),x5=({key:t,editor:e,onPaste:n,onDrop:r,allowedMimeTypes:o})=>new re({key:t||new ae("fileHandler"),props:{handleDrop(s,i){var l;if(!r||!((l=i.dataTransfer)!=null&&l.files.length))return!1;const a=s.posAtCoords({left:i.clientX,top:i.clientY});let c=Array.from(i.dataTransfer.files);return o&&(c=c.filter(u=>o.includes(u.type))),c.length===0?!1:(i.preventDefault(),i.stopPropagation(),r(e,c,a?.pos||0),!0)},handlePaste(s,i){var l;if(!n||!((l=i.clipboardData)!=null&&l.files.length))return!1;let a=Array.from(i.clipboardData.files);const c=i.clipboardData.getData("text/html");return o&&(a=a.filter(u=>o.includes(u.type))),!(a.length===0||(i.preventDefault(),i.stopPropagation(),n(e,a,c),c.length>0))}}}),S5=Y.create({name:"fileHandler",addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins(){return[x5({key:new ae(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste})]}}),E5=S5,k5=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,M5=ge.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Q(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,o,s,i;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",a=(o=(r=t.attrs)==null?void 0:r.alt)!=null?o:"",c=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:o,getPos:s,HTMLAttributes:i,editor:l})=>{const a=document.createElement("img");Object.entries(i).forEach(([d,f])=>{if(f!=null)switch(d){case"width":case"height":break;default:a.setAttribute(d,f);break}}),a.src=i.src;const c=new L2({element:a,editor:l,node:o,getPos:s,onResize:(d,f)=>{a.style.width=`${d}px`,a.style.height=`${f}px`},onCommit:(d,f)=>{const h=s();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:d,height:f}).run()},onUpdate:(d,f,h)=>d.type===o.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",a.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Vp({find:k5,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),T5=M5;const D0=t=>{const e=({node:n})=>{const r=t.current;return r?b.jsx(Kw,{children:b.jsx(r,{...n.attrs})}):null};return ge.create({name:"fileAttachment",group:"block",atom:!0,addAttributes(){return{name:{default:""},mimeType:{default:""},url:{default:""},size:{default:0}}},parseHTML(){return[{tag:'div[data-type="file-attachment"]'}]},renderHTML({HTMLAttributes:n}){return["div",Q(n,{"data-type":"file-attachment"})]},addNodeView(){return Xw(e)}})},P0=({name:t,url:e})=>b.jsxs("a",{href:e,download:t,className:"file-attachment",tabIndex:0,"aria-label":`${t} 다운로드`,children:[b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"file-attachment__icon","aria-hidden":"true",children:b.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),b.jsx("span",{className:"file-attachment__name",children:t})]}),A5=t=>new Promise((e,n)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}),R5=["image/png","image/jpeg","image/gif","image/webp"],N5=t=>t.type.startsWith("image/"),O5=({uploadFile:t,onFileInsert:e,onFileError:n,allowNonImageFile:r=!1,FileAttachmentComponent:o=P0})=>{const s=E.useRef(t),i=E.useRef(e),l=E.useRef(n),a=E.useRef(o);E.useEffect(()=>{s.current=t},[t]),E.useEffect(()=>{i.current=e},[e]),E.useEffect(()=>{l.current=n},[n]),E.useEffect(()=>{a.current=o},[o]);const c=E.useCallback(async h=>s.current?await s.current(h):await A5(h),[]),u=E.useCallback((h,p,m,g)=>{if(h){if(N5(p)){h.chain().insertContentAt(g,{type:"image",attrs:{src:m}}).focus().run();return}h.chain().insertContentAt(g,{type:"fileAttachment",attrs:{name:p.name,mimeType:p.type,url:m,size:p.size}}).focus().run()}},[]),d=Vw({extensions:[LS,R0,O0,N0,a5.configure({types:["heading","paragraph"]}),xm,T5,D0(a),w5.configure({table:{resizable:!0}}),I0.extend({addAttributes(){return{...this.parent?.(),backgroundColor:{default:null,renderHTML:h=>h.backgroundColor?{style:`background-color: ${h.backgroundColor}`}:{},parseHTML:h=>h.style.backgroundColor.replace(/['"]+/g,"")}}}}),E5.configure({allowedMimeTypes:r?void 0:R5,onDrop:async(h,p,m)=>{for(const g of p){const y=await c(g);i.current?.(g),u(h,g,y,m)}},onPaste:async(h,p,m)=>{if(m){l.current?.(new Error("외부에서 복사해온 파일을 바로 붙여넣기할 수 없습니다"));return}for(const g of p){const y=await c(g);i.current?.(g),u(h,g,y,h.state.selection.anchor)}}})],content:`
187
+ <h2>
188
+ Hi there,
189
+ </h2>
190
+ <p>
191
+ this is a <em>basic</em> example of <strong>Tiptap</strong>. Sure, there are all kind of basic text styles you'd probably expect from a text editor. But wait until you see the lists:
192
+ </p>
193
+ <ul>
194
+ <li>
195
+ That's a bullet list with one …
196
+ </li>
197
+ <li>
198
+ … or two list items.
199
+ </li>
200
+ </ul>
201
+ <p>
202
+ Isn't that great? And all of that is editable. B ut wait, there's more. Let's try a code block:
203
+ </p>
204
+ <pre><code class="language-css">body {
205
+ display: none;
206
+ }</code></pre>
207
+ <p>
208
+ I know, I know, this is impressive. It's only the tip of the iceberg though. Give it a try and click a little bit around. Don't forget to check the other examples too.
209
+ </p>
210
+ <blockquote>
211
+ Wow, that's amazing. Good work, boy! 👏
212
+ <br />
213
+ — Mom
214
+ </blockquote>
215
+ `}),f=E.useMemo(()=>({editor:d}),[d]);return b.jsx(I5,{children:b.jsxs(li.Provider,{value:f,children:[b.jsx(t5,{editor:d}),b.jsx(Kp,{editor:d})]})})},I5=({children:t})=>b.jsx("div",{className:"tiptap-wrapper",children:t});exports.DefaultFileAttachmentComponent=P0;exports.TiptapEditor=O5;exports.createFileAttachmentExtension=D0;